diff --git a/.classpath b/.classpath index 0765de88a..2b20699b0 100644 --- a/.classpath +++ b/.classpath @@ -2,32 +2,17 @@ + - - - - + + + + - - - - - - - - - - - - - - - - @@ -45,5 +30,7 @@ + + diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..168bdd5df --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +build +*.zip +.idea +.vscode diff --git a/.github/ISSUE_TEMPLATE/issue-report.md b/.github/ISSUE_TEMPLATE/issue-report.md new file mode 100644 index 000000000..9dbbd0b61 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue-report.md @@ -0,0 +1,32 @@ +--- +name: Issue report +about: Create a report to help us improve +title: "[Logger][Editor]" +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS version: [e.g. Windows 10, Linux (dist), etc] + - Java version: [From RomRaider - Help - About, e.g. Sun Microsystems Inc. 1.6.0_45] + - RomRaider version: [or Github commit if not the latest official release] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000..691068799 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,31 @@ +name: RomRaider build + +on: [push,pull_request] + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Setup Java 8 + uses: actions/setup-java@v1.4.3 + with: + java-version: '8' + java-package: jdk + architecture: x64 + - name: set JRE_DIR environment variable + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + run: echo ::set-env name=JRE_DIR::$(echo $JAVA_HOME)/jre + + - name: Test Compiler + run: javac -version + + - name: All + run: | + echo JRE_DIR=$JRE_DIR + ant all diff --git a/.gitignore b/.gitignore index b1290f2a4..f4242c11e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ src/main/java/com/romraider/Version.java +3rdparty/IzPack/ +3rdparty/launch4j/ build/ target/ -tmp/ +tmp/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..de7fa5b9b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,22 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Debug (Launch)-ECUExec", + "request": "launch", + "mainClass": "com.romraider.ECUExec", + "projectName": "romraider" + }, + { + "type": "java", + "name": "Debug (Launch)-EcuLoggerExec", + "request": "launch", + "mainClass": "com.romraider.logger.ecu.EcuLoggerExec", + "projectName": "romraider" + } + ] +} \ No newline at end of file diff --git a/3rdparty/IzPack/.installationinformation b/3rdparty/IzPack/.installationinformation deleted file mode 100644 index 9877c7a25..000000000 Binary files a/3rdparty/IzPack/.installationinformation and /dev/null differ diff --git a/3rdparty/IzPack/Description.txt b/3rdparty/IzPack/Description.txt deleted file mode 100644 index 5ee301ec8..000000000 --- a/3rdparty/IzPack/Description.txt +++ /dev/null @@ -1,21 +0,0 @@ -[ Description ] - - IzPack is Copyright (c) 2001-2008 Julien Ponge. - http://izpack.org/ - julien.ponge@gmail.com - - IzPack is a powerfull Java installer builder released under the terms of -the Apache License Version 2.0. - - It is able to create lightweight and modular installers. You can extend -its capacities through a plugin-like architecture to make it better suit your -needs. - - You have the choice of the installer panels you want to use (some can do -the same job, so that you can select the one you prefer) and you even have the -choice of the kind of installer that you want to use. - - IzPack doesn't use any portion of native code, it is designed to be fully -independant from the operating system that runs it. It is very easy for the -end-user to use an installer made with IzPack, with a well-installed JVM, -a single "java -jar installer.jar" will launch it :-) diff --git a/3rdparty/IzPack/License.txt b/3rdparty/IzPack/License.txt deleted file mode 100644 index d64569567..000000000 --- a/3rdparty/IzPack/License.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/3rdparty/IzPack/Readme.txt b/3rdparty/IzPack/Readme.txt deleted file mode 100644 index ad39cbdd0..000000000 --- a/3rdparty/IzPack/Readme.txt +++ /dev/null @@ -1,37 +0,0 @@ -IzPack Readme -============= - -IzPack is a one-stop solution for packaging, distributing and deploying -applications. - -It is fully cross-platform and generates a single installer. As such, -it is an alternative to native solutions such as platform-specific -installers and package managers. - -IzPack-generated installers only require a Java virtual machine to run. -It is however capable of providing integration with the host operating -systems (e.g., creating desktop shortcuts or editing the Windows registry). - -Licensing -========= - -IzPack is published under the terms of the Apache License, Version 2.0, -meaning that you can adapt it to your needs with very minimal constraints. - -Some third-party components (e.g., look and feel libraries) may be released -under different terms. - -Community -========= - -IzPack is part of the Codehaus - -* Web site: -* Codehaus space: -* Mailing-lists: -* Confluence wiki: -* News feed: -* Subversion repository: -* Git repository (synchronized from svn): -* FishEye SVN browser: -* JIRA issues tracker: diff --git a/3rdparty/IzPack/bin/.gitignore b/3rdparty/IzPack/bin/.gitignore deleted file mode 100644 index 0a820cf7d..000000000 --- a/3rdparty/IzPack/bin/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/panels -/customActions diff --git a/3rdparty/IzPack/bin/compile b/3rdparty/IzPack/bin/compile deleted file mode 100755 index 55096acaa..000000000 --- a/3rdparty/IzPack/bin/compile +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh - -# Copyright 2001-2005 The Apache Software Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# allow command line pre-set opts -if [ -z "$IZPACK_OPTS" ] ; then - IZPACK_OPTS="" -fi - -# load user izpack configuration (may specify IZPACK_HOME -if [ -f "$HOME/.izpackrc" ] ; then - . $HOME/.izpackrc -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -case "`uname`" in - CYGWIN*) cygwin=true ;; - Darwin*) darwin=true - if [ -z "$JAVA_VERSION" ] ; then - JAVA_VERSION="CurrentJDK" - else - echo "Using Java version: $JAVA_VERSION" - fi - if [ -z "$JAVA_HOME" ] ; then - JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home - fi - ;; -esac - -if [ -z "$IZPACK_HOME" ] ; then - # try to find IZPACK - if [ -d /opt/izpack ] ; then - IZPACK_HOME=/opt/izpack - fi - - if [ -d "${HOME}/izpack" ] ; then - IZPACK_HOME="${HOME}/izpack" - fi - - ## resolve links - $0 may be a link to izpack's home - PRG="$0" - progname=`basename "$0"` - saveddir=`pwd` - - # need this for relative symlinks - dirname_prg=`dirname "$PRG"` - cd "$dirname_prg" - - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi - done - - IZPACK_HOME=`dirname "$PRG"`/.. - - cd "$saveddir" - - # make it fully qualified - IZPACK_HOME=`cd "$IZPACK_HOME" && pwd` -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$IZPACK_HOME" ] && - IZPACK_HOME=`cygpath --unix "$IZPACK_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD=`which java 2> /dev/null ` - if [ -z "$JAVACMD" ] ; then - JAVACMD=java - fi - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." - echo " We cannot execute $JAVACMD" - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." - echo " If build fails because sun.* classes could not be found" - echo " you will need to set the JAVA_HOME environment variable" - echo " to the installation directory of java." -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$IZPACK_HOME" ] && - IZPACK_HOME=`cygpath --windows "$IZPACK_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` -fi - -# For Darwin, use classes.jar for TOOLS_JAR -TOOLS_JAR="${JAVA_HOME}/lib/tools.jar" -if $darwin; then - TOOLS_JAR="/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Classes/classes.jar" -fi - -MAIN_CLASS=com.izforge.izpack.compiler.Compiler - -"$JAVACMD" -Xmx512m \ - $IZPACK_OPTS \ - -classpath "${IZPACK_HOME}/lib/standalone-compiler.jar" \ - "-Dtools.jar=$TOOLS_JAR" \ - "-Dizpack.home=${IZPACK_HOME}" \ - $MAIN_CLASS "$@" diff --git a/3rdparty/IzPack/bin/compile.bat b/3rdparty/IzPack/bin/compile.bat deleted file mode 100644 index 045cdd1d4..000000000 --- a/3rdparty/IzPack/bin/compile.bat +++ /dev/null @@ -1,105 +0,0 @@ -@echo off - -REM Copyright 2001,2004-2005 The Apache Software Foundation -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. - -if "%OS%"=="Windows_NT" @setlocal -if "%OS%"=="WINNT" @setlocal - -rem %~dp0 is expanded pathname of the current script -set DEFAULT_IZPACK_HOME=%~dp0.. - -if "%IZPACK_HOME%"=="" set IZPACK_HOME=%DEFAULT_IZPACK_HOME% -set DEFAULT_IZPACK_HOME= - -rem Slurp the command line arguments. This loop allows for an unlimited number -rem of arguments (up to the command line limit, anyway). -set IZPACK_CMD_LINE_ARGS=%1 -if ""%1""=="""" goto doneStart -shift -:setupArgs -if ""%1""=="""" goto doneStart -set IZPACK_CMD_LINE_ARGS=%IZPACK_CMD_LINE_ARGS% %1 -shift -goto setupArgs -rem This label provides a place for the argument list loop to break out -rem and for NT handling to skip to. - -:doneStart -rem find IZPACK_HOME if it does not exist due to either -rem an invalid value passed by the user or the %0 problem -rem on Windows 9x -set IZPACK_JAR=lib\standalone-compiler.jar -if exist "%IZPACK_HOME%\%IZPACK_JAR%" goto checkJava - -rem check for Izpack in Program Files -if not exist "%ProgramFiles%\IzPack" goto checkSystemDrive -set IZPACK_HOME=%ProgramFiles%\Izpack -if exist "%IZPACK_HOME%\%IZPACK_JAR%" goto checkJava - -:checkSystemDrive -rem check for Izpack in root directory of system drive -if not exist %SystemDrive%\Izpack\%IZPACK_JAR% goto checkCDrive -set IZPACK_HOME=%SystemDrive%\Izpack\ -goto checkJava - -:checkCDrive -rem check for Izpack in C:\Izpack for Win9X users -if not exist C:\Izpack\%IZPACK_JAR% goto noIzpackHome -set IZPACK_HOME=C:\Izpack\ -goto checkJava - -:noIzpackHome -echo IZPACK_HOME is set incorrectly or Izpack could not be located. Please set IZPACK_HOME. -goto end - -:checkJava -set _JAVACMD=%JAVACMD% - -if "%JAVA_HOME%" == "" goto noJavaHome -if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome -if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe -goto setClasspath - -:noJavaHome -if "%_JAVACMD%" == "" set _JAVACMD=java.exe - -:setClasspath -set LOCALCLASSPATH=%IZPACK_HOME%\Izpack.jar;%CLASSPATH% -for %%i in ("%IZPACK_HOME%\lib\*.jar") do call "%IZPACK_HOME%\bin\lcp.bat" %%i - -:runIzpack -set MAIN_CLASS=com.izforge.izpack.compiler.Compiler - -echo Executing -echo Java CMD: ["%_JAVACMD%" -Xmx512m] -echo Izpack options: [%IZPACK_OPTS%] -echo Class Path: ["%LOCALCLASSPATH%"] -echo Main Class: [%MAIN_CLASS%] -echo CMD line ARGS: [%IZPACK_CMD_LINE_ARGS%] -"%_JAVACMD%" -Xmx512m %IZPACK_OPTS% -classpath "%LOCALCLASSPATH%" %MAIN_CLASS% %IZPACK_CMD_LINE_ARGS% -goto end - -:end -set _JAVACMD= -set IZPACK_CMD_LINE_ARGS= -set LOCALCLASSPATH= -set MAIN_CLASS= - -if "%OS%"=="Windows_NT" @endlocal -if "%OS%"=="WINNT" @endlocal - -:mainEnd - - \ No newline at end of file diff --git a/3rdparty/IzPack/bin/customActions/AntActionInstallerListener.jar b/3rdparty/IzPack/bin/customActions/AntActionInstallerListener.jar deleted file mode 100644 index 19159566b..000000000 Binary files a/3rdparty/IzPack/bin/customActions/AntActionInstallerListener.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/AntActionInstallerListener/com/izforge/izpack/event/AntAction.class b/3rdparty/IzPack/bin/customActions/AntActionInstallerListener/com/izforge/izpack/event/AntAction.class deleted file mode 100644 index a9c8b2507..000000000 Binary files a/3rdparty/IzPack/bin/customActions/AntActionInstallerListener/com/izforge/izpack/event/AntAction.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/AntActionInstallerListener/com/izforge/izpack/event/AntActionInstallerListener.class b/3rdparty/IzPack/bin/customActions/AntActionInstallerListener/com/izforge/izpack/event/AntActionInstallerListener.class deleted file mode 100644 index db0c13463..000000000 Binary files a/3rdparty/IzPack/bin/customActions/AntActionInstallerListener/com/izforge/izpack/event/AntActionInstallerListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/AntActionUninstallerListener.jar b/3rdparty/IzPack/bin/customActions/AntActionUninstallerListener.jar deleted file mode 100644 index 146122a85..000000000 Binary files a/3rdparty/IzPack/bin/customActions/AntActionUninstallerListener.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/AntActionUninstallerListener/com/izforge/izpack/event/AntAction.class b/3rdparty/IzPack/bin/customActions/AntActionUninstallerListener/com/izforge/izpack/event/AntAction.class deleted file mode 100644 index a9c8b2507..000000000 Binary files a/3rdparty/IzPack/bin/customActions/AntActionUninstallerListener/com/izforge/izpack/event/AntAction.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/AntActionUninstallerListener/com/izforge/izpack/event/AntActionUninstallerListener.class b/3rdparty/IzPack/bin/customActions/AntActionUninstallerListener/com/izforge/izpack/event/AntActionUninstallerListener.class deleted file mode 100644 index 18c141349..000000000 Binary files a/3rdparty/IzPack/bin/customActions/AntActionUninstallerListener/com/izforge/izpack/event/AntActionUninstallerListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFInstallerListener.jar b/3rdparty/IzPack/bin/customActions/BSFInstallerListener.jar deleted file mode 100644 index 1ef89e5f2..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFInstallerListener.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction$1.class b/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction$1.class deleted file mode 100644 index 48de71d18..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction$MethodDescriptor.class b/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction$MethodDescriptor.class deleted file mode 100644 index 6d53bb2bb..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction$MethodDescriptor.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction$MethodExistenceChecker.class b/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction$MethodExistenceChecker.class deleted file mode 100644 index 6240e3259..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction$MethodExistenceChecker.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction.class b/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction.class deleted file mode 100644 index f13e1ae6c..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFAction.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFInstallerListener.class b/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFInstallerListener.class deleted file mode 100644 index 6452f400e..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFInstallerListener/com/izforge/izpack/event/BSFInstallerListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener.jar b/3rdparty/IzPack/bin/customActions/BSFUninstallerListener.jar deleted file mode 100644 index c8a285568..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction$1.class b/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction$1.class deleted file mode 100644 index 48de71d18..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction$MethodDescriptor.class b/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction$MethodDescriptor.class deleted file mode 100644 index 6d53bb2bb..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction$MethodDescriptor.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction$MethodExistenceChecker.class b/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction$MethodExistenceChecker.class deleted file mode 100644 index 6240e3259..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction$MethodExistenceChecker.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction.class b/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction.class deleted file mode 100644 index f13e1ae6c..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFAction.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFUninstallerListener.class b/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFUninstallerListener.class deleted file mode 100644 index dba8763b6..000000000 Binary files a/3rdparty/IzPack/bin/customActions/BSFUninstallerListener/com/izforge/izpack/event/BSFUninstallerListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/LateShortcutInstallListener.jar b/3rdparty/IzPack/bin/customActions/LateShortcutInstallListener.jar deleted file mode 100644 index b7a9fdcde..000000000 Binary files a/3rdparty/IzPack/bin/customActions/LateShortcutInstallListener.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/LateShortcutInstallListener/com/izforge/izpack/event/LateShortcutInstallListener.class b/3rdparty/IzPack/bin/customActions/LateShortcutInstallListener/com/izforge/izpack/event/LateShortcutInstallListener.class deleted file mode 100644 index 1d54f254d..000000000 Binary files a/3rdparty/IzPack/bin/customActions/LateShortcutInstallListener/com/izforge/izpack/event/LateShortcutInstallListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/ProgressBarInstallerListener.jar b/3rdparty/IzPack/bin/customActions/ProgressBarInstallerListener.jar deleted file mode 100644 index 3cb3419bf..000000000 Binary files a/3rdparty/IzPack/bin/customActions/ProgressBarInstallerListener.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/ProgressBarInstallerListener/com/izforge/izpack/event/ProgressBarInstallerListener.class b/3rdparty/IzPack/bin/customActions/ProgressBarInstallerListener/com/izforge/izpack/event/ProgressBarInstallerListener.class deleted file mode 100644 index 3a8d86f9c..000000000 Binary files a/3rdparty/IzPack/bin/customActions/ProgressBarInstallerListener/com/izforge/izpack/event/ProgressBarInstallerListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener.jar b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener.jar deleted file mode 100644 index cf2968cf9..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/izpack/COIOSHelper.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/izpack/COIOSHelper.class deleted file mode 100644 index e643d6f2d..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/izpack/COIOSHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/izpack/Registry.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/izpack/Registry.class deleted file mode 100644 index 3eebc57d8..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/izpack/Registry.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class deleted file mode 100644 index 478ac1400..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/AccessControlList.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/AccessControlList.class deleted file mode 100644 index a6a445cdf..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/AccessControlList.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/MSWinConstants.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/MSWinConstants.class deleted file mode 100644 index e9544c18e..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/MSWinConstants.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/NativeLibException.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/NativeLibException.class deleted file mode 100644 index aa835d045..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/NativeLibException.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/RegDataContainer.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/RegDataContainer.class deleted file mode 100644 index 5fde65a88..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/RegDataContainer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/RegistryImpl.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/RegistryImpl.class deleted file mode 100644 index b20cd8f0a..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/RegistryImpl.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/RegistryLogItem.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/RegistryLogItem.class deleted file mode 100644 index a6b56f1ff..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/RegistryLogItem.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/resources/NativeLibErr.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/resources/NativeLibErr.class deleted file mode 100644 index 7479269a5..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/resources/NativeLibErr.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/resources/NativeLibErr_de.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/resources/NativeLibErr_de.class deleted file mode 100644 index d4783819f..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/coi/tools/os/win/resources/NativeLibErr_de.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/event/NativeInstallerListener.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/event/NativeInstallerListener.class deleted file mode 100644 index 445d37b5c..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/event/NativeInstallerListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/event/RegistryInstallerListener.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/event/RegistryInstallerListener.class deleted file mode 100644 index cfdceaecf..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/event/RegistryInstallerListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/OSClassHelper.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/OSClassHelper.class deleted file mode 100644 index dc1cfffe0..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/OSClassHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/os/RegistryHandler.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/os/RegistryHandler.class deleted file mode 100644 index 2c3ab7cf8..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/os/RegistryHandler.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/os/Win_RegistryHandler.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/os/Win_RegistryHandler.class deleted file mode 100644 index 77077a69c..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/os/Win_RegistryHandler.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/os/WrappedNativeLibException.class b/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/os/WrappedNativeLibException.class deleted file mode 100644 index fdae23fa8..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryInstallerListener/com/izforge/izpack/util/os/WrappedNativeLibException.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener.jar b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener.jar deleted file mode 100644 index 2acfe8d84..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/izpack/COIOSHelper.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/izpack/COIOSHelper.class deleted file mode 100644 index e643d6f2d..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/izpack/COIOSHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/izpack/Registry.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/izpack/Registry.class deleted file mode 100644 index 3eebc57d8..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/izpack/Registry.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class deleted file mode 100644 index 478ac1400..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/AccessControlList.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/AccessControlList.class deleted file mode 100644 index a6a445cdf..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/AccessControlList.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/MSWinConstants.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/MSWinConstants.class deleted file mode 100644 index e9544c18e..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/MSWinConstants.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/NativeLibException.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/NativeLibException.class deleted file mode 100644 index aa835d045..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/NativeLibException.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/RegDataContainer.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/RegDataContainer.class deleted file mode 100644 index 5fde65a88..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/RegDataContainer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/RegistryImpl.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/RegistryImpl.class deleted file mode 100644 index b20cd8f0a..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/RegistryImpl.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/RegistryLogItem.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/RegistryLogItem.class deleted file mode 100644 index a6b56f1ff..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/RegistryLogItem.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/resources/NativeLibErr.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/resources/NativeLibErr.class deleted file mode 100644 index 7479269a5..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/resources/NativeLibErr.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/resources/NativeLibErr_de.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/resources/NativeLibErr_de.class deleted file mode 100644 index d4783819f..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/coi/tools/os/win/resources/NativeLibErr_de.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/event/NativeUninstallerListener.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/event/NativeUninstallerListener.class deleted file mode 100644 index e660ebd01..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/event/NativeUninstallerListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/event/RegistryUninstallerListener.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/event/RegistryUninstallerListener.class deleted file mode 100644 index 95a091aa8..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/event/RegistryUninstallerListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/OSClassHelper.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/OSClassHelper.class deleted file mode 100644 index dc1cfffe0..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/OSClassHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/os/RegistryHandler.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/os/RegistryHandler.class deleted file mode 100644 index 2c3ab7cf8..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/os/RegistryHandler.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/os/Win_RegistryHandler.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/os/Win_RegistryHandler.class deleted file mode 100644 index 77077a69c..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/os/Win_RegistryHandler.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/os/WrappedNativeLibException.class b/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/os/WrappedNativeLibException.class deleted file mode 100644 index fdae23fa8..000000000 Binary files a/3rdparty/IzPack/bin/customActions/RegistryUninstallerListener/com/izforge/izpack/util/os/WrappedNativeLibException.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/SummaryLoggerInstallerListener.jar b/3rdparty/IzPack/bin/customActions/SummaryLoggerInstallerListener.jar deleted file mode 100644 index 3d55a0762..000000000 Binary files a/3rdparty/IzPack/bin/customActions/SummaryLoggerInstallerListener.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/customActions/SummaryLoggerInstallerListener/com/izforge/izpack/event/SummaryLoggerInstallerListener.class b/3rdparty/IzPack/bin/customActions/SummaryLoggerInstallerListener/com/izforge/izpack/event/SummaryLoggerInstallerListener.class deleted file mode 100644 index 8ec2e8090..000000000 Binary files a/3rdparty/IzPack/bin/customActions/SummaryLoggerInstallerListener/com/izforge/izpack/event/SummaryLoggerInstallerListener.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/icons/izpack.icns b/3rdparty/IzPack/bin/icons/izpack.icns deleted file mode 100644 index 76665e5db..000000000 Binary files a/3rdparty/IzPack/bin/icons/izpack.icns and /dev/null differ diff --git a/3rdparty/IzPack/bin/icons/izpack.ico b/3rdparty/IzPack/bin/icons/izpack.ico deleted file mode 100644 index 492b5b8f7..000000000 Binary files a/3rdparty/IzPack/bin/icons/izpack.ico and /dev/null differ diff --git a/3rdparty/IzPack/bin/icons/izpack_16.png b/3rdparty/IzPack/bin/icons/izpack_16.png deleted file mode 100644 index 5a4682923..000000000 Binary files a/3rdparty/IzPack/bin/icons/izpack_16.png and /dev/null differ diff --git a/3rdparty/IzPack/bin/icons/izpack_16.xpm b/3rdparty/IzPack/bin/icons/izpack_16.xpm deleted file mode 100644 index ea0f5b73a..000000000 --- a/3rdparty/IzPack/bin/icons/izpack_16.xpm +++ /dev/null @@ -1,173 +0,0 @@ -/* XPM */ -static char *izpack_16[] = { -/* columns rows colors chars-per-pixel */ -"16 16 151 2", -" c #222955", -". c #004100", -"X c #3C457A", -"o c #4B527A", -"O c #394393", -"+ c #505E99", -"@ c #555E9B", -"# c #4E5AA0", -"$ c #4D5BA9", -"% c #5D619A", -"& c #5161AE", -"* c #60688F", -"= c #6275CB", -"- c #6693F6", -"; c #699AF9", -": c #6A9BF9", -"> c #6F9AF8", -", c #7695FB", -"< c #7C9EF2", -"1 c #69A0FB", -"2 c #977A6E", -"3 c #867A83", -"4 c #A38C6E", -"5 c #F6A110", -"6 c #F9AA1B", -"7 c #FCAA18", -"8 c #FEB51D", -"9 c #F7AB22", -"0 c #FBB026", -"q c #FBB127", -"w c #FEB82B", -"e c #FEBD28", -"r c #F9B937", -"t c #FEBE30", -"y c #DBAC4F", -"u c #E6BC64", -"i c #FEC330", -"p c #FCC039", -"a c #FEC938", -"s c #FEC64F", -"d c #FECC56", -"f c #FED757", -"g c #F0C270", -"h c #FED666", -"j c #FED86D", -"k c #FEDC75", -"l c #9B8D8F", -"z c #9B9398", -"x c #8791BC", -"c c #929CB7", -"v c #A6998E", -"b c #A29897", -"n c #A89CA8", -"m c #BBA485", -"M c #B1AAA6", -"N c #BFB7A4", -"B c #8999C5", -"V c #8C9FCE", -"C c #8090D3", -"Z c #8999D8", -"A c #919FDA", -"S c #8099F5", -"D c #819AF6", -"F c #829EFC", -"G c #8EA3EC", -"H c #85A4FE", -"J c #81AFFE", -"K c #85AFFE", -"L c #81B9FE", -"P c #8CB5FE", -"I c #90A4ED", -"U c #97AAE8", -"Y c #96AAEB", -"T c #9CABED", -"R c #91A7F8", -"E c #92ABFE", -"W c #92B9FC", -"Q c #90BDFE", -"! c #9FB1F2", -"~ c #9FB3FE", -"^ c #A6AACF", -"/ c #A2B1E6", -"( c #A3B3F2", -") c #A1B2F6", -"_ c #A6B9FC", -"` c #A7BEFE", -"' c #A9B7F5", -"] c #B0BBE8", -"[ c #B1BDEE", -"{ c #86CBFE", -"} c #8EC2FE", -"| c #8FC2FE", -" . c #89D0FE", -".. c #92C5FE", -"X. c #9AC6FE", -"o. c #9FC4FE", -"O. c #99CBFE", -"+. c #95D0FE", -"@. c #A2CCFE", -"#. c #A6CEFE", -"$. c #A7D2FE", -"%. c #AED2FE", -"&. c #ACD5FE", -"*. c #B7C2F3", -"=. c #B2C6FD", -"-. c #BEC9F0", -";. c #BECCFE", -":. c #BECEFD", -">. c #B7DAFE", -",. c #D3C085", -"<. c #DDC988", -"1. c #CECAAC", -"2. c #FEE485", -"3. c #FEEE83", -"4. c #FBE796", -"5. c #EBE2AA", -"6. c #FEFEB3", -"7. c #FEFEB8", -"8. c #C8CECA", -"9. c #C0CAF9", -"0. c #C6DBFE", -"q. c #D6DCF7", -"w. c #D7DCFC", -"e. c #C6E6FE", -"r. c #C9E7FE", -"t. c #D6E6FE", -"y. c #D3E8FE", -"u. c #D3EEFE", -"i. c #D7EBFE", -"p. c #DDECFE", -"a. c #F6F3C0", -"s. c #FCFDD8", -"d. c #E2EEFE", -"f. c #E4EEFE", -"g. c #E7F1FE", -"h. c #E6F3FE", -"j. c #E8F3FE", -"k. c #EBF6FE", -"l. c #EDF7FE", -"z. c #EEFCFE", -"x. c #F0F7FE", -"c. c #F1FBFE", -"v. c #F2FBFE", -"b. c #F6FBFE", -"n. c #F8FCFE", -"m. c #F8FDFE", -"M. c #FBFEFE", -"N. c #FCFEFE", -"B. c #FDFEFE", -"V. c #FEFEFE", -"C. c None", -/* pixels */ -"C.C.C.C.C.C.D G C.C.< C.C.C.C.C.", -"C.C.C.C.C.^ 5.7.# B s.8.# C.C.C.", -"C.C.C.C.D g h k u 4.7.6.1.# C.C.", -"C.C.C.C.C.n w i 8 6 j 2.2.,.@ C.", -"C.C.C.C.C., m a t 5 q s d f 3 C.", -"C.C.C.C.C.H K M p 7 q w r 2 C.C.", -"C.C.C.C.C.F ..J b 9 w y v c * O ", -"C.C.~ :._ R > L P z 4 l <.N o C.", -"C.9.V.V.t.f.*.- ..o.< V x C.C.", -"E z.V.V.l.V.V.G : @.&.O.Q C.C.C.", -"` t.z.-.] m.g.( : X.>.+.| C.C.C.", -"=.h.M./ A l.p.! : #.e.{ | C.C.C.", -") V.V.l.m.V.M.T W %.u. .$.C.C.C.", -"C.q.z.t.V.V.w.& U h.M.r.Z C.C.C.", -"C.= Y 0.d.[ X C.C.' 9.@ C.C.C.C.", -"C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C." -}; diff --git a/3rdparty/IzPack/bin/icons/izpack_32.png b/3rdparty/IzPack/bin/icons/izpack_32.png deleted file mode 100644 index e76572bc1..000000000 Binary files a/3rdparty/IzPack/bin/icons/izpack_32.png and /dev/null differ diff --git a/3rdparty/IzPack/bin/icons/izpack_32.xpm b/3rdparty/IzPack/bin/icons/izpack_32.xpm deleted file mode 100644 index 2236a35f3..000000000 --- a/3rdparty/IzPack/bin/icons/izpack_32.xpm +++ /dev/null @@ -1,260 +0,0 @@ -/* XPM */ -static char *package_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 222 2", -" c #36417A", -". c #404A84", -"X c #46508A", -"o c #405090", -"O c #485797", -"+ c #505E9F", -"@ c #4D59A1", -"# c #4D5FAC", -"$ c #515DA5", -"% c #5563A5", -"& c #5661AA", -"* c #5963AC", -"= c #5A65AE", -"- c #5B68AB", -"; c #5566B4", -": c #5669B0", -"> c #5D6DBC", -", c #696EA0", -"< c #6D77AF", -"1 c #6773B7", -"2 c #7B77A0", -"3 c #6170C0", -"4 c #6473C3", -"5 c #627AC9", -"6 c #6D7CCC", -"7 c #6A7FD5", -"8 c #7780B9", -"9 c #7D86BF", -"0 c #7081CB", -"q c #7381D2", -"w c #7583D5", -"e c #7185DC", -"r c #768DDD", -"t c #7989D4", -"y c #7E8BDD", -"u c #7F90C8", -"i c #6E8CE1", -"p c #778BE3", -"a c #7B97EE", -"s c #7E97F5", -"d c #F7AE1C", -"f c #F6B21F", -"g c #FCB213", -"h c #F9B523", -"j c #FCB827", -"k c #FBBD35", -"l c #CBAB79", -"z c #D2B078", -"x c #E1B759", -"c c #EFBD59", -"v c #F2B850", -"b c #F7BD55", -"n c #FFBE51", -"m c #E2B87B", -"M c #FFC12F", -"N c #FFC632", -"B c #FEC038", -"V c #FFC83E", -"C c #FFC243", -"Z c #FEC746", -"A c #FFCD41", -"S c #FFC948", -"D c #FEC84F", -"F c #FFCF4C", -"G c #FEC252", -"H c #FECE52", -"J c #FDCE59", -"K c #FFCC5A", -"L c #FDD24D", -"P c #FFD557", -"I c #FDD45D", -"U c #FFC765", -"Y c #FFCF72", -"T c #FFD265", -"R c #FED16B", -"E c #FED76E", -"W c #FFDE6C", -"Q c #FFD373", -"! c #FDD87D", -"~ c #868EBB", -"^ c #8995BB", -"/ c #929ABB", -"( c #9D9DB4", -") c #B5A08A", -"_ c #BAA696", -"` c #AFACBD", -"' c #B4A7A8", -"] c #8393DE", -"[ c #859CD9", -"{ c #8E9CDC", -"} c #919CC2", -"| c #8797E3", -" . c #8194ED", -".. c #859AEC", -"X. c #8E9DEA", -"o. c #829BFA", -"O. c #859EFD", -"+. c #96A2D6", -"@. c #9DA5D3", -"#. c #87A2E6", -"$. c #8FA1E7", -"%. c #82A4FF", -"&. c #87A2FA", -"*. c #85ADFD", -"=. c #8BA0F3", -"-. c #89A1FF", -";. c #8AA5FE", -":. c #8EA9FF", -">. c #8EACFD", -",. c #81B3FF", -"<. c #84B9FF", -"1. c #8DB7FF", -"2. c #8FBDFE", -"3. c #94A7ED", -"4. c #94A3F0", -"5. c #92A7FA", -"6. c #9BADF4", -"7. c #94B8FB", -"8. c #97B8FF", -"9. c #9BB6FB", -"0. c #9DB4FF", -"q. c #99BDFF", -"w. c #9FBDFB", -"e. c #A5B0D7", -"r. c #B0A8C0", -"t. c #B0B7D9", -"y. c #A0ADEE", -"u. c #A7B3E7", -"i. c #A4B4EE", -"p. c #AEB9EE", -"a. c #A5B6FE", -"s. c #ADB5F1", -"d. c #A8B8F3", -"f. c #A8BDFD", -"g. c #B3BFF4", -"h. c #92C0FF", -"j. c #99C0FD", -"k. c #99D1FE", -"l. c #9CD5FF", -"z. c #A2CDFF", -"x. c #A7C9FF", -"c. c #ADC6FF", -"v. c #ABC8F9", -"b. c #A8CEFE", -"n. c #A3D6FD", -"m. c #ACD2FF", -"M. c #ADD6FF", -"N. c #B6C1E9", -"B. c #B7CBFF", -"V. c #B4CCF8", -"C. c #BEC5F5", -"Z. c #B3D3FE", -"A. c #BED2F9", -"S. c #BCD4FF", -"D. c #B9DEFF", -"F. c #BEDAFF", -"G. c #CAAE87", -"H. c #C9B095", -"J. c #C6B6B1", -"K. c #E2C999", -"L. c #F2D28A", -"P. c #FFE183", -"I. c #FEE189", -"U. c #FFE198", -"Y. c #FFE79C", -"T. c #FDE895", -"R. c #FFEB97", -"E. c #FFE6A1", -"W. c #FFEDA6", -"Q. c #FFF2B1", -"!. c #FDF5B2", -"~. c #FFF8BB", -"^. c #C5C2C7", -"/. c #D5D4CB", -"(. c #C1CCF4", -"). c #C3D3FF", -"_. c #C6DAFF", -"`. c #CAD6FE", -"'. c #CED9FF", -"]. c #CEDEFF", -"[. c #D4DBFE", -"{. c #C0E0FE", -"}. c #C3E4FF", -"|. c #C7ECFF", -" X c #C8E0FF", -".X c #CAE6FE", -"XX c #CFE3FC", -"oX c #D2E1FF", -"OX c #D2E6FF", -"+X c #D7E3FF", -"@X c #D5EDFF", -"#X c #DAEAFE", -"$X c #DDEDFF", -"%X c #DCF0FD", -"&X c #E3E7D6", -"*X c #EFF0D9", -"=X c #F7F0C7", -"-X c #FFF6C0", -";X c #FBFFC6", -":X c #FFFDC6", -">X c #FFFECD", -",X c #F3F4DD", -"X&Xp pXe { 1X1X*X[ > pXpXpXpXpXpXpX", -"pXpXpXpXpXpXpXpXpX:.^.E.Y.W.Q.!.e.e t.1X1X1X1X.@.J I I k k h k k Z J I T J U 2 O pXpX", -"pXpXpXpXpXpXpXpXpXpXpX9.b.>.+.R W C d k k Z C Z D C n 2 @ pXpXpX", -"pXpXpXpXpXpXpXpXpXpXpXf.b.z.>...L.Z j k k C C D J v 2 $ pXpXpXpX", -"pXpXpXpXpXpXpXpXpXpXpXa.z.b.b.q.r x k k C Z D H ) 1 } ~ ~ # # @ ", -"pXpXpXpXpXpX-.O.o.o.&.a.x.<.z.b.9.t z k n Z z < } =X>X>X=X^ + ", -"pXpXpXpX-.f.[.].`.B.0.3.*.,.<.b.z.q.y l c } } K.I.T.U.' ; . pXpX", -"pXpX&.a.qXyXtXeX#X`.+X'.6.a ,.7.Z.Z.x.e 6 0 _ H.m G.< O pXpXpXpX", -"pXpX0.yXiXiXiX8X2X+X+XyXyX6.a ,.<.M.D.Z.c.1.$.#.t 5 : pXpXpXpXpX", -"pX:.wXiXiXiXiXyX$X$X6XiXiXyXX.*.<.<.F.}. Xz.b.m.m.7.& pXpXpXpXpX", -"s `.6XtXiXiXiXiXwXwXiXiXiXyX).i <.1.2. XF.m.m.m.M.d.: pXpXpXpXpX", -":.3X@X6XyXiXiXqX4XeXiXiXiXtXrXy ,.<.<.{.{.m.M.M.l.w.* pXpXpXpXpX", -"8.OX+X3X$XtX8Xd.a.#XtXtX6X#X_.4.*.2.2.}..XF.n.n.l.v.: pXpXpXpXpX", -"a._. X#X6XwX[.0 pXp.5X6X+X+X[.$.*.h.2.OX@XF.n.l.k.v.& pXpXpXpXpX", -"a.3XwXtXuXiX6X3.| 2XqXtXqX4X+XX.*.2.h..X$X.Xk.l.k.v.: pXpXpXpXpX", -"s tXiXiXiXiXtX4X5XrXiXrXyX6X#X7 8.h.h.@X7X|.k.k.l.V.& pXpXpXpXpX", -"a [.iXiXiXiX8X8XyXyXiXiXyXtX`.t OXx.j.$X9X@Xk.k.l.A.: pXpXpXpXpX", -"pX=.uXiXiX8X#X8XyXyXiXiXyXyX] r _.3Xz.6XtX@Xl.|.eXN.& pXpXpXpXpX", -"pXr s.iXtX#X X6XtXtXuXiXiXs.> 1 p B.qXiXyXuXeX+X{ > X pXpXpXpXpX", -"pXpXq 6.XXoXS.6X8XyXyXtX6.> pXpXpXp C.yXiX6Xu.5 & pXpXpXpXpXpXpX", -"pXpXpX5 y i.B.6X6X].v.6 - pXpXpXpXpXi s.(.t 1 pXpXpXpXpXpXpXpXpX", -"pXpXpXpXpX- 5 4 4 1 % pXpXpXpXpXpXpXpX6 7 + pXpXpXpXpXpXpXpXpXpX", -"pXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpX" -}; diff --git a/3rdparty/IzPack/bin/langpacks/checklangpack b/3rdparty/IzPack/bin/langpacks/checklangpack deleted file mode 100644 index 98369a255..000000000 --- a/3rdparty/IzPack/bin/langpacks/checklangpack +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# - -tmpfile="stringids.tmp" - -# rather use English as the authoritative source for string IDs? -reference_file="*.xml" - -idfilter='/^.*id="\([^"]*\)".*$/{ - s//\1/ - p - }' - -checkfiles="*.xml" - -if [ $# -ge 1 -a -n "$1" ] ; then - checkfiles="$1" -fi - -# basic sanity check -if [ ! -f eng.xml ] ; then - echo "Could not find eng.xml - please go to the directory containing the" - echo "translation files before executing this script." - exit 1 -fi - -sed -n -e "$idfilter" $reference_file | sort | uniq > $tmpfile - -echo "lines starting with \"-\" mark missing strings, lines with \"+\" are superfluous" - -for i in $checkfiles ; do - if [ ! -f "$i" ] ; then - echo "$i not found. Skipping" - continue - fi - - echo "report of $i (- = missing, + = probably superfluous)" - sed -n -e "$idfilter" $i | sort | diff -U 0 $tmpfile - | sed -n -e '/^[-+][^-+]/p' -done - diff --git a/3rdparty/IzPack/bin/langpacks/flags/cat.gif b/3rdparty/IzPack/bin/langpacks/flags/cat.gif deleted file mode 100644 index 171e2ffeb..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/cat.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/chn.gif b/3rdparty/IzPack/bin/langpacks/flags/chn.gif deleted file mode 100644 index 4bfb96b26..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/chn.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/cze.gif b/3rdparty/IzPack/bin/langpacks/flags/cze.gif deleted file mode 100644 index efb5c8333..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/cze.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/dan.gif b/3rdparty/IzPack/bin/langpacks/flags/dan.gif deleted file mode 100644 index c44261c23..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/dan.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/deu.gif b/3rdparty/IzPack/bin/langpacks/flags/deu.gif deleted file mode 100644 index 01a9dc55a..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/deu.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/ell.gif b/3rdparty/IzPack/bin/langpacks/flags/ell.gif deleted file mode 100644 index 9a491d4f5..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/ell.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/eng.gif b/3rdparty/IzPack/bin/langpacks/flags/eng.gif deleted file mode 100644 index 3418042b5..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/eng.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/eus.gif b/3rdparty/IzPack/bin/langpacks/flags/eus.gif deleted file mode 100644 index a2b45d07e..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/eus.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/fa.gif b/3rdparty/IzPack/bin/langpacks/flags/fa.gif deleted file mode 100644 index e71904139..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/fa.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/fin.gif b/3rdparty/IzPack/bin/langpacks/flags/fin.gif deleted file mode 100644 index 0b8a8daf1..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/fin.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/fra.gif b/3rdparty/IzPack/bin/langpacks/flags/fra.gif deleted file mode 100644 index 9bbeeeaf2..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/fra.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/glg.gif b/3rdparty/IzPack/bin/langpacks/flags/glg.gif deleted file mode 100644 index bf86d15bf..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/glg.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/hun.gif b/3rdparty/IzPack/bin/langpacks/flags/hun.gif deleted file mode 100644 index 2b594e854..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/hun.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/ind.gif b/3rdparty/IzPack/bin/langpacks/flags/ind.gif deleted file mode 100644 index ae760382c..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/ind.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/ita.gif b/3rdparty/IzPack/bin/langpacks/flags/ita.gif deleted file mode 100644 index 223e924c4..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/ita.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/jpn.gif b/3rdparty/IzPack/bin/langpacks/flags/jpn.gif deleted file mode 100644 index 66d7b273d..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/jpn.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/kor.gif b/3rdparty/IzPack/bin/langpacks/flags/kor.gif deleted file mode 100644 index fe9b9cb55..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/kor.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/mys.gif b/3rdparty/IzPack/bin/langpacks/flags/mys.gif deleted file mode 100644 index 472ce4410..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/mys.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/ned.gif b/3rdparty/IzPack/bin/langpacks/flags/ned.gif deleted file mode 100644 index 7b168bea2..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/ned.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/nor.gif b/3rdparty/IzPack/bin/langpacks/flags/nor.gif deleted file mode 100644 index 26f3ab6ce..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/nor.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/pol.gif b/3rdparty/IzPack/bin/langpacks/flags/pol.gif deleted file mode 100644 index d827c27b0..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/pol.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/por.gif b/3rdparty/IzPack/bin/langpacks/flags/por.gif deleted file mode 100644 index 07147d9d1..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/por.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/prt.gif b/3rdparty/IzPack/bin/langpacks/flags/prt.gif deleted file mode 100644 index 360c6de48..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/prt.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/rom.gif b/3rdparty/IzPack/bin/langpacks/flags/rom.gif deleted file mode 100644 index b6d8ad18f..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/rom.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/rus.gif b/3rdparty/IzPack/bin/langpacks/flags/rus.gif deleted file mode 100644 index afcaab6b9..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/rus.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/scg.gif b/3rdparty/IzPack/bin/langpacks/flags/scg.gif deleted file mode 100644 index 708a4e2fd..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/scg.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/spa.gif b/3rdparty/IzPack/bin/langpacks/flags/spa.gif deleted file mode 100644 index dede2ce9f..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/spa.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/svk.gif b/3rdparty/IzPack/bin/langpacks/flags/svk.gif deleted file mode 100644 index 9913f8284..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/svk.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/swe.gif b/3rdparty/IzPack/bin/langpacks/flags/swe.gif deleted file mode 100644 index 3c76300c2..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/swe.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/tur.gif b/3rdparty/IzPack/bin/langpacks/flags/tur.gif deleted file mode 100644 index db124d91d..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/tur.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/twn.gif b/3rdparty/IzPack/bin/langpacks/flags/twn.gif deleted file mode 100644 index 382bd4164..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/twn.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/flags/ukr.gif b/3rdparty/IzPack/bin/langpacks/flags/ukr.gif deleted file mode 100644 index ec6d1de0b..000000000 Binary files a/3rdparty/IzPack/bin/langpacks/flags/ukr.gif and /dev/null differ diff --git a/3rdparty/IzPack/bin/langpacks/installer/cat.xml b/3rdparty/IzPack/bin/langpacks/installer/cat.xml deleted file mode 100644 index e3b586853..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/cat.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/chn.xml b/3rdparty/IzPack/bin/langpacks/installer/chn.xml deleted file mode 100644 index 77eceb531..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/chn.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/cze.xml b/3rdparty/IzPack/bin/langpacks/installer/cze.xml deleted file mode 100644 index 36eb37cc9..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/cze.xml +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/dan.xml b/3rdparty/IzPack/bin/langpacks/installer/dan.xml deleted file mode 100644 index 711f0ff42..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/dan.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/deu.xml b/3rdparty/IzPack/bin/langpacks/installer/deu.xml deleted file mode 100644 index 5931cbd70..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/deu.xml +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/ell.xml b/3rdparty/IzPack/bin/langpacks/installer/ell.xml deleted file mode 100644 index a2bb50d49..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/ell.xml +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/eng.xml b/3rdparty/IzPack/bin/langpacks/installer/eng.xml deleted file mode 100644 index cd9b8bb36..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/eng.xml +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/eus.xml b/3rdparty/IzPack/bin/langpacks/installer/eus.xml deleted file mode 100644 index 1016074c9..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/eus.xml +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/fa.xml b/3rdparty/IzPack/bin/langpacks/installer/fa.xml deleted file mode 100644 index b0ebf7b28..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/fa.xml +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/fin.xml b/3rdparty/IzPack/bin/langpacks/installer/fin.xml deleted file mode 100644 index 192a13fcb..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/fin.xml +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/fra.xml b/3rdparty/IzPack/bin/langpacks/installer/fra.xml deleted file mode 100644 index f53bd9f7c..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/fra.xml +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/glg.xml b/3rdparty/IzPack/bin/langpacks/installer/glg.xml deleted file mode 100644 index 859594a87..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/glg.xml +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/hun.xml b/3rdparty/IzPack/bin/langpacks/installer/hun.xml deleted file mode 100644 index b23797b93..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/hun.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/ind.xml b/3rdparty/IzPack/bin/langpacks/installer/ind.xml deleted file mode 100644 index d5b13293a..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/ind.xml +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/ita.xml b/3rdparty/IzPack/bin/langpacks/installer/ita.xml deleted file mode 100644 index 6a7228fb8..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/ita.xml +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/jpn.xml b/3rdparty/IzPack/bin/langpacks/installer/jpn.xml deleted file mode 100644 index 837007760..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/jpn.xml +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/kor.xml b/3rdparty/IzPack/bin/langpacks/installer/kor.xml deleted file mode 100644 index def4f7c32..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/kor.xml +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/mys.xml b/3rdparty/IzPack/bin/langpacks/installer/mys.xml deleted file mode 100644 index 664fb5378..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/mys.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/ned.xml b/3rdparty/IzPack/bin/langpacks/installer/ned.xml deleted file mode 100644 index 2e56b22e5..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/ned.xml +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/nor.xml b/3rdparty/IzPack/bin/langpacks/installer/nor.xml deleted file mode 100644 index 3a577e544..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/nor.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/pol.xml b/3rdparty/IzPack/bin/langpacks/installer/pol.xml deleted file mode 100644 index eab895987..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/pol.xml +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/3rdparty/IzPack/bin/langpacks/installer/por.xml b/3rdparty/IzPack/bin/langpacks/installer/por.xml deleted file mode 100644 index 496d48813..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/por.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/prt.xml b/3rdparty/IzPack/bin/langpacks/installer/prt.xml deleted file mode 100644 index c01c15103..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/prt.xml +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/rom.xml b/3rdparty/IzPack/bin/langpacks/installer/rom.xml deleted file mode 100644 index 6c33fe0eb..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/rom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/rus.xml b/3rdparty/IzPack/bin/langpacks/installer/rus.xml deleted file mode 100644 index 07c4e8742..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/rus.xml +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/3rdparty/IzPack/bin/langpacks/installer/scg.xml b/3rdparty/IzPack/bin/langpacks/installer/scg.xml deleted file mode 100644 index 4180f6df9..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/scg.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/spa.xml b/3rdparty/IzPack/bin/langpacks/installer/spa.xml deleted file mode 100644 index d9768fcda..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/spa.xml +++ /dev/null @@ -1,285 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/3rdparty/IzPack/bin/langpacks/installer/svk.xml b/3rdparty/IzPack/bin/langpacks/installer/svk.xml deleted file mode 100644 index f576750f7..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/svk.xml +++ /dev/null @@ -1,278 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/swe.xml b/3rdparty/IzPack/bin/langpacks/installer/swe.xml deleted file mode 100644 index 4588409c2..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/swe.xml +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/testLangpacks.ksh b/3rdparty/IzPack/bin/langpacks/installer/testLangpacks.ksh deleted file mode 100644 index ebca08bd1..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/testLangpacks.ksh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh - -typeset -i count=0 -langpacks=$(ls *.xml) - -typeset help verbose -for opt; do - case "$opt" in - -h*) help=true; shift; continue;; - (-v*) verbose=true; shift; continue;; - esac -done - -if [ a$help = "atrue" ] ; then - echo Shell scrip to verify entries in langpacks. - echo This shell script writes the ids which are in eng.xml - echo but not in the langpack with the given ISO3 to stdout. - echo usage: $0 [-h] [-v] [ISO3] - exit 0 -fi -if [ $# -gt 0 ]; then - langpacks=$1.xml -fi - -for lp in $langpacks; do - echo "Result for langpack $lp:" - result="" - count=0 - for i in `awk '{print $2}' eng.xml | grep 'id="'`; do - MATCH=`grep "$i" $lp`; - if [ "${MATCH}" = "" ]; then - result[count]=$i - count=count+1 - fi; - done; - if [ $count -eq 0 ] ; then - echo " All ids present" - else - echo " $count IDs missing!" - if [ a$verbose = "atrue" ] ; then - i=2 - for line in ${result[*]} ; do - echo " $line" - if [ $i -gt $count ] ; then - break - fi - i=$i+1 - done; - fi - fi - -done; diff --git a/3rdparty/IzPack/bin/langpacks/installer/tur.xml b/3rdparty/IzPack/bin/langpacks/installer/tur.xml deleted file mode 100644 index cfa9da5a3..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/tur.xml +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/twn.xml b/3rdparty/IzPack/bin/langpacks/installer/twn.xml deleted file mode 100644 index a81dc1118..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/twn.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/langpacks/installer/ukr.xml b/3rdparty/IzPack/bin/langpacks/installer/ukr.xml deleted file mode 100644 index 65c848163..000000000 --- a/3rdparty/IzPack/bin/langpacks/installer/ukr.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/IzPack/bin/lcp.bat b/3rdparty/IzPack/bin/lcp.bat deleted file mode 100644 index c34e28bf5..000000000 --- a/3rdparty/IzPack/bin/lcp.bat +++ /dev/null @@ -1,31 +0,0 @@ -REM -REM Copyright 2001-2004 The Apache Software Foundation -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. -REM -REM - -set _CLASSPATHCOMPONENT=%1 -if ""%1""=="""" goto gotAllArgs -shift - -:argCheck -if ""%1""=="""" goto gotAllArgs -set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1 -shift -goto argCheck - -:gotAllArgs -set LOCALCLASSPATH=%_CLASSPATHCOMPONENT%;%LOCALCLASSPATH% - - \ No newline at end of file diff --git a/3rdparty/IzPack/bin/native/3rdparty/COIOSHelper.dll b/3rdparty/IzPack/bin/native/3rdparty/COIOSHelper.dll deleted file mode 100644 index ae24a541d..000000000 Binary files a/3rdparty/IzPack/bin/native/3rdparty/COIOSHelper.dll and /dev/null differ diff --git a/3rdparty/IzPack/bin/native/3rdparty/COIOSHelper_x64.dll b/3rdparty/IzPack/bin/native/3rdparty/COIOSHelper_x64.dll deleted file mode 100644 index 50ece7558..000000000 Binary files a/3rdparty/IzPack/bin/native/3rdparty/COIOSHelper_x64.dll and /dev/null differ diff --git a/3rdparty/IzPack/bin/native/3rdparty/Usage.txt b/3rdparty/IzPack/bin/native/3rdparty/Usage.txt deleted file mode 100644 index 3805ad9ca..000000000 --- a/3rdparty/IzPack/bin/native/3rdparty/Usage.txt +++ /dev/null @@ -1 +0,0 @@ -Put your own native libraries here. diff --git a/3rdparty/IzPack/bin/native/izpack/ShellLink.dll b/3rdparty/IzPack/bin/native/izpack/ShellLink.dll deleted file mode 100644 index bd0ad4b5c..000000000 Binary files a/3rdparty/IzPack/bin/native/izpack/ShellLink.dll and /dev/null differ diff --git a/3rdparty/IzPack/bin/native/izpack/ShellLink_x64.dll b/3rdparty/IzPack/bin/native/izpack/ShellLink_x64.dll deleted file mode 100644 index 03dda8a4b..000000000 Binary files a/3rdparty/IzPack/bin/native/izpack/ShellLink_x64.dll and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel.jar b/3rdparty/IzPack/bin/panels/CheckedHelloPanel.jar deleted file mode 100644 index 31e12debc..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/izpack/COIOSHelper.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/izpack/COIOSHelper.class deleted file mode 100644 index e643d6f2d..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/izpack/COIOSHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/izpack/Registry.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/izpack/Registry.class deleted file mode 100644 index 3eebc57d8..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/izpack/Registry.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class deleted file mode 100644 index 478ac1400..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/AccessControlList.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/AccessControlList.class deleted file mode 100644 index a6a445cdf..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/AccessControlList.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/MSWinConstants.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/MSWinConstants.class deleted file mode 100644 index e9544c18e..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/MSWinConstants.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/NativeLibException.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/NativeLibException.class deleted file mode 100644 index aa835d045..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/NativeLibException.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/RegDataContainer.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/RegDataContainer.class deleted file mode 100644 index 5fde65a88..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/RegDataContainer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/RegistryImpl.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/RegistryImpl.class deleted file mode 100644 index b20cd8f0a..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/RegistryImpl.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/RegistryLogItem.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/RegistryLogItem.class deleted file mode 100644 index a6b56f1ff..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/RegistryLogItem.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/resources/NativeLibErr.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/resources/NativeLibErr.class deleted file mode 100644 index 7479269a5..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/resources/NativeLibErr.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/resources/NativeLibErr_de.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/resources/NativeLibErr_de.class deleted file mode 100644 index d4783819f..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/coi/tools/os/win/resources/NativeLibErr_de.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/panels/CheckedHelloPanel.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/panels/CheckedHelloPanel.class deleted file mode 100644 index d13eb11a7..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/panels/CheckedHelloPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/panels/HelloPanel.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/panels/HelloPanel.class deleted file mode 100644 index 26a5006ac..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/panels/HelloPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/OSClassHelper.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/OSClassHelper.class deleted file mode 100644 index dc1cfffe0..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/OSClassHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/os/RegistryHandler.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/os/RegistryHandler.class deleted file mode 100644 index 2c3ab7cf8..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/os/RegistryHandler.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/os/Win_RegistryHandler.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/os/Win_RegistryHandler.class deleted file mode 100644 index 77077a69c..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/os/Win_RegistryHandler.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/os/WrappedNativeLibException.class b/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/os/WrappedNativeLibException.class deleted file mode 100644 index fdae23fa8..000000000 Binary files a/3rdparty/IzPack/bin/panels/CheckedHelloPanel/com/izforge/izpack/util/os/WrappedNativeLibException.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CompilePanel.jar b/3rdparty/IzPack/bin/panels/CompilePanel.jar deleted file mode 100644 index 736db4e1e..000000000 Binary files a/3rdparty/IzPack/bin/panels/CompilePanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanel$CompilerErrorDialog$1.class b/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanel$CompilerErrorDialog$1.class deleted file mode 100644 index 22b5732fc..000000000 Binary files a/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanel$CompilerErrorDialog$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanel$CompilerErrorDialog.class b/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanel$CompilerErrorDialog.class deleted file mode 100644 index 0e8824005..000000000 Binary files a/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanel$CompilerErrorDialog.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanel.class b/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanel.class deleted file mode 100644 index b396e8e98..000000000 Binary files a/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanelAutomationHelper.class deleted file mode 100644 index ced265d78..000000000 Binary files a/3rdparty/IzPack/bin/panels/CompilePanel/com/izforge/izpack/panels/CompilePanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel.jar b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel.jar deleted file mode 100644 index fb82a75fa..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/DirInputField.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/DirInputField.class deleted file mode 100644 index c41a441b9..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/DirInputField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/FileInputField.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/FileInputField.class deleted file mode 100644 index 705ad0968..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/FileInputField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/MultipleFileInputField.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/MultipleFileInputField.class deleted file mode 100644 index 51c11538b..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/MultipleFileInputField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/PasswordGroup.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/PasswordGroup.class deleted file mode 100644 index b872d437f..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/PasswordGroup.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/PasswordUIElement.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/PasswordUIElement.class deleted file mode 100644 index 7e90726ab..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/PasswordUIElement.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/ProcessingClient.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/ProcessingClient.class deleted file mode 100644 index f32beffe6..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/ProcessingClient.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/Processor.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/Processor.class deleted file mode 100644 index c2fb450b9..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/Processor.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RadioButtonUIElement.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RadioButtonUIElement.class deleted file mode 100644 index 2de71b24a..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RadioButtonUIElement.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleInputField$FieldSpec.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleInputField$FieldSpec.class deleted file mode 100644 index f745cc247..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleInputField$FieldSpec.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleInputField.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleInputField.class deleted file mode 100644 index 81a16e235..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleInputField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleTextField$Rule.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleTextField$Rule.class deleted file mode 100644 index e7cc9e365..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleTextField$Rule.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleTextField.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleTextField.class deleted file mode 100644 index e41a85dff..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/RuleTextField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/StringInputProcessingClient.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/StringInputProcessingClient.class deleted file mode 100644 index 2a23e722c..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/StringInputProcessingClient.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/TextInputField.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/TextInputField.class deleted file mode 100644 index 82679be7e..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/TextInputField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UIElement.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UIElement.class deleted file mode 100644 index d99ed73d4..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UIElement.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UIElementType.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UIElementType.class deleted file mode 100644 index 09fdda270..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UIElementType.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputFileFilter.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputFileFilter.class deleted file mode 100644 index c51723c0a..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputFileFilter.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$1.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$1.class deleted file mode 100644 index 2ea44bd0f..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$2.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$2.class deleted file mode 100644 index 19dea8c10..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$2.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField$1.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField$1.class deleted file mode 100644 index 1ba7bbd6b..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField.class deleted file mode 100644 index 4ebf91424..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$TextValuePair.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$TextValuePair.class deleted file mode 100644 index 3dfe1172c..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel$TextValuePair.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel.class deleted file mode 100644 index a0717a8e6..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanelAutomationHelper.class deleted file mode 100644 index a13cb083f..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/UserInputPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/Validator.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/Validator.class deleted file mode 100644 index 91ff31df6..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/Validator.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/ValidatorContainer.class b/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/ValidatorContainer.class deleted file mode 100644 index fe1276164..000000000 Binary files a/3rdparty/IzPack/bin/panels/ConditionalUserInputPanel/com/izforge/izpack/panels/ValidatorContainer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/DataCheckPanel.jar b/3rdparty/IzPack/bin/panels/DataCheckPanel.jar deleted file mode 100644 index b2d4193c2..000000000 Binary files a/3rdparty/IzPack/bin/panels/DataCheckPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/DataCheckPanel/com/izforge/izpack/panels/DataCheckPanel.class b/3rdparty/IzPack/bin/panels/DataCheckPanel/com/izforge/izpack/panels/DataCheckPanel.class deleted file mode 100644 index d8e3fe895..000000000 Binary files a/3rdparty/IzPack/bin/panels/DataCheckPanel/com/izforge/izpack/panels/DataCheckPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/DefaultTargetPanel.jar b/3rdparty/IzPack/bin/panels/DefaultTargetPanel.jar deleted file mode 100644 index 8b979c1a1..000000000 Binary files a/3rdparty/IzPack/bin/panels/DefaultTargetPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/DefaultTargetPanel.class b/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/DefaultTargetPanel.class deleted file mode 100644 index fb3bfb56c..000000000 Binary files a/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/DefaultTargetPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/DefaultTargetPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/DefaultTargetPanelAutomationHelper.class deleted file mode 100644 index 78d3e1983..000000000 Binary files a/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/DefaultTargetPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/PathInputPanel.class b/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/PathInputPanel.class deleted file mode 100644 index a11a8e0f9..000000000 Binary files a/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/PathInputPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/PathSelectionPanel.class b/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/PathSelectionPanel.class deleted file mode 100644 index c8029014c..000000000 Binary files a/3rdparty/IzPack/bin/panels/DefaultTargetPanel/com/izforge/izpack/panels/PathSelectionPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel.jar b/3rdparty/IzPack/bin/panels/ExtendedInstallPanel.jar deleted file mode 100644 index a94f3f4af..000000000 Binary files a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/ExtendedInstallPanel.class b/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/ExtendedInstallPanel.class deleted file mode 100644 index 79ee0b373..000000000 Binary files a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/ExtendedInstallPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$1.class b/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$1.class deleted file mode 100644 index b9880c93c..000000000 Binary files a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$2.class b/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$2.class deleted file mode 100644 index 3d6296757..000000000 Binary files a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$2.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$3.class b/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$3.class deleted file mode 100644 index 9bc9ef598..000000000 Binary files a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$3.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$4.class b/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$4.class deleted file mode 100644 index 88680f1d9..000000000 Binary files a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$4.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$5.class b/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$5.class deleted file mode 100644 index 88311d287..000000000 Binary files a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel$5.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel.class b/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel.class deleted file mode 100644 index 7bb514158..000000000 Binary files a/3rdparty/IzPack/bin/panels/ExtendedInstallPanel/com/izforge/izpack/panels/InstallPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/FinishPanel.jar b/3rdparty/IzPack/bin/panels/FinishPanel.jar deleted file mode 100644 index ff0240b39..000000000 Binary files a/3rdparty/IzPack/bin/panels/FinishPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/FinishPanel/com/izforge/izpack/panels/FinishPanel.class b/3rdparty/IzPack/bin/panels/FinishPanel/com/izforge/izpack/panels/FinishPanel.class deleted file mode 100644 index 05955a849..000000000 Binary files a/3rdparty/IzPack/bin/panels/FinishPanel/com/izforge/izpack/panels/FinishPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/FinishPanel/com/izforge/izpack/panels/FinishPanelConsoleHelper.class b/3rdparty/IzPack/bin/panels/FinishPanel/com/izforge/izpack/panels/FinishPanelConsoleHelper.class deleted file mode 100644 index b92c79fff..000000000 Binary files a/3rdparty/IzPack/bin/panels/FinishPanel/com/izforge/izpack/panels/FinishPanelConsoleHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HTMLHelloPanel.jar b/3rdparty/IzPack/bin/panels/HTMLHelloPanel.jar deleted file mode 100644 index 1efd24d57..000000000 Binary files a/3rdparty/IzPack/bin/panels/HTMLHelloPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HTMLHelloPanel/com/izforge/izpack/panels/HTMLHelloPanel.class b/3rdparty/IzPack/bin/panels/HTMLHelloPanel/com/izforge/izpack/panels/HTMLHelloPanel.class deleted file mode 100644 index 81624ca78..000000000 Binary files a/3rdparty/IzPack/bin/panels/HTMLHelloPanel/com/izforge/izpack/panels/HTMLHelloPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HTMLHelloPanel/com/izforge/izpack/panels/HTMLInfoPanel$1.class b/3rdparty/IzPack/bin/panels/HTMLHelloPanel/com/izforge/izpack/panels/HTMLInfoPanel$1.class deleted file mode 100644 index f3b2c28a6..000000000 Binary files a/3rdparty/IzPack/bin/panels/HTMLHelloPanel/com/izforge/izpack/panels/HTMLInfoPanel$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HTMLHelloPanel/com/izforge/izpack/panels/HTMLInfoPanel.class b/3rdparty/IzPack/bin/panels/HTMLHelloPanel/com/izforge/izpack/panels/HTMLInfoPanel.class deleted file mode 100644 index 7d9ed7e3f..000000000 Binary files a/3rdparty/IzPack/bin/panels/HTMLHelloPanel/com/izforge/izpack/panels/HTMLInfoPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HTMLInfoPanel.jar b/3rdparty/IzPack/bin/panels/HTMLInfoPanel.jar deleted file mode 100644 index 732e6b829..000000000 Binary files a/3rdparty/IzPack/bin/panels/HTMLInfoPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HTMLInfoPanel/com/izforge/izpack/panels/HTMLInfoPanel$1.class b/3rdparty/IzPack/bin/panels/HTMLInfoPanel/com/izforge/izpack/panels/HTMLInfoPanel$1.class deleted file mode 100644 index f3b2c28a6..000000000 Binary files a/3rdparty/IzPack/bin/panels/HTMLInfoPanel/com/izforge/izpack/panels/HTMLInfoPanel$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HTMLInfoPanel/com/izforge/izpack/panels/HTMLInfoPanel.class b/3rdparty/IzPack/bin/panels/HTMLInfoPanel/com/izforge/izpack/panels/HTMLInfoPanel.class deleted file mode 100644 index 7d9ed7e3f..000000000 Binary files a/3rdparty/IzPack/bin/panels/HTMLInfoPanel/com/izforge/izpack/panels/HTMLInfoPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HTMLLicencePanel.jar b/3rdparty/IzPack/bin/panels/HTMLLicencePanel.jar deleted file mode 100644 index 8af39050a..000000000 Binary files a/3rdparty/IzPack/bin/panels/HTMLLicencePanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HTMLLicencePanel/com/izforge/izpack/panels/HTMLLicencePanel.class b/3rdparty/IzPack/bin/panels/HTMLLicencePanel/com/izforge/izpack/panels/HTMLLicencePanel.class deleted file mode 100644 index 138314960..000000000 Binary files a/3rdparty/IzPack/bin/panels/HTMLLicencePanel/com/izforge/izpack/panels/HTMLLicencePanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HTMLLicencePanel/com/izforge/izpack/panels/HTMLLicencePanelConsoleHelper.class b/3rdparty/IzPack/bin/panels/HTMLLicencePanel/com/izforge/izpack/panels/HTMLLicencePanelConsoleHelper.class deleted file mode 100644 index 803e37e8a..000000000 Binary files a/3rdparty/IzPack/bin/panels/HTMLLicencePanel/com/izforge/izpack/panels/HTMLLicencePanelConsoleHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HelloPanel.jar b/3rdparty/IzPack/bin/panels/HelloPanel.jar deleted file mode 100644 index aa273d1b8..000000000 Binary files a/3rdparty/IzPack/bin/panels/HelloPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HelloPanel/com/izforge/izpack/panels/HelloPanel.class b/3rdparty/IzPack/bin/panels/HelloPanel/com/izforge/izpack/panels/HelloPanel.class deleted file mode 100644 index 26a5006ac..000000000 Binary files a/3rdparty/IzPack/bin/panels/HelloPanel/com/izforge/izpack/panels/HelloPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/HelloPanel/com/izforge/izpack/panels/HelloPanelConsoleHelper.class b/3rdparty/IzPack/bin/panels/HelloPanel/com/izforge/izpack/panels/HelloPanelConsoleHelper.class deleted file mode 100644 index e9be3a8e4..000000000 Binary files a/3rdparty/IzPack/bin/panels/HelloPanel/com/izforge/izpack/panels/HelloPanelConsoleHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel.jar b/3rdparty/IzPack/bin/panels/ImgPacksPanel.jar deleted file mode 100644 index 668ab4e97..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/ImgPacksPanel.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/ImgPacksPanel.class deleted file mode 100644 index 130f279cc..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/ImgPacksPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/ImgPacksPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/ImgPacksPanelAutomationHelper.class deleted file mode 100644 index 11b86f8bf..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/ImgPacksPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksModel.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksModel.class deleted file mode 100644 index 49e432e84..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksModel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper$1PInfo.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper$1PInfo.class deleted file mode 100644 index 893d0bea1..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper$1PInfo.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper.class deleted file mode 100644 index 7c265b9c6..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$1.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$1.class deleted file mode 100644 index ecb42a0c3..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$2.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$2.class deleted file mode 100644 index 93e4123d2..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$2.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$CheckBoxRenderer.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$CheckBoxRenderer.class deleted file mode 100644 index bb72cdca9..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$CheckBoxRenderer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$LFIndependentIcon.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$LFIndependentIcon.class deleted file mode 100644 index 34bbbc44b..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$LFIndependentIcon.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$PacksPanelTableCellRenderer.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$PacksPanelTableCellRenderer.class deleted file mode 100644 index 7af726596..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase$PacksPanelTableCellRenderer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase.class deleted file mode 100644 index 1374b04cb..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelBase.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelInterface.class b/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelInterface.class deleted file mode 100644 index b3e26f71d..000000000 Binary files a/3rdparty/IzPack/bin/panels/ImgPacksPanel/com/izforge/izpack/panels/PacksPanelInterface.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InfoPanel.jar b/3rdparty/IzPack/bin/panels/InfoPanel.jar deleted file mode 100644 index c27cd7dde..000000000 Binary files a/3rdparty/IzPack/bin/panels/InfoPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InfoPanel/com/izforge/izpack/panels/InfoPanel.class b/3rdparty/IzPack/bin/panels/InfoPanel/com/izforge/izpack/panels/InfoPanel.class deleted file mode 100644 index 199cd8156..000000000 Binary files a/3rdparty/IzPack/bin/panels/InfoPanel/com/izforge/izpack/panels/InfoPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallPanel.jar b/3rdparty/IzPack/bin/panels/InstallPanel.jar deleted file mode 100644 index ab71fa673..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$1.class b/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$1.class deleted file mode 100644 index b9880c93c..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$2.class b/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$2.class deleted file mode 100644 index 3d6296757..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$2.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$3.class b/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$3.class deleted file mode 100644 index 9bc9ef598..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$3.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$4.class b/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$4.class deleted file mode 100644 index 88680f1d9..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$4.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$5.class b/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$5.class deleted file mode 100644 index 88311d287..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel$5.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel.class b/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel.class deleted file mode 100644 index 7bb514158..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanelAutomationHelper.class deleted file mode 100644 index 0f0af3bf9..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanelConsoleHelper.class b/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanelConsoleHelper.class deleted file mode 100644 index b74f036f5..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallPanel/com/izforge/izpack/panels/InstallPanelConsoleHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallationGroupPanel.jar b/3rdparty/IzPack/bin/panels/InstallationGroupPanel.jar deleted file mode 100644 index ce69092dd..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallationGroupPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$1.class b/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$1.class deleted file mode 100644 index 6f9c956aa..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$2.class b/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$2.class deleted file mode 100644 index d57a1a70e..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$2.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$3.class b/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$3.class deleted file mode 100644 index 4c356ec68..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$3.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$GroupData.class b/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$GroupData.class deleted file mode 100644 index 61319d827..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel$GroupData.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel.class b/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel.class deleted file mode 100644 index 3d2db576b..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanelAutomationHelper.class deleted file mode 100644 index fea25d6ca..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallationGroupPanel/com/izforge/izpack/panels/InstallationGroupPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallationTypePanel.jar b/3rdparty/IzPack/bin/panels/InstallationTypePanel.jar deleted file mode 100644 index 8ae0d7641..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallationTypePanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/InstallationTypePanel/com/izforge/izpack/panels/InstallationTypePanel.class b/3rdparty/IzPack/bin/panels/InstallationTypePanel/com/izforge/izpack/panels/InstallationTypePanel.class deleted file mode 100644 index 602eae829..000000000 Binary files a/3rdparty/IzPack/bin/panels/InstallationTypePanel/com/izforge/izpack/panels/InstallationTypePanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel.jar b/3rdparty/IzPack/bin/panels/JDKPathPanel.jar deleted file mode 100644 index 17fd09c93..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/izpack/COIOSHelper.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/izpack/COIOSHelper.class deleted file mode 100644 index e643d6f2d..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/izpack/COIOSHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/izpack/Registry.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/izpack/Registry.class deleted file mode 100644 index 3eebc57d8..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/izpack/Registry.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class deleted file mode 100644 index 478ac1400..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/AccessControlList$AccessControlEntry.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/AccessControlList.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/AccessControlList.class deleted file mode 100644 index a6a445cdf..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/AccessControlList.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/MSWinConstants.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/MSWinConstants.class deleted file mode 100644 index e9544c18e..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/MSWinConstants.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/NativeLibException.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/NativeLibException.class deleted file mode 100644 index aa835d045..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/NativeLibException.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/RegDataContainer.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/RegDataContainer.class deleted file mode 100644 index 5fde65a88..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/RegDataContainer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/RegistryImpl.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/RegistryImpl.class deleted file mode 100644 index b20cd8f0a..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/RegistryImpl.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/RegistryLogItem.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/RegistryLogItem.class deleted file mode 100644 index a6b56f1ff..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/RegistryLogItem.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/resources/NativeLibErr.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/resources/NativeLibErr.class deleted file mode 100644 index 7479269a5..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/resources/NativeLibErr.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/resources/NativeLibErr_de.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/resources/NativeLibErr_de.class deleted file mode 100644 index d4783819f..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/coi/tools/os/win/resources/NativeLibErr_de.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/panels/JDKPathPanel.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/panels/JDKPathPanel.class deleted file mode 100644 index 5e654997a..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/panels/JDKPathPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/panels/PathInputPanel.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/panels/PathInputPanel.class deleted file mode 100644 index a11a8e0f9..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/panels/PathInputPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/panels/PathSelectionPanel.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/panels/PathSelectionPanel.class deleted file mode 100644 index c8029014c..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/panels/PathSelectionPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/OSClassHelper.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/OSClassHelper.class deleted file mode 100644 index dc1cfffe0..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/OSClassHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/os/RegistryHandler.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/os/RegistryHandler.class deleted file mode 100644 index 2c3ab7cf8..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/os/RegistryHandler.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/os/Win_RegistryHandler.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/os/Win_RegistryHandler.class deleted file mode 100644 index 77077a69c..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/os/Win_RegistryHandler.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/os/WrappedNativeLibException.class b/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/os/WrappedNativeLibException.class deleted file mode 100644 index fdae23fa8..000000000 Binary files a/3rdparty/IzPack/bin/panels/JDKPathPanel/com/izforge/izpack/util/os/WrappedNativeLibException.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/LicencePanel.jar b/3rdparty/IzPack/bin/panels/LicencePanel.jar deleted file mode 100644 index 3bece4301..000000000 Binary files a/3rdparty/IzPack/bin/panels/LicencePanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/LicencePanel/com/izforge/izpack/panels/LicencePanel.class b/3rdparty/IzPack/bin/panels/LicencePanel/com/izforge/izpack/panels/LicencePanel.class deleted file mode 100644 index d085418b1..000000000 Binary files a/3rdparty/IzPack/bin/panels/LicencePanel/com/izforge/izpack/panels/LicencePanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/LicencePanel/com/izforge/izpack/panels/LicencePanelConsoleHelper.class b/3rdparty/IzPack/bin/panels/LicencePanel/com/izforge/izpack/panels/LicencePanelConsoleHelper.class deleted file mode 100644 index d61272645..000000000 Binary files a/3rdparty/IzPack/bin/panels/LicencePanel/com/izforge/izpack/panels/LicencePanelConsoleHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel.jar b/3rdparty/IzPack/bin/panels/PacksPanel.jar deleted file mode 100644 index b728f241b..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/ImgPacksPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/ImgPacksPanelAutomationHelper.class deleted file mode 100644 index 11b86f8bf..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/ImgPacksPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksModel.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksModel.class deleted file mode 100644 index 49e432e84..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksModel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanel.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanel.class deleted file mode 100644 index 9d2380e7a..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper$1PInfo.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper$1PInfo.class deleted file mode 100644 index 893d0bea1..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper$1PInfo.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper.class deleted file mode 100644 index 7c265b9c6..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$1.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$1.class deleted file mode 100644 index ecb42a0c3..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$2.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$2.class deleted file mode 100644 index 93e4123d2..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$2.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$CheckBoxRenderer.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$CheckBoxRenderer.class deleted file mode 100644 index bb72cdca9..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$CheckBoxRenderer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$LFIndependentIcon.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$LFIndependentIcon.class deleted file mode 100644 index 34bbbc44b..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$LFIndependentIcon.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$PacksPanelTableCellRenderer.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$PacksPanelTableCellRenderer.class deleted file mode 100644 index 7af726596..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase$PacksPanelTableCellRenderer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase.class deleted file mode 100644 index 1374b04cb..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelBase.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelInterface.class b/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelInterface.class deleted file mode 100644 index b3e26f71d..000000000 Binary files a/3rdparty/IzPack/bin/panels/PacksPanel/com/izforge/izpack/panels/PacksPanelInterface.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ProcessPanel.jar b/3rdparty/IzPack/bin/panels/ProcessPanel.jar deleted file mode 100644 index 082a89098..000000000 Binary files a/3rdparty/IzPack/bin/panels/ProcessPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ProcessPanel/com/izforge/izpack/panels/ProcessPanel$1.class b/3rdparty/IzPack/bin/panels/ProcessPanel/com/izforge/izpack/panels/ProcessPanel$1.class deleted file mode 100644 index cb16ddd67..000000000 Binary files a/3rdparty/IzPack/bin/panels/ProcessPanel/com/izforge/izpack/panels/ProcessPanel$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ProcessPanel/com/izforge/izpack/panels/ProcessPanel.class b/3rdparty/IzPack/bin/panels/ProcessPanel/com/izforge/izpack/panels/ProcessPanel.class deleted file mode 100644 index 1cd4a1615..000000000 Binary files a/3rdparty/IzPack/bin/panels/ProcessPanel/com/izforge/izpack/panels/ProcessPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ProcessPanel/com/izforge/izpack/panels/ProcessPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/ProcessPanel/com/izforge/izpack/panels/ProcessPanelAutomationHelper.class deleted file mode 100644 index c36c8d78a..000000000 Binary files a/3rdparty/IzPack/bin/panels/ProcessPanel/com/izforge/izpack/panels/ProcessPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/SelectPrinterPanel.jar b/3rdparty/IzPack/bin/panels/SelectPrinterPanel.jar deleted file mode 100644 index c85b9f902..000000000 Binary files a/3rdparty/IzPack/bin/panels/SelectPrinterPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/SelectPrinterPanel/com/izforge/izpack/panels/SelectPrinterPanel.class b/3rdparty/IzPack/bin/panels/SelectPrinterPanel/com/izforge/izpack/panels/SelectPrinterPanel.class deleted file mode 100644 index 4646d8883..000000000 Binary files a/3rdparty/IzPack/bin/panels/SelectPrinterPanel/com/izforge/izpack/panels/SelectPrinterPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ShortcutPanel.jar b/3rdparty/IzPack/bin/panels/ShortcutPanel.jar deleted file mode 100644 index 5ff21c266..000000000 Binary files a/3rdparty/IzPack/bin/panels/ShortcutPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/panels/ShortcutData.class b/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/panels/ShortcutData.class deleted file mode 100644 index de6f08b57..000000000 Binary files a/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/panels/ShortcutData.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/panels/ShortcutPanel.class b/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/panels/ShortcutPanel.class deleted file mode 100644 index a702221b2..000000000 Binary files a/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/panels/ShortcutPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/panels/ShortcutPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/panels/ShortcutPanelAutomationHelper.class deleted file mode 100644 index 3f0c18355..000000000 Binary files a/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/panels/ShortcutPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/util/xml/XMLHelper.class b/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/util/xml/XMLHelper.class deleted file mode 100644 index 3c9cdcdef..000000000 Binary files a/3rdparty/IzPack/bin/panels/ShortcutPanel/com/izforge/izpack/util/xml/XMLHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/SimpleFinishPanel.jar b/3rdparty/IzPack/bin/panels/SimpleFinishPanel.jar deleted file mode 100644 index 7a4c13a98..000000000 Binary files a/3rdparty/IzPack/bin/panels/SimpleFinishPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/SimpleFinishPanel/com/izforge/izpack/panels/SimpleFinishPanel.class b/3rdparty/IzPack/bin/panels/SimpleFinishPanel/com/izforge/izpack/panels/SimpleFinishPanel.class deleted file mode 100644 index e2d74db1f..000000000 Binary files a/3rdparty/IzPack/bin/panels/SimpleFinishPanel/com/izforge/izpack/panels/SimpleFinishPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/SudoPanel.jar b/3rdparty/IzPack/bin/panels/SudoPanel.jar deleted file mode 100644 index 837970864..000000000 Binary files a/3rdparty/IzPack/bin/panels/SudoPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/SudoPanel/com/izforge/izpack/panels/SudoPanel.class b/3rdparty/IzPack/bin/panels/SudoPanel/com/izforge/izpack/panels/SudoPanel.class deleted file mode 100644 index d8d79aadf..000000000 Binary files a/3rdparty/IzPack/bin/panels/SudoPanel/com/izforge/izpack/panels/SudoPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/SummaryPanel.jar b/3rdparty/IzPack/bin/panels/SummaryPanel.jar deleted file mode 100644 index a6a7a3696..000000000 Binary files a/3rdparty/IzPack/bin/panels/SummaryPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/SummaryPanel/com/izforge/izpack/panels/SummaryPanel.class b/3rdparty/IzPack/bin/panels/SummaryPanel/com/izforge/izpack/panels/SummaryPanel.class deleted file mode 100644 index 30217e4f5..000000000 Binary files a/3rdparty/IzPack/bin/panels/SummaryPanel/com/izforge/izpack/panels/SummaryPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TargetPanel.jar b/3rdparty/IzPack/bin/panels/TargetPanel.jar deleted file mode 100644 index 30d8f2396..000000000 Binary files a/3rdparty/IzPack/bin/panels/TargetPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/PathInputPanel.class b/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/PathInputPanel.class deleted file mode 100644 index a11a8e0f9..000000000 Binary files a/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/PathInputPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/PathSelectionPanel.class b/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/PathSelectionPanel.class deleted file mode 100644 index c8029014c..000000000 Binary files a/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/PathSelectionPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/TargetPanel.class b/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/TargetPanel.class deleted file mode 100644 index 4b55da6ac..000000000 Binary files a/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/TargetPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/TargetPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/TargetPanelAutomationHelper.class deleted file mode 100644 index 2924f46be..000000000 Binary files a/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/TargetPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/TargetPanelConsoleHelper.class b/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/TargetPanelConsoleHelper.class deleted file mode 100644 index 4d7e72cfb..000000000 Binary files a/3rdparty/IzPack/bin/panels/TargetPanel/com/izforge/izpack/panels/TargetPanelConsoleHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel.jar b/3rdparty/IzPack/bin/panels/TreePacksPanel.jar deleted file mode 100644 index 9f5c281ad..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/CheckBoxNode.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/CheckBoxNode.class deleted file mode 100644 index 072c95942..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/CheckBoxNode.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/CheckBoxNodeRenderer.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/CheckBoxNodeRenderer.class deleted file mode 100644 index 59de44312..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/CheckBoxNodeRenderer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/CheckTreeController.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/CheckTreeController.class deleted file mode 100644 index 0def5cd59..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/CheckTreeController.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/ImgPacksPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/ImgPacksPanelAutomationHelper.class deleted file mode 100644 index 11b86f8bf..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/ImgPacksPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksModel.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksModel.class deleted file mode 100644 index 49e432e84..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksModel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper$1PInfo.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper$1PInfo.class deleted file mode 100644 index 893d0bea1..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper$1PInfo.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper.class deleted file mode 100644 index 7c265b9c6..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$1.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$1.class deleted file mode 100644 index ecb42a0c3..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$2.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$2.class deleted file mode 100644 index 93e4123d2..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$2.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$CheckBoxRenderer.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$CheckBoxRenderer.class deleted file mode 100644 index bb72cdca9..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$CheckBoxRenderer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$LFIndependentIcon.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$LFIndependentIcon.class deleted file mode 100644 index 34bbbc44b..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$LFIndependentIcon.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$PacksPanelTableCellRenderer.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$PacksPanelTableCellRenderer.class deleted file mode 100644 index 7af726596..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase$PacksPanelTableCellRenderer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase.class deleted file mode 100644 index 1374b04cb..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelBase.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelInterface.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelInterface.class deleted file mode 100644 index b3e26f71d..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PacksPanelInterface.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PartialIcon.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PartialIcon.class deleted file mode 100644 index c9ff9ff95..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/PartialIcon.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/TreePacksPanel$1.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/TreePacksPanel$1.class deleted file mode 100644 index 19db5aa65..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/TreePacksPanel$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/TreePacksPanel.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/TreePacksPanel.class deleted file mode 100644 index e92117827..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/TreePacksPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/TreePacksPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/TreePacksPanelAutomationHelper.class deleted file mode 100644 index ca53dd306..000000000 Binary files a/3rdparty/IzPack/bin/panels/TreePacksPanel/com/izforge/izpack/panels/TreePacksPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel.jar b/3rdparty/IzPack/bin/panels/UserInputPanel.jar deleted file mode 100644 index e4696c016..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/DirInputField.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/DirInputField.class deleted file mode 100644 index c41a441b9..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/DirInputField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/FileInputField.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/FileInputField.class deleted file mode 100644 index 705ad0968..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/FileInputField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/MultipleFileInputField.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/MultipleFileInputField.class deleted file mode 100644 index 51c11538b..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/MultipleFileInputField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/PasswordGroup.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/PasswordGroup.class deleted file mode 100644 index b872d437f..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/PasswordGroup.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/PasswordUIElement.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/PasswordUIElement.class deleted file mode 100644 index 7e90726ab..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/PasswordUIElement.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/ProcessingClient.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/ProcessingClient.class deleted file mode 100644 index f32beffe6..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/ProcessingClient.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/Processor.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/Processor.class deleted file mode 100644 index c2fb450b9..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/Processor.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RadioButtonUIElement.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RadioButtonUIElement.class deleted file mode 100644 index 2de71b24a..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RadioButtonUIElement.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleInputField$FieldSpec.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleInputField$FieldSpec.class deleted file mode 100644 index f745cc247..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleInputField$FieldSpec.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleInputField.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleInputField.class deleted file mode 100644 index 81a16e235..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleInputField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleTextField$Rule.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleTextField$Rule.class deleted file mode 100644 index e7cc9e365..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleTextField$Rule.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleTextField.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleTextField.class deleted file mode 100644 index e41a85dff..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/RuleTextField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/StringInputProcessingClient.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/StringInputProcessingClient.class deleted file mode 100644 index 2a23e722c..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/StringInputProcessingClient.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/TextInputField.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/TextInputField.class deleted file mode 100644 index 82679be7e..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/TextInputField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UIElement.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UIElement.class deleted file mode 100644 index d99ed73d4..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UIElement.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UIElementType.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UIElementType.class deleted file mode 100644 index 09fdda270..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UIElementType.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputFileFilter.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputFileFilter.class deleted file mode 100644 index c51723c0a..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputFileFilter.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$1.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$1.class deleted file mode 100644 index 2ea44bd0f..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$2.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$2.class deleted file mode 100644 index 19dea8c10..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$2.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField$1.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField$1.class deleted file mode 100644 index 1ba7bbd6b..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField$1.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField.class deleted file mode 100644 index 4ebf91424..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$SearchField.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$TextValuePair.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$TextValuePair.class deleted file mode 100644 index 3dfe1172c..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel$TextValuePair.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel.class deleted file mode 100644 index a0717a8e6..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelAutomationHelper.class deleted file mode 100644 index a13cb083f..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper$Choice.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper$Choice.class deleted file mode 100644 index 5c035cf18..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper$Choice.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper$Input.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper$Input.class deleted file mode 100644 index 53698a5be..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper$Input.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper$Password.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper$Password.class deleted file mode 100644 index 6a301ba21..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper$Password.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper.class deleted file mode 100644 index 78335d251..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/UserInputPanelConsoleHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/Validator.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/Validator.class deleted file mode 100644 index 91ff31df6..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/Validator.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/ValidatorContainer.class b/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/ValidatorContainer.class deleted file mode 100644 index fe1276164..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserInputPanel/com/izforge/izpack/panels/ValidatorContainer.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserPathPanel.jar b/3rdparty/IzPack/bin/panels/UserPathPanel.jar deleted file mode 100644 index b615634ac..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserPathPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathInputPanel.class b/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathInputPanel.class deleted file mode 100644 index 074e91b62..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathInputPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathPanel.class b/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathPanel.class deleted file mode 100644 index 0423b3f61..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathPanelAutomationHelper.class b/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathPanelAutomationHelper.class deleted file mode 100644 index 5a07d17f9..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathPanelAutomationHelper.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathSelectionPanel.class b/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathSelectionPanel.class deleted file mode 100644 index 2ccfc609a..000000000 Binary files a/3rdparty/IzPack/bin/panels/UserPathPanel/com/izforge/izpack/panels/UserPathSelectionPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/XInfoPanel.jar b/3rdparty/IzPack/bin/panels/XInfoPanel.jar deleted file mode 100644 index 2f0614bdf..000000000 Binary files a/3rdparty/IzPack/bin/panels/XInfoPanel.jar and /dev/null differ diff --git a/3rdparty/IzPack/bin/panels/XInfoPanel/com/izforge/izpack/panels/XInfoPanel.class b/3rdparty/IzPack/bin/panels/XInfoPanel/com/izforge/izpack/panels/XInfoPanel.class deleted file mode 100644 index b9e214ca4..000000000 Binary files a/3rdparty/IzPack/bin/panels/XInfoPanel/com/izforge/izpack/panels/XInfoPanel.class and /dev/null differ diff --git a/3rdparty/IzPack/bin/start.sh b/3rdparty/IzPack/bin/start.sh deleted file mode 100644 index ffc3062b1..000000000 --- a/3rdparty/IzPack/bin/start.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env bash - -# ShellScript -# - to detect a desktop and their native -# File/WebBrowser such as Konqueror (KDE) or Nautilus/Epiphany (Gnome) -# Or -# - to detect a browser from the mozilla family -# The first prefered one will open the given $1 document -# which should be a web url (http://host.domain.com/path/index.html) or a -# local file like file:///local/folder/document.html -# Note: Tested on SuSE, Fedora an Mandriva Linux and Solaris 9 with kde, gnome or a mozilla installed -# -# This is licensed as part of -# IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved. -# -# http://izpack.org/ -# http://izpack.codehaus.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Usage: -# -# ./start.sh http://izpack.org/ -# -# author marc.eppelmann@gmx.de -# $Id: start.sh 2116 2008-04-19 13:00:24Z jponge $ -# - -function detectDesktop() { - if [[ "$DISPLAY" = "" ]]; then - return 1 - fi - - local LC_ALL=C - local clients - if ! clients=`xlsclients`; then - # TODO: should we fall back to using ps? - return 1 - fi - - if echo "$clients" | grep -qE '(gnome-panel|nautilus|metacity)'; then - echo gnome - elif echo "$clients" | grep -qE '(kicker|slicker|karamba|kwin)'; then - echo kde - else - echo other - fi - return 1 -} - -function lookForRunningGecko(){ - if command -v firefox &>/dev/null; then - tempfile=`mktemp` - - firefox -remote "ping()" 2> $tempfile - - if [ -s $tempfile ]; then - rm $tempfile - echo "none" # is not running :-) - return 1 - else - rm $tempfile - echo firefox # is running :-) - return 0 - fi - fi # firefox "$1" - if command -v mozilla &>/dev/null; then - #if mozilla -remote "ping()" - if command mozilla -remote "ping()" &>/dev/null; then - echo mozilla # is running :-) - return 0 - fi - fi - echo "none" - - return 1 -} - -desktop=`detectDesktop` -gecko=`lookForRunningGecko` - -echo "found Desktop: $desktop" -echo "found Gecko: $gecko" - -if [[ "$gecko" = "none" ]]; then # try open a new instance if found: - if command -v firefox &>/dev/null; then - firefox "$1" & - elif command -v mozilla &>/dev/null; then - mozilla "$1" & - elif [[ "$desktop" = "gnome" ]] && command -v gnome-open &>/dev/null; then - gnome-open "$1" & - elif [[ "$desktop" = "kde" ]]; then - kfmclient exec "$1" & - else - exit 1 - fi -else - echo "Launching: $gecko" - $gecko -remote "openurl($1)" & -fi - - diff --git a/3rdparty/IzPack/current_version.txt b/3rdparty/IzPack/current_version.txt deleted file mode 100644 index 9c9320998..000000000 --- a/3rdparty/IzPack/current_version.txt +++ /dev/null @@ -1 +0,0 @@ -The current version is 4.3.2 \ No newline at end of file diff --git a/3rdparty/IzPack/legal/Ant-Licence.txt b/3rdparty/IzPack/legal/Ant-Licence.txt deleted file mode 100644 index b279c7a20..000000000 --- a/3rdparty/IzPack/legal/Ant-Licence.txt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 2000-2002 The Apache Software Foundation. All - * rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Ant" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see . - * - */ diff --git a/3rdparty/IzPack/legal/IzPack-Licence.txt b/3rdparty/IzPack/legal/IzPack-Licence.txt deleted file mode 100644 index d64569567..000000000 --- a/3rdparty/IzPack/legal/IzPack-Licence.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/3rdparty/IzPack/legal/Kunststoff-Licence.txt b/3rdparty/IzPack/legal/Kunststoff-Licence.txt deleted file mode 100644 index da7e17ba6..000000000 --- a/3rdparty/IzPack/legal/Kunststoff-Licence.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/3rdparty/IzPack/legal/LiquidLnF-Licence.txt b/3rdparty/IzPack/legal/LiquidLnF-Licence.txt deleted file mode 100644 index da7e17ba6..000000000 --- a/3rdparty/IzPack/legal/LiquidLnF-Licence.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/3rdparty/IzPack/legal/Looks-Licence.txt b/3rdparty/IzPack/legal/Looks-Licence.txt deleted file mode 100644 index 29885624d..000000000 --- a/3rdparty/IzPack/legal/Looks-Licence.txt +++ /dev/null @@ -1,31 +0,0 @@ - - The BSD License for the JGoodies Looks - ====================================== - -Copyright (c) 2001-2004 JGoodies Karsten Lentzsch. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - o Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - o Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - o Neither the name of JGoodies Karsten Lentzsch nor the names of - its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdparty/IzPack/legal/Metouia-Licence.txt b/3rdparty/IzPack/legal/Metouia-Licence.txt deleted file mode 100644 index da7e17ba6..000000000 --- a/3rdparty/IzPack/legal/Metouia-Licence.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/3rdparty/IzPack/legal/NanoXML-Licence.txt b/3rdparty/IzPack/legal/NanoXML-Licence.txt deleted file mode 100644 index 18cd08db9..000000000 --- a/3rdparty/IzPack/legal/NanoXML-Licence.txt +++ /dev/null @@ -1,21 +0,0 @@ -NanoXML Licence : - -Copyright (C) 2001 Marc De Scheemaecker, All Rights Reserved. - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the -use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software in - a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source distribution. diff --git a/3rdparty/IzPack/lib/ant.jar b/3rdparty/IzPack/lib/ant.jar deleted file mode 100644 index b335c003e..000000000 Binary files a/3rdparty/IzPack/lib/ant.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/bsf.jar b/3rdparty/IzPack/lib/bsf.jar deleted file mode 100644 index 302896730..000000000 Binary files a/3rdparty/IzPack/lib/bsf.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/compiler.jar b/3rdparty/IzPack/lib/compiler.jar deleted file mode 100644 index 70fd3b680..000000000 Binary files a/3rdparty/IzPack/lib/compiler.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/installer.jar b/3rdparty/IzPack/lib/installer.jar deleted file mode 100644 index f06863d37..000000000 Binary files a/3rdparty/IzPack/lib/installer.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/izevent.jar b/3rdparty/IzPack/lib/izevent.jar deleted file mode 100644 index 43b1432f6..000000000 Binary files a/3rdparty/IzPack/lib/izevent.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/jakarta-regexp-1.3.jar b/3rdparty/IzPack/lib/jakarta-regexp-1.3.jar deleted file mode 100644 index 30db57e4c..000000000 Binary files a/3rdparty/IzPack/lib/jakarta-regexp-1.3.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/kunststoff.jar b/3rdparty/IzPack/lib/kunststoff.jar deleted file mode 100644 index 17b9a8c4a..000000000 Binary files a/3rdparty/IzPack/lib/kunststoff.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/liquidlnf.jar b/3rdparty/IzPack/lib/liquidlnf.jar deleted file mode 100644 index bb3bcf859..000000000 Binary files a/3rdparty/IzPack/lib/liquidlnf.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/looks.jar b/3rdparty/IzPack/lib/looks.jar deleted file mode 100644 index 0177edfee..000000000 Binary files a/3rdparty/IzPack/lib/looks.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/metouia.jar b/3rdparty/IzPack/lib/metouia.jar deleted file mode 100644 index 313b0fb44..000000000 Binary files a/3rdparty/IzPack/lib/metouia.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/nimbus.jar b/3rdparty/IzPack/lib/nimbus.jar deleted file mode 100644 index 56520f74b..000000000 Binary files a/3rdparty/IzPack/lib/nimbus.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/standalone-compiler.jar b/3rdparty/IzPack/lib/standalone-compiler.jar deleted file mode 100644 index 66945f943..000000000 Binary files a/3rdparty/IzPack/lib/standalone-compiler.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/substance.jar b/3rdparty/IzPack/lib/substance.jar deleted file mode 100644 index 90242e1eb..000000000 Binary files a/3rdparty/IzPack/lib/substance.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/uninstaller-ext.jar b/3rdparty/IzPack/lib/uninstaller-ext.jar deleted file mode 100644 index 4be0ca042..000000000 Binary files a/3rdparty/IzPack/lib/uninstaller-ext.jar and /dev/null differ diff --git a/3rdparty/IzPack/lib/uninstaller.jar b/3rdparty/IzPack/lib/uninstaller.jar deleted file mode 100644 index eb4f0310c..000000000 Binary files a/3rdparty/IzPack/lib/uninstaller.jar and /dev/null differ diff --git a/3rdparty/IzPack/utils/native-launcher/AUTHORS b/3rdparty/IzPack/utils/native-launcher/AUTHORS deleted file mode 100644 index d88ac47a2..000000000 --- a/3rdparty/IzPack/utils/native-launcher/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Julien Ponge diff --git a/3rdparty/IzPack/utils/native-launcher/Changes b/3rdparty/IzPack/utils/native-launcher/Changes deleted file mode 100644 index 5d2d9f175..000000000 --- a/3rdparty/IzPack/utils/native-launcher/Changes +++ /dev/null @@ -1,28 +0,0 @@ -NOTE: this file is no longer maintained and is replaced by the IzPack JIRA at -http://jira.codehaus.org/browse/IZPACK - - -Release 2.2 (2007.02.24) [release-2.2] - -2007.02.20 (Julien Ponge) -* Updated Win32 binary: static Qt linking, no mingw dependency and UPX - compression. - -Release 2.1 (2006.09.20) [release-2.1] - -2006.08.23 (Julien Ponge) -* Updated Win32 binary. - -2006.07.23 (Julien Ponge) -* launcher.cpp, main.cpp: fixes on the interpretation of the QProcess:execute() - return values. The launcher should be running fine now. -* Mac OS X: build universal binaries. -* Mac OS X: script to embed the Qt libraries inside the application bundle. - -2006.07.22 (Julien Ponge) -* main.cpp: fix for stupid error that disables the JRE radio button if a JRE - is provider, and enables it when it is not. - -Release 2.0 (2005.10.27) [release-2.0] - -* New Qt-based launcher. diff --git a/3rdparty/IzPack/utils/native-launcher/LICENSE b/3rdparty/IzPack/utils/native-launcher/LICENSE deleted file mode 100644 index c853e67c2..000000000 --- a/3rdparty/IzPack/utils/native-launcher/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -The IzPack Launcher -http://izpack.org/ -http://izpack.codehaus.org/ - -Copyright (c) 2004 - 2008 Julien Ponge - All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. diff --git a/3rdparty/IzPack/utils/native-launcher/README b/3rdparty/IzPack/utils/native-launcher/README deleted file mode 100644 index b850d3dd1..000000000 --- a/3rdparty/IzPack/utils/native-launcher/README +++ /dev/null @@ -1,11 +0,0 @@ -This is a native launcher for IzPack installers. - -The source code can be compiled to any platform supported by Qt -from Trolltech with no changes: -- cd src -- qmake -- make - -Enjoy! - --- Julien Ponge diff --git a/3rdparty/IzPack/utils/native-launcher/dist/launcher.exe b/3rdparty/IzPack/utils/native-launcher/dist/launcher.exe deleted file mode 100644 index 61cf56e8a..000000000 Binary files a/3rdparty/IzPack/utils/native-launcher/dist/launcher.exe and /dev/null differ diff --git a/3rdparty/IzPack/utils/native-launcher/dist/launcher_fr.qm b/3rdparty/IzPack/utils/native-launcher/dist/launcher_fr.qm deleted file mode 100644 index c6b58462d..000000000 Binary files a/3rdparty/IzPack/utils/native-launcher/dist/launcher_fr.qm and /dev/null differ diff --git a/3rdparty/IzPack/utils/native-launcher/doc/LICENSE b/3rdparty/IzPack/utils/native-launcher/doc/LICENSE deleted file mode 100644 index fc582507e..000000000 --- a/3rdparty/IzPack/utils/native-launcher/doc/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -The IzPack Launcher -http://izpack.org/ -http://izpack.codehaus.org/ - -Copyright (c) 2004 - 2008 Julien Ponge - All rights reserved. - -Redistribution and use in source (XML DocBook) and 'compiled' forms (XML, -(X)HTML, PDF, PostScript, RTF and so forth) with or without modification, are -permitted provided that the following conditions are met: - -1. Redistributions of source code (XML DocBook) must retain the above copyright -notice, this list of conditions and the following disclaimer as the first lines -of this file unmodified. - -2. Redistributions in compiled form (transformed to other DTDs, converted to -PDF, PostScript, RTF and other formats) must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -Important: THIS DOCUMENTATION IS PROVIDED BY THE IZPACK PROJECT "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE IZPACK PROJECT BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdparty/IzPack/utils/native-launcher/doc/docbook-en/failure-dialog.png b/3rdparty/IzPack/utils/native-launcher/doc/docbook-en/failure-dialog.png deleted file mode 100644 index 118c2fc07..000000000 Binary files a/3rdparty/IzPack/utils/native-launcher/doc/docbook-en/failure-dialog.png and /dev/null differ diff --git a/3rdparty/IzPack/utils/native-launcher/doc/docbook-en/manual.xml b/3rdparty/IzPack/utils/native-launcher/doc/docbook-en/manual.xml deleted file mode 100644 index af52d1bef..000000000 --- a/3rdparty/IzPack/utils/native-launcher/doc/docbook-en/manual.xml +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - ]> - - - - - - IzPack launcher manual - - 2004, 2005 - Julien PONGE - - - Legal notice - The IzPack Launcher - - http://www.izforge.com/izpack/ - - - http://developer.berlios.de/projects/izpack/ - - - Redistribution and use in source (XML DocBook) and 'compiled' forms (XML, - (X)HTML, PDF, PostScript, RTF and so forth) with or without modification, are - permitted provided that the following conditions are met: - - - Redistributions of source code (XML DocBook) must retain the above copyright - notice, this list of conditions and the following disclaimer as the first lines - of this file unmodified. - - - - Redistributions in compiled form (transformed to other DTDs, converted to - PDF, PostScript, RTF and other formats) must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - - - Important: - THIS DOCUMENTATION IS PROVIDED BY THE IZPACK PROJECT "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE IZPACK PROJECT BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - Overview - - - - Introduction - - The - IzPack - project - allows you to prepare some installers for your applications. Those installers - can be used identically no matter what the target operating system is because - it has been implemented with the Java technology. This means that the same - installer file can be distributed to your Linux, FreeBSD, Win32 and Mac users. - While this is already a big advantage over preparing an installer or a package - for each platform, it still relies on the hypothesis that your users already - have a well installed Java Runtime Environment (JRE) on their systems. - - - While corporate users should be able to install a JRE by themselves, - this might not always be the case. Worse, the average home user might not know - what a JRE is and he might not understand why your installer can't be launched. - - - - - - - What the native launcher solves - - The IzPack native launcher solves the previous problem by offering - a native executable to your users. Thus, they will launch it instead of directly - trying to launch the Java-based installer. What's more, Win32 users will be more - familiar with a native executable than a Jar file. - - - The IzPack launcher will do the following things when executed: - - - check for a JVM on the system - - - launch the installer if a valid JVM has been found - - - offer the following choices in case no JVM could be found: - - - manually locate a 'java' executable - - - (optional) install a JVM that is provided by the package - maker, for instance on a CD-ROM - - - - download a JVM from the internet - - - - - - - -
- The JRE detection failure and resolution dialog. - - - - - -
- - The IzPack launcher is implemented in C++ and makes use of the portable - Trolltech Qt - toolkit. Thus, the IzPack - launcher can be run on several platforms (*nix, MacOS, Win32). - - - The IzPack launcher is published under a MIT-style license agreement: - &launcher-license; - - -
- - - - Getting the IzPack launcher - - The IzPack launcher can be downloaded from - BerliOS - of from theIzPack homepage. - - - IzPack makes use ofSubVersion. - You can download the development version ('trunk') by following the instructions at - - http://developer.berlios.de/svn/?group_id=1408 - - You can also get here the various releases ('tags'). - - - The IzPack launcher archive comes with the full source code, the documentation as well - as a sample configuration file. It also contains a build for the Win32 platform, so that you - can use it directly on this platform. - - - - - - - Building the IzPack launcher from the source code - - There are many reasons why you would want to build the IzPack launcher from the source code, be it to - compile it for your specific environment, to make a few adaptations to your needs or simply because you - would - like to hack on it. - - - - - - - Building with Qt/X11 - - The X11 port of Qt includes the Linux-based distributions, the commercial Unix variants or - the BSD systems family. These systems generally come with a complete compilation toolchain with the - GCC compiler. All you really need is to get Qt/X11 installed properly. Once this is done, you can build - the launcher this way: - cd src/ - qmake launcher.pro - make - - - - - - - - Building with Qt/Win32 - - TO BE ADDED - - - -
- - - - Using the launcher - - - - Preparing the launcher directory layout - - First of all, you can put in a fresh directory the Win32 executable that you can find - in the 'dist' directory of the IzPack launcher distribution. Then you can pick - the translations that you need by copying the related files, for instance - launcher_fr.qm. Finally, you'll need - to create a - launcher.ini - configuration file in order to tweak the launcher - behaviour. - - - - - - - Preparing the configuration file - - The configuration file is quite simple. It has groups and entries. The top-level - entries (those not belonging to a group) can be overridden by some operating system ones. - To customize the behaviour for a specific operating system, you just have to create a group - whose name matches the operating system identifier. Then you can simply override the entries. - - - The entries are the following: - - - jar: specifies the installer Jar file to launch - - - jre: the path to a JRE that the user can install if none has been found - on his system - - - - download: the URL to get a JVM from. - - - The 'jre' entry is not mandatory. - - - The following operating systems identifiers can be used to make groups: - - - win32 - - - x11 - - - mac - - - - - - - - - Sample configuration file - - &sample-launcher-ini; - - - - - - - - Acknowledgements - - - - The BerliOS crew - - - Trolltech for making Qt so wonderful. - - - - The IzPack launcher 1.x series had this acknowledgement: - - - Marcus Stursberg (German translation) - - - Frank Bille Jensen (Danish translation) - - - Elmar Grom (user feedback suggestions) - - - Alex Carlos Braga Antao (Brazilian translation) - - - David Perez Carmona (Spanish translation) - - - Dustin Sacks (Win98 fixes) - - - The BerliOS crew - - - The wxWidgets crew. - - - - - -
diff --git a/3rdparty/IzPack/utils/native-launcher/src/img/kpackage_16.png b/3rdparty/IzPack/utils/native-launcher/src/img/kpackage_16.png deleted file mode 100644 index a69df614f..000000000 Binary files a/3rdparty/IzPack/utils/native-launcher/src/img/kpackage_16.png and /dev/null differ diff --git a/3rdparty/IzPack/utils/native-launcher/src/img/kpackage_32.png b/3rdparty/IzPack/utils/native-launcher/src/img/kpackage_32.png deleted file mode 100644 index b938d97c6..000000000 Binary files a/3rdparty/IzPack/utils/native-launcher/src/img/kpackage_32.png and /dev/null differ diff --git a/3rdparty/IzPack/utils/native-launcher/src/img/kpackage_48.png b/3rdparty/IzPack/utils/native-launcher/src/img/kpackage_48.png deleted file mode 100644 index 4f629eaf3..000000000 Binary files a/3rdparty/IzPack/utils/native-launcher/src/img/kpackage_48.png and /dev/null differ diff --git a/3rdparty/IzPack/utils/native-launcher/src/img/mac.icns b/3rdparty/IzPack/utils/native-launcher/src/img/mac.icns deleted file mode 100644 index 76665e5db..000000000 Binary files a/3rdparty/IzPack/utils/native-launcher/src/img/mac.icns and /dev/null differ diff --git a/3rdparty/IzPack/utils/native-launcher/src/img/win32.ico b/3rdparty/IzPack/utils/native-launcher/src/img/win32.ico deleted file mode 100644 index ba0233933..000000000 Binary files a/3rdparty/IzPack/utils/native-launcher/src/img/win32.ico and /dev/null differ diff --git a/3rdparty/IzPack/utils/native-launcher/src/launcher.cpp b/3rdparty/IzPack/utils/native-launcher/src/launcher.cpp deleted file mode 100644 index 15c73829a..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/launcher.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - * The IzPack Launcher - * http://izpack.org/ - * http://izpack.codehaus.org/ - * - * Copyright (c) 2004 - 2008 Julien Ponge - All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include "launcher.h" - -Launcher::Launcher() -{ - QSettings ini("launcher.ini", QSettings::IniFormat, 0); - - // Top-level settings - if (ini.contains("jre")) - { - jre = ini.value("jre").toString(); - } - if (ini.contains("jar")) - { - jar = ini.value("jar").toString(); - } - if (ini.contains("download")) - { - download = ini.value("download").toString(); - } - - // Platform-specific settings -#ifdef Q_WS_WIN - QString group = "win32"; -#endif -#ifdef Q_WS_MAC - QString group = "mac"; -#endif -#ifdef Q_WS_X11 - QString group = "x11"; -#endif - if (ini.contains(group + "/jre")) - { - jre = ini.value(group + "/jre").toString(); - } - if (ini.contains(group + "/jar")) - { - jar = ini.value(group + "/jar").toString(); - } - if (ini.contains(group + "/download")) - { - download = ini.value(group + "/download").toString(); - } -} - -bool Launcher::launch() -{ - return launch(javaExecPath); -} - -bool Launcher::launch(const QString &runtimeExecPath) -{ - QStringList args; - args.append("-jar"); - args.append(jar); - return Launcher::execute(runtimeExecPath, args); -} - -void Launcher::downloadJRE() -{ - -#ifdef Q_WS_WIN - - QStringList args; - args.append("url.dll,FileProtocolHandler"); - args.append(download); - Launcher::execute("rundll32", args); - -#endif - -#ifdef Q_WS_X11 - - QStringList browsers; - browsers.append("firefox"); - browsers.append("mozilla"); - browsers.append("konqueror"); - browsers.append("opera"); - for (int i = 0; i < browsers.size(); ++i) - { - if (Launcher::execute(browsers.at(i), QStringList("-v")) == 0) - { - Launcher::execute(browsers.at(i), QStringList(download)); - return; - } - } - -#endif - -#ifdef Q_WS_MAC - - Launcher::execute("open", QStringList(download)); - -#endif - -} - -bool Launcher::installProvidedJRE() -{ - return Launcher::execute(jre); -} - -bool Launcher::detectJRE() -{ - -#ifdef Q_WS_WIN - - // Windows-specific registry lookups - QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft" - "\\Java Runtime Environment\\", QSettings::NativeFormat); - if (settings.contains("CurrentVersion")) - { - QString version = settings.value("CurrentVersion").toString(); - if (version != "1.1") - { - QString path = settings.value(version + "/JavaHome").toString(); - javaExecPath = path + "\\bin\\java"; - return true; - } - } - -#endif - - // JAVA_HOME lookup - char* envRes = getenv("JAVA_HOME"); - if (envRes) - { - QString path = QString(envRes); -#ifdef Q_WS_QWIN - path = path + "\\bin\\java"; -#else - path = path + "bin/java"; -#endif - if (QFile::exists(path)) - { - javaExecPath = path; - return true; - } - } - -#ifdef Q_WS_MAC - - // Mac OS X - QString pathOnOSX = "/System/Library/Frameworks/JavaVM.framework/" - "Versions/CurrentJDK/Commands/java"; - if (Launcher::execute(pathOnOSX, QStringList("-version")) == 0) - { - javaExecPath = pathOnOSX; - return true; - } - -#endif - - // Last chance, lucky trial - if (Launcher::execute("java", QStringList("-version")) == 0) - { - javaExecPath = "java"; - return true; - } - - return false; -} - -int Launcher::execute(const QString &program, const QStringList &arguments) -{ - QProcess process; - - process.setReadChannelMode(QProcess::ForwardedChannels); - process.start(program, arguments); - process.waitForFinished(-1); - - int exitCode = process.exitCode(); - if (process.error() == QProcess::FailedToStart) - { - exitCode = -1; - } - - return exitCode; -} - -int Launcher::execute(const QString &program) -{ - QProcess process; - process.setReadChannelMode(QProcess::ForwardedChannels); - process.start(program); - process.waitForFinished(-1); - - int exitCode = process.exitCode(); - if (process.error() == QProcess::FailedToStart) - { - exitCode = -1; - } - - return exitCode; -} - diff --git a/3rdparty/IzPack/utils/native-launcher/src/launcher.h b/3rdparty/IzPack/utils/native-launcher/src/launcher.h deleted file mode 100644 index 9c03da7da..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/launcher.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The IzPack Launcher - * http://izpack.org/ - * http://izpack.codehaus.org/ - * - * Copyright (c) 2004 - 2008 Julien Ponge - All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef LAUNCHER_H -#define LAUNCHER_H - -#include -#include -#include -#include -#include - -class Launcher -{ - -private: - - QString javaExecPath; - - QString jar; - - QString jre; - - QString download; - -public: - - Launcher(); - - bool detectJRE(); - - bool launch(); - - bool launch(const QString &runtimeExecPath); - - void downloadJRE(); - - bool installProvidedJRE(); - - inline QString getJREPath() const - { - return javaExecPath; - } - - inline bool isJREProvided() const - { - return jre != ""; - } - - int execute(const QString &program, const QStringList &arguments); - - int execute(const QString &program); -}; - -#endif diff --git a/3rdparty/IzPack/utils/native-launcher/src/launcher.ini b/3rdparty/IzPack/utils/native-launcher/src/launcher.ini deleted file mode 100644 index 9a6768025..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/launcher.ini +++ /dev/null @@ -1,17 +0,0 @@ -# Sample launcher.ini file. -# Feel free to use it as a basis for your own ones. - -# Global entries, can be overriden by specific ones. -jar = IzPack-install.jar -download = http://www.java.com/ - -# Win32 specific entries -[win32] -jre = jre/setup.exe - -# Linux specific entries -[x11] -jre = jre/linux_setup.sh - -# Mac specific entries -# [mac] diff --git a/3rdparty/IzPack/utils/native-launcher/src/launcher.pro b/3rdparty/IzPack/utils/native-launcher/src/launcher.pro deleted file mode 100644 index 420157bef..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/launcher.pro +++ /dev/null @@ -1,19 +0,0 @@ -TEMPLATE = app -CONFIG += warn_on release qt -macx { - QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk - CONFIG += x86 ppc -} -QT = core gui -FORMS = resolve-dialog.ui -HEADERS = launcher.h resolve-dialog.h -SOURCES = main.cpp launcher.cpp resolve-dialog.cpp -RESOURCES = resources.qrc -TRANSLATIONS = launcher_fr.ts -TARGET=launcher -win32 { - RC_FILE = win32.rc -} -macx { - RC_FILE = img/mac.icns -} diff --git a/3rdparty/IzPack/utils/native-launcher/src/launcher_fr.qm b/3rdparty/IzPack/utils/native-launcher/src/launcher_fr.qm deleted file mode 100644 index c6b58462d..000000000 Binary files a/3rdparty/IzPack/utils/native-launcher/src/launcher_fr.qm and /dev/null differ diff --git a/3rdparty/IzPack/utils/native-launcher/src/launcher_fr.ts b/3rdparty/IzPack/utils/native-launcher/src/launcher_fr.ts deleted file mode 100644 index 2767de88a..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/launcher_fr.ts +++ /dev/null @@ -1,57 +0,0 @@ - - - @default - - Error - Erreur - - - The installer could not be launched. - L'installateur n'a pas pu etre lancé. - - - Please select the 'java' executable program. - Veuillez selectionner le programme exécutable 'java'. - - - The provided Java Runtime Environment could not be installed. - L'environnement d'exécution Java n'a pas pu etre installé. - - - - ResolveDialog - - IzPack launcher - Lanceur IzPack - - - <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The software that you want to install requires a Java runtime environment.</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">No Java runtime environment could be found, but one can be automatically installed for you.</p></body></html> - <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Le logiciel que vous désirez installer nécessite un environnement d'exécution Java.</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> -Aucun environnement d'exécution Java n'a pu etre trouvé, mais il est possible d'en installer un automatiquement pour vous.</p></body></html> - - - You have the following installation choices: - Vous avez les possibilités d'installation suivantes : - - - manually specify the location of an existing Java runtime environment - spécifier manuellement l'emplacement d'un environnement d'exécution Java existant - - - automatically install the Java runtime environment provided with this software - installer automatiquement l'environnement d'exécution Java fourni avec ce logiciel - - - download the latest version of the Sun Java runtime environment from the Internet. - télécharger la dernière version de l'environnement d'exécution Java de Sun depuis l'Internet. - - - &OK - &OK - - - &Quit - &Quitter - - - diff --git a/3rdparty/IzPack/utils/native-launcher/src/macosx-embed-qtlibs.sh b/3rdparty/IzPack/utils/native-launcher/src/macosx-embed-qtlibs.sh deleted file mode 100644 index 7361016a7..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/macosx-embed-qtlibs.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# Embeds the Qt libraries inside the application bundle, allowing it to be redistributed -# to any Mac without Qt installed. -# -# -- Julien Ponge - -mkdir launcher.app/Contents/Frameworks -cp -R $1/QtCore.framework launcher.app/Contents/Frameworks -cp -R $1/QtGui.framework launcher.app/Contents/Frameworks - -find launcher.app -name '*_debug' | xargs rm -find launcher.app -name 'Headers' | xargs rm -rf - -install_name_tool -id @executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore \ -launcher.app/Contents/Frameworks/QtCore.framework/Versions/4.0/QtCore - -install_name_tool -id @executable_path/../Frameworks/QtGui.framework/Versions/4.0/QtGui \ -launcher.app/Contents/Frameworks/QtGui.framework/Versions/4.0/QtGui - -install_name_tool -change $1/QtCore.framework/Versions/4.0/QtCore \ -@executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore \ -launcher.app/Contents/MacOs/launcher - -install_name_tool -change $1/QtGui.framework/Versions/4.0/QtGui \ -@executable_path/../Frameworks/QtGui.framework/Versions/4.0/QtGui \ -launcher.app/Contents/MacOs/launcher - -install_name_tool -change path/to/Qt/lib/QtCore.framework/Versions/4.0/QtCore \ -@executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore \ -launcher.app/Contents/Frameworks/QtGui.framework/Versions/4.0/QtGui - -tar cjf ../dist/launcher.app-macosx-universal.tar.bz2 launcher.app/ diff --git a/3rdparty/IzPack/utils/native-launcher/src/main.cpp b/3rdparty/IzPack/utils/native-launcher/src/main.cpp deleted file mode 100644 index e4a2099ba..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/main.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The IzPack Launcher - * http://izpack.org/ - * http://izpack.codehaus.org/ - * - * Copyright (c) 2004 - 2008 Julien Ponge - All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include -#include -#include -#include -#include - -#include "launcher.h" -#include "resolve-dialog.h" - -#include -using namespace std; - -void show_launch_error_message() -{ - QMessageBox::critical(0, QT_TR_NOOP("Error"), - QT_TR_NOOP("The installer could not be launched.")); -} - -int main(int argc, char** argv) -{ - QApplication app(argc, argv); - - QString locale = QLocale::system().name(); - QTranslator translator; - translator.load(QString("launcher_") + locale); - app.installTranslator(&translator); - - Launcher launcher; -detect: - if (launcher.detectJRE()) - { - if (launcher.launch() != 0) - { - show_launch_error_message(); - return 1; - } - } - else - { - ResolveDialog* dlg = new ResolveDialog(); - if (!launcher.isJREProvided()) - { - dlg->disableProvidedRadio(); - } - if (dlg->exec() != QDialog::Accepted) - { - return 1; - } - switch (dlg->getResolveChoice()) - { - case MANUAL: - if (launcher.launch(QFileDialog::getOpenFileName(0, - QT_TR_NOOP("Please select the 'java' executable program."))) != 0) - { - show_launch_error_message(); - return 1; - } - break; - - case PROVIDED: - if (launcher.installProvidedJRE()) - { - QMessageBox::critical(0, QT_TR_NOOP("Error"), - QT_TR_NOOP("The provided Java Runtime Environment could not be installed.")); - return 1; - } - goto detect; - - case DOWNLOAD: - launcher.downloadJRE(); - goto detect; - break; - - default: - break; - } - } - - return 0; -} diff --git a/3rdparty/IzPack/utils/native-launcher/src/resolve-dialog.cpp b/3rdparty/IzPack/utils/native-launcher/src/resolve-dialog.cpp deleted file mode 100644 index 98068ea90..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/resolve-dialog.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The IzPack Launcher - * http://izpack.org/ - * http://izpack.codehaus.org/ - * - * Copyright (c) 2004 - 2008 Julien Ponge - All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include "resolve-dialog.h" - -ResolveDialog::ResolveDialog(QWidget* parent) - : QDialog(parent) -{ - ui.setupUi(this); - - connect(ui.okButton, SIGNAL(clicked()), this, SLOT(accept())); - connect(ui.quitButton, SIGNAL(clicked()), this, SLOT(reject())); -} - -ResolveChoice ResolveDialog::getResolveChoice() -{ - if (ui.manualRadioButton->isChecked()) - { - return MANUAL; - } - else if (ui.providedRadioButton->isChecked()) - { - return PROVIDED; - } - else - { - return DOWNLOAD; - } -} diff --git a/3rdparty/IzPack/utils/native-launcher/src/resolve-dialog.h b/3rdparty/IzPack/utils/native-launcher/src/resolve-dialog.h deleted file mode 100644 index 81d37b1f8..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/resolve-dialog.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The IzPack Launcher - * http://izpack.org/ - * http://izpack.codehaus.org/ - * - * Copyright (c) 2004 - 2008 Julien Ponge - All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef RESOLVE_DIALOG_H -#define RESOLVE_DIALOG_H - -#include -#include - -#include "ui_resolve-dialog.h" - -enum ResolveChoice -{ - MANUAL, - PROVIDED, - DOWNLOAD -}; - -class ResolveDialog : public QDialog -{ - Q_OBJECT - -private: - - Ui::ResolveDialog ui; - -public: - - ResolveDialog(QWidget* parent = 0); - - ResolveChoice getResolveChoice(); - - inline void disableProvidedRadio() - { - ui.providedRadioButton->setEnabled(false); - } - -}; - -#endif diff --git a/3rdparty/IzPack/utils/native-launcher/src/resolve-dialog.ui b/3rdparty/IzPack/utils/native-launcher/src/resolve-dialog.ui deleted file mode 100644 index 7491e1cca..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/resolve-dialog.ui +++ /dev/null @@ -1,190 +0,0 @@ - - - - - ResolveDialog - - - - 0 - 0 - 621 - 387 - - - - IzPack launcher - - - :/img/img/kpackage_32.png - - - - 8 - - - 6 - - - - - - - - :/img/img/kpackage_48.png - - - - - - - <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The software that you want to install requires a Java runtime environment.</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">No Java runtime environment could be found, but one can be automatically installed for you.</p></body></html> - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - You have the following installation choices: - - - - 8 - - - 6 - - - - - manually specify the location of an existing Java runtime environment - - - true - - - - - - - automatically install the Java runtime environment provided with this software - - - - - - - download the latest version of the Sun Java runtime environment from the Internet. - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - - 131 - 31 - - - - - - - - &OK - - - true - - - - - - - &Quit - - - - - - - - - - - - - - okButton - clicked() - ResolveDialog - accept() - - - 278 - 253 - - - 96 - 254 - - - - - quitButton - clicked() - ResolveDialog - reject() - - - 369 - 253 - - - 179 - 282 - - - - - diff --git a/3rdparty/IzPack/utils/native-launcher/src/resources.qrc b/3rdparty/IzPack/utils/native-launcher/src/resources.qrc deleted file mode 100644 index 38004b828..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/resources.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - img/kpackage_16.png - img/kpackage_32.png - img/kpackage_48.png - - diff --git a/3rdparty/IzPack/utils/native-launcher/src/win32.rc b/3rdparty/IzPack/utils/native-launcher/src/win32.rc deleted file mode 100644 index b427c108a..000000000 --- a/3rdparty/IzPack/utils/native-launcher/src/win32.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "img/win32.ico" diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/LICENSE.txt b/3rdparty/IzPack/utils/wrappers/izpack2app/LICENSE.txt deleted file mode 100644 index d64569567..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2app/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/MSVCR71.dll b/3rdparty/IzPack/utils/wrappers/izpack2app/MSVCR71.dll deleted file mode 100644 index 9d9e0286c..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2app/MSVCR71.dll and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/Info.plist b/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/Info.plist deleted file mode 100644 index d62e352c7..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CFBundleName - IzPack - CFBundleVersion - 100.0 - CFBundleAllowMixedLocalizations - true - CFBundleExecutable - JavaApplicationStub - CFBundleDevelopmentRegion - English - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleInfoDictionaryVersion - 6.0 - CFBundleIconFile - izpack.icns - Java - - MainClass - com.izforge.izpack.installer.Installer - JVMVersion - 1.4+ - ClassPath - $JAVAROOT/__JAR__ - Properties - - apple.laf.useScreenMenuBar - true - - - - diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/MacOS/JavaApplicationStub b/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/MacOS/JavaApplicationStub deleted file mode 100644 index 4190041db..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/MacOS/JavaApplicationStub and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/PkgInfo b/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/PkgInfo deleted file mode 100644 index bd04210fb..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPL???? \ No newline at end of file diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/Resources/izpack.icns b/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/Resources/izpack.icns deleted file mode 100644 index 76665e5db..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2app/Mac-App-Template/Contents/Resources/izpack.icns and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/NOTICE b/3rdparty/IzPack/utils/wrappers/izpack2app/NOTICE deleted file mode 100644 index c0c494d60..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2app/NOTICE +++ /dev/null @@ -1,7 +0,0 @@ -IzPack notice -------------- - - This product includes software developed by Julien Ponge and others - for the IzPack project: - - http://izpack.org/ - - http://izpack.codehaus.org/ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/app.ico b/3rdparty/IzPack/utils/wrappers/izpack2app/app.ico deleted file mode 100644 index 38ab95afd..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2app/app.ico and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/izpack2app.exe b/3rdparty/IzPack/utils/wrappers/izpack2app/izpack2app.exe deleted file mode 100644 index 412f7f7bf..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2app/izpack2app.exe and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/izpack2app.py b/3rdparty/IzPack/utils/wrappers/izpack2app/izpack2app.py deleted file mode 100644 index 0322ad38d..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2app/izpack2app.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -# ........................................................................... # -# -# IzPack - 2007, 2008 Julien Ponge, All Rights Reserved. -# -# http://izpack.org/ -# http://izpack.codehaus.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ........................................................................... # - -import os -import sys -from shutil import * - -def main(): - base = os.path.dirname(sys.argv[0]) - jar = sys.argv[1] - jar_name = os.path.basename(jar) - app = sys.argv[2] - - if os.path.exists(app): rmtree(app) - copytree(os.path.join(base, 'Mac-App-Template'), app) - java_folder = os.path.join(app, 'Contents/Resources/Java/') - if not os.path.exists(java_folder): os.mkdir(java_folder) - copy(jar, java_folder) - - def reducer(str, line): - return str + line - - plist_path = os.path.join(app, 'Contents/Info.plist') - plist = open(plist_path, 'r') - plist_content = reduce(reducer, plist.readlines(), '').replace('__JAR__', jar_name) - plist.close() - plist = open(plist_path, 'w') - plist.write(plist_content) - plist.close() - -if __name__ == '__main__': - if (len(sys.argv) != 3): - print "Usage: izpack2app.py installer.jar Installer.app" - else: - main() diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/library.zip b/3rdparty/IzPack/utils/wrappers/izpack2app/library.zip deleted file mode 100644 index 9763fba4e..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2app/library.zip and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/setup.py b/3rdparty/IzPack/utils/wrappers/izpack2app/setup.py deleted file mode 100644 index 0144cb917..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2app/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -# ........................................................................... # -# -# IzPack - Copyright 2007 Julien Ponge, All Rights Reserved. -# -# http://izpack.org/ -# http://izpack.codehaus.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ........................................................................... # - -from distutils.core import setup -import py2exe - -setup( - console = [{ - 'script': 'izpack2app.py', - 'icon_resources': [(0, 'app.ico')] - }], - script_args=['py2exe', '--bundle-files', '1'] -) diff --git a/3rdparty/IzPack/utils/wrappers/izpack2app/w9xpopen.exe b/3rdparty/IzPack/utils/wrappers/izpack2app/w9xpopen.exe deleted file mode 100644 index 139f6dd1d..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2app/w9xpopen.exe and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/7zS.sfx b/3rdparty/IzPack/utils/wrappers/izpack2exe/7zS.sfx deleted file mode 100644 index 0cfaf3ee3..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2exe/7zS.sfx and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/7za.exe b/3rdparty/IzPack/utils/wrappers/izpack2exe/7za.exe deleted file mode 100644 index 06e8b434f..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2exe/7za.exe and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/COPYING.7zS-sfx.txt b/3rdparty/IzPack/utils/wrappers/izpack2exe/COPYING.7zS-sfx.txt deleted file mode 100644 index f3926a615..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2exe/COPYING.7zS-sfx.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/LICENSE.7zip.txt b/3rdparty/IzPack/utils/wrappers/izpack2exe/LICENSE.7zip.txt deleted file mode 100644 index f3926a615..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2exe/LICENSE.7zip.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/LICENSE.txt b/3rdparty/IzPack/utils/wrappers/izpack2exe/LICENSE.txt deleted file mode 100644 index d64569567..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2exe/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/LICENSE.upx.txt b/3rdparty/IzPack/utils/wrappers/izpack2exe/LICENSE.upx.txt deleted file mode 100644 index d159169d1..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2exe/LICENSE.upx.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/MSVCR71.dll b/3rdparty/IzPack/utils/wrappers/izpack2exe/MSVCR71.dll deleted file mode 100644 index 9d9e0286c..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2exe/MSVCR71.dll and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/NOTICE b/3rdparty/IzPack/utils/wrappers/izpack2exe/NOTICE deleted file mode 100644 index c0c494d60..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2exe/NOTICE +++ /dev/null @@ -1,7 +0,0 @@ -IzPack notice -------------- - - This product includes software developed by Julien Ponge and others - for the IzPack project: - - http://izpack.org/ - - http://izpack.codehaus.org/ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/app.ico b/3rdparty/IzPack/utils/wrappers/izpack2exe/app.ico deleted file mode 100644 index 38ab95afd..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2exe/app.ico and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/exe.ico b/3rdparty/IzPack/utils/wrappers/izpack2exe/exe.ico deleted file mode 100644 index 0ab0ce354..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2exe/exe.ico and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/izpack2exe.exe b/3rdparty/IzPack/utils/wrappers/izpack2exe/izpack2exe.exe deleted file mode 100644 index 0a6162926..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2exe/izpack2exe.exe and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/izpack2exe.py b/3rdparty/IzPack/utils/wrappers/izpack2exe/izpack2exe.py deleted file mode 100644 index 65302bcd0..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2exe/izpack2exe.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python -# ........................................................................... # -# -# IzPack - Copyright 2007, 2008 Julien Ponge, All Rights Reserved. -# -# http://izpack.org/ -# http://izpack.codehaus.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ........................................................................... # - -import os -import sys -from shutil import * -from optparse import OptionParser - -def parse_options(): - parser = OptionParser() - parser.add_option("--file", action="append", dest="file", - help="The installer JAR file / files") - parser.add_option("--output", action="store", dest="output", - default="setup.exe", - help="The executable file") - parser.add_option("--with-7z", action="store", dest="p7z", - default="7za", - help="Path to the 7-Zip executable") - parser.add_option("--with-upx", action="store", dest="upx", - default="upx", - help="Path to the UPX executable") - parser.add_option("--no-upx", action="store_true", dest="no_upx", - default=False, - help="Do not use UPX to further compress the output") - parser.add_option("--launch-file", action="store", dest="launch", - default="launcher.exe", - help="File to launch after extract") - (options, args) = parser.parse_args() - if (options.file is None): - parser.error("no installer file has been given") - return options - -def create_exe(settings): - filename = os.path.basename(settings.launch) - if(len(settings.file) == 1): - filename = os.path.basename(settings.file[0]) - - files = " ".join(settings.file); - p7z = '"%s" a -t7z -mx=9 -ms=off installer.7z %s' % (settings.p7z, files) - - os.system(p7z) - config = open('config.txt', 'w') - config.write(';!@Install@!UTF-8!\r\n') - config.write('Title="IzPack"\r\n') - config.write('Progress="yes"\r\n') - config.write('ExecuteFile="%s"\r\n' % filename) - config.write(';!@InstallEnd@!\r\n') - config.close() - - if settings.p7z == '7za': - sfx = os.path.join(os.path.dirname(sys.argv[0]), '7zS.sfx') - else: - sfx = os.path.join(os.path.dirname(settings.p7z), '7zS.sfx') - files = [sfx, 'config.txt', 'installer.7z'] - output = open(settings.output, 'wb') - for f in files: - in_file = open(f, 'rb') - copyfileobj(in_file, output, 2048) - in_file.close() - output.close() - - if (not settings.no_upx): - upx = '"%s" --ultra-brute %s' % (settings.upx, settings.output) - os.system(upx) - - os.remove('config.txt') - os.remove('installer.7z') - -def main(): - create_exe(parse_options()) - -if __name__ == "__main__": - main() diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/library.zip b/3rdparty/IzPack/utils/wrappers/izpack2exe/library.zip deleted file mode 100644 index d044a9ec4..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2exe/library.zip and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/setup.py b/3rdparty/IzPack/utils/wrappers/izpack2exe/setup.py deleted file mode 100644 index 21c07ba18..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2exe/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -# ........................................................................... # -# -# IzPack - Copyright 2007, 2008 Julien Ponge, All Rights Reserved. -# -# http://izpack.org/ -# http://izpack.codehaus.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ........................................................................... # - -from distutils.core import setup -import py2exe - -setup( - console = [{ - 'script': 'izpack2exe.py', - 'icon_resources': [(0, 'app.ico')] - }], - script_args=['py2exe', '--bundle-files', '1'] -) diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/upx.exe b/3rdparty/IzPack/utils/wrappers/izpack2exe/upx.exe deleted file mode 100644 index 6266213c6..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2exe/upx.exe and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2exe/w9xpopen.exe b/3rdparty/IzPack/utils/wrappers/izpack2exe/w9xpopen.exe deleted file mode 100644 index 139f6dd1d..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2exe/w9xpopen.exe and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/LICENSE.txt b/3rdparty/IzPack/utils/wrappers/izpack2jnlp/LICENSE.txt deleted file mode 100644 index d64569567..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/MSVCR71.dll b/3rdparty/IzPack/utils/wrappers/izpack2jnlp/MSVCR71.dll deleted file mode 100644 index 9d9e0286c..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/MSVCR71.dll and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/NOTICE b/3rdparty/IzPack/utils/wrappers/izpack2jnlp/NOTICE deleted file mode 100644 index c0c494d60..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/NOTICE +++ /dev/null @@ -1,7 +0,0 @@ -IzPack notice -------------- - - This product includes software developed by Julien Ponge and others - for the IzPack project: - - http://izpack.org/ - - http://izpack.codehaus.org/ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/app.ico b/3rdparty/IzPack/utils/wrappers/izpack2jnlp/app.ico deleted file mode 100644 index 38ab95afd..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/app.ico and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/izpack2jnlp.exe b/3rdparty/IzPack/utils/wrappers/izpack2jnlp/izpack2jnlp.exe deleted file mode 100644 index 7b52b0abc..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/izpack2jnlp.exe and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/izpack2jnlp.py b/3rdparty/IzPack/utils/wrappers/izpack2jnlp/izpack2jnlp.py deleted file mode 100644 index c0a29cc62..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/izpack2jnlp.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env python -# ........................................................................... # -# -# IzPack - Copyright 2008 Julien Ponge, All Rights Reserved. -# -# http://izpack.org/ -# http://izpack.codehaus.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ........................................................................... # - -JNLP_TEMPLATE = """ - - - - $title - $vendor - - $description - - - - - - - - - - - -""" - -def parse_options(): - from optparse import OptionParser - parser = OptionParser() - - parser.add_option("--codebase", - action="store", - dest="codebase", - help="URL to the downloads") - parser.add_option("--jnlp", - action="store", - dest="jnlp", - help="Name of the JNLP file, relative to --codebase") - parser.add_option("--title", - action="store", - dest="title", - help="Title of the application to install") - parser.add_option("--vendor", - action="store", - dest="vendor", - help="Name of the application vendor") - parser.add_option("--homepage", - action="store", - dest="homepage", - help="URL to the application homepage") - parser.add_option("--description", - action="store", - dest="description", - help="A short description of the application") - parser.add_option("--installer", - action="store", - dest="installer", - help="Name of the installer JAR file, relative to --codebase") - - (options, args) = parser.parse_args() - - to_check = (options.codebase, - options.jnlp, - options.title, - options.vendor, - options.homepage, - options.description, - options.installer) - for item in to_check: - if item is None: - parser.error("Some arguments were missing, please run again with --help") - - return options - -def main(): - from string import Template - opts = parse_options() - jnlp = Template(JNLP_TEMPLATE) - jnlp_file = open(opts.jnlp, "w") - jnlp_file.write(jnlp.substitute(codebase=opts.codebase, - jnlp=opts.jnlp, - title=opts.title, - vendor=opts.vendor, - homepage=opts.homepage, - description=opts.description, - installer=opts.installer)) - jnlp_file.close() - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/library.zip b/3rdparty/IzPack/utils/wrappers/izpack2jnlp/library.zip deleted file mode 100644 index cdb274e75..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/library.zip and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/setup.py b/3rdparty/IzPack/utils/wrappers/izpack2jnlp/setup.py deleted file mode 100644 index 6892544ba..000000000 --- a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -# ........................................................................... # -# -# IzPack - Copyright 2008 Julien Ponge, All Rights Reserved. -# -# http://izpack.org/ -# http://izpack.codehaus.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ........................................................................... # - -from distutils.core import setup -import py2exe - -setup( - console = [{ - 'script': 'izpack2jnlp.py', - 'icon_resources': [(0, 'app.ico')] - }], - script_args=['py2exe', '--bundle-files', '1'] -) diff --git a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/w9xpopen.exe b/3rdparty/IzPack/utils/wrappers/izpack2jnlp/w9xpopen.exe deleted file mode 100644 index 139f6dd1d..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/w9xpopen.exe and /dev/null differ diff --git a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/webstart.png b/3rdparty/IzPack/utils/wrappers/izpack2jnlp/webstart.png deleted file mode 100644 index 87d1cf7b2..000000000 Binary files a/3rdparty/IzPack/utils/wrappers/izpack2jnlp/webstart.png and /dev/null differ diff --git a/3rdparty/README.txt b/3rdparty/README.txt index 933837f7b..2a2a05fdc 100644 --- a/3rdparty/README.txt +++ b/3rdparty/README.txt @@ -1 +1,28 @@ -This directory is for third-party tools needed to build and package the project \ No newline at end of file +This directory is for the third-party tools needed to build and package the RomRaider +distribution application. + +Two tools are required to build the distribution of RomRaider: + +IzPack - is a widely used tool for packaging applications on the Javaâ„¢ platform. + Easily make installers that work seamlessly on Microsoft Windowsâ„¢, Linuxâ„¢, + Solarisâ„¢ and Mac OS Xâ„¢. + + Download the standalone compiler izpack-standalone-compiler-4.3.5.jar and + save it in the IzPack directory, rename and remove the version part (-4.3.5) of the filename. + https://repo1.maven.org/maven2/org/codehaus/izpack/izpack-standalone-compiler/4.3.5/izpack-standalone-compiler-4.3.5.jar + +launch4j - is a cross-platform tool for wrapping Java applications distributed as jars + in lightweight Windows native executable. + + Download the ZIP package and extract it into the 3rdparty directory making + sure that launch4j.jar is in the first directory level of launch4j. + launch4j-3.13-win32.zip + https://sourceforge.net/projects/launch4j/files/launch4j-3/3.13/launch4j-3.13-win32.zip/download + +Expected directory structure: +RomRaider\3rdparty\ + IzPack\ + izpack-standalone-compiler.jar + launch4j\ + launch4j.jar + ... and other files\folders diff --git a/3rdparty/launch4j/.classpath b/3rdparty/launch4j/.classpath deleted file mode 100644 index 734d175a6..000000000 --- a/3rdparty/launch4j/.classpath +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/3rdparty/launch4j/.project b/3rdparty/launch4j/.project deleted file mode 100644 index 1c1309dfa..000000000 --- a/3rdparty/launch4j/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - launch4j - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/3rdparty/launch4j/LICENSE.txt b/3rdparty/launch4j/LICENSE.txt deleted file mode 100644 index 82223322f..000000000 --- a/3rdparty/launch4j/LICENSE.txt +++ /dev/null @@ -1,30 +0,0 @@ -Launch4j (http://launch4j.sourceforge.net/) -Cross-platform Java application wrapper for creating Windows native executables. - -Copyright (c) 2004, 2008 Grzegorz Kowal - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/3rdparty/launch4j/bin/COPYING b/3rdparty/launch4j/bin/COPYING deleted file mode 100644 index 60549be51..000000000 --- a/3rdparty/launch4j/bin/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/3rdparty/launch4j/bin/ld.exe b/3rdparty/launch4j/bin/ld.exe deleted file mode 100644 index f388b9513..000000000 Binary files a/3rdparty/launch4j/bin/ld.exe and /dev/null differ diff --git a/3rdparty/launch4j/bin/windres.exe b/3rdparty/launch4j/bin/windres.exe deleted file mode 100644 index 4ad2ae98a..000000000 Binary files a/3rdparty/launch4j/bin/windres.exe and /dev/null differ diff --git a/3rdparty/launch4j/build.xml b/3rdparty/launch4j/build.xml deleted file mode 100644 index a7682ce0c..000000000 --- a/3rdparty/launch4j/build.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/launch4j/current_version.txt b/3rdparty/launch4j/current_version.txt deleted file mode 100644 index 31ae39353..000000000 --- a/3rdparty/launch4j/current_version.txt +++ /dev/null @@ -1 +0,0 @@ -The current version is 3.0.1 \ No newline at end of file diff --git a/3rdparty/launch4j/demo/ConsoleApp/ConsoleApp.exe b/3rdparty/launch4j/demo/ConsoleApp/ConsoleApp.exe deleted file mode 100644 index d8a8f75d0..000000000 Binary files a/3rdparty/launch4j/demo/ConsoleApp/ConsoleApp.exe and /dev/null differ diff --git a/3rdparty/launch4j/demo/ConsoleApp/ConsoleApp.jar b/3rdparty/launch4j/demo/ConsoleApp/ConsoleApp.jar deleted file mode 100644 index 6d4b126e6..000000000 Binary files a/3rdparty/launch4j/demo/ConsoleApp/ConsoleApp.jar and /dev/null differ diff --git a/3rdparty/launch4j/demo/ConsoleApp/build.bat b/3rdparty/launch4j/demo/ConsoleApp/build.bat deleted file mode 100644 index ed5f704e3..000000000 --- a/3rdparty/launch4j/demo/ConsoleApp/build.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off -if "%ANT_HOME%"=="" goto noAntHome -if "%JAVA_HOME%"=="" goto noJavaHome -call "%ANT_HOME%\bin\ant.bat" exe -goto end - -:noAntHome -echo ANT_HOME environment variable is not set -goto end - -:noJavaHome -echo JAVA_HOME environment variable is not set - -:end diff --git a/3rdparty/launch4j/demo/ConsoleApp/build.xml b/3rdparty/launch4j/demo/ConsoleApp/build.xml deleted file mode 100644 index 5f3473da6..000000000 --- a/3rdparty/launch4j/demo/ConsoleApp/build.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/launch4j/demo/ConsoleApp/l4j/ConsoleApp.ico b/3rdparty/launch4j/demo/ConsoleApp/l4j/ConsoleApp.ico deleted file mode 100644 index cc4c540e2..000000000 Binary files a/3rdparty/launch4j/demo/ConsoleApp/l4j/ConsoleApp.ico and /dev/null differ diff --git a/3rdparty/launch4j/demo/ConsoleApp/lib/readme.txt b/3rdparty/launch4j/demo/ConsoleApp/lib/readme.txt deleted file mode 100644 index ef44ded3a..000000000 --- a/3rdparty/launch4j/demo/ConsoleApp/lib/readme.txt +++ /dev/null @@ -1,8 +0,0 @@ -Put your jar libs here and the build script will include them -in the classpath stored inside the jar manifest. -In order to run your application move the output exe file from -the dist directory to the same level as lib. - -SimpleApp.exe -lib/ -lib/xml.jar diff --git a/3rdparty/launch4j/demo/ConsoleApp/readme.txt b/3rdparty/launch4j/demo/ConsoleApp/readme.txt deleted file mode 100644 index fa38dc8bd..000000000 --- a/3rdparty/launch4j/demo/ConsoleApp/readme.txt +++ /dev/null @@ -1 +0,0 @@ -To build the example application set JAVA_HOME and ANT_HOME environment variables. diff --git a/3rdparty/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java b/3rdparty/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java deleted file mode 100644 index eb1398c2c..000000000 --- a/3rdparty/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.example; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class ConsoleApp { - public static void main(String[] args) { - StringBuffer sb = new StringBuffer("Hello World!\n\nJava version: "); - sb.append(System.getProperty("java.version")); - sb.append("\nJava home: "); - sb.append(System.getProperty("java.home")); - sb.append("\nCurrent dir: "); - sb.append(System.getProperty("user.dir")); - if (args.length > 0) { - sb.append("\nArgs: "); - for (int i = 0; i < args.length; i++) { - sb.append(args[i]); - sb.append(' '); - } - } - sb.append("\n\nEnter a line of text, Ctrl-C to stop.\n\n>"); - System.out.print(sb.toString()); - try { - BufferedReader is = new BufferedReader(new InputStreamReader(System.in)); - String line; - while ((line = is.readLine()) != null && !line.equalsIgnoreCase("quit")) { - System.out.print("You wrote: " + line + "\n\n>"); - } - is.close(); - System.exit(123); - } catch (IOException e) { - System.err.print(e); - } - } -} diff --git a/3rdparty/launch4j/demo/LICENSE.txt b/3rdparty/launch4j/demo/LICENSE.txt deleted file mode 100644 index d6d6bb5ea..000000000 --- a/3rdparty/launch4j/demo/LICENSE.txt +++ /dev/null @@ -1,30 +0,0 @@ -Launch4j (http://launch4j.sourceforge.net/) -Cross-platform Java application wrapper for creating Windows native executables. - -Copyright (c) 2004, 2007 Grzegorz Kowal - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/3rdparty/launch4j/demo/SimpleApp/SimpleApp.exe b/3rdparty/launch4j/demo/SimpleApp/SimpleApp.exe deleted file mode 100644 index 1a75fc298..000000000 Binary files a/3rdparty/launch4j/demo/SimpleApp/SimpleApp.exe and /dev/null differ diff --git a/3rdparty/launch4j/demo/SimpleApp/SimpleApp.jar b/3rdparty/launch4j/demo/SimpleApp/SimpleApp.jar deleted file mode 100644 index f02c6133b..000000000 Binary files a/3rdparty/launch4j/demo/SimpleApp/SimpleApp.jar and /dev/null differ diff --git a/3rdparty/launch4j/demo/SimpleApp/build.bat b/3rdparty/launch4j/demo/SimpleApp/build.bat deleted file mode 100644 index ed5f704e3..000000000 --- a/3rdparty/launch4j/demo/SimpleApp/build.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off -if "%ANT_HOME%"=="" goto noAntHome -if "%JAVA_HOME%"=="" goto noJavaHome -call "%ANT_HOME%\bin\ant.bat" exe -goto end - -:noAntHome -echo ANT_HOME environment variable is not set -goto end - -:noJavaHome -echo JAVA_HOME environment variable is not set - -:end diff --git a/3rdparty/launch4j/demo/SimpleApp/build.xml b/3rdparty/launch4j/demo/SimpleApp/build.xml deleted file mode 100644 index 82f4b4998..000000000 --- a/3rdparty/launch4j/demo/SimpleApp/build.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/launch4j/demo/SimpleApp/l4j/SimpleApp.ico b/3rdparty/launch4j/demo/SimpleApp/l4j/SimpleApp.ico deleted file mode 100644 index cc4c540e2..000000000 Binary files a/3rdparty/launch4j/demo/SimpleApp/l4j/SimpleApp.ico and /dev/null differ diff --git a/3rdparty/launch4j/demo/SimpleApp/l4j/SimpleApp.xml b/3rdparty/launch4j/demo/SimpleApp/l4j/SimpleApp.xml deleted file mode 100644 index 9a7dc940a..000000000 --- a/3rdparty/launch4j/demo/SimpleApp/l4j/SimpleApp.xml +++ /dev/null @@ -1,18 +0,0 @@ - - gui - ../SimpleApp.jar - ../SimpleApp.exe - SimpleApp - . - true - SimpleApp.ico - - 1.4.0 - - - splash.bmp - true - 60 - true - - \ No newline at end of file diff --git a/3rdparty/launch4j/demo/SimpleApp/l4j/splash.bmp b/3rdparty/launch4j/demo/SimpleApp/l4j/splash.bmp deleted file mode 100644 index 88d7bbf10..000000000 Binary files a/3rdparty/launch4j/demo/SimpleApp/l4j/splash.bmp and /dev/null differ diff --git a/3rdparty/launch4j/demo/SimpleApp/lib/readme.txt b/3rdparty/launch4j/demo/SimpleApp/lib/readme.txt deleted file mode 100644 index ef44ded3a..000000000 --- a/3rdparty/launch4j/demo/SimpleApp/lib/readme.txt +++ /dev/null @@ -1,8 +0,0 @@ -Put your jar libs here and the build script will include them -in the classpath stored inside the jar manifest. -In order to run your application move the output exe file from -the dist directory to the same level as lib. - -SimpleApp.exe -lib/ -lib/xml.jar diff --git a/3rdparty/launch4j/demo/SimpleApp/readme.txt b/3rdparty/launch4j/demo/SimpleApp/readme.txt deleted file mode 100644 index fa38dc8bd..000000000 --- a/3rdparty/launch4j/demo/SimpleApp/readme.txt +++ /dev/null @@ -1 +0,0 @@ -To build the example application set JAVA_HOME and ANT_HOME environment variables. diff --git a/3rdparty/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java b/3rdparty/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java deleted file mode 100644 index 8e87c5953..000000000 --- a/3rdparty/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.example; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.UIManager; - -public class SimpleApp extends JFrame { - public SimpleApp(String[] args) { - super("Java Application"); - final int inset = 100; - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - setBounds (inset, inset, - screenSize.width - inset * 2, screenSize.height - inset * 2); - - JMenu menu = new JMenu("File"); - menu.add(new JMenuItem("Open")); - menu.add(new JMenuItem("Save")); - JMenuBar mb = new JMenuBar(); - mb.setOpaque(true); - mb.add(menu); - setJMenuBar(mb); - - this.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - System.exit(123); - }}); - setVisible(true); - - StringBuffer sb = new StringBuffer("Java version: "); - sb.append(System.getProperty("java.version")); - sb.append("\nJava home: "); - sb.append(System.getProperty("java.home")); - sb.append("\nCurrent dir: "); - sb.append(System.getProperty("user.dir")); - if (args.length > 0) { - sb.append("\nArgs: "); - for (int i = 0; i < args.length; i++) { - sb.append(args[i]); - sb.append(' '); - } - } - JOptionPane.showMessageDialog(this, - sb.toString(), - "Info", - JOptionPane.INFORMATION_MESSAGE); - } - - public static void setLAF() { - JFrame.setDefaultLookAndFeelDecorated(true); - Toolkit.getDefaultToolkit().setDynamicLayout(true); - System.setProperty("sun.awt.noerasebackground","true"); - try { - UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); - } catch (Exception e) { - System.err.println("Failed to set LookAndFeel"); - } - } - - public static void main(String[] args) { - setLAF(); - new SimpleApp(args); - } -} diff --git a/3rdparty/launch4j/demo/readme.txt b/3rdparty/launch4j/demo/readme.txt deleted file mode 100644 index f59178214..000000000 --- a/3rdparty/launch4j/demo/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -JRE/SDK 1.4.0 or higher must be installed on your system to run this demo. - -try running it with some command line arguments... diff --git a/3rdparty/launch4j/head/LICENSE.txt b/3rdparty/launch4j/head/LICENSE.txt deleted file mode 100644 index 536488e61..000000000 --- a/3rdparty/launch4j/head/LICENSE.txt +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2004, 2007 Grzegorz Kowal - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -Except as contained in this notice, the name(s) of the above copyright holders -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/3rdparty/launch4j/head/consolehead.o b/3rdparty/launch4j/head/consolehead.o deleted file mode 100644 index 739d9767f..000000000 Binary files a/3rdparty/launch4j/head/consolehead.o and /dev/null differ diff --git a/3rdparty/launch4j/head/guihead.o b/3rdparty/launch4j/head/guihead.o deleted file mode 100644 index e830aa9e2..000000000 Binary files a/3rdparty/launch4j/head/guihead.o and /dev/null differ diff --git a/3rdparty/launch4j/head/head.o b/3rdparty/launch4j/head/head.o deleted file mode 100644 index d595f9e78..000000000 Binary files a/3rdparty/launch4j/head/head.o and /dev/null differ diff --git a/3rdparty/launch4j/head_src/LICENSE.txt b/3rdparty/launch4j/head_src/LICENSE.txt deleted file mode 100644 index 2805f412a..000000000 --- a/3rdparty/launch4j/head_src/LICENSE.txt +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2004, 2008 Grzegorz Kowal - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -Except as contained in this notice, the name(s) of the above copyright holders -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/3rdparty/launch4j/head_src/consolehead/Makefile.win b/3rdparty/launch4j/head_src/consolehead/Makefile.win deleted file mode 100644 index 349e4c00f..000000000 --- a/3rdparty/launch4j/head_src/consolehead/Makefile.win +++ /dev/null @@ -1,33 +0,0 @@ -# Project: consolehead -# Makefile created by Dev-C++ 4.9.9.2 - -CPP = g++.exe -CC = gcc.exe -WINDRES = windres.exe -RES = -OBJ = ../../head/consolehead.o ../../head/head.o $(RES) -LINKOBJ = ../../head/consolehead.o ../../head/head.o $(RES) -LIBS = -L"C:/Dev-Cpp/lib" -n -s -INCS = -I"C:/Dev-Cpp/include" -CXXINCS = -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -BIN = consolehead.exe -CXXFLAGS = $(CXXINCS) -fexpensive-optimizations -O3 -CFLAGS = $(INCS) -fexpensive-optimizations -O3 -RM = rm -f - -.PHONY: all all-before all-after clean clean-custom - -all: all-before consolehead.exe all-after - - -clean: clean-custom - ${RM} $(OBJ) $(BIN) - -$(BIN): $(OBJ) -# $(CC) $(LINKOBJ) -o "consolehead.exe" $(LIBS) - -../../head/consolehead.o: consolehead.c - $(CC) -c consolehead.c -o ../../head/consolehead.o $(CFLAGS) - -../../head/head.o: ../head.c - $(CC) -c ../head.c -o ../../head/head.o $(CFLAGS) diff --git a/3rdparty/launch4j/head_src/consolehead/consolehead.c b/3rdparty/launch4j/head_src/consolehead/consolehead.c deleted file mode 100644 index 755a7673c..000000000 --- a/3rdparty/launch4j/head_src/consolehead/consolehead.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#include "../resource.h" -#include "../head.h" - -int main(int argc, char* argv[]) -{ - setConsoleFlag(); - LPTSTR cmdLine = GetCommandLine(); - if (*cmdLine == '"') { - if (*(cmdLine = strchr(cmdLine + 1, '"') + 1)) { - cmdLine++; - } - } else if ((cmdLine = strchr(cmdLine, ' ')) != NULL) { - cmdLine++; - } else { - cmdLine = ""; - } - int result = prepare(cmdLine); - if (result == ERROR_ALREADY_EXISTS) { - char errMsg[BIG_STR] = {0}; - loadString(INSTANCE_ALREADY_EXISTS_MSG, errMsg); - msgBox(errMsg); - closeLogFile(); - return 2; - } - if (result != TRUE) { - signalError(); - return 1; - } - - result = (int) execute(TRUE); - if (result == -1) { - signalError(); - } else { - return result; - } -} diff --git a/3rdparty/launch4j/head_src/consolehead/consolehead.dev b/3rdparty/launch4j/head_src/consolehead/consolehead.dev deleted file mode 100644 index a309ec94f..000000000 --- a/3rdparty/launch4j/head_src/consolehead/consolehead.dev +++ /dev/null @@ -1,108 +0,0 @@ -[Project] -FileName=consolehead.dev -Name=consolehead -UnitCount=4 -Type=1 -Ver=1 -ObjFiles= -Includes= -Libs= -PrivateResource= -ResourceIncludes= -MakeIncludes= -Compiler= -CppCompiler= -Linker=-n_@@_ -IsCpp=0 -Icon= -ExeOutput= -ObjectOutput=..\..\head -OverrideOutput=0 -OverrideOutputName=consolehead.exe -HostApplication= -Folders= -CommandLine= -UseCustomMakefile=0 -CustomMakefile=Makefile.win -IncludeVersionInfo=0 -SupportXPThemes=0 -CompilerSet=0 -CompilerSettings=0000000001001000000100 - -[Unit1] -FileName=consolehead.c -CompileCpp=0 -Folder=consolehead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[VersionInfo] -Major=0 -Minor=1 -Release=1 -Build=1 -LanguageID=1033 -CharsetID=1252 -CompanyName= -FileVersion= -FileDescription=Developed using the Dev-C++ IDE -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion= -AutoIncBuildNr=0 - -[Unit2] -FileName=..\resource.h -CompileCpp=0 -Folder=consolehead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit3] -FileName=..\head.c -CompileCpp=0 -Folder=consolehead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit4] -FileName=..\head.h -CompileCpp=0 -Folder=consolehead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit5] -FileName=..\head.rc -Folder=consolehead -Compile=1 -Link=0 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit6] -FileName=..\resid.h -CompileCpp=0 -Folder=consolehead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - diff --git a/3rdparty/launch4j/head_src/guihead/Makefile.win b/3rdparty/launch4j/head_src/guihead/Makefile.win deleted file mode 100644 index 30cee5623..000000000 --- a/3rdparty/launch4j/head_src/guihead/Makefile.win +++ /dev/null @@ -1,33 +0,0 @@ -# Project: guihead -# Makefile created by Dev-C++ 4.9.9.2 - -CPP = g++.exe -CC = gcc.exe -WINDRES = windres.exe -RES = -OBJ = ../../head/guihead.o ../../head/head.o $(RES) -LINKOBJ = ../../head/guihead.o ../../head/head.o $(RES) -LIBS = -L"C:/Dev-Cpp/lib" -mwindows -n -s -INCS = -I"C:/Dev-Cpp/include" -CXXINCS = -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -BIN = guihead.exe -CXXFLAGS = $(CXXINCS) -fexpensive-optimizations -O3 -CFLAGS = $(INCS) -fexpensive-optimizations -O3 -RM = rm -f - -.PHONY: all all-before all-after clean clean-custom - -all: all-before guihead.exe all-after - - -clean: clean-custom - ${RM} $(OBJ) $(BIN) - -$(BIN): $(OBJ) -# $(CC) $(LINKOBJ) -o "guihead.exe" $(LIBS) - -../../head/guihead.o: guihead.c - $(CC) -c guihead.c -o ../../head/guihead.o $(CFLAGS) - -../../head/head.o: ../head.c - $(CC) -c ../head.c -o ../../head/head.o $(CFLAGS) diff --git a/3rdparty/launch4j/head_src/guihead/guihead.c b/3rdparty/launch4j/head_src/guihead/guihead.c deleted file mode 100644 index 508a5bdac..000000000 --- a/3rdparty/launch4j/head_src/guihead/guihead.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - Sylvain Mina (single instance patch) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#include "../resource.h" -#include "../head.h" -#include "guihead.h" - -extern FILE* hLog; -extern PROCESS_INFORMATION pi; - -HWND hWnd; -DWORD dwExitCode = 0; -BOOL stayAlive = FALSE; -BOOL splash = FALSE; -BOOL splashTimeoutErr; -BOOL waitForWindow; -int splashTimeout = DEFAULT_SPLASH_TIMEOUT; - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) { - int result = prepare(lpCmdLine); - if (result == ERROR_ALREADY_EXISTS) { - HWND handle = getInstanceWindow(); - ShowWindow(handle, SW_SHOW); - SetForegroundWindow(handle); - closeLogFile(); - return 2; - } - if (result != TRUE) { - signalError(); - return 1; - } - - splash = loadBool(SHOW_SPLASH) - && strstr(lpCmdLine, "--l4j-no-splash") == NULL; - stayAlive = loadBool(GUI_HEADER_STAYS_ALIVE) - && strstr(lpCmdLine, "--l4j-dont-wait") == NULL; - if (splash || stayAlive) { - hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, "STATIC", "", - WS_POPUP | SS_BITMAP, - 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); - if (splash) { - char timeout[10] = {0}; - if (loadString(SPLASH_TIMEOUT, timeout)) { - splashTimeout = atoi(timeout); - if (splashTimeout <= 0 || splashTimeout > MAX_SPLASH_TIMEOUT) { - splashTimeout = DEFAULT_SPLASH_TIMEOUT; - } - } - splashTimeoutErr = loadBool(SPLASH_TIMEOUT_ERR) - && strstr(lpCmdLine, "--l4j-no-splash-err") == NULL; - waitForWindow = loadBool(SPLASH_WAITS_FOR_WINDOW); - HANDLE hImage = LoadImage(hInstance, // handle of the instance containing the image - MAKEINTRESOURCE(SPLASH_BITMAP), // name or identifier of image - IMAGE_BITMAP, // type of image - 0, // desired width - 0, // desired height - LR_DEFAULTSIZE); - if (hImage == NULL) { - signalError(); - return 1; - } - SendMessage(hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hImage); - RECT rect; - GetWindowRect(hWnd, &rect); - int x = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2; - int y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2; - SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE); - ShowWindow(hWnd, nCmdShow); - UpdateWindow (hWnd); - } - if (!SetTimer (hWnd, ID_TIMER, 1000 /* 1s */, TimerProc)) { - signalError(); - return 1; - } - } - if (execute(FALSE) == -1) { - signalError(); - return 1; - } - if (!(splash || stayAlive)) { - debug("Exit code:\t0\n"); - closeHandles(); - return 0; - } - - MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - debug("Exit code:\t%d\n", dwExitCode); - closeHandles(); - return dwExitCode; -} - -HWND getInstanceWindow() { - char windowTitle[STR]; - char instWindowTitle[STR] = {0}; - if (loadString(INSTANCE_WINDOW_TITLE, instWindowTitle)) { - HWND handle = FindWindowEx(NULL, NULL, NULL, NULL); - while (handle != NULL) { - GetWindowText(handle, windowTitle, STR - 1); - if (strstr(windowTitle, instWindowTitle) != NULL) { - return handle; - } else { - handle = FindWindowEx(NULL, handle, NULL, NULL); - } - } - } - return NULL; -} - -BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam) { - DWORD processId; - GetWindowThreadProcessId(hwnd, &processId); - if (pi.dwProcessId == processId) { - LONG styles = GetWindowLong(hwnd, GWL_STYLE); - if ((styles & WS_VISIBLE) != 0) { - splash = FALSE; - ShowWindow(hWnd, SW_HIDE); - return FALSE; - } - } - return TRUE; -} - -VOID CALLBACK TimerProc( - HWND hwnd, // handle of window for timer messages - UINT uMsg, // WM_TIMER message - UINT idEvent, // timer identifier - DWORD dwTime) { // current system time - - if (splash) { - if (splashTimeout == 0) { - splash = FALSE; - ShowWindow(hWnd, SW_HIDE); - if (waitForWindow && splashTimeoutErr) { - KillTimer(hwnd, ID_TIMER); - signalError(); - PostQuitMessage(0); - } - } else { - splashTimeout--; - if (waitForWindow) { - EnumWindows(enumwndfn, 0); - } - } - } - GetExitCodeProcess(pi.hProcess, &dwExitCode); - if (dwExitCode != STILL_ACTIVE - || !(splash || stayAlive)) { - KillTimer(hWnd, ID_TIMER); - PostQuitMessage(0); - } -} diff --git a/3rdparty/launch4j/head_src/guihead/guihead.dev b/3rdparty/launch4j/head_src/guihead/guihead.dev deleted file mode 100644 index 7c30088f1..000000000 --- a/3rdparty/launch4j/head_src/guihead/guihead.dev +++ /dev/null @@ -1,109 +0,0 @@ -[Project] -FileName=guihead.dev -Name=guihead -UnitCount=5 -Type=0 -Ver=1 -ObjFiles= -Includes= -Libs= -PrivateResource= -ResourceIncludes= -MakeIncludes= -Compiler= -CppCompiler= -Linker=-n_@@_ -IsCpp=0 -Icon= -ExeOutput= -ObjectOutput=..\..\head -OverrideOutput=0 -OverrideOutputName=guihead.exe -HostApplication= -Folders= -CommandLine= -UseCustomMakefile=1 -CustomMakefile=Makefile.win -IncludeVersionInfo=0 -SupportXPThemes=0 -CompilerSet=0 -CompilerSettings=0000000001001000000100 - -[Unit1] -FileName=guihead.c -CompileCpp=0 -Folder=guihead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd=$(CC) -c guihead.c -o ../../head/guihead.o $(CFLAGS) - -[Unit2] -FileName=guihead.h -CompileCpp=0 -Folder=guihead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[VersionInfo] -Major=0 -Minor=1 -Release=1 -Build=1 -LanguageID=1033 -CharsetID=1252 -CompanyName= -FileVersion= -FileDescription=Developed using the Dev-C++ IDE -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion= -AutoIncBuildNr=0 - -[Unit4] -FileName=..\head.h -CompileCpp=0 -Folder=guihead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit6] -FileName=..\resid.h -CompileCpp=0 -Folder=guihead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit3] -FileName=..\head.c -CompileCpp=0 -Folder=guihead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit5] -FileName=..\resource.h -CompileCpp=0 -Folder=guihead -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - diff --git a/3rdparty/launch4j/head_src/guihead/guihead.h b/3rdparty/launch4j/head_src/guihead/guihead.h deleted file mode 100644 index 2fc71e31f..000000000 --- a/3rdparty/launch4j/head_src/guihead/guihead.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#define ID_TIMER 1 -#define DEFAULT_SPLASH_TIMEOUT 60 /* 60 seconds */ -#define MAX_SPLASH_TIMEOUT 60 * 15 /* 15 minutes */ - -HWND getInstanceWindow(); - -BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam); - -VOID CALLBACK TimerProc( - HWND hwnd, // handle of window for timer messages - UINT uMsg, // WM_TIMER message - UINT idEvent, // timer identifier - DWORD dwTime // current system time -); diff --git a/3rdparty/launch4j/head_src/head.c b/3rdparty/launch4j/head_src/head.c deleted file mode 100644 index fe2ff0900..000000000 --- a/3rdparty/launch4j/head_src/head.c +++ /dev/null @@ -1,807 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2008 Grzegorz Kowal, - Ian Roberts (jdk preference patch) - Sylvain Mina (single instance patch) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#include "resource.h" -#include "head.h" - -HMODULE hModule; -FILE* hLog; -BOOL console = FALSE; -BOOL wow64 = FALSE; -int foundJava = NO_JAVA_FOUND; - -struct _stat statBuf; -PROCESS_INFORMATION pi; -DWORD priority; - -char mutexName[STR] = {0}; - -char errUrl[256] = {0}; -char errTitle[STR] = "Launch4j"; -char errMsg[BIG_STR] = {0}; - -char javaMinVer[STR] = {0}; -char javaMaxVer[STR] = {0}; -char foundJavaVer[STR] = {0}; -char foundJavaKey[_MAX_PATH] = {0}; - -char oldPwd[_MAX_PATH] = {0}; -char workingDir[_MAX_PATH] = {0}; -char cmd[_MAX_PATH] = {0}; -char args[MAX_ARGS] = {0}; - -FILE* openLogFile(const char* exePath, const int pathLen) { - char path[_MAX_PATH] = {0}; - strncpy(path, exePath, pathLen); - strcat(path, "\\launch4j.log"); - return fopen(path, "a"); -} - -void closeLogFile() { - if (hLog != NULL) { - fclose(hLog); - } -} - -void setWow64Flag() { - LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress( - GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); - - if (fnIsWow64Process != NULL) { - fnIsWow64Process(GetCurrentProcess(), &wow64); - } - debug("WOW64:\t\t%s\n", wow64 ? "yes" : "no"); -} - -void setConsoleFlag() { - console = TRUE; -} - -void msgBox(const char* text) { - if (console) { - printf("%s: %s\n", errTitle, text); - } else { - MessageBox(NULL, text, errTitle, MB_OK); - } -} - -void signalError() { - DWORD err = GetLastError(); - if (err) { - LPVOID lpMsgBuf; - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - err, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &lpMsgBuf, - 0, - NULL); - debug("Error:\t\t%s\n", (LPCTSTR) lpMsgBuf); - strcat(errMsg, "\n\n"); - strcat(errMsg, (LPCTSTR) lpMsgBuf); - msgBox(errMsg); - LocalFree(lpMsgBuf); - } else { - msgBox(errMsg); - } - if (*errUrl) { - debug("Open URL:\t%s\n", errUrl); - ShellExecute(NULL, "open", errUrl, NULL, NULL, SW_SHOWNORMAL); - } - closeLogFile(); -} - -BOOL loadString(const int resID, char* buffer) { - HRSRC hResource; - HGLOBAL hResourceLoaded; - LPBYTE lpBuffer; - - hResource = FindResourceEx(hModule, RT_RCDATA, MAKEINTRESOURCE(resID), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)); - if (NULL != hResource) { - hResourceLoaded = LoadResource(hModule, hResource); - if (NULL != hResourceLoaded) { - lpBuffer = (LPBYTE) LockResource(hResourceLoaded); - if (NULL != lpBuffer) { - int x = 0; - do { - buffer[x] = (char) lpBuffer[x]; - } while (buffer[x++] != 0); - // debug("Resource %d:\t%s\n", resID, buffer); - return TRUE; - } - } - } else { - SetLastError(0); - } - return FALSE; -} - -BOOL loadBool(const int resID) { - char boolStr[20] = {0}; - loadString(resID, boolStr); - return strcmp(boolStr, TRUE_STR) == 0; -} - -int loadInt(const int resID) { - char intStr[20] = {0}; - loadString(resID, intStr); - return atoi(intStr); -} - -BOOL regQueryValue(const char* regPath, unsigned char* buffer, - unsigned long bufferLength) { - HKEY hRootKey; - char* key; - char* value; - if (strstr(regPath, HKEY_CLASSES_ROOT_STR) == regPath) { - hRootKey = HKEY_CLASSES_ROOT; - } else if (strstr(regPath, HKEY_CURRENT_USER_STR) == regPath) { - hRootKey = HKEY_CURRENT_USER; - } else if (strstr(regPath, HKEY_LOCAL_MACHINE_STR) == regPath) { - hRootKey = HKEY_LOCAL_MACHINE; - } else if (strstr(regPath, HKEY_USERS_STR) == regPath) { - hRootKey = HKEY_USERS; - } else if (strstr(regPath, HKEY_CURRENT_CONFIG_STR) == regPath) { - hRootKey = HKEY_CURRENT_CONFIG; - } else { - return FALSE; - } - key = strchr(regPath, '\\') + 1; - value = strrchr(regPath, '\\') + 1; - *(value - 1) = 0; - - HKEY hKey; - unsigned long datatype; - BOOL result = FALSE; - if ((wow64 && RegOpenKeyEx(hRootKey, - key, - 0, - KEY_READ | KEY_WOW64_64KEY, - &hKey) == ERROR_SUCCESS) - || RegOpenKeyEx(hRootKey, - key, - 0, - KEY_READ, - &hKey) == ERROR_SUCCESS) { - result = RegQueryValueEx(hKey, value, NULL, &datatype, buffer, &bufferLength) - == ERROR_SUCCESS; - RegCloseKey(hKey); - } - *(value - 1) = '\\'; - return result; -} - -void regSearch(const HKEY hKey, const char* keyName, const int searchType) { - DWORD x = 0; - unsigned long size = BIG_STR; - FILETIME time; - char buffer[BIG_STR] = {0}; - while (RegEnumKeyEx( - hKey, // handle to key to enumerate - x++, // index of subkey to enumerate - buffer, // address of buffer for subkey name - &size, // address for size of subkey buffer - NULL, // reserved - NULL, // address of buffer for class string - NULL, // address for size of class buffer - &time) == ERROR_SUCCESS) { - - if (strcmp(buffer, javaMinVer) >= 0 - && (!*javaMaxVer || strcmp(buffer, javaMaxVer) <= 0) - && strcmp(buffer, foundJavaVer) > 0) { - strcpy(foundJavaVer, buffer); - strcpy(foundJavaKey, keyName); - appendPath(foundJavaKey, buffer); - foundJava = searchType; - debug("Match:\t\t%s\\%s\n", keyName, buffer); - } else { - debug("Ignore:\t\t%s\\%s\n", keyName, buffer); - } - size = BIG_STR; - } -} - -void regSearchWow(const char* keyName, const int searchType) { - HKEY hKey; - debug("64-bit search:\t%s...\n", keyName); - if (wow64 && RegOpenKeyEx(HKEY_LOCAL_MACHINE, - keyName, - 0, - KEY_READ | KEY_WOW64_64KEY, - &hKey) == ERROR_SUCCESS) { - - regSearch(hKey, keyName, searchType | KEY_WOW64_64KEY); - RegCloseKey(hKey); - if ((foundJava & KEY_WOW64_64KEY) != NO_JAVA_FOUND) - { - debug("Using 64-bit runtime.\n"); - return; - } - } - debug("32-bit search:\t%s...\n", keyName); - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, - keyName, - 0, - KEY_READ, - &hKey) == ERROR_SUCCESS) { - regSearch(hKey, keyName, searchType); - RegCloseKey(hKey); - } -} - -void regSearchJreSdk(const char* jreKeyName, const char* sdkKeyName, - const int jdkPreference) { - if (jdkPreference == JDK_ONLY || jdkPreference == PREFER_JDK) { - regSearchWow(sdkKeyName, FOUND_SDK); - if (jdkPreference != JDK_ONLY) { - regSearchWow(jreKeyName, FOUND_JRE); - } - } else { // jdkPreference == JRE_ONLY or PREFER_JRE - regSearchWow(jreKeyName, FOUND_JRE); - if (jdkPreference != JRE_ONLY) { - regSearchWow(sdkKeyName, FOUND_SDK); - } - } -} - -BOOL findJavaHome(char* path, const int jdkPreference) { - regSearchJreSdk("SOFTWARE\\JavaSoft\\Java Runtime Environment", - "SOFTWARE\\JavaSoft\\Java Development Kit", - jdkPreference); - if (foundJava == NO_JAVA_FOUND) { - regSearchJreSdk("SOFTWARE\\IBM\\Java2 Runtime Environment", - "SOFTWARE\\IBM\\Java Development Kit", - jdkPreference); - } - if (foundJava != NO_JAVA_FOUND) { - HKEY hKey; - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, - foundJavaKey, - 0, - KEY_READ | (foundJava & KEY_WOW64_64KEY), - &hKey) == ERROR_SUCCESS) { - unsigned char buffer[BIG_STR] = {0}; - unsigned long bufferlength = BIG_STR; - unsigned long datatype; - if (RegQueryValueEx(hKey, "JavaHome", NULL, &datatype, buffer, - &bufferlength) == ERROR_SUCCESS) { - int i = 0; - do { - path[i] = buffer[i]; - } while (path[i++] != 0); - if (foundJava & FOUND_SDK) { - appendPath(path, "jre"); - } - RegCloseKey(hKey); - return TRUE; - } - RegCloseKey(hKey); - } - } - return FALSE; -} - -/* - * Extract the executable name, returns path length. - */ -int getExePath(char* exePath) { - if (GetModuleFileName(hModule, exePath, _MAX_PATH) == 0) { - return -1; - } - return strrchr(exePath, '\\') - exePath; -} - -void appendPath(char* basepath, const char* path) { - if (basepath[strlen(basepath) - 1] != '\\') { - strcat(basepath, "\\"); - } - strcat(basepath, path); -} - -void appendJavaw(char* jrePath) { - if (console) { - appendPath(jrePath, "bin\\java.exe"); - } else { - appendPath(jrePath, "bin\\javaw.exe"); - } -} - -void appendLauncher(const BOOL setProcName, char* exePath, - const int pathLen, char* cmd) { - if (setProcName) { - char tmpspec[_MAX_PATH]; - char tmpfile[_MAX_PATH]; - strcpy(tmpspec, cmd); - strcat(tmpspec, LAUNCH4J_TMP_DIR); - tmpspec[strlen(tmpspec) - 1] = 0; - if (_stat(tmpspec, &statBuf) == 0) { - // Remove temp launchers and manifests - struct _finddata_t c_file; - long hFile; - appendPath(tmpspec, "*.exe"); - strcpy(tmpfile, cmd); - strcat(tmpfile, LAUNCH4J_TMP_DIR); - char* filename = tmpfile + strlen(tmpfile); - if ((hFile = _findfirst(tmpspec, &c_file)) != -1L) { - do { - strcpy(filename, c_file.name); - debug("Unlink:\t\t%s\n", tmpfile); - _unlink(tmpfile); - strcat(tmpfile, MANIFEST); - debug("Unlink:\t\t%s\n", tmpfile); - _unlink(tmpfile); - } while (_findnext(hFile, &c_file) == 0); - } - _findclose(hFile); - } else { - if (_mkdir(tmpspec) != 0) { - debug("Mkdir failed:\t%s\n", tmpspec); - appendJavaw(cmd); - return; - } - } - char javaw[_MAX_PATH]; - strcpy(javaw, cmd); - appendJavaw(javaw); - strcpy(tmpfile, cmd); - strcat(tmpfile, LAUNCH4J_TMP_DIR); - char* tmpfilename = tmpfile + strlen(tmpfile); - char* exeFilePart = exePath + pathLen + 1; - - // Copy manifest - char manifest[_MAX_PATH] = {0}; - strcpy(manifest, exePath); - strcat(manifest, MANIFEST); - if (_stat(manifest, &statBuf) == 0) { - strcat(tmpfile, exeFilePart); - strcat(tmpfile, MANIFEST); - debug("Copy:\t\t%s -> %s\n", manifest, tmpfile); - CopyFile(manifest, tmpfile, FALSE); - } - - // Copy launcher - strcpy(tmpfilename, exeFilePart); - debug("Copy:\t\t%s -> %s\n", javaw, tmpfile); - if (CopyFile(javaw, tmpfile, FALSE)) { - strcpy(cmd, tmpfile); - return; - } else if (_stat(javaw, &statBuf) == 0) { - long fs = statBuf.st_size; - if (_stat(tmpfile, &statBuf) == 0 && fs == statBuf.st_size) { - debug("Reusing:\t\t%s\n", tmpfile); - strcpy(cmd, tmpfile); - return; - } - } - } - appendJavaw(cmd); -} - -void appendAppClasspath(char* dst, const char* src, const char* classpath) { - strcat(dst, src); - if (*classpath) { - strcat(dst, ";"); - } -} - -BOOL isJrePathOk(const char* path) { - char javaw[_MAX_PATH]; - BOOL result = FALSE; - if (*path) { - strcpy(javaw, path); - appendJavaw(javaw); - result = _stat(javaw, &statBuf) == 0; - } - debug("Check launcher:\t%s %s\n", javaw, result ? "(OK)" : "(n/a)"); - return result; -} - -/* - * Expand environment %variables% - */ -BOOL expandVars(char *dst, const char *src, const char *exePath, const int pathLen) { - char varName[STR]; - char varValue[MAX_VAR_SIZE]; - while (strlen(src) > 0) { - char *start = strchr(src, '%'); - if (start != NULL) { - char *end = strchr(start + 1, '%'); - if (end == NULL) { - return FALSE; - } - // Copy content up to %VAR% - strncat(dst, src, start - src); - // Insert value of %VAR% - *varName = 0; - strncat(varName, start + 1, end - start - 1); - // Remember value start for logging - char *varValue = dst + strlen(dst); - if (strcmp(varName, "EXEDIR") == 0) { - strncat(dst, exePath, pathLen); - } else if (strcmp(varName, "EXEFILE") == 0) { - strcat(dst, exePath); - } else if (strcmp(varName, "PWD") == 0) { - GetCurrentDirectory(_MAX_PATH, dst + strlen(dst)); - } else if (strcmp(varName, "OLDPWD") == 0) { - strcat(dst, oldPwd); - } else if (strstr(varName, HKEY_STR) == varName) { - regQueryValue(varName, dst + strlen(dst), BIG_STR); - } else if (GetEnvironmentVariable(varName, varValue, MAX_VAR_SIZE) > 0) { - strcat(dst, varValue); - } - debug("Substitute:\t%s = %s\n", varName, varValue); - src = end + 1; - } else { - // Copy remaining content - strcat(dst, src); - break; - } - } - return TRUE; -} - -void appendHeapSizes(char *dst) { - MEMORYSTATUS m; - memset(&m, 0, sizeof(m)); - GlobalMemoryStatus(&m); - - appendHeapSize(dst, INITIAL_HEAP_SIZE, INITIAL_HEAP_PERCENT, - m.dwAvailPhys, "-Xms"); - appendHeapSize(dst, MAX_HEAP_SIZE, MAX_HEAP_PERCENT, - m.dwAvailPhys, "-Xmx"); -} - -void appendHeapSize(char *dst, const int absID, const int percentID, - const DWORD freeMemory, const char *option) { - - const int mb = 1048576; // 1 MB - int abs = loadInt(absID); - int percent = loadInt(percentID); - int free = (long long) freeMemory * percent / (100 * mb); // 100% * 1 MB - int size = free > abs ? free : abs; - if (size > 0) { - debug("Heap %s:\t%d MB / %d%%, Free: %d MB, Heap size: %d MB\n", - option, abs, percent, freeMemory / mb, size); - strcat(dst, option); - _itoa(size, dst + strlen(dst), 10); // 10 -- radix - strcat(dst, "m "); - } -} - -int prepare(const char *lpCmdLine) { - char tmp[MAX_ARGS] = {0}; - hModule = GetModuleHandle(NULL); - if (hModule == NULL) { - return FALSE; - } - - // Get executable path - char exePath[_MAX_PATH] = {0}; - int pathLen = getExePath(exePath); - if (pathLen == -1) { - return FALSE; - } - - // Initialize logging - if (strstr(lpCmdLine, "--l4j-debug") != NULL) { - hLog = openLogFile(exePath, pathLen); - if (hLog == NULL) { - return FALSE; - } - debug("\n\nCmdLine:\t%s %s\n", exePath, lpCmdLine); - } - - setWow64Flag(); - - // Set default error message, title and optional support web site url. - loadString(SUPPORT_URL, errUrl); - loadString(ERR_TITLE, errTitle); - if (!loadString(STARTUP_ERR, errMsg)) { - return FALSE; - } - - // Single instance - loadString(MUTEX_NAME, mutexName); - if (*mutexName) { - SECURITY_ATTRIBUTES security; - security.nLength = sizeof(SECURITY_ATTRIBUTES); - security.bInheritHandle = TRUE; - security.lpSecurityDescriptor = NULL; - CreateMutexA(&security, FALSE, mutexName); - if (GetLastError() == ERROR_ALREADY_EXISTS) { - debug("Instance already exists."); - return ERROR_ALREADY_EXISTS; - } - } - - // Working dir - char tmp_path[_MAX_PATH] = {0}; - GetCurrentDirectory(_MAX_PATH, oldPwd); - if (loadString(CHDIR, tmp_path)) { - strncpy(workingDir, exePath, pathLen); - appendPath(workingDir, tmp_path); - _chdir(workingDir); - debug("Working dir:\t%s\n", workingDir); - } - - // Use bundled jre or find java - if (loadString(JRE_PATH, tmp_path)) { - char jrePath[MAX_ARGS] = {0}; - expandVars(jrePath, tmp_path, exePath, pathLen); - debug("Bundled JRE:\t%s\n", jrePath); - if (jrePath[0] == '\\' || jrePath[1] == ':') { - // Absolute - strcpy(cmd, jrePath); - } else { - // Relative - strncpy(cmd, exePath, pathLen); - appendPath(cmd, jrePath); - } - } - if (!isJrePathOk(cmd)) { - if (!loadString(JAVA_MIN_VER, javaMinVer)) { - loadString(BUNDLED_JRE_ERR, errMsg); - return FALSE; - } - loadString(JAVA_MAX_VER, javaMaxVer); - if (!findJavaHome(cmd, loadInt(JDK_PREFERENCE))) { - loadString(JRE_VERSION_ERR, errMsg); - strcat(errMsg, " "); - strcat(errMsg, javaMinVer); - if (*javaMaxVer) { - strcat(errMsg, " - "); - strcat(errMsg, javaMaxVer); - } - loadString(DOWNLOAD_URL, errUrl); - return FALSE; - } - if (!isJrePathOk(cmd)) { - loadString(LAUNCHER_ERR, errMsg); - return FALSE; - } - } - - // Append a path to the Path environment variable - char jreBinPath[_MAX_PATH]; - strcpy(jreBinPath, cmd); - strcat(jreBinPath, "\\bin"); - if (!appendToPathVar(jreBinPath)) { - return FALSE; - } - - // Set environment variables - char envVars[MAX_VAR_SIZE] = {0}; - loadString(ENV_VARIABLES, envVars); - char *var = strtok(envVars, "\t"); - while (var != NULL) { - char *varValue = strchr(var, '='); - *varValue++ = 0; - *tmp = 0; - expandVars(tmp, varValue, exePath, pathLen); - debug("Set var:\t%s = %s\n", var, tmp); - SetEnvironmentVariable(var, tmp); - var = strtok(NULL, "\t"); - } - *tmp = 0; - - // Process priority - priority = loadInt(PRIORITY_CLASS); - - // Custom process name - const BOOL setProcName = loadBool(SET_PROC_NAME) - && strstr(lpCmdLine, "--l4j-default-proc") == NULL; - const BOOL wrapper = loadBool(WRAPPER); - - appendLauncher(setProcName, exePath, pathLen, cmd); - - // Heap sizes - appendHeapSizes(args); - - // JVM options - if (loadString(JVM_OPTIONS, tmp)) { - strcat(tmp, " "); - } else { - *tmp = 0; - } - /* - * Load additional JVM options from .l4j.ini file - * Options are separated by spaces or CRLF - * # starts an inline comment - */ - strncpy(tmp_path, exePath, strlen(exePath) - 3); - strcat(tmp_path, "l4j.ini"); - long hFile; - if ((hFile = _open(tmp_path, _O_RDONLY)) != -1) { - const int jvmOptLen = strlen(tmp); - char* src = tmp + jvmOptLen; - char* dst = src; - const int len = _read(hFile, src, MAX_ARGS - jvmOptLen - BIG_STR); - BOOL copy = TRUE; - int i; - for (i = 0; i < len; i++, src++) { - if (*src == '#') { - copy = FALSE; - } else if (*src == 13 || *src == 10) { - copy = TRUE; - if (dst > tmp && *(dst - 1) != ' ') { - *dst++ = ' '; - } - } else if (copy) { - *dst++ = *src; - } - } - *dst = 0; - if (len > 0 && *(dst - 1) != ' ') { - strcat(tmp, " "); - } - _close(hFile); - } - - // Expand environment %variables% - expandVars(args, tmp, exePath, pathLen); - - // MainClass + Classpath or Jar - char mainClass[STR] = {0}; - char jar[_MAX_PATH] = {0}; - loadString(JAR, jar); - if (loadString(MAIN_CLASS, mainClass)) { - if (!loadString(CLASSPATH, tmp)) { - return FALSE; - } - char exp[MAX_ARGS] = {0}; - expandVars(exp, tmp, exePath, pathLen); - strcat(args, "-classpath \""); - if (wrapper) { - appendAppClasspath(args, exePath, exp); - } else if (*jar) { - appendAppClasspath(args, jar, exp); - } - - // Deal with wildcards or >> strcat(args, exp); << - char* cp = strtok(exp, ";"); - while(cp != NULL) { - debug("Add classpath:\t%s\n", cp); - if (strpbrk(cp, "*?") != NULL) { - int len = strrchr(cp, '\\') - cp + 1; - strncpy(tmp_path, cp, len); - char* filename = tmp_path + len; - *filename = 0; - struct _finddata_t c_file; - long hFile; - if ((hFile = _findfirst(cp, &c_file)) != -1L) { - do { - strcpy(filename, c_file.name); - strcat(args, tmp_path); - strcat(args, ";"); - debug(" \" :\t%s\n", tmp_path); - } while (_findnext(hFile, &c_file) == 0); - } - _findclose(hFile); - } else { - strcat(args, cp); - strcat(args, ";"); - } - cp = strtok(NULL, ";"); - } - *(args + strlen(args) - 1) = 0; - - strcat(args, "\" "); - strcat(args, mainClass); - } else if (wrapper) { - strcat(args, "-jar \""); - strcat(args, exePath); - strcat(args, "\""); - } else { - strcat(args, "-jar \""); - strncat(args, exePath, pathLen); - appendPath(args, jar); - strcat(args, "\""); - } - - // Constant command line args - if (loadString(CMD_LINE, tmp)) { - strcat(args, " "); - strcat(args, tmp); - } - - // Command line args - if (*lpCmdLine) { - strcpy(tmp, lpCmdLine); - char* dst; - while ((dst = strstr(tmp, "--l4j-")) != NULL) { - char* src = strchr(dst, ' '); - if (src == NULL || *(src + 1) == 0) { - *dst = 0; - } else { - strcpy(dst, src + 1); - } - } - if (*tmp) { - strcat(args, " "); - strcat(args, tmp); - } - } - - debug("Launcher:\t%s\n", cmd); - debug("Launcher args:\t%s\n", args); - debug("Args length:\t%d/32768 chars\n", strlen(args)); - return TRUE; -} - -void closeHandles() { - CloseHandle(pi.hThread); - CloseHandle(pi.hProcess); - closeLogFile(); -} - -/* - * Append a path to the Path environment variable - */ -BOOL appendToPathVar(const char* path) { - char chBuf[MAX_VAR_SIZE] = {0}; - - const int pathSize = GetEnvironmentVariable("Path", chBuf, MAX_VAR_SIZE); - if (MAX_VAR_SIZE - pathSize - 1 < strlen(path)) { - return FALSE; - } - strcat(chBuf, ";"); - strcat(chBuf, path); - return SetEnvironmentVariable("Path", chBuf); -} - -DWORD execute(const BOOL wait) { - STARTUPINFO si; - memset(&pi, 0, sizeof(pi)); - memset(&si, 0, sizeof(si)); - si.cb = sizeof(si); - - DWORD dwExitCode = -1; - char cmdline[MAX_ARGS]; - strcpy(cmdline, "\""); - strcat(cmdline, cmd); - strcat(cmdline, "\" "); - strcat(cmdline, args); - if (CreateProcess(NULL, cmdline, NULL, NULL, - TRUE, priority, NULL, NULL, &si, &pi)) { - if (wait) { - WaitForSingleObject(pi.hProcess, INFINITE); - GetExitCodeProcess(pi.hProcess, &dwExitCode); - debug("Exit code:\t%d\n", dwExitCode); - closeHandles(); - } else { - dwExitCode = 0; - } - } - return dwExitCode; -} diff --git a/3rdparty/launch4j/head_src/head.h b/3rdparty/launch4j/head_src/head.h deleted file mode 100644 index 2e3bdb1d0..000000000 --- a/3rdparty/launch4j/head_src/head.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2008 Grzegorz Kowal, - Ian Roberts (jdk preference patch) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#ifndef _LAUNCH4J_HEAD__INCLUDED_ -#define _LAUNCH4J_HEAD__INCLUDED_ - -#define WIN32_LEAN_AND_MEAN // VC - Exclude rarely-used stuff from Windows headers - -// Windows Header Files: -#include - -// C RunTime Header Files -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define NO_JAVA_FOUND 0 -#define FOUND_JRE 1 -#define FOUND_SDK 2 - -#define JRE_ONLY 0 -#define PREFER_JRE 1 -#define PREFER_JDK 2 -#define JDK_ONLY 3 - -#define LAUNCH4J_TMP_DIR "\\launch4j-tmp\\" -#define MANIFEST ".manifest" - -#define KEY_WOW64_64KEY 0x0100 - -#define HKEY_STR "HKEY" -#define HKEY_CLASSES_ROOT_STR "HKEY_CLASSES_ROOT" -#define HKEY_CURRENT_USER_STR "HKEY_CURRENT_USER" -#define HKEY_LOCAL_MACHINE_STR "HKEY_LOCAL_MACHINE" -#define HKEY_USERS_STR "HKEY_USERS" -#define HKEY_CURRENT_CONFIG_STR "HKEY_CURRENT_CONFIG" - -#define STR 128 -#define BIG_STR 1024 -#define MAX_VAR_SIZE 32767 -#define MAX_ARGS 32768 - -#define TRUE_STR "true" -#define FALSE_STR "false" - -#define debug(args...) if (hLog != NULL) fprintf(hLog, ## args); - -typedef void (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); - -FILE* openLogFile(const char* exePath, const int pathLen); -void closeLogFile(); -void msgBox(const char* text); -void signalError(); -BOOL loadString(const int resID, char* buffer); -BOOL loadBool(const int resID); -int loadInt(const int resID); -BOOL regQueryValue(const char* regPath, unsigned char* buffer, - unsigned long bufferLength); -void regSearch(const HKEY hKey, const char* keyName, const int searchType); -void regSearchWow(const char* keyName, const int searchType); -void regSearchJreSdk(const char* jreKeyName, const char* sdkKeyName, - const int jdkPreference); -BOOL findJavaHome(char* path, const int jdkPreference); -int getExePath(char* exePath); -void appendPath(char* basepath, const char* path); -void appendJavaw(char* jrePath); -void appendAppClasspath(char* dst, const char* src, const char* classpath); -BOOL isJrePathOk(const char* path); -BOOL expandVars(char *dst, const char *src, const char *exePath, const int pathLen); -void appendHeapSizes(char *dst); -void appendHeapSize(char *dst, const int absID, const int percentID, - const DWORD freeMemory, const char *option); -int prepare(const char *lpCmdLine); -void closeHandles(); -BOOL appendToPathVar(const char* path); -DWORD execute(const BOOL wait); - -#endif // _LAUNCH4J_HEAD__INCLUDED_ diff --git a/3rdparty/launch4j/head_src/resource.h b/3rdparty/launch4j/head_src/resource.h deleted file mode 100644 index 3c0f73cfc..000000000 --- a/3rdparty/launch4j/head_src/resource.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2008 Grzegorz Kowal - Ian Roberts (jdk preference patch) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -// ICON -#define APP_ICON 1 - -// BITMAP -#define SPLASH_BITMAP 1 - -// RCDATA -#define JRE_PATH 1 -#define JAVA_MIN_VER 2 -#define JAVA_MAX_VER 3 -#define SHOW_SPLASH 4 -#define SPLASH_WAITS_FOR_WINDOW 5 -#define SPLASH_TIMEOUT 6 -#define SPLASH_TIMEOUT_ERR 7 -#define CHDIR 8 -#define SET_PROC_NAME 9 -#define ERR_TITLE 10 -#define GUI_HEADER_STAYS_ALIVE 11 -#define JVM_OPTIONS 12 -#define CMD_LINE 13 -#define JAR 14 -#define MAIN_CLASS 15 -#define CLASSPATH 16 -#define WRAPPER 17 -#define JDK_PREFERENCE 18 -#define ENV_VARIABLES 19 -#define PRIORITY_CLASS 20 -#define DOWNLOAD_URL 21 -#define SUPPORT_URL 22 -#define MUTEX_NAME 23 -#define INSTANCE_WINDOW_TITLE 24 -#define INITIAL_HEAP_SIZE 25 -#define INITIAL_HEAP_PERCENT 26 -#define MAX_HEAP_SIZE 27 -#define MAX_HEAP_PERCENT 28 - -#define STARTUP_ERR 101 -#define BUNDLED_JRE_ERR 102 -#define JRE_VERSION_ERR 103 -#define LAUNCHER_ERR 104 -#define INSTANCE_ALREADY_EXISTS_MSG 105 diff --git a/3rdparty/launch4j/launch4j.exe b/3rdparty/launch4j/launch4j.exe deleted file mode 100644 index 0e2eb2ba5..000000000 Binary files a/3rdparty/launch4j/launch4j.exe and /dev/null differ diff --git a/3rdparty/launch4j/launch4j.jar b/3rdparty/launch4j/launch4j.jar deleted file mode 100644 index ec68ae48d..000000000 Binary files a/3rdparty/launch4j/launch4j.jar and /dev/null differ diff --git a/3rdparty/launch4j/launch4j.jfpr b/3rdparty/launch4j/launch4j.jfpr deleted file mode 100644 index a2e63ebc5..000000000 Binary files a/3rdparty/launch4j/launch4j.jfpr and /dev/null differ diff --git a/3rdparty/launch4j/launch4jc.exe b/3rdparty/launch4j/launch4jc.exe deleted file mode 100644 index 565cc2f07..000000000 Binary files a/3rdparty/launch4j/launch4jc.exe and /dev/null differ diff --git a/3rdparty/launch4j/lib/JGoodies.Forms.LICENSE.txt b/3rdparty/launch4j/lib/JGoodies.Forms.LICENSE.txt deleted file mode 100644 index 9ba2419e7..000000000 --- a/3rdparty/launch4j/lib/JGoodies.Forms.LICENSE.txt +++ /dev/null @@ -1,31 +0,0 @@ - - The BSD License for the JGoodies Forms - ====================================== - -Copyright (c) 2002-2004 JGoodies Karsten Lentzsch. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - o Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - o Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - o Neither the name of JGoodies Karsten Lentzsch nor the names of - its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdparty/launch4j/lib/JGoodies.Looks.LICENSE.txt b/3rdparty/launch4j/lib/JGoodies.Looks.LICENSE.txt deleted file mode 100644 index 8bbefa2eb..000000000 --- a/3rdparty/launch4j/lib/JGoodies.Looks.LICENSE.txt +++ /dev/null @@ -1,31 +0,0 @@ - - The BSD License for the JGoodies Looks - ====================================== - -Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - o Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - o Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - o Neither the name of JGoodies Karsten Lentzsch nor the names of - its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdparty/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt b/3rdparty/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt deleted file mode 100644 index cbee875ba..000000000 --- a/3rdparty/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/3rdparty/launch4j/lib/XStream.LICENSE.txt b/3rdparty/launch4j/lib/XStream.LICENSE.txt deleted file mode 100644 index 5ccad8694..000000000 --- a/3rdparty/launch4j/lib/XStream.LICENSE.txt +++ /dev/null @@ -1,27 +0,0 @@ -(BSD Style License) - -Copyright (c) 2003-2004, Joe Walnes -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of -conditions and the following disclaimer. Redistributions in binary form must reproduce -the above copyright notice, this list of conditions and the following disclaimer in -the documentation and/or other materials provided with the distribution. - -Neither the name of XStream nor the names of its contributors may be used to endorse -or promote products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY -WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. diff --git a/3rdparty/launch4j/lib/commons-beanutils.jar b/3rdparty/launch4j/lib/commons-beanutils.jar deleted file mode 100644 index b1b89c9c9..000000000 Binary files a/3rdparty/launch4j/lib/commons-beanutils.jar and /dev/null differ diff --git a/3rdparty/launch4j/lib/commons-logging.jar b/3rdparty/launch4j/lib/commons-logging.jar deleted file mode 100644 index b73a80fab..000000000 Binary files a/3rdparty/launch4j/lib/commons-logging.jar and /dev/null differ diff --git a/3rdparty/launch4j/lib/commons.LICENSE.txt b/3rdparty/launch4j/lib/commons.LICENSE.txt deleted file mode 100644 index fdb647522..000000000 --- a/3rdparty/launch4j/lib/commons.LICENSE.txt +++ /dev/null @@ -1,50 +0,0 @@ -/* - - ============================================================================ - The Apache Software License, Version 1.1 - ============================================================================ - - Copyright (C) @year@ The Apache Software Foundation. All rights reserved. - - Redistribution and use in source and binary forms, with or without modifica- - tion, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. The end-user documentation included with the redistribution, if any, must - include the following acknowledgment: "This product includes software - developed by the Apache Software Foundation (http://www.apache.org/)." - Alternately, this acknowledgment may appear in the software itself, if - and wherever such third-party acknowledgments normally appear. - - 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be - used to endorse or promote products derived from this software without - prior written permission. For written permission, please contact - apache@apache.org. - - 5. Products derived from this software may not be called "Apache", nor may - "Apache" appear in their name, without prior written permission of the - Apache Software Foundation. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - This software consists of voluntary contributions made by many individuals - on behalf of the Apache Software Foundation and was originally created by - Stefano Mazzocchi . For more information on the Apache - Software Foundation, please see . - -*/ diff --git a/3rdparty/launch4j/lib/forms.jar b/3rdparty/launch4j/lib/forms.jar deleted file mode 100644 index aed060a49..000000000 Binary files a/3rdparty/launch4j/lib/forms.jar and /dev/null differ diff --git a/3rdparty/launch4j/lib/formsrt.jar b/3rdparty/launch4j/lib/formsrt.jar deleted file mode 100644 index e0de6ecf1..000000000 Binary files a/3rdparty/launch4j/lib/formsrt.jar and /dev/null differ diff --git a/3rdparty/launch4j/lib/foxtrot.LICENSE.txt b/3rdparty/launch4j/lib/foxtrot.LICENSE.txt deleted file mode 100644 index 5fa4019d5..000000000 --- a/3rdparty/launch4j/lib/foxtrot.LICENSE.txt +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2002, Simone Bordet & Marco Cravero -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - Neither the name of Foxtrot nor the names of the contributors may be used - to endorse or promote products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdparty/launch4j/lib/foxtrot.jar b/3rdparty/launch4j/lib/foxtrot.jar deleted file mode 100644 index f39103a09..000000000 Binary files a/3rdparty/launch4j/lib/foxtrot.jar and /dev/null differ diff --git a/3rdparty/launch4j/lib/looks.jar b/3rdparty/launch4j/lib/looks.jar deleted file mode 100644 index d2c47c743..000000000 Binary files a/3rdparty/launch4j/lib/looks.jar and /dev/null differ diff --git a/3rdparty/launch4j/lib/xstream.jar b/3rdparty/launch4j/lib/xstream.jar deleted file mode 100644 index 392e1c937..000000000 Binary files a/3rdparty/launch4j/lib/xstream.jar and /dev/null differ diff --git a/3rdparty/launch4j/manifest/uac.exe.manifest b/3rdparty/launch4j/manifest/uac.exe.manifest deleted file mode 100644 index 3041fbc5b..000000000 --- a/3rdparty/launch4j/manifest/uac.exe.manifest +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/3rdparty/launch4j/manifest/xp-themes.exe.manifest b/3rdparty/launch4j/manifest/xp-themes.exe.manifest deleted file mode 100644 index e2c7511f9..000000000 --- a/3rdparty/launch4j/manifest/xp-themes.exe.manifest +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/3rdparty/launch4j/src/images/asterix-o.gif b/3rdparty/launch4j/src/images/asterix-o.gif deleted file mode 100644 index f5cf3b307..000000000 Binary files a/3rdparty/launch4j/src/images/asterix-o.gif and /dev/null differ diff --git a/3rdparty/launch4j/src/images/asterix.gif b/3rdparty/launch4j/src/images/asterix.gif deleted file mode 100644 index ba801670a..000000000 Binary files a/3rdparty/launch4j/src/images/asterix.gif and /dev/null differ diff --git a/3rdparty/launch4j/src/images/build.png b/3rdparty/launch4j/src/images/build.png deleted file mode 100644 index 625285f0b..000000000 Binary files a/3rdparty/launch4j/src/images/build.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/button_ok.png b/3rdparty/launch4j/src/images/button_ok.png deleted file mode 100644 index 5b0f6a617..000000000 Binary files a/3rdparty/launch4j/src/images/button_ok.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/cancel16.png b/3rdparty/launch4j/src/images/cancel16.png deleted file mode 100644 index a432b492c..000000000 Binary files a/3rdparty/launch4j/src/images/cancel16.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/down16.png b/3rdparty/launch4j/src/images/down16.png deleted file mode 100644 index f3bc4cd09..000000000 Binary files a/3rdparty/launch4j/src/images/down16.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/edit_add16.png b/3rdparty/launch4j/src/images/edit_add16.png deleted file mode 100644 index e9485082e..000000000 Binary files a/3rdparty/launch4j/src/images/edit_add16.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/info.png b/3rdparty/launch4j/src/images/info.png deleted file mode 100644 index eb37d9a08..000000000 Binary files a/3rdparty/launch4j/src/images/info.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/new.png b/3rdparty/launch4j/src/images/new.png deleted file mode 100644 index 6e2700ad9..000000000 Binary files a/3rdparty/launch4j/src/images/new.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/new16.png b/3rdparty/launch4j/src/images/new16.png deleted file mode 100644 index f38d02ee5..000000000 Binary files a/3rdparty/launch4j/src/images/new16.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/ok16.png b/3rdparty/launch4j/src/images/ok16.png deleted file mode 100644 index 5b0f6a617..000000000 Binary files a/3rdparty/launch4j/src/images/ok16.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/open.png b/3rdparty/launch4j/src/images/open.png deleted file mode 100644 index a801665fd..000000000 Binary files a/3rdparty/launch4j/src/images/open.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/open16.png b/3rdparty/launch4j/src/images/open16.png deleted file mode 100644 index 5321c17c6..000000000 Binary files a/3rdparty/launch4j/src/images/open16.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/run.png b/3rdparty/launch4j/src/images/run.png deleted file mode 100644 index b41fa2b97..000000000 Binary files a/3rdparty/launch4j/src/images/run.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/save.png b/3rdparty/launch4j/src/images/save.png deleted file mode 100644 index 74b37b0b5..000000000 Binary files a/3rdparty/launch4j/src/images/save.png and /dev/null differ diff --git a/3rdparty/launch4j/src/images/up16.png b/3rdparty/launch4j/src/images/up16.png deleted file mode 100644 index 184c118b6..000000000 Binary files a/3rdparty/launch4j/src/images/up16.png and /dev/null differ diff --git a/3rdparty/launch4j/src/launch4j.properties b/3rdparty/launch4j/src/launch4j.properties deleted file mode 100644 index 463c7a034..000000000 --- a/3rdparty/launch4j/src/launch4j.properties +++ /dev/null @@ -1,2 +0,0 @@ -versionNumber=3.0.1.0 -version=3.0.1 diff --git a/3rdparty/launch4j/src/net/sf/launch4j/Builder.java b/3rdparty/launch4j/src/net/sf/launch4j/Builder.java deleted file mode 100644 index d7badc7f3..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/Builder.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2005-04-24 - */ -package net.sf.launch4j; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.StringTokenizer; - -import net.sf.launch4j.binding.InvariantViolationException; -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.ConfigPersister; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Builder { - private final Log _log; - private final File _basedir; - - public Builder(Log log) { - _log = log; - _basedir = Util.getJarBasedir(); - } - - public Builder(Log log, File basedir) { - _log = log; - _basedir = basedir; - } - - /** - * @return Output file path. - */ - public File build() throws BuilderException { - final Config c = ConfigPersister.getInstance().getConfig(); - try { - c.validate(); - } catch (InvariantViolationException e) { - throw new BuilderException(e.getMessage()); - } - File rc = null; - File ro = null; - File outfile = null; - FileInputStream is = null; - FileOutputStream os = null; - final RcBuilder rcb = new RcBuilder(); - try { - rc = rcb.build(c); - ro = Util.createTempFile("o"); - outfile = ConfigPersister.getInstance().getOutputFile(); - - Cmd resCmd = new Cmd(_basedir); - resCmd.addExe("windres") - .add(Util.WINDOWS_OS ? "--preprocessor=type" : "--preprocessor=cat") - .add("-J rc -O coff -F pe-i386") - .addAbsFile(rc) - .addAbsFile(ro); - _log.append(Messages.getString("Builder.compiling.resources")); - resCmd.exec(_log); - - Cmd ldCmd = new Cmd(_basedir); - ldCmd.addExe("ld") - .add("-mi386pe") - .add("--oformat pei-i386") - .add((c.getHeaderType().equals(Config.GUI_HEADER)) - ? "--subsystem windows" : "--subsystem console") - .add("-s") // strip symbols - .addFiles(c.getHeaderObjects()) - .addAbsFile(ro) - .addFiles(c.getLibs()) - .add("-o") - .addAbsFile(outfile); - _log.append(Messages.getString("Builder.linking")); - ldCmd.exec(_log); - - if (!c.isDontWrapJar()) { - _log.append(Messages.getString("Builder.wrapping")); - int len; - byte[] buffer = new byte[1024]; - is = new FileInputStream(Util.getAbsoluteFile( - ConfigPersister.getInstance().getConfigPath(), c.getJar())); - os = new FileOutputStream(outfile, true); - while ((len = is.read(buffer)) > 0) { - os.write(buffer, 0, len); - } - } - _log.append(Messages.getString("Builder.success") + outfile.getPath()); - return outfile; - } catch (IOException e) { - Util.delete(outfile); - _log.append(e.getMessage()); - throw new BuilderException(e); - } catch (ExecException e) { - Util.delete(outfile); - String msg = e.getMessage(); - if (msg != null && msg.indexOf("windres") != -1) { - if (e.getErrLine() != -1) { - _log.append(Messages.getString("Builder.line.has.errors", - String.valueOf(e.getErrLine()))); - _log.append(rcb.getLine(e.getErrLine())); - } else { - _log.append(Messages.getString("Builder.generated.resource.file")); - _log.append(rcb.getContent()); - } - } - throw new BuilderException(e); - } finally { - Util.close(is); - Util.close(os); - Util.delete(rc); - Util.delete(ro); - } - } -} - -class Cmd { - private final List _cmd = new ArrayList(); - private final File _basedir; - private final File _bindir; - - public Cmd(File basedir) { - _basedir = basedir; - String path = System.getProperty("launch4j.bindir"); - if (path == null) { - _bindir = new File(basedir, "bin"); - } else { - File bindir = new File(path); - _bindir = bindir.isAbsolute() ? bindir : new File(basedir, path); - } - } - - public Cmd add(String s) { - StringTokenizer st = new StringTokenizer(s); - while (st.hasMoreTokens()) { - _cmd.add(st.nextToken()); - } - return this; - } - - public Cmd addAbsFile(File file) { - _cmd.add(file.getPath()); - return this; - } - - public Cmd addFile(String pathname) { - _cmd.add(new File(_basedir, pathname).getPath()); - return this; - } - - public Cmd addExe(String pathname) { - if (Util.WINDOWS_OS) { - pathname += ".exe"; - } - _cmd.add(new File(_bindir, pathname).getPath()); - return this; - } - - public Cmd addFiles(List files) { - for (Iterator iter = files.iterator(); iter.hasNext();) { - addFile((String) iter.next()); - } - return this; - } - - public void exec(Log log) throws ExecException { - String[] cmd = (String[]) _cmd.toArray(new String[_cmd.size()]); - Util.exec(cmd, log); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/BuilderException.java b/3rdparty/launch4j/src/net/sf/launch4j/BuilderException.java deleted file mode 100644 index a84c2e279..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/BuilderException.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 13, 2005 - */ -package net.sf.launch4j; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class BuilderException extends Exception { - public BuilderException() {} - - public BuilderException(Throwable t) { - super(t); - } - - public BuilderException(String msg) { - super(msg); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/ExecException.java b/3rdparty/launch4j/src/net/sf/launch4j/ExecException.java deleted file mode 100644 index 236ae780f..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/ExecException.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 14, 2005 - */ -package net.sf.launch4j; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class ExecException extends Exception { - private final int _errLine; - - public ExecException(Throwable t, int errLine) { - super(t); - _errLine = errLine; - } - - public ExecException(Throwable t) { - this(t, -1); - } - - public ExecException(String msg, int errLine) { - super(msg); - _errLine = errLine; - } - - public ExecException(String msg) { - this(msg, -1); - } - - public int getErrLine() { - return _errLine; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/FileChooserFilter.java b/3rdparty/launch4j/src/net/sf/launch4j/FileChooserFilter.java deleted file mode 100644 index 5199a6deb..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/FileChooserFilter.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2004-01-15 - */ -package net.sf.launch4j; - -import java.io.File; - -import javax.swing.filechooser.FileFilter; - -/** - * @author Copyright (C) 2004 Grzegorz Kowal - */ -public class FileChooserFilter extends FileFilter { - String _description; - String[] _extensions; - - public FileChooserFilter(String description, String extension) { - _description = description; - _extensions = new String[] {extension}; - } - - public FileChooserFilter(String description, String[] extensions) { - _description = description; - _extensions = extensions; - } - - public boolean accept(File f) { - if (f.isDirectory()) { - return true; - } - String ext = Util.getExtension(f); - for (int i = 0; i < _extensions.length; i++) { - if (ext.toLowerCase().equals(_extensions[i].toLowerCase())) { - return true; - } - } - return false; - } - - public String getDescription() { - return _description; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/Log.java b/3rdparty/launch4j/src/net/sf/launch4j/Log.java deleted file mode 100644 index c4d591b0c..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/Log.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 12, 2005 - */ -package net.sf.launch4j; - -import javax.swing.JTextArea; -import javax.swing.SwingUtilities; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public abstract class Log { - private static final Log _consoleLog = new ConsoleLog(); - private static final Log _antLog = new AntLog(); - - public abstract void clear(); - public abstract void append(String line); - - public static Log getConsoleLog() { - return _consoleLog; - } - - public static Log getAntLog() { - return _antLog; - } - - public static Log getSwingLog(JTextArea textArea) { - return new SwingLog(textArea); - } -} - -class ConsoleLog extends Log { - public void clear() { - System.out.println("\n"); - } - - public void append(String line) { - System.out.println("launch4j: " + line); - } -} - -class AntLog extends Log { - public void clear() { - System.out.println("\n"); - } - - public void append(String line) { - System.out.println(line); - } -} - -class SwingLog extends Log { - private final JTextArea _textArea; - - public SwingLog(JTextArea textArea) { - _textArea = textArea; - } - - public void clear() { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - _textArea.setText(""); - }}); - } - - public void append(final String line) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - _textArea.append(line + "\n"); - }}); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/Main.java b/3rdparty/launch4j/src/net/sf/launch4j/Main.java deleted file mode 100644 index 45f84ad79..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/Main.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2008 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 21, 2005 - */ -package net.sf.launch4j; - -import java.io.File; -import java.io.InputStream; -import java.util.Properties; - -import net.sf.launch4j.config.ConfigPersister; -import net.sf.launch4j.formimpl.MainFrame; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Main { - private static String _name; - private static String _description; - - public static void main(String[] args) { - try { - Properties props = new Properties(); - InputStream in = Main.class.getClassLoader() - .getResourceAsStream("launch4j.properties"); - props.load(in); - in.close(); - setDescription(props); - - if (args.length == 0) { - ConfigPersister.getInstance().createBlank(); - MainFrame.createInstance(); - } else if (args.length == 1 && !args[0].startsWith("-")) { - ConfigPersister.getInstance().load(new File(args[0])); - Builder b = new Builder(Log.getConsoleLog()); - b.build(); - } else { - System.out.println(_description - + Messages.getString("Main.usage") - + ": launch4j config.xml"); - } - } catch (Exception e) { - Log.getConsoleLog().append(e.getMessage()); - } - } - - public static String getName() { - return _name; - } - - public static String getDescription() { - return _description; - } - - private static void setDescription(Properties props) { - _name = "Launch4j " + props.getProperty("version"); - _description = _name + - " (http://launch4j.sourceforge.net/)\n" + - "Cross-platform Java application wrapper" + - " for creating Windows native executables.\n\n" + - "Copyright (C) 2004, 2008 Grzegorz Kowal\n\n" + - "Launch4j comes with ABSOLUTELY NO WARRANTY.\n" + - "This is free software, licensed under the BSD License.\n" + - "This product includes software developed by the Apache Software Foundation" + - " (http://www.apache.org/)."; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/Messages.java b/3rdparty/launch4j/src/net/sf/launch4j/Messages.java deleted file mode 100644 index 35d4c8950..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/Messages.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j; - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - private static final MessageFormat FORMATTER = new MessageFormat(""); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } - - public static String getString(String key, String arg0) { - return getString(key, new Object[] {arg0}); - } - - public static String getString(String key, String arg0, String arg1) { - return getString(key, new Object[] {arg0, arg1}); - } - - public static String getString(String key, String arg0, String arg1, String arg2) { - return getString(key, new Object[] {arg0, arg1, arg2}); - } - - public static String getString(String key, Object[] args) { - try { - FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); - return FORMATTER.format(args); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/OptionParser.java b/3rdparty/launch4j/src/net/sf/launch4j/OptionParser.java deleted file mode 100644 index bb2432c8e..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/OptionParser.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2005-04-24 - */ -package net.sf.launch4j; - -//import net.sf.launch4j.config.Config; - -//import org.apache.commons.cli.CommandLine; -//import org.apache.commons.cli.CommandLineParser; -//import org.apache.commons.cli.HelpFormatter; -//import org.apache.commons.cli.Options; -//import org.apache.commons.cli.ParseException; -//import org.apache.commons.cli.PosixParser; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class OptionParser { - -// private final Options _options; -// -// public OptionParser() { -// _options = new Options(); -// _options.addOption("h", "header", true, "header"); -// } -// -// public Config parse(Config c, String[] args) throws ParseException { -// CommandLineParser parser = new PosixParser(); -// CommandLine cl = parser.parse(_options, args); -// c.setJar(getFile(props, Config.JAR)); -// c.setOutfile(getFile(props, Config.OUTFILE)); -// } -// -// public void printHelp() { -// HelpFormatter formatter = new HelpFormatter(); -// formatter.printHelp("launch4j", _options); -// } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/RcBuilder.java b/3rdparty/launch4j/src/net/sf/launch4j/RcBuilder.java deleted file mode 100644 index f8885e3e6..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/RcBuilder.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2005-04-24 - */ -package net.sf.launch4j; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.List; - -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.ConfigPersister; -import net.sf.launch4j.config.Jre; -import net.sf.launch4j.config.Msg; -import net.sf.launch4j.config.Splash; -import net.sf.launch4j.config.VersionInfo; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class RcBuilder { - - // winnt.h - public static final int LANG_NEUTRAL = 0; - public static final int SUBLANG_NEUTRAL = 0; - public static final int SUBLANG_DEFAULT = 1; - public static final int SUBLANG_SYS_DEFAULT = 2; - - // MANIFEST - public static final int MANIFEST = 1; - - // ICON - public static final int APP_ICON = 1; - - // BITMAP - public static final int SPLASH_BITMAP = 1; - - // RCDATA - public static final int JRE_PATH = 1; - public static final int JAVA_MIN_VER = 2; - public static final int JAVA_MAX_VER = 3; - public static final int SHOW_SPLASH = 4; - public static final int SPLASH_WAITS_FOR_WINDOW = 5; - public static final int SPLASH_TIMEOUT = 6; - public static final int SPLASH_TIMEOUT_ERR = 7; - public static final int CHDIR = 8; - public static final int SET_PROC_NAME = 9; - public static final int ERR_TITLE = 10; - public static final int GUI_HEADER_STAYS_ALIVE = 11; - public static final int JVM_OPTIONS = 12; - public static final int CMD_LINE = 13; - public static final int JAR = 14; - public static final int MAIN_CLASS = 15; - public static final int CLASSPATH = 16; - public static final int WRAPPER = 17; - public static final int JDK_PREFERENCE = 18; - public static final int ENV_VARIABLES = 19; - public static final int PRIORITY_CLASS = 20; - public static final int DOWNLOAD_URL = 21; - public static final int SUPPORT_URL = 22; - public static final int MUTEX_NAME = 23; - public static final int INSTANCE_WINDOW_TITLE = 24; - public static final int INITIAL_HEAP_SIZE = 25; - public static final int INITIAL_HEAP_PERCENT = 26; - public static final int MAX_HEAP_SIZE = 27; - public static final int MAX_HEAP_PERCENT = 28; - - public static final int STARTUP_ERR = 101; - public static final int BUNDLED_JRE_ERR = 102; - public static final int JRE_VERSION_ERR = 103; - public static final int LAUNCHER_ERR = 104; - public static final int INSTANCE_ALREADY_EXISTS_MSG = 105; - - private final StringBuffer _sb = new StringBuffer(); - - public String getContent() { - return _sb.toString(); - } - - public String getLine(int line) { - return _sb.toString().split("\n")[line - 1]; - } - - public File build(Config c) throws IOException { - _sb.append("LANGUAGE "); - _sb.append(LANG_NEUTRAL); - _sb.append(", "); - _sb.append(SUBLANG_DEFAULT); - _sb.append('\n'); - addVersionInfo(c.getVersionInfo()); - addJre(c.getJre()); - addManifest(MANIFEST, c.getManifest()); - addIcon(APP_ICON, c.getIcon()); - addText(ERR_TITLE, c.getErrTitle()); - addText(DOWNLOAD_URL, c.getDownloadUrl()); - addText(SUPPORT_URL, c.getSupportUrl()); - addText(CMD_LINE, c.getCmdLine()); - addWindowsPath(CHDIR, c.getChdir()); - addText(PRIORITY_CLASS, String.valueOf(c.getPriorityClass())); - addTrue(SET_PROC_NAME, c.isCustomProcName()); - addTrue(GUI_HEADER_STAYS_ALIVE, c.isStayAlive()); - addSplash(c.getSplash()); - addMessages(c); - - if (c.getSingleInstance() != null) { - addText(MUTEX_NAME, c.getSingleInstance().getMutexName()); - addText(INSTANCE_WINDOW_TITLE, c.getSingleInstance().getWindowTitle()); - } - - if (c.getVariables() != null && !c.getVariables().isEmpty()) { - StringBuffer vars = new StringBuffer(); - append(vars, c.getVariables(), "\t"); - addText(ENV_VARIABLES, vars.toString()); - } - - // MAIN_CLASS / JAR - addTrue(WRAPPER, !c.isDontWrapJar()); - if (c.getClassPath() != null) { - addText(MAIN_CLASS, c.getClassPath().getMainClass()); - addWindowsPath(CLASSPATH, c.getClassPath().getPathsString()); - } - if (c.isDontWrapJar() && c.getJar() != null) { - addWindowsPath(JAR, c.getJar().getPath()); - } - - File f = Util.createTempFile("rc"); - BufferedWriter w = new BufferedWriter(new FileWriter(f)); - w.write(_sb.toString()); - w.close(); - return f; - } - - private void addVersionInfo(VersionInfo v) { - if (v == null) { - return; - } - _sb.append("1 VERSIONINFO\n"); - _sb.append("FILEVERSION "); - _sb.append(v.getFileVersion().replaceAll("\\.", ", ")); - _sb.append("\nPRODUCTVERSION "); - _sb.append(v.getProductVersion().replaceAll("\\.", ", ")); - _sb.append("\nFILEFLAGSMASK 0\n" + - "FILEOS 0x40000\n" + - "FILETYPE 1\n" + - "{\n" + - " BLOCK \"StringFileInfo\"\n" + - " {\n" + - " BLOCK \"040904E4\"\n" + // English - " {\n"); - addVerBlockValue("CompanyName", v.getCompanyName()); - addVerBlockValue("FileDescription", v.getFileDescription()); - addVerBlockValue("FileVersion", v.getTxtFileVersion()); - addVerBlockValue("InternalName", v.getInternalName()); - addVerBlockValue("LegalCopyright", v.getCopyright()); - addVerBlockValue("OriginalFilename", v.getOriginalFilename()); - addVerBlockValue("ProductName", v.getProductName()); - addVerBlockValue("ProductVersion", v.getTxtProductVersion()); - _sb.append(" }\n }\nBLOCK \"VarFileInfo\"\n{\nVALUE \"Translation\", 0x0409, 0x04E4\n}\n}"); - } - - private void addJre(Jre jre) { - addWindowsPath(JRE_PATH, jre.getPath()); - addText(JAVA_MIN_VER, jre.getMinVersion()); - addText(JAVA_MAX_VER, jre.getMaxVersion()); - addText(JDK_PREFERENCE, String.valueOf(jre.getJdkPreferenceIndex())); - addInteger(INITIAL_HEAP_SIZE, jre.getInitialHeapSize()); - addInteger(INITIAL_HEAP_PERCENT, jre.getInitialHeapPercent()); - addInteger(MAX_HEAP_SIZE, jre.getMaxHeapSize()); - addInteger(MAX_HEAP_PERCENT, jre.getMaxHeapPercent()); - - StringBuffer options = new StringBuffer(); - if (jre.getOptions() != null && !jre.getOptions().isEmpty()) { - addSpace(options); - append(options, jre.getOptions(), " "); - } - addText(JVM_OPTIONS, options.toString()); - } - - private void addSplash(Splash splash) { - if (splash == null) { - return; - } - addTrue(SHOW_SPLASH, true); - addTrue(SPLASH_WAITS_FOR_WINDOW, splash.getWaitForWindow()); - addText(SPLASH_TIMEOUT, String.valueOf(splash.getTimeout())); - addTrue(SPLASH_TIMEOUT_ERR, splash.isTimeoutErr()); - addBitmap(SPLASH_BITMAP, splash.getFile()); - } - - private void addMessages(Config c) { - Msg msg = c.getMessages(); - if (msg == null) { - msg = new Msg(); - } - addText(STARTUP_ERR, msg.getStartupErr()); - addText(BUNDLED_JRE_ERR, msg.getBundledJreErr()); - addText(JRE_VERSION_ERR, msg.getJreVersionErr()); - addText(LAUNCHER_ERR, msg.getLauncherErr()); - if (c.getSingleInstance() != null) { - addText(INSTANCE_ALREADY_EXISTS_MSG, msg.getInstanceAlreadyExistsMsg()); - } - } - - private void append(StringBuffer sb, List list, String separator) { - for (int i = 0; i < list.size(); i++) { - sb.append(list.get(i)); - if (i < list.size() - 1) { - sb.append(separator); - } - } - } - - private void addText(int id, String text) { - if (text == null || text.equals("")) { - return; - } - _sb.append(id); - _sb.append(" RCDATA BEGIN \""); - _sb.append(escape(text)); - _sb.append("\\0\" END\n"); - } - - private void addTrue(int id, boolean value) { - if (value) { - addText(id, "true"); - } - } - - private void addInteger(int id, Integer value) { - if (value != null) { - addText(id, value.toString()); - } - } - - /** - * Stores path in Windows format with '\' separators. - */ - private void addWindowsPath(int id, String path) { - if (path == null || path.equals("")) { - return; - } - _sb.append(id); - _sb.append(" RCDATA BEGIN \""); - _sb.append(path.replaceAll("\\\\", "\\\\\\\\") - .replaceAll("/", "\\\\\\\\")); - _sb.append("\\0\" END\n"); - } - - private void addManifest(int id, File manifest) { - if (manifest == null || manifest.getPath().equals("")) { - return; - } - _sb.append(id); - _sb.append(" 24 \""); - _sb.append(getPath(Util.getAbsoluteFile( - ConfigPersister.getInstance().getConfigPath(), manifest))); - _sb.append("\"\n"); - } - - private void addIcon(int id, File icon) { - if (icon == null || icon.getPath().equals("")) { - return; - } - _sb.append(id); - _sb.append(" ICON DISCARDABLE \""); - _sb.append(getPath(Util.getAbsoluteFile( - ConfigPersister.getInstance().getConfigPath(), icon))); - _sb.append("\"\n"); - } - - private void addBitmap(int id, File bitmap) { - if (bitmap == null) { - return; - } - _sb.append(id); - _sb.append(" BITMAP \""); - _sb.append(getPath(Util.getAbsoluteFile( - ConfigPersister.getInstance().getConfigPath(), bitmap))); - _sb.append("\"\n"); - } - - private String getPath(File f) { - return f.getPath().replaceAll("\\\\", "\\\\\\\\"); - } - - private void addSpace(StringBuffer sb) { - int len = sb.length(); - if (len-- > 0 && sb.charAt(len) != ' ') { - sb.append(' '); - } - } - - private void addVerBlockValue(String key, String value) { - _sb.append(" VALUE \""); - _sb.append(key); - _sb.append("\", \""); - if (value != null) { - _sb.append(escape(value)); - } - _sb.append("\"\n"); - } - - private String escape(String text) { - return text.replaceAll("\"", "\"\""); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/Util.java b/3rdparty/launch4j/src/net/sf/launch4j/Util.java deleted file mode 100644 index f3bf2456d..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/Util.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2005-04-24 - */ -package net.sf.launch4j; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Util { - public static final boolean WINDOWS_OS = System.getProperty("os.name") - .toLowerCase().startsWith("windows"); - - private Util() {} - - public static File createTempFile(String suffix) throws IOException { - String tmpdir = System.getProperty("launch4j.tmpdir"); - if (tmpdir != null) { - if (tmpdir.indexOf(' ') != -1) { - throw new IOException(Messages.getString("Util.tmpdir")); - } - return File.createTempFile("launch4j", suffix, new File(tmpdir)); - } else { - return File.createTempFile("launch4j", suffix); - } - } - - /** - * Returns the base directory of a jar file or null if the class is a standalone file. - * @return System specific path - * - * Based on a patch submitted by Josh Elsasser - */ - public static File getJarBasedir() { - String url = Util.class.getClassLoader() - .getResource(Util.class.getName().replace('.', '/') + ".class") - .getFile() - .replaceAll("%20", " "); - if (url.startsWith("file:")) { - String jar = url.substring(5, url.lastIndexOf('!')); - int x = jar.lastIndexOf('/'); - if (x == -1) { - x = jar.lastIndexOf('\\'); - } - String basedir = jar.substring(0, x + 1); - return new File(basedir); - } else { - return new File("."); - } - } - - public static File getAbsoluteFile(File basepath, File f) { - return f.isAbsolute() ? f : new File(basepath, f.getPath()); - } - - public static String getExtension(File f) { - String name = f.getName(); - int x = name.lastIndexOf('.'); - if (x != -1) { - return name.substring(x); - } else { - return ""; - } - } - - public static void exec(String[] cmd, Log log) throws ExecException { - BufferedReader is = null; - try { - if (WINDOWS_OS) { - for (int i = 0; i < cmd.length; i++) { - cmd[i] = cmd[i].replaceAll("/", "\\\\"); - } - } - Process p = Runtime.getRuntime().exec(cmd); - is = new BufferedReader(new InputStreamReader(p.getErrorStream())); - String line; - int errLine = -1; - Pattern pattern = Pattern.compile(":\\d+:"); - while ((line = is.readLine()) != null) { - log.append(line); - Matcher matcher = pattern.matcher(line); - if (matcher.find()) { - errLine = Integer.valueOf( - line.substring(matcher.start() + 1, matcher.end() - 1)) - .intValue(); - if (line.matches("(?i).*unrecognized escape sequence")) { - log.append(Messages.getString("Util.use.double.backslash")); - } - break; - } - } - is.close(); - p.waitFor(); - if (errLine != -1) { - throw new ExecException(Messages.getString("Util.exec.failed") - + ": " + cmd, errLine); - } - if (p.exitValue() != 0) { - throw new ExecException(Messages.getString("Util.exec.failed") - + "(" + p.exitValue() + "): " + cmd); - } - } catch (IOException e) { - close(is); - throw new ExecException(e); - } catch (InterruptedException e) { - close(is); - throw new ExecException(e); - } - } - - public static void close(final InputStream o) { - if (o != null) { - try { - o.close(); - } catch (IOException e) { - System.err.println(e); // XXX log - } - } - } - - public static void close(final OutputStream o) { - if (o != null) { - try { - o.close(); - } catch (IOException e) { - System.err.println(e); // XXX log - } - } - } - - public static void close(final Reader o) { - if (o != null) { - try { - o.close(); - } catch (IOException e) { - System.err.println(e); // XXX log - } - } - } - - public static void close(final Writer o) { - if (o != null) { - try { - o.close(); - } catch (IOException e) { - System.err.println(e); // XXX log - } - } - } - - public static boolean delete(File f) { - return (f != null) ? f.delete() : false; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/ant/AntClassPath.java b/3rdparty/launch4j/src/net/sf/launch4j/ant/AntClassPath.java deleted file mode 100644 index a67bab91f..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/ant/AntClassPath.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jul 19, 2006 - */ -package net.sf.launch4j.ant; - -import java.util.ArrayList; -import java.util.List; - -import net.sf.launch4j.config.ClassPath; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class AntClassPath extends ClassPath { - private final List wrappedPaths = new ArrayList(); - - public void setCp(String cp){ - wrappedPaths.add(cp); - } - - public void addCp(StringWrapper cp) { - wrappedPaths.add(cp); - } - - public void unwrap() { - setPaths(StringWrapper.unwrap(wrappedPaths)); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/ant/AntConfig.java b/3rdparty/launch4j/src/net/sf/launch4j/ant/AntConfig.java deleted file mode 100644 index 4482436a9..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/ant/AntConfig.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 24, 2005 - */ -package net.sf.launch4j.ant; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.tools.ant.BuildException; - -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.Msg; -import net.sf.launch4j.config.SingleInstance; -import net.sf.launch4j.config.Splash; -import net.sf.launch4j.config.VersionInfo; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class AntConfig extends Config { - private final List wrappedHeaderObjects = new ArrayList(); - private final List wrappedLibs = new ArrayList(); - private final List wrappedVariables = new ArrayList(); - - public void setJarPath(String path) { - setJar(new File(path)); - } - - public void addObj(StringWrapper obj) { - wrappedHeaderObjects.add(obj); - } - - public void addLib(StringWrapper lib) { - wrappedLibs.add(lib); - } - - public void addVar(StringWrapper var) { - wrappedVariables.add(var); - } - - // __________________________________________________________________________________ - - public void addSingleInstance(SingleInstance singleInstance) { - checkNull(getSingleInstance(), "singleInstance"); - setSingleInstance(singleInstance); - } - - public void addClassPath(AntClassPath classPath) { - checkNull(getClassPath(), "classPath"); - setClassPath(classPath); - } - - public void addJre(AntJre jre) { - checkNull(getJre(), "jre"); - setJre(jre); - } - - public void addSplash(Splash splash) { - checkNull(getSplash(), "splash"); - setSplash(splash); - } - - public void addVersionInfo(VersionInfo versionInfo) { - checkNull(getVersionInfo(), "versionInfo"); - setVersionInfo(versionInfo); - } - - public void addMessages(Msg messages) { - checkNull(getMessages(), "messages"); - setMessages(messages); - } - - // __________________________________________________________________________________ - - public void unwrap() { - setHeaderObjects(StringWrapper.unwrap(wrappedHeaderObjects)); - setLibs(StringWrapper.unwrap(wrappedLibs)); - setVariables(StringWrapper.unwrap(wrappedVariables)); - if (getClassPath() != null) { - ((AntClassPath) getClassPath()).unwrap(); - } - if (getJre() != null) { - ((AntJre) getJre()).unwrap(); - } - } - - private void checkNull(Object o, String name) { - if (o != null) { - throw new BuildException( - Messages.getString("AntConfig.duplicate.element") - + ": " - + name); - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/ant/AntJre.java b/3rdparty/launch4j/src/net/sf/launch4j/ant/AntJre.java deleted file mode 100644 index b83e3ee02..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/ant/AntJre.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jul 18, 2006 - */ -package net.sf.launch4j.ant; - -import java.util.ArrayList; -import java.util.List; - -import net.sf.launch4j.config.Jre; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class AntJre extends Jre { - private final List wrappedOptions = new ArrayList(); - - public void addOpt(StringWrapper opt) { - wrappedOptions.add(opt); - } - - public void unwrap() { - setOptions(StringWrapper.unwrap(wrappedOptions)); - } - - /** - * For backwards compatibility. - */ - public void setDontUsePrivateJres(boolean dontUse) { - if (dontUse) { - setJdkPreference(JDK_PREFERENCE_JRE_ONLY); - } - else { - setJdkPreference(JDK_PREFERENCE_PREFER_JRE); - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java b/3rdparty/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java deleted file mode 100644 index a28287698..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 24, 2005 - */ -package net.sf.launch4j.ant; - -import java.io.File; - -import net.sf.launch4j.Builder; -import net.sf.launch4j.BuilderException; -import net.sf.launch4j.Log; -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.ConfigPersister; -import net.sf.launch4j.config.ConfigPersisterException; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Launch4jTask extends Task { - private File _configFile; - private AntConfig _config; - - // System properties - private File tmpdir; // launch4j.tmpdir - private File bindir; // launch4j.bindir - - // Override configFile settings - private File jar; - private File outfile; - private String fileVersion; - private String txtFileVersion; - private String productVersion; - private String txtProductVersion; - - public void execute() throws BuildException { - try { - if (tmpdir != null) { - System.setProperty("launch4j.tmpdir", tmpdir.getPath()); - } - if (bindir != null) { - System.setProperty("launch4j.bindir", bindir.getPath()); - } - if (_configFile != null && _config != null) { - throw new BuildException( - Messages.getString("Launch4jTask.specify.config")); - } else if (_configFile != null) { - ConfigPersister.getInstance().load(_configFile); - Config c = ConfigPersister.getInstance().getConfig(); - if (jar != null) { - c.setJar(jar); - } - if (outfile != null) { - c.setOutfile(outfile); - } - if (fileVersion != null) { - c.getVersionInfo().setFileVersion(fileVersion); - } - if (txtFileVersion != null) { - c.getVersionInfo().setTxtFileVersion(txtFileVersion); - } - if (productVersion != null) { - c.getVersionInfo().setProductVersion(productVersion); - } - if (txtProductVersion != null) { - c.getVersionInfo().setTxtProductVersion(txtProductVersion); - } - } else if (_config != null) { - _config.unwrap(); - ConfigPersister.getInstance().setAntConfig(_config, - getProject().getBaseDir()); - } else { - throw new BuildException( - Messages.getString("Launch4jTask.specify.config")); - } - final Builder b = new Builder(Log.getAntLog()); - b.build(); - } catch (ConfigPersisterException e) { - throw new BuildException(e); - } catch (BuilderException e) { - throw new BuildException(e); - } - } - - public void setConfigFile(File configFile) { - _configFile = configFile; - } - - public void addConfig(AntConfig config) { - _config = config; - } - - public void setBindir(File bindir) { - this.bindir = bindir; - } - - public void setTmpdir(File tmpdir) { - this.tmpdir = tmpdir; - } - - public void setFileVersion(String fileVersion) { - this.fileVersion = fileVersion; - } - - public void setJar(File jar) { - this.jar = jar; - } - - public void setJarPath(String path) { - this.jar = new File(path); - } - - public void setOutfile(File outfile) { - this.outfile = outfile; - } - - public void setProductVersion(String productVersion) { - this.productVersion = productVersion; - } - - public void setTxtFileVersion(String txtFileVersion) { - this.txtFileVersion = txtFileVersion; - } - - public void setTxtProductVersion(String txtProductVersion) { - this.txtProductVersion = txtProductVersion; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/ant/Messages.java b/3rdparty/launch4j/src/net/sf/launch4j/ant/Messages.java deleted file mode 100644 index 0f823f7af..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/ant/Messages.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.ant; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.ant.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/ant/StringWrapper.java b/3rdparty/launch4j/src/net/sf/launch4j/ant/StringWrapper.java deleted file mode 100644 index 6d38af1a5..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/ant/StringWrapper.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jul 18, 2006 - */ -package net.sf.launch4j.ant; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class StringWrapper { - private String text; - - public static List unwrap(List wrappers) { - if (wrappers.isEmpty()) { - return null; - } - List strings = new ArrayList(wrappers.size()); - for (Iterator iter = wrappers.iterator(); iter.hasNext();) { - strings.add(iter.next().toString()); - } - return strings; - } - - public void addText(String text) { - this.text = text; - } - - public String toString() { - return text; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/ant/messages.properties b/3rdparty/launch4j/src/net/sf/launch4j/ant/messages.properties deleted file mode 100644 index 9666633c2..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/ant/messages.properties +++ /dev/null @@ -1,35 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Launch4jTask.specify.config=Specify configFile or config -AntConfig.duplicate.element=Duplicate element diff --git a/3rdparty/launch4j/src/net/sf/launch4j/ant/messages_es.properties b/3rdparty/launch4j/src/net/sf/launch4j/ant/messages_es.properties deleted file mode 100644 index 9211e8e03..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/ant/messages_es.properties +++ /dev/null @@ -1,35 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Launch4jTask.specify.config=Specify configFile or config -AntConfig.duplicate.element=Duplicate element diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/Binding.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/Binding.java deleted file mode 100644 index 49c9b45ff..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/Binding.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 30, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public interface Binding { - /** Used to mark components with invalid data. */ - public final static Color INVALID_COLOR = Color.PINK; - - /** Java Bean property bound to a component */ - public String getProperty(); - /** Clear component, set it to the default value */ - public void clear(IValidatable bean); - /** Java Bean property -> Component */ - public void put(IValidatable bean); - /** Component -> Java Bean property */ - public void get(IValidatable bean); - /** Mark component as valid */ - public void markValid(); - /** Mark component as invalid */ - public void markInvalid(); - /** Enable or disable the component */ - public void setEnabled(boolean enabled); -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/BindingException.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/BindingException.java deleted file mode 100644 index 15dc10cc0..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/BindingException.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 30, 2005 - */ -package net.sf.launch4j.binding; - -/** - * Signals a runtime error, a missing property in a Java Bean for example. - * - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class BindingException extends RuntimeException { - public BindingException(Throwable t) { - super(t); - } - - public BindingException(String msg) { - super(msg); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/Bindings.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/Bindings.java deleted file mode 100644 index 73f507e49..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/Bindings.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 30, 2005 - */ -package net.sf.launch4j.binding; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JRadioButton; -import javax.swing.JTextArea; -import javax.swing.JToggleButton; -import javax.swing.text.JTextComponent; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * Creates and handles bindings. - * - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Bindings implements PropertyChangeListener { - private final Map _bindings = new HashMap(); - private final Map _optComponents = new HashMap(); - private boolean _modified = false; - - /** - * Used to track component modifications. - */ - public void propertyChange(PropertyChangeEvent evt) { - String prop = evt.getPropertyName(); - if ("AccessibleValue".equals(prop) - || "AccessibleText".equals(prop) - || "AccessibleVisibleData".equals(prop)) { - _modified = true; - } - } - - /** - * Any of the components modified? - */ - public boolean isModified() { - return _modified; - } - - public Binding getBinding(String property) { - return (Binding) _bindings.get(property); - } - - private void registerPropertyChangeListener(JComponent c) { - c.getAccessibleContext().addPropertyChangeListener(this); - } - - private void registerPropertyChangeListener(JComponent[] cs) { - for (int i = 0; i < cs.length; i++) { - cs[i].getAccessibleContext().addPropertyChangeListener(this); - } - } - - private boolean isPropertyNull(IValidatable bean, Binding b) { - try { - for (Iterator iter = _optComponents.keySet().iterator(); iter.hasNext();) { - String property = (String) iter.next(); - if (b.getProperty().startsWith(property)) { - return PropertyUtils.getProperty(bean, property) == null; - } - } - return false; - } catch (Exception e) { - throw new BindingException(e); - } - } - - /** - * Enables or disables all components bound to properties that begin with given prefix. - */ - public void setComponentsEnabled(String prefix, boolean enabled) { - for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) { - Binding b = (Binding) iter.next(); - if (b.getProperty().startsWith(prefix)) { - b.setEnabled(enabled); - } - } - } - - /** - * Clear all components, set them to their default values. - * Clears the _modified flag. - */ - public void clear(IValidatable bean) { - for (Iterator iter = _optComponents.values().iterator(); iter.hasNext();) { - ((Binding) iter.next()).clear(bean); - } - for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) { - ((Binding) iter.next()).clear(bean); - } - _modified = false; - } - - /** - * Copies data from the Java Bean to the UI components. - * Clears the _modified flag. - */ - public void put(IValidatable bean) { - for (Iterator iter = _optComponents.values().iterator(); iter.hasNext();) { - ((Binding) iter.next()).put(bean); - } - for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) { - Binding b = (Binding) iter.next(); - if (isPropertyNull(bean, b)) { - b.clear(null); - } else { - b.put(bean); - } - } - _modified = false; - } - - /** - * Copies data from UI components to the Java Bean and checks it's class invariants. - * Clears the _modified flag. - * @throws InvariantViolationException - * @throws BindingException - */ - public void get(IValidatable bean) { - try { - for (Iterator iter = _optComponents.values().iterator(); iter.hasNext();) { - ((Binding) iter.next()).get(bean); - } - for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) { - Binding b = (Binding) iter.next(); - if (!isPropertyNull(bean, b)) { - b.get(bean); - } - } - bean.checkInvariants(); - for (Iterator iter = _optComponents.keySet().iterator(); iter.hasNext();) { - String property = (String) iter.next(); - IValidatable component = (IValidatable) PropertyUtils.getProperty(bean, - property); - if (component != null) { - component.checkInvariants(); - } - } - _modified = false; // XXX - } catch (InvariantViolationException e) { - e.setBinding(getBinding(e.getProperty())); - throw e; - } catch (Exception e) { - throw new BindingException(e); - } - } - - private Bindings add(Binding b) { - if (_bindings.containsKey(b.getProperty())) { - throw new BindingException(Messages.getString("Bindings.duplicate.binding")); - } - _bindings.put(b.getProperty(), b); - return this; - } - - /** - * Add an optional (nullable) Java Bean component of type clazz. - */ - public Bindings addOptComponent(String property, Class clazz, JToggleButton c, - boolean enabledByDefault) { - Binding b = new OptComponentBinding(this, property, clazz, c, enabledByDefault); - if (_optComponents.containsKey(property)) { - throw new BindingException(Messages.getString("Bindings.duplicate.binding")); - } - _optComponents.put(property, b); - return this; - } - - /** - * Add an optional (nullable) Java Bean component of type clazz. - */ - public Bindings addOptComponent(String property, Class clazz, JToggleButton c) { - return addOptComponent(property, clazz, c, false); - } - - /** - * Handles JEditorPane, JTextArea, JTextField - */ - public Bindings add(String property, JTextComponent c, String defaultValue) { - registerPropertyChangeListener(c); - return add(new JTextComponentBinding(property, c, defaultValue)); - } - - /** - * Handles JEditorPane, JTextArea, JTextField - */ - public Bindings add(String property, JTextComponent c) { - registerPropertyChangeListener(c); - return add(new JTextComponentBinding(property, c, "")); - } - - /** - * Handles JToggleButton, JCheckBox - */ - public Bindings add(String property, JToggleButton c, boolean defaultValue) { - registerPropertyChangeListener(c); - return add(new JToggleButtonBinding(property, c, defaultValue)); - } - - /** - * Handles JToggleButton, JCheckBox - */ - public Bindings add(String property, JToggleButton c) { - registerPropertyChangeListener(c); - return add(new JToggleButtonBinding(property, c, false)); - } - - /** - * Handles JRadioButton - */ - public Bindings add(String property, JRadioButton[] cs, int defaultValue) { - registerPropertyChangeListener(cs); - return add(new JRadioButtonBinding(property, cs, defaultValue)); - } - - /** - * Handles JRadioButton - */ - public Bindings add(String property, JRadioButton[] cs) { - registerPropertyChangeListener(cs); - return add(new JRadioButtonBinding(property, cs, 0)); - } - - /** - * Handles JTextArea - */ - public Bindings add(String property, JTextArea textArea, String defaultValue) { - registerPropertyChangeListener(textArea); - return add(new JTextComponentBinding(property, textArea, defaultValue)); - } - - /** - * Handles JTextArea lists - */ - public Bindings add(String property, JTextArea textArea) { - registerPropertyChangeListener(textArea); - return add(new JTextAreaBinding(property, textArea)); - } - - /** - * Handles Optional JTextArea lists - */ - public Bindings add(String property, String stateProperty, - JToggleButton button, JTextArea textArea) { - registerPropertyChangeListener(button); - registerPropertyChangeListener(textArea); - return add(new OptJTextAreaBinding(property, stateProperty, button, textArea)); - } - - /** - * Handles JList - */ - public Bindings add(String property, JList list) { - registerPropertyChangeListener(list); - return add(new JListBinding(property, list)); - } - - /** - * Handles JComboBox - */ - public Bindings add(String property, JComboBox combo, int defaultValue) { - registerPropertyChangeListener(combo); - return add(new JComboBoxBinding(property, combo, defaultValue)); - } - - /** - * Handles JComboBox - */ - public Bindings add(String property, JComboBox combo) { - registerPropertyChangeListener(combo); - return add(new JComboBoxBinding(property, combo, 0)); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/IValidatable.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/IValidatable.java deleted file mode 100644 index fe0dd4862..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/IValidatable.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2004-01-30 - */ -package net.sf.launch4j.binding; - -/** - * @author Copyright (C) 2004 Grzegorz Kowal - */ -public interface IValidatable { - public void checkInvariants(); -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java deleted file mode 100644 index 2f7f88b1d..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jun 23, 2003 - */ -package net.sf.launch4j.binding; - -/** - * @author Copyright (C) 2003 Grzegorz Kowal - */ -public class InvariantViolationException extends RuntimeException { - private final String _property; - private Binding _binding; - - public InvariantViolationException(String msg) { - super(msg); - _property = null; - } - - public InvariantViolationException(String property, String msg) { - super(msg); - _property = property; - } - - public String getProperty() { - return _property; - } - - public Binding getBinding() { - return _binding; - } - - public void setBinding(Binding binding) { - _binding = binding; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java deleted file mode 100644 index 81d6ff28e..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2007 Ian Roberts - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 10, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; - -import javax.swing.JComboBox; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2007 Ian Roberts - */ -public class JComboBoxBinding implements Binding { - private final String _property; - private final JComboBox _combo; - private final int _defaultValue; - private final Color _validColor; - - public JComboBoxBinding(String property, JComboBox combo, int defaultValue) { - if (property == null || combo == null) { - throw new NullPointerException(); - } - if (property.equals("") - || combo.getItemCount() == 0 - || defaultValue < 0 || defaultValue >= combo.getItemCount()) { - throw new IllegalArgumentException(); - } - _property = property; - _combo = combo; - _defaultValue = defaultValue; - _validColor = combo.getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - select(_defaultValue); - } - - public void put(IValidatable bean) { - try { - Integer i = (Integer) PropertyUtils.getProperty(bean, _property); - if (i == null) { - throw new BindingException( - Messages.getString("JComboBoxBinding.property.null")); - } - select(i.intValue()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - PropertyUtils.setProperty(bean, _property, new Integer(_combo.getSelectedIndex())); - return; - } catch (Exception e) { - throw new BindingException(e); - } - } - - private void select(int index) { - if (index < 0 || index >= _combo.getItemCount()) { - throw new BindingException( - Messages.getString("JComboBoxBinding.index.out.of.bounds")); - } - _combo.setSelectedIndex(index); - } - - public void markValid() { - _combo.setBackground(_validColor); - _combo.requestFocusInWindow(); - } - - public void markInvalid() { - _combo.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _combo.setEnabled(enabled); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/JListBinding.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/JListBinding.java deleted file mode 100644 index 31dec58c1..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/JListBinding.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.swing.DefaultListModel; -import javax.swing.JList; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class JListBinding implements Binding { - private final String _property; - private final JList _list; - private final Color _validColor; - - public JListBinding(String property, JList list) { - if (property == null || list == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - _property = property; - _list = list; - _validColor = _list.getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - _list.setModel(new DefaultListModel()); - } - - public void put(IValidatable bean) { - try { - DefaultListModel model = new DefaultListModel(); - List list = (List) PropertyUtils.getProperty(bean, _property); - if (list != null) { - for (Iterator iter = list.iterator(); iter.hasNext();) { - model.addElement(iter.next()); - } - } - _list.setModel(model); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - DefaultListModel model = (DefaultListModel) _list.getModel(); - final int size = model.getSize(); - List list = new ArrayList(size); - for (int i = 0; i < size; i++) { - list.add(model.get(i)); - } - PropertyUtils.setProperty(bean, _property, list); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() { - _list.setBackground(_validColor); - _list.requestFocusInWindow(); - } - - public void markInvalid() { - _list.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _list.setEnabled(enabled); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java deleted file mode 100644 index 9d922bedf..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 10, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; - -import javax.swing.JRadioButton; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class JRadioButtonBinding implements Binding { - private final String _property; - private final JRadioButton[] _buttons; - private final int _defaultValue; - private final Color _validColor; - - public JRadioButtonBinding(String property, JRadioButton[] buttons, int defaultValue) { - if (property == null || buttons == null) { - throw new NullPointerException(); - } - for (int i = 0; i < buttons.length; i++) { - if (buttons[i] == null) { - throw new NullPointerException(); - } - } - if (property.equals("") - || buttons.length == 0 - || defaultValue < 0 || defaultValue >= buttons.length) { - throw new IllegalArgumentException(); - } - _property = property; - _buttons = buttons; - _defaultValue = defaultValue; - _validColor = buttons[0].getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - select(_defaultValue); - } - - public void put(IValidatable bean) { - try { - Integer i = (Integer) PropertyUtils.getProperty(bean, _property); - if (i == null) { - throw new BindingException( - Messages.getString("JRadioButtonBinding.property.null")); - } - select(i.intValue()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - for (int i = 0; i < _buttons.length; i++) { - if (_buttons[i].isSelected()) { - PropertyUtils.setProperty(bean, _property, new Integer(i)); - return; - } - } - throw new BindingException( - Messages.getString("JRadioButtonBinding.nothing.selected")); - } catch (Exception e) { - throw new BindingException(e); - } - } - - private void select(int index) { - if (index < 0 || index >= _buttons.length) { - throw new BindingException( - Messages.getString("JRadioButtonBinding.index.out.of.bounds")); - } - _buttons[index].setSelected(true); - } - - public void markValid() { - for (int i = 0; i < _buttons.length; i++) { - if (_buttons[i].isSelected()) { - _buttons[i].setBackground(_validColor); - _buttons[i].requestFocusInWindow(); - return; - } - } - throw new BindingException( - Messages.getString("JRadioButtonBinding.nothing.selected")); - } - - public void markInvalid() { - for (int i = 0; i < _buttons.length; i++) { - if (_buttons[i].isSelected()) { - _buttons[i].setBackground(Binding.INVALID_COLOR); - return; - } - } - throw new BindingException( - Messages.getString("JRadioButtonBinding.nothing.selected")); - } - - public void setEnabled(boolean enabled) { - for (int i = 0; i < _buttons.length; i++) { - _buttons[i].setEnabled(enabled); - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java deleted file mode 100644 index d4e8a2c65..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jun 14, 2006 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.JTextArea; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class JTextAreaBinding implements Binding { - private final String _property; - private final JTextArea _textArea; - private final Color _validColor; - - public JTextAreaBinding(String property, JTextArea textArea) { - if (property == null || textArea == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - _property = property; - _textArea = textArea; - _validColor = _textArea.getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - put(bean); - } - - public void put(IValidatable bean) { - try { - List list = (List) PropertyUtils.getProperty(bean, _property); - StringBuffer sb = new StringBuffer(); - if (list != null) { - for (int i = 0; i < list.size(); i++) { - sb.append(list.get(i)); - if (i < list.size() - 1) { - sb.append("\n"); - } - } - } - _textArea.setText(sb.toString()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - String text = _textArea.getText(); - if (!text.equals("")) { - String[] items = text.split("\n"); - List list = new ArrayList(); - for (int i = 0; i < items.length; i++) { - list.add(items[i]); - } - PropertyUtils.setProperty(bean, _property, list); - } else { - PropertyUtils.setProperty(bean, _property, null); - } - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() { - _textArea.setBackground(_validColor); - _textArea.requestFocusInWindow(); - } - - public void markInvalid() { - _textArea.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _textArea.setEnabled(enabled); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java deleted file mode 100644 index 6b0dd1b0b..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 30, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; - -import javax.swing.text.JTextComponent; - -import org.apache.commons.beanutils.BeanUtils; - -/** - * Handles JEditorPane, JTextArea, JTextField - * - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class JTextComponentBinding implements Binding { - private final String _property; - private final JTextComponent _textComponent; - private final String _defaultValue; - private final Color _validColor; - - public JTextComponentBinding(String property, JTextComponent textComponent, - String defaultValue) { - if (property == null || textComponent == null || defaultValue == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - _property = property; - _textComponent = textComponent; - _defaultValue = defaultValue; - _validColor = _textComponent.getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - _textComponent.setText(_defaultValue); - } - - public void put(IValidatable bean) { - try { - String s = BeanUtils.getProperty(bean, _property); - // XXX displays zeros as blank - _textComponent.setText(s != null && !s.equals("0") ? s : ""); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - BeanUtils.setProperty(bean, _property, _textComponent.getText()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() { - _textComponent.setBackground(_validColor); - _textComponent.requestFocusInWindow(); - } - - public void markInvalid() { - _textComponent.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _textComponent.setEnabled(enabled); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java deleted file mode 100644 index a7055cccc..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 30, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; - -import javax.swing.JToggleButton; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * Handles JToggleButton, JCheckBox - * - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class JToggleButtonBinding implements Binding { - private final String _property; - private final JToggleButton _button; - private final boolean _defaultValue; - private final Color _validColor; - - public JToggleButtonBinding(String property, JToggleButton button, - boolean defaultValue) { - if (property == null || button == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - _property = property; - _button = button; - _defaultValue = defaultValue; - _validColor = _button.getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - _button.setSelected(_defaultValue); - } - - public void put(IValidatable bean) { - try { - Boolean b = (Boolean) PropertyUtils.getProperty(bean, _property); - _button.setSelected(b != null && b.booleanValue()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - PropertyUtils.setProperty(bean, _property, - Boolean.valueOf(_button.isSelected())); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() { - _button.setBackground(_validColor); - _button.requestFocusInWindow(); - } - - public void markInvalid() { - _button.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _button.setEnabled(enabled); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/Messages.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/Messages.java deleted file mode 100644 index 91ddff2b1..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/Messages.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.binding; - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.binding.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - private static final MessageFormat FORMATTER = new MessageFormat(""); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } - - public static String getString(String key, String arg0) { - return getString(key, new Object[] {arg0}); - } - - public static String getString(String key, String arg0, String arg1) { - return getString(key, new Object[] {arg0, arg1}); - } - - public static String getString(String key, String arg0, String arg1, String arg2) { - return getString(key, new Object[] {arg0, arg1, arg2}); - } - - public static String getString(String key, Object[] args) { - try { - FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); - return FORMATTER.format(args); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java deleted file mode 100644 index b573da628..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 11, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Arrays; - -import javax.swing.JToggleButton; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class OptComponentBinding implements Binding, ActionListener { - private final Bindings _bindings; - private final String _property; - private final Class _clazz; - private final JToggleButton _button; - private final boolean _enabledByDefault; - - public OptComponentBinding(Bindings bindings, String property, Class clazz, - JToggleButton button, boolean enabledByDefault) { - if (property == null || clazz == null || button == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - if (!Arrays.asList(clazz.getInterfaces()).contains(IValidatable.class)) { - throw new IllegalArgumentException( - Messages.getString("OptComponentBinding.must.implement") - + IValidatable.class); - } - _bindings = bindings; - _property = property; - _clazz = clazz; - _button = button; - _button.addActionListener(this); - _enabledByDefault = enabledByDefault; - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - _button.setSelected(_enabledByDefault); - updateComponents(); - } - - public void put(IValidatable bean) { - try { - Object component = PropertyUtils.getProperty(bean, _property); - _button.setSelected(component != null); - updateComponents(); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - PropertyUtils.setProperty(bean, _property, _button.isSelected() - ? _clazz.newInstance() : null); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() {} - - public void markInvalid() {} - - public void setEnabled(boolean enabled) {} // XXX implement? - - public void actionPerformed(ActionEvent e) { - updateComponents(); - } - - private void updateComponents() { - _bindings.setComponentsEnabled(_property, _button.isSelected()); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java deleted file mode 100644 index 3cea776d7..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Sep 3, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.JTextArea; -import javax.swing.JToggleButton; - -import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class OptJTextAreaBinding implements Binding, ActionListener { - private final String _property; - private final String _stateProperty; - private final JToggleButton _button; - private final JTextArea _textArea; - private final Color _validColor; - - public OptJTextAreaBinding(String property, String stateProperty, - JToggleButton button, JTextArea textArea) { - if (property == null || button == null || textArea == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - _property = property; - _stateProperty = stateProperty; - _button = button; - _textArea = textArea; - _validColor = _textArea.getBackground(); - button.addActionListener(this); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - put(bean); - } - - public void put(IValidatable bean) { - try { - boolean selected = "true".equals(BeanUtils.getProperty(bean, - _stateProperty)); - _button.setSelected(selected); - _textArea.setEnabled(selected); - List list = (List) PropertyUtils.getProperty(bean, _property); - StringBuffer sb = new StringBuffer(); - if (list != null) { - for (int i = 0; i < list.size(); i++) { - sb.append(list.get(i)); - if (i < list.size() - 1) { - sb.append("\n"); - } - } - } - _textArea.setText(sb.toString()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - String text = _textArea.getText(); - if (_button.isSelected() && !text.equals("")) { - String[] items = text.split("\n"); - List list = new ArrayList(); - for (int i = 0; i < items.length; i++) { - list.add(items[i]); - } - PropertyUtils.setProperty(bean, _property, list); - } else { - PropertyUtils.setProperty(bean, _property, null); - } - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() { - _textArea.setBackground(_validColor); - _textArea.requestFocusInWindow(); - } - - public void markInvalid() { - _textArea.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _textArea.setEnabled(enabled); - } - - public void actionPerformed(ActionEvent e) { - _textArea.setEnabled(_button.isSelected()); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/Validator.java b/3rdparty/launch4j/src/net/sf/launch4j/binding/Validator.java deleted file mode 100644 index 88ea67c33..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/Validator.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2004-01-30 - */ -package net.sf.launch4j.binding; - -import java.io.File; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -import net.sf.launch4j.Util; -import net.sf.launch4j.config.ConfigPersister; - -/** - * @author Copyright (C) 2004 Grzegorz Kowal - */ -public class Validator { - public static final String ALPHANUMERIC_PATTERN = "[\\w]*?"; - public static final String ALPHA_PATTERN = "[\\w&&\\D]*?"; - public static final String NUMERIC_PATTERN = "[\\d]*?"; - public static final String PATH_PATTERN = "[\\w|[ .,:\\-/\\\\]]*?"; - - public static final int MAX_STR = 128; - public static final int MAX_PATH = 260; - public static final int MAX_BIG_STR = 8192; // or 16384; - public static final int MAX_ARGS = 32767 - 2048; - - private Validator() {} - - public static boolean isEmpty(String s) { - return s == null || s.equals(""); - } - - public static void checkNotNull(Object o, String property, String name) { - if (o == null) { - signalViolation(property, - Messages.getString("Validator.empty.field", name)); - } - } - - public static void checkString(String s, int maxLength, String property, - String name) { - if (s == null || s.length() == 0) { - signalViolation(property, - Messages.getString("Validator.empty.field", name)); - } - if (s.length() > maxLength) { - signalLengthViolation(property, name, maxLength); - } - } - - public static void checkOptStrings(List strings, int maxLength, int totalMaxLength, - String property, String name) { - if (strings == null) { - return; - } - int totalLength = 0; - for (Iterator iter = strings.iterator(); iter.hasNext();) { - String s = (String) iter.next(); - checkString(s, maxLength, property, name); - totalLength += s.length(); - if (totalLength > totalMaxLength) { - signalLengthViolation(property, name, totalMaxLength); - } - } - } - - public static void checkString(String s, int maxLength, String pattern, - String property, String name) { - checkString(s, maxLength, property, name); - if (!s.matches(pattern)) { - signalViolation(property, - Messages.getString("Validator.invalid.data", name)); - } - } - - public static void checkOptStrings(List strings, int maxLength, int totalMaxLength, - String pattern, String property, String name, String msg) { - if (strings == null) { - return; - } - int totalLength = 0; - for (Iterator iter = strings.iterator(); iter.hasNext();) { - String s = (String) iter.next(); - checkString(s, maxLength, property, name); - if (!s.matches(pattern)) { - signalViolation(property, msg != null - ? msg - : Messages.getString("Validator.invalid.data", name)); - } - totalLength += s.length(); - if (totalLength > totalMaxLength) { - signalLengthViolation(property, name, totalMaxLength); - } - } - } - - public static void checkOptString(String s, int maxLength, String property, - String name) { - if (s == null || s.length() == 0) { - return; - } - if (s.length() > maxLength) { - signalLengthViolation(property, name, maxLength); - } - } - - public static void checkOptString(String s, int maxLength, String pattern, - String property, String name) { - if (s == null || s.length() == 0) { - return; - } - if (s.length() > maxLength) { - signalLengthViolation(property, name, maxLength); - } - if (!s.matches(pattern)) { - signalViolation(property, - Messages.getString("Validator.invalid.data", name)); - } - } - - public static void checkRange(int value, int min, int max, - String property, String name) { - if (value < min || value > max) { - signalViolation(property, - Messages.getString("Validator.must.be.in.range", name, - String.valueOf(min), String.valueOf(max))); - } - } - - public static void checkRange(char value, char min, char max, - String property, String name) { - if (value < min || value > max) { - signalViolation(property, Messages.getString("Validator.must.be.in.range", - name, String.valueOf(min), String.valueOf(max))); - } - } - - public static void checkMin(int value, int min, String property, String name) { - if (value < min) { - signalViolation(property, - Messages.getString("Validator.must.be.at.least", name, - String.valueOf(min))); - } - } - - public static void checkIn(String s, String[] strings, String property, - String name) { - if (isEmpty(s)) { - signalViolation(property, - Messages.getString("Validator.empty.field", name)); - } - List list = Arrays.asList(strings); - if (!list.contains(s)) { - signalViolation(property, - Messages.getString("Validator.invalid.option", name, list.toString())); - } - } - - public static void checkTrue(boolean condition, String property, String msg) { - if (!condition) { - signalViolation(property, msg); - } - } - - public static void checkFalse(boolean condition, String property, String msg) { - if (condition) { - signalViolation(property, msg); - } - } - - public static void checkElementsNotNullUnique(Collection c, String property, - String msg) { - if (c.contains(null) - || new HashSet(c).size() != c.size()) { - signalViolation(property, - Messages.getString("Validator.already.exists", msg)); - } - } - - public static void checkElementsUnique(Collection c, String property, String msg) { - if (new HashSet(c).size() != c.size()) { - signalViolation(property, - Messages.getString("Validator.already.exists", msg)); - } - } - - public static void checkFile(File f, String property, String fileDescription) { - File cfgPath = ConfigPersister.getInstance().getConfigPath(); - if (f == null - || f.getPath().equals("") - || (!f.exists() && !Util.getAbsoluteFile(cfgPath, f).exists())) { - signalViolation(property, - Messages.getString("Validator.doesnt.exist", fileDescription)); - } - } - - public static void checkOptFile(File f, String property, String fileDescription) { - if (f != null && f.getPath().length() > 0) { - checkFile(f, property, fileDescription); - } - } - - public static void checkRelativeWinPath(String path, String property, String msg) { - if (path == null - || path.equals("") - || path.startsWith("/") - || path.startsWith("\\") - || path.indexOf(':') != -1) { - signalViolation(property, msg); - } - } - - public static void signalLengthViolation(String property, String name, - int maxLength) { - signalViolation(property, - Messages.getString("Validator.exceeds.max.length", name, - String.valueOf(maxLength))); - } - - public static void signalViolation(String property, String msg) { - throw new InvariantViolationException(property, msg); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/messages.properties b/3rdparty/launch4j/src/net/sf/launch4j/binding/messages.properties deleted file mode 100644 index adb5a8886..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/messages.properties +++ /dev/null @@ -1,52 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -OptComponentBinding.must.implement=Optional component must implement - -Validator.empty.field=Enter: {0} -Validator.invalid.data=Invalid data: {0} -Validator.must.be.in.range={0} must be in range [{1}-{2}] -Validator.must.be.at.least={0} must be at least -Validator.already.exists={0} already exists. -Validator.doesnt.exist={0} doesn''t exist. -Validator.exceeds.max.length={0} exceeds the maximum length of {1} characters. -Validator.invalid.option={0} must be one of [{1}] - -Bindings.duplicate.binding=Duplicate binding - -JRadioButtonBinding.property.null=Property is null -JRadioButtonBinding.nothing.selected=Nothing selected -JRadioButtonBinding.index.out.of.bounds=Button index out of bounds - -JComboBoxBinding.property.null=Property is null -JComboBoxBinding.index.out.of.bounds=Combo box index out of bounds diff --git a/3rdparty/launch4j/src/net/sf/launch4j/binding/messages_es.properties b/3rdparty/launch4j/src/net/sf/launch4j/binding/messages_es.properties deleted file mode 100644 index e2e50fcb4..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/binding/messages_es.properties +++ /dev/null @@ -1,51 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -OptComponentBinding.must.implement=El componente opcional debe ser implementado - -Validator.empty.field=Introduzca: {0} -Validator.invalid.data=Dato no válido: {0} -Validator.must.be.in.range={0} debe estar en el rango [{1}-{2}] -Validator.must.be.at.least={0} deb ser al menos -Validator.already.exists={0} ya existe. -Validator.doesnt.exist={0} no existe. -Validator.exceeds.max.length={0} excede la longitud máxima de {1} caracteres. -Validator.invalid.option={0} must be one of [{1}] - -Bindings.duplicate.binding=Binding duplicado - -JRadioButtonBinding.property.null=La propiedad es nula -JRadioButtonBinding.nothing.selected=Nada seleccionado -JRadioButtonBinding.index.out.of.bounds=Índice de botón fuera de límite -JComboBoxBinding.property.null=Property is null -JComboBoxBinding.index.out.of.bounds=Combo box index out of bounds diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/ClassPath.java b/3rdparty/launch4j/src/net/sf/launch4j/config/ClassPath.java deleted file mode 100644 index da7dbd6c4..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/ClassPath.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.config; - -import java.util.List; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class ClassPath implements IValidatable { - private String mainClass; - private List paths; - - public void checkInvariants() { - Validator.checkString(mainClass, Validator.MAX_PATH, "mainClass", - Messages.getString("ClassPath.mainClass")); - Validator.checkOptStrings(paths, - Validator.MAX_PATH, - Validator.MAX_BIG_STR, - "paths", - Messages.getString("ClassPath.path")); - } - - public String getMainClass() { - return mainClass; - } - - public void setMainClass(String mainClass) { - this.mainClass = mainClass; - } - - public List getPaths() { - return paths; - } - - public void setPaths(List paths) { - this.paths = paths; - } - - public String getPathsString() { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < paths.size(); i++) { - sb.append(paths.get(i)); - if (i < paths.size() - 1) { - sb.append(';'); - } - } - return sb.toString(); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/Config.java b/3rdparty/launch4j/src/net/sf/launch4j/config/Config.java deleted file mode 100644 index 27633bfb4..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/Config.java +++ /dev/null @@ -1,396 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 21, 2005 - */ -package net.sf.launch4j.config; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Config implements IValidatable { - - // 1.x config properties_____________________________________________________________ - public static final String HEADER = "header"; - public static final String JAR = "jar"; - public static final String OUTFILE = "outfile"; - public static final String ERR_TITLE = "errTitle"; - public static final String JAR_ARGS = "jarArgs"; - public static final String CHDIR = "chdir"; - public static final String CUSTOM_PROC_NAME = "customProcName"; - public static final String STAY_ALIVE = "stayAlive"; - public static final String ICON = "icon"; - - // __________________________________________________________________________________ - public static final String DOWNLOAD_URL = "http://java.com/download"; - - public static final String GUI_HEADER = "gui"; - public static final String CONSOLE_HEADER = "console"; - - private static final String[] HEADER_TYPES = new String[] { GUI_HEADER, - CONSOLE_HEADER }; - - private static final String[] PRIORITY_CLASS_NAMES = new String[] { "normal", - "idle", - "high" }; - - private static final int[] PRIORITY_CLASSES = new int[] { 0x00000020, - 0x00000040, - 0x00000080 }; - - private boolean dontWrapJar; - private String headerType = GUI_HEADER; - private List headerObjects; - private List libs; - private File jar; - private File outfile; - - // Runtime header configuration - private String errTitle; - private String cmdLine; - private String chdir; - private String priority; - private String downloadUrl; - private String supportUrl; - private boolean customProcName; - private boolean stayAlive; - private File manifest; - private File icon; - private List variables; - private SingleInstance singleInstance; - private ClassPath classPath; - private Jre jre; - private Splash splash; - private VersionInfo versionInfo; - private Msg messages; - - public void checkInvariants() { - Validator.checkTrue(outfile != null && outfile.getPath().endsWith(".exe"), - "outfile", Messages.getString("Config.specify.output.exe")); - if (dontWrapJar) { - if (jar != null && !jar.getPath().equals("")) { - Validator.checkRelativeWinPath(jar.getPath(), "jar", - Messages.getString("Config.application.jar.path")); - } else { - Validator.checkTrue(classPath != null, "classPath", - Messages.getString("ClassPath.or.jar")); - } - } else { - Validator.checkFile(jar, "jar", - Messages.getString("Config.application.jar")); - } - if (!Validator.isEmpty(chdir)) { - Validator.checkRelativeWinPath(chdir, "chdir", - Messages.getString("Config.chdir.relative")); - Validator.checkFalse(chdir.toLowerCase().equals("true") - || chdir.toLowerCase().equals("false"), - "chdir", Messages.getString("Config.chdir.path")); - } - Validator.checkOptFile(manifest, "manifest", Messages.getString("Config.manifest")); - Validator.checkOptFile(icon, "icon", Messages.getString("Config.icon")); - Validator.checkOptString(cmdLine, Validator.MAX_BIG_STR, "jarArgs", - Messages.getString("Config.jar.arguments")); - Validator.checkOptString(errTitle, Validator.MAX_STR, "errTitle", - Messages.getString("Config.error.title")); - Validator.checkOptString(downloadUrl, 256, - "downloadUrl", Messages.getString("Config.download.url")); - Validator.checkOptString(supportUrl, 256, - "supportUrl", Messages.getString("Config.support.url")); - Validator.checkIn(getHeaderType(), HEADER_TYPES, "headerType", - Messages.getString("Config.header.type")); - Validator.checkFalse(getHeaderType().equals(CONSOLE_HEADER) && splash != null, - "headerType", - Messages.getString("Config.splash.not.impl.by.console.hdr")); - Validator.checkOptStrings(variables, - Validator.MAX_ARGS, - Validator.MAX_ARGS, - "[^=%\t]+=[^=\t]+", - "variables", - Messages.getString("Config.variables"), - Messages.getString("Config.variables.err")); - Validator.checkIn(getPriority(), PRIORITY_CLASS_NAMES, "priority", - Messages.getString("Config.priority")); - jre.checkInvariants(); - } - - public void validate() { - checkInvariants(); - if (classPath != null) { - classPath.checkInvariants(); - } - if (splash != null) { - splash.checkInvariants(); - } - if (versionInfo != null) { - versionInfo.checkInvariants(); - } - } - - /** Change current directory to EXE location. */ - public String getChdir() { - return chdir; - } - - public void setChdir(String chdir) { - this.chdir = chdir; - } - - /** Constant command line arguments passed to the application. */ - public String getCmdLine() { - return cmdLine; - } - - public void setCmdLine(String cmdLine) { - this.cmdLine = cmdLine; - } - - /** Optional, error message box title. */ - public String getErrTitle() { - return errTitle; - } - - public void setErrTitle(String errTitle) { - this.errTitle = errTitle; - } - - /** launch4j header file. */ - public String getHeaderType() { - return headerType.toLowerCase(); - } - - public void setHeaderType(String headerType) { - this.headerType = headerType; - } - - /** launch4j header file index - used by GUI. */ - public int getHeaderTypeIndex() { - int x = Arrays.asList(HEADER_TYPES).indexOf(getHeaderType()); - return x != -1 ? x : 0; - } - - public void setHeaderTypeIndex(int headerTypeIndex) { - headerType = HEADER_TYPES[headerTypeIndex]; - } - - public boolean isCustomHeaderObjects() { - return headerObjects != null && !headerObjects.isEmpty(); - } - - public List getHeaderObjects() { - return isCustomHeaderObjects() ? headerObjects - : getHeaderType().equals(GUI_HEADER) - ? LdDefaults.GUI_HEADER_OBJECTS - : LdDefaults.CONSOLE_HEADER_OBJECTS; - } - - public void setHeaderObjects(List headerObjects) { - this.headerObjects = headerObjects; - } - - public boolean isCustomLibs() { - return libs != null && !libs.isEmpty(); - } - - public List getLibs() { - return isCustomLibs() ? libs : LdDefaults.LIBS; - } - - public void setLibs(List libs) { - this.libs = libs; - } - - /** Wrapper's manifest for User Account Control. */ - public File getManifest() { - return manifest; - } - - public void setManifest(File manifest) { - this.manifest = manifest; - } - - /** ICO file. */ - public File getIcon() { - return icon; - } - - public void setIcon(File icon) { - this.icon = icon; - } - - /** Jar to wrap. */ - public File getJar() { - return jar; - } - - public void setJar(File jar) { - this.jar = jar; - } - - public List getVariables() { - return variables; - } - - public void setVariables(List variables) { - this.variables = variables; - } - - public ClassPath getClassPath() { - return classPath; - } - - public void setClassPath(ClassPath classpath) { - this.classPath = classpath; - } - - /** JRE configuration */ - public Jre getJre() { - return jre; - } - - public void setJre(Jre jre) { - this.jre = jre; - } - - /** Output EXE file. */ - public File getOutfile() { - return outfile; - } - - public void setOutfile(File outfile) { - this.outfile = outfile; - } - - /** Custom process name as the output EXE file name. */ - public boolean isCustomProcName() { - return customProcName; - } - - public void setCustomProcName(boolean customProcName) { - this.customProcName = customProcName; - } - - /** Splash screen configuration. */ - public Splash getSplash() { - return splash; - } - - public void setSplash(Splash splash) { - this.splash = splash; - } - - /** Stay alive after launching the application. */ - public boolean isStayAlive() { - return stayAlive; - } - - public void setStayAlive(boolean stayAlive) { - this.stayAlive = stayAlive; - } - - public VersionInfo getVersionInfo() { - return versionInfo; - } - - public void setVersionInfo(VersionInfo versionInfo) { - this.versionInfo = versionInfo; - } - - public boolean isDontWrapJar() { - return dontWrapJar; - } - - public void setDontWrapJar(boolean dontWrapJar) { - this.dontWrapJar = dontWrapJar; - } - - public int getPriorityIndex() { - int x = Arrays.asList(PRIORITY_CLASS_NAMES).indexOf(getPriority()); - return x != -1 ? x : 0; - } - - public void setPriorityIndex(int x) { - priority = PRIORITY_CLASS_NAMES[x]; - } - - public String getPriority() { - return Validator.isEmpty(priority) ? PRIORITY_CLASS_NAMES[0] : priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public int getPriorityClass() { - return PRIORITY_CLASSES[getPriorityIndex()]; - } - - public String getDownloadUrl() { - return downloadUrl == null ? DOWNLOAD_URL : downloadUrl; - } - - public void setDownloadUrl(String downloadUrl) { - this.downloadUrl = downloadUrl; - } - - public String getSupportUrl() { - return supportUrl; - } - - public void setSupportUrl(String supportUrl) { - this.supportUrl = supportUrl; - } - - public Msg getMessages() { - return messages; - } - - public void setMessages(Msg messages) { - this.messages = messages; - } - - public SingleInstance getSingleInstance() { - return singleInstance; - } - - public void setSingleInstance(SingleInstance singleInstance) { - this.singleInstance = singleInstance; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/ConfigPersister.java b/3rdparty/launch4j/src/net/sf/launch4j/config/ConfigPersister.java deleted file mode 100644 index 43daf8681..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/ConfigPersister.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 22, 2005 - */ -package net.sf.launch4j.config; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import net.sf.launch4j.Util; - -import com.thoughtworks.xstream.XStream; -import com.thoughtworks.xstream.io.xml.DomDriver; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class ConfigPersister { - - private static final ConfigPersister _instance = new ConfigPersister(); - - private final XStream _xstream; - private Config _config; - private File _configPath; - - private ConfigPersister() { - _xstream = new XStream(new DomDriver()); - _xstream.alias("launch4jConfig", Config.class); - _xstream.alias("classPath", ClassPath.class); - _xstream.alias("jre", Jre.class); - _xstream.alias("splash", Splash.class); - _xstream.alias("versionInfo", VersionInfo.class); - - _xstream.addImplicitCollection(Config.class, "headerObjects", "obj", - String.class); - _xstream.addImplicitCollection(Config.class, "libs", "lib", String.class); - _xstream.addImplicitCollection(Config.class, "variables", "var", String.class); - _xstream.addImplicitCollection(ClassPath.class, "paths", "cp", String.class); - _xstream.addImplicitCollection(Jre.class, "options", "opt", String.class); - } - - public static ConfigPersister getInstance() { - return _instance; - } - - public Config getConfig() { - return _config; - } - - public File getConfigPath() { - return _configPath; - } - - public File getOutputPath() throws IOException { - if (_config.getOutfile().isAbsolute()) { - return _config.getOutfile().getParentFile(); - } - File parent = _config.getOutfile().getParentFile(); - return (parent != null) ? new File(_configPath, parent.getPath()) : _configPath; - } - - public File getOutputFile() throws IOException { - return _config.getOutfile().isAbsolute() - ? _config.getOutfile() - : new File(getOutputPath(), _config.getOutfile().getName()); - } - - public void createBlank() { - _config = new Config(); - _config.setJre(new Jre()); - _configPath = null; - } - - public void setAntConfig(Config c, File basedir) { - _config = c; - _configPath = basedir; - } - - public void load(File f) throws ConfigPersisterException { - try { - FileReader r = new FileReader(f); - char[] buf = new char[(int) f.length()]; - r.read(buf); - r.close(); - // Convert 2.x config to 3.x - String s = String.valueOf(buf) - .replaceAll("0<", "gui<") - .replaceAll("1<", "console<") - .replaceAll("jarArgs>", "cmdLine>") - .replaceAll("", "") - .replaceAll("args>", "opt>") - .replaceAll("", "") - .replaceAll("false", - "" + Jre.JDK_PREFERENCE_PREFER_JRE + "") - .replaceAll("true", - "" + Jre.JDK_PREFERENCE_JRE_ONLY + "") - .replaceAll("0", "") - .replaceAll("0", ""); - _config = (Config) _xstream.fromXML(s); - setConfigPath(f); - } catch (Exception e) { - throw new ConfigPersisterException(e); - } - } - - /** - * Imports launch4j 1.x.x config file. - */ - public void loadVersion1(File f) throws ConfigPersisterException { - try { - Props props = new Props(f); - _config = new Config(); - String header = props.getProperty(Config.HEADER); - _config.setHeaderType(header == null - || header.toLowerCase().equals("guihead.bin") ? Config.GUI_HEADER - : Config.CONSOLE_HEADER); - _config.setJar(props.getFile(Config.JAR)); - _config.setOutfile(props.getFile(Config.OUTFILE)); - _config.setJre(new Jre()); - _config.getJre().setPath(props.getProperty(Jre.PATH)); - _config.getJre().setMinVersion(props.getProperty(Jre.MIN_VERSION)); - _config.getJre().setMaxVersion(props.getProperty(Jre.MAX_VERSION)); - String args = props.getProperty(Jre.ARGS); - if (args != null) { - List jreOptions = new ArrayList(); - jreOptions.add(args); - _config.getJre().setOptions(jreOptions); - } - _config.setCmdLine(props.getProperty(Config.JAR_ARGS)); - _config.setChdir("true".equals(props.getProperty(Config.CHDIR)) - ? "." : null); - _config.setCustomProcName("true".equals( - props.getProperty("setProcName"))); // 1.x - _config.setStayAlive("true".equals(props.getProperty(Config.STAY_ALIVE))); - _config.setErrTitle(props.getProperty(Config.ERR_TITLE)); - _config.setIcon(props.getFile(Config.ICON)); - File splashFile = props.getFile(Splash.SPLASH_FILE); - if (splashFile != null) { - _config.setSplash(new Splash()); - _config.getSplash().setFile(splashFile); - String waitfor = props.getProperty("waitfor"); // 1.x - _config.getSplash().setWaitForWindow(waitfor != null - && !waitfor.equals("")); - String splashTimeout = props.getProperty(Splash.TIMEOUT); - if (splashTimeout != null) { - _config.getSplash().setTimeout(Integer.parseInt(splashTimeout)); - } - _config.getSplash().setTimeoutErr("true".equals( - props.getProperty(Splash.TIMEOUT_ERR))); - } else { - _config.setSplash(null); - } - setConfigPath(f); - } catch (IOException e) { - throw new ConfigPersisterException(e); - } - } - - public void save(File f) throws ConfigPersisterException { - try { - BufferedWriter w = new BufferedWriter(new FileWriter(f)); - _xstream.toXML(_config, w); - w.close(); - setConfigPath(f); - } catch (Exception e) { - throw new ConfigPersisterException(e); - } - } - - private void setConfigPath(File configFile) { - _configPath = configFile.getAbsoluteFile().getParentFile(); - } - - private class Props { - final Properties _properties = new Properties(); - - public Props(File f) throws IOException { - FileInputStream is = null; - try { - is = new FileInputStream(f); - _properties.load(is); - } finally { - Util.close(is); - } - } - - /** - * Get property and remove trailing # comments. - */ - public String getProperty(String key) { - String p = _properties.getProperty(key); - if (p == null) { - return null; - } - int x = p.indexOf('#'); - if (x == -1) { - return p; - } - do { - x--; - } while (x > 0 && (p.charAt(x) == ' ' || p.charAt(x) == '\t')); - return (x == 0) ? "" : p.substring(0, x + 1); - } - - public File getFile(String key) { - String value = getProperty(key); - return value != null ? new File(value) : null; - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java b/3rdparty/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java deleted file mode 100644 index 29940b945..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 22, 2005 - */ -package net.sf.launch4j.config; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class ConfigPersisterException extends Exception { - - public ConfigPersisterException(String msg, Throwable t) { - super(msg, t); - } - - public ConfigPersisterException(Throwable t) { - super(t); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/Jre.java b/3rdparty/launch4j/src/net/sf/launch4j/config/Jre.java deleted file mode 100644 index 0df45bb84..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/Jre.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 21, 2005 - */ -package net.sf.launch4j.config; - -import java.util.Arrays; -import java.util.List; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Jre implements IValidatable { - - // 1.x config properties_____________________________________________________________ - public static final String PATH = "jrepath"; - public static final String MIN_VERSION = "javamin"; - public static final String MAX_VERSION = "javamax"; - public static final String ARGS = "jvmArgs"; - - // __________________________________________________________________________________ - public static final String VERSION_PATTERN = "(\\d\\.){2}\\d(_\\d+)?"; - - public static final String JDK_PREFERENCE_JRE_ONLY = "jreOnly"; - public static final String JDK_PREFERENCE_PREFER_JRE = "preferJre"; - public static final String JDK_PREFERENCE_PREFER_JDK = "preferJdk"; - public static final String JDK_PREFERENCE_JDK_ONLY = "jdkOnly"; - - private static final String[] JDK_PREFERENCE_NAMES = new String[] { - JDK_PREFERENCE_JRE_ONLY, - JDK_PREFERENCE_PREFER_JRE, - JDK_PREFERENCE_PREFER_JDK, - JDK_PREFERENCE_JDK_ONLY }; - - public static final int DEFAULT_JDK_PREFERENCE_INDEX - = Arrays.asList(JDK_PREFERENCE_NAMES).indexOf(JDK_PREFERENCE_PREFER_JRE); - - private String path; - private String minVersion; - private String maxVersion; - private String jdkPreference; - private Integer initialHeapSize; - private Integer initialHeapPercent; - private Integer maxHeapSize; - private Integer maxHeapPercent; - private List options; - - public void checkInvariants() { - Validator.checkOptString(minVersion, 10, VERSION_PATTERN, - "jre.minVersion", Messages.getString("Jre.min.version")); - Validator.checkOptString(maxVersion, 10, VERSION_PATTERN, - "jre.maxVersion", Messages.getString("Jre.max.version")); - if (Validator.isEmpty(path)) { - Validator.checkFalse(Validator.isEmpty(minVersion), - "jre.minVersion", Messages.getString("Jre.specify.jre.min.version.or.path")); - } else { - Validator.checkString(path, Validator.MAX_PATH, - "jre.path", Messages.getString("Jre.bundled.path")); - } - if (!Validator.isEmpty(maxVersion)) { - Validator.checkFalse(Validator.isEmpty(minVersion), - "jre.minVersion", Messages.getString("Jre.specify.min.version")); - Validator.checkTrue(minVersion.compareTo(maxVersion) < 0, - "jre.maxVersion", Messages.getString("Jre.max.greater.than.min")); - } - Validator.checkTrue(initialHeapSize == null || maxHeapSize != null, - "jre.maxHeapSize", Messages.getString("Jre.initial.and.max.heap")); - Validator.checkTrue(initialHeapSize == null || initialHeapSize.intValue() > 0, - "jre.initialHeapSize", Messages.getString("Jre.initial.heap")); - Validator.checkTrue(maxHeapSize == null || (maxHeapSize.intValue() - >= ((initialHeapSize != null) ? initialHeapSize.intValue() : 1)), - "jre.maxHeapSize", Messages.getString("Jre.max.heap")); - Validator.checkTrue(initialHeapPercent == null || maxHeapPercent != null, - "jre.maxHeapPercent", Messages.getString("Jre.initial.and.max.heap")); - if (initialHeapPercent != null) { - Validator.checkRange(initialHeapPercent.intValue(), 1, 100, - "jre.initialHeapPercent", - Messages.getString("Jre.initial.heap.percent")); - } - if (maxHeapPercent != null) { - Validator.checkRange(maxHeapPercent.intValue(), - initialHeapPercent != null ? initialHeapPercent.intValue() : 1, 100, - "jre.maxHeapPercent", - Messages.getString("Jre.max.heap.percent")); - } - Validator.checkIn(getJdkPreference(), JDK_PREFERENCE_NAMES, - "jre.jdkPreference", Messages.getString("Jre.jdkPreference.invalid")); - Validator.checkOptStrings(options, - Validator.MAX_ARGS, - Validator.MAX_ARGS, - "[^\"]*|([^\"]*\"[^\"]*\"[^\"]*)*", - "jre.options", - Messages.getString("Jre.jvm.options"), - Messages.getString("Jre.jvm.options.unclosed.quotation")); - - // Quoted variable references: "[^%]*|([^%]*\"([^%]*%[^%]+%[^%]*)+\"[^%]*)*" - Validator.checkOptStrings(options, - Validator.MAX_ARGS, - Validator.MAX_ARGS, - "[^%]*|([^%]*([^%]*%[^%]+%[^%]*)+[^%]*)*", - "jre.options", - Messages.getString("Jre.jvm.options"), - Messages.getString("Jre.jvm.options.variable")); - } - - /** JVM options */ - public List getOptions() { - return options; - } - - public void setOptions(List options) { - this.options = options; - } - - /** Max Java version (x.x.x) */ - public String getMaxVersion() { - return maxVersion; - } - - public void setMaxVersion(String maxVersion) { - this.maxVersion = maxVersion; - } - - /** Min Java version (x.x.x) */ - public String getMinVersion() { - return minVersion; - } - - public void setMinVersion(String minVersion) { - this.minVersion = minVersion; - } - - /** Preference for standalone JRE or JDK-private JRE */ - public String getJdkPreference() { - return Validator.isEmpty(jdkPreference) ? JDK_PREFERENCE_PREFER_JRE - : jdkPreference; - } - - public void setJdkPreference(String jdkPreference) { - this.jdkPreference = jdkPreference; - } - - /** Preference for standalone JRE or JDK-private JRE */ - public int getJdkPreferenceIndex() { - int x = Arrays.asList(JDK_PREFERENCE_NAMES).indexOf(getJdkPreference()); - return x != -1 ? x : DEFAULT_JDK_PREFERENCE_INDEX; - } - - public void setJdkPreferenceIndex(int x) { - jdkPreference = JDK_PREFERENCE_NAMES[x]; - } - - /** JRE path */ - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - /** Initial heap size in MB */ - public Integer getInitialHeapSize() { - return initialHeapSize; - } - - public void setInitialHeapSize(Integer initialHeapSize) { - this.initialHeapSize = getInteger(initialHeapSize); - } - - /** Max heap size in MB */ - public Integer getMaxHeapSize() { - return maxHeapSize; - } - - public void setMaxHeapSize(Integer maxHeapSize) { - this.maxHeapSize = getInteger(maxHeapSize); - } - - public Integer getInitialHeapPercent() { - return initialHeapPercent; - } - - public void setInitialHeapPercent(Integer initialHeapPercent) { - this.initialHeapPercent = getInteger(initialHeapPercent); - } - - public Integer getMaxHeapPercent() { - return maxHeapPercent; - } - - public void setMaxHeapPercent(Integer maxHeapPercent) { - this.maxHeapPercent = getInteger(maxHeapPercent); - } - - /** Convert 0 to null */ - private Integer getInteger(Integer i) { - return i != null && i.intValue() == 0 ? null : i; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/LdDefaults.java b/3rdparty/launch4j/src/net/sf/launch4j/config/LdDefaults.java deleted file mode 100644 index 55f457cc3..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/LdDefaults.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Sep 3, 2005 - */ -package net.sf.launch4j.config; - -import java.util.Arrays; -import java.util.List; - -public class LdDefaults { - - public static final List GUI_HEADER_OBJECTS = Arrays.asList(new String[] { - "w32api/crt2.o", - "head/guihead.o", - "head/head.o" }); - - public static final List CONSOLE_HEADER_OBJECTS = Arrays.asList(new String[] { - "w32api/crt2.o", - "head/consolehead.o", - "head/head.o"}); - - public static final List LIBS = Arrays.asList(new String[] { - "w32api/libmingw32.a", - "w32api/libgcc.a", - "w32api/libmsvcrt.a", - "w32api/libkernel32.a", - "w32api/libuser32.a", - "w32api/libadvapi32.a", - "w32api/libshell32.a" }); -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/Messages.java b/3rdparty/launch4j/src/net/sf/launch4j/config/Messages.java deleted file mode 100644 index a3f344e59..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/Messages.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.config; - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.config.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - private static final MessageFormat FORMATTER = new MessageFormat(""); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } - - public static String getString(String key, String arg0) { - return getString(key, new Object[] {arg0}); - } - - public static String getString(String key, String arg0, String arg1) { - return getString(key, new Object[] {arg0, arg1}); - } - - public static String getString(String key, String arg0, String arg1, String arg2) { - return getString(key, new Object[] {arg0, arg1, arg2}); - } - - public static String getString(String key, Object[] args) { - try { - FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); - return FORMATTER.format(args); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/Msg.java b/3rdparty/launch4j/src/net/sf/launch4j/config/Msg.java deleted file mode 100644 index ea3acfa34..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/Msg.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Oct 8, 2006 - */ -package net.sf.launch4j.config; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class Msg implements IValidatable { - private String startupErr; - private String bundledJreErr; - private String jreVersionErr; - private String launcherErr; - private String instanceAlreadyExistsMsg; - - public void checkInvariants() { - Validator.checkOptString(startupErr, 1024, "startupErr", - Messages.getString("Msg.startupErr")); - Validator.checkOptString(bundledJreErr, 1024, "bundledJreErr", - Messages.getString("Msg.bundledJreErr")); - Validator.checkOptString(jreVersionErr, 1024, "jreVersionErr", - Messages.getString("Msg.jreVersionErr")); - Validator.checkOptString(launcherErr, 1024, "launcherErr", - Messages.getString("Msg.launcherErr")); - Validator.checkOptString(instanceAlreadyExistsMsg, 1024, "instanceAlreadyExistsMsg", - Messages.getString("Msg.instanceAlreadyExistsMsg")); - } - - public String getStartupErr() { - return !Validator.isEmpty(startupErr) ? startupErr - : "An error occurred while starting the application."; - } - - public void setStartupErr(String startupErr) { - this.startupErr = startupErr; - } - - public String getBundledJreErr() { - return !Validator.isEmpty(bundledJreErr) ? bundledJreErr - : "This application was configured to use a bundled Java Runtime" + - " Environment but the runtime is missing or corrupted."; - } - - public void setBundledJreErr(String bundledJreErr) { - this.bundledJreErr = bundledJreErr; - } - - public String getJreVersionErr() { - return !Validator.isEmpty(jreVersionErr) ? jreVersionErr - : "This application requires a Java Runtime Environment"; - } - - public void setJreVersionErr(String jreVersionErr) { - this.jreVersionErr = jreVersionErr; - } - - public String getLauncherErr() { - return !Validator.isEmpty(launcherErr) ? launcherErr - : "The registry refers to a nonexistent Java Runtime Environment" + - " installation or the runtime is corrupted."; - } - - public void setLauncherErr(String launcherErr) { - this.launcherErr = launcherErr; - } - - public String getInstanceAlreadyExistsMsg() { - return !Validator.isEmpty(instanceAlreadyExistsMsg) ? instanceAlreadyExistsMsg - : "An application instance is already running."; - } - - public void setInstanceAlreadyExistsMsg(String instanceAlreadyExistsMsg) { - this.instanceAlreadyExistsMsg = instanceAlreadyExistsMsg; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/SingleInstance.java b/3rdparty/launch4j/src/net/sf/launch4j/config/SingleInstance.java deleted file mode 100644 index 0ae340cd7..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/SingleInstance.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - * Created on 2007-09-16 - */ -package net.sf.launch4j.config; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2007 Grzegorz Kowal - */ -public class SingleInstance implements IValidatable { - - private String mutexName; - private String windowTitle; - - public void checkInvariants() { - Validator.checkString(mutexName, Validator.MAX_STR, - "singleInstance.mutexName", - Messages.getString("SingleInstance.mutexName")); - Validator.checkOptString(windowTitle, Validator.MAX_STR, - "singleInstance.windowTitle", - Messages.getString("SingleInstance.windowTitle")); - } - - public String getWindowTitle() { - return windowTitle; - } - - public void setWindowTitle(String appWindowName) { - this.windowTitle = appWindowName; - } - - public String getMutexName() { - return mutexName; - } - - public void setMutexName(String mutexName) { - this.mutexName = mutexName; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/Splash.java b/3rdparty/launch4j/src/net/sf/launch4j/config/Splash.java deleted file mode 100644 index f736f8208..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/Splash.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 21, 2005 - */ -package net.sf.launch4j.config; - -import java.io.File; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Splash implements IValidatable { - - // 1.x config properties_____________________________________________________________ - public static final String SPLASH_FILE = "splash"; - public static final String WAIT_FOR_TITLE = "waitForTitle"; - public static final String TIMEOUT = "splashTimeout"; - public static final String TIMEOUT_ERR = "splashTimeoutErr"; - - // __________________________________________________________________________________ - private File file; - private boolean waitForWindow = true; - private int timeout = 60; - private boolean timeoutErr = true; - - public void checkInvariants() { - Validator.checkFile(file, "splash.file", - Messages.getString("Splash.splash.file")); - Validator.checkRange(timeout, 1, 60 * 15, "splash.timeout", - Messages.getString("Splash.splash.timeout")); - } - - /** Splash screen in BMP format. */ - public File getFile() { - return file; - } - - public void setFile(File file) { - this.file = file; - } - - /** Splash timeout in seconds. */ - public int getTimeout() { - return timeout; - } - - public void setTimeout(int timeout) { - this.timeout = timeout; - } - - /** Signal error on splash timeout. */ - public boolean isTimeoutErr() { - return timeoutErr; - } - - public void setTimeoutErr(boolean timeoutErr) { - this.timeoutErr = timeoutErr; - } - - /** Hide splash screen when the child process displayes the first window. */ - public boolean getWaitForWindow() { - return waitForWindow; - } - - public void setWaitForWindow(boolean waitForWindow) { - this.waitForWindow = waitForWindow; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/VersionInfo.java b/3rdparty/launch4j/src/net/sf/launch4j/config/VersionInfo.java deleted file mode 100644 index d719460c2..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/VersionInfo.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 21, 2005 - */ -package net.sf.launch4j.config; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class VersionInfo implements IValidatable { - public static final String VERSION_PATTERN = "(\\d+\\.){3}\\d+"; - - private String fileVersion; - private String txtFileVersion; - private String fileDescription; - private String copyright; - private String productVersion; - private String txtProductVersion; - private String productName; - private String companyName; - private String internalName; - private String originalFilename; - - public void checkInvariants() { - Validator.checkString(fileVersion, 20, VERSION_PATTERN, - "versionInfo.fileVersion", - Messages.getString("VersionInfo.file.version")); - Validator.checkString(txtFileVersion, 50, "versionInfo.txtFileVersion", - Messages.getString("VersionInfo.txt.file.version")); - Validator.checkString(fileDescription, 150, "versionInfo.fileDescription", - Messages.getString("VersionInfo.file.description")); - Validator.checkString(copyright, 150, "versionInfo.copyright", - Messages.getString("VersionInfo.copyright")); - Validator.checkString(productVersion, 20, VERSION_PATTERN, - "versionInfo.productVersion", - Messages.getString("VersionInfo.product.version")); - Validator.checkString(txtProductVersion, 50, "versionInfo.txtProductVersion", - Messages.getString("VersionInfo.txt.product.version")); - Validator.checkString(productName, 150, "versionInfo.productName", - Messages.getString("VersionInfo.product.name")); - Validator.checkOptString(companyName, 150, "versionInfo.companyName", - Messages.getString("VersionInfo.company.name")); - Validator.checkString(internalName, 50, "versionInfo.internalName", - Messages.getString("VersionInfo.internal.name")); - Validator.checkTrue(!internalName.endsWith(".exe"), "versionInfo.internalName", - Messages.getString("VersionInfo.internal.name.not.exe")); - Validator.checkString(originalFilename, 50, "versionInfo.originalFilename", - Messages.getString("VersionInfo.original.filename")); - Validator.checkTrue(originalFilename.endsWith(".exe"), - "versionInfo.originalFilename", - Messages.getString("VersionInfo.original.filename.exe")); - } - - public String getCompanyName() { - return companyName; - } - - public void setCompanyName(String companyName) { - this.companyName = companyName; - } - - public String getCopyright() { - return copyright; - } - - public void setCopyright(String copyright) { - this.copyright = copyright; - } - - public String getFileDescription() { - return fileDescription; - } - - public void setFileDescription(String fileDescription) { - this.fileDescription = fileDescription; - } - - public String getFileVersion() { - return fileVersion; - } - - public void setFileVersion(String fileVersion) { - this.fileVersion = fileVersion; - } - - public String getInternalName() { - return internalName; - } - - public void setInternalName(String internalName) { - this.internalName = internalName; - } - - public String getOriginalFilename() { - return originalFilename; - } - - public void setOriginalFilename(String originalFilename) { - this.originalFilename = originalFilename; - } - - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public String getProductVersion() { - return productVersion; - } - - public void setProductVersion(String productVersion) { - this.productVersion = productVersion; - } - - public String getTxtFileVersion() { - return txtFileVersion; - } - - public void setTxtFileVersion(String txtFileVersion) { - this.txtFileVersion = txtFileVersion; - } - - public String getTxtProductVersion() { - return txtProductVersion; - } - - public void setTxtProductVersion(String txtProductVersion) { - this.txtProductVersion = txtProductVersion; - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/messages.properties b/3rdparty/launch4j/src/net/sf/launch4j/config/messages.properties deleted file mode 100644 index 5753663f4..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/messages.properties +++ /dev/null @@ -1,93 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Splash.splash.file=Splash file -Splash.splash.timeout=Splash timeout - -Config.specify.output.exe=Specify output file with .exe extension. -Config.application.jar=Application jar -Config.application.jar.path=Specify runtime path of the jar relative to the executable. -Config.chdir.relative='chdir' must be a path relative to the executable. -Config.chdir.path='chdir' is now a path instead of a boolean, please check the docs. -Config.manifest=Manifest -Config.icon=Icon -Config.jar.arguments=Jar arguments -Config.error.title=Error title -Config.download.url=Download URL -Config.support.url=Support URL -Config.header.type=Header type -Config.splash.not.impl.by.console.hdr=Splash screen is not implemented by console header. -Config.variables=Environment variables -Config.variables.err=Environment variable assignment should have the form varname=[value][%varref%]... -Config.priority=Process priority - -ClassPath.mainClass=Main class -ClassPath.or.jar=Specify runtime path of a jar or the classpath. -ClassPath.path=Classpath - -VersionInfo.file.version=File version, should be 'x.x.x.x' -VersionInfo.txt.file.version=Free form file version -VersionInfo.file.description=File description -VersionInfo.copyright=Copyright -VersionInfo.product.version=Product version, should be 'x.x.x.x' -VersionInfo.txt.product.version=Free from product version -VersionInfo.product.name=Product name -VersionInfo.company.name=Company name -VersionInfo.internal.name=Internal name -VersionInfo.internal.name.not.exe=Internal name shouldn't have the .exe extension. -VersionInfo.original.filename=Original filename -VersionInfo.original.filename.exe=Original filename should end with the .exe extension. - -Jre.min.version=Minimum JRE version should be x.x.x[_xx] -Jre.max.version=Maximum JRE version should be x.x.x[_xx] -Jre.specify.jre.min.version.or.path=Specify minimum JRE version and/or bundled JRE path. -Jre.bundled.path=Bundled JRE path -Jre.specify.min.version=Specify minimum JRE version. -Jre.max.greater.than.min=Maximum JRE version must be greater than the minimum.\nTo use a certain JRE version, you may set the min/max range to [1.4.2 - 1.4.2_10] for example. -Jre.initial.and.max.heap=If you change the initial heap size please also specify the maximum size. -Jre.initial.heap=Initial heap size must be greater than 0, leave the field blank to use the JVM default. -Jre.max.heap=Maximum heap size cannot be less than the initial size, leave the field blank to use the JVM default. -Jre.initial.heap.percent=Initial heap % -Jre.max.heap.percent=Maximum heap % -Jre.jdkPreference.invalid=Unrecognised value for JDK preference, should be between 0 and 3 inclusive. -Jre.jvm.options=JVM arguments -Jre.jvm.options.unclosed.quotation=JVM arguments contain an unclosed quotation. -Jre.jvm.options.variable=Invalid environment variable reference. - -Msg.startupErr=Startup error message -Msg.bundledJreErr=Bundled JRE error message -Msg.jreVersionErr=JRE version error message -Msg.launcherErr=Launcher error message - -SingleInstance.mutexName=Mutex name -SingleInstance.windowTitle=Window title diff --git a/3rdparty/launch4j/src/net/sf/launch4j/config/messages_es.properties b/3rdparty/launch4j/src/net/sf/launch4j/config/messages_es.properties deleted file mode 100644 index 5e8659b1f..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/config/messages_es.properties +++ /dev/null @@ -1,75 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Splash.splash.file = Fichero de la pantalla de bienvenida -Splash.splash.timeout = Tiempo de espera de la pantalla de bienvenida - -Config.specify.output.exe = Especifique el fichero de salida con extensi\u00F3n .exe. -Config.application.jar = Aplicaci\u00F3n jar -Config.application.jar.path = Especifique la ruta del jar relativa al ejecutable. -Config.chdir.relative = 'Cambiar al directorio' debe ser una ruta relativa al ejecutable. -Config.chdir.path = 'Cambiar al directorio' ahora es una ruta en lugar de un booleano, por favor consulte la documentaci\u00F3n. -Config.icon = Icono -Config.jar.arguments = Argumentos del jar -Config.error.title = T\u00EDtulo de error -Config.header.type = Tipo de cabecera -Config.splash.not.impl.by.console.hdr = La pantalla de bienvenida no est\u00E1 implementada para la cabecera de tipo consola. - -VersionInfo.file.version = La versi\u00F3n del fichero, deber\u00EDa ser 'x.x.x.x' -VersionInfo.txt.file.version = Forma libre de versi\u00F3n del fichero -VersionInfo.file.description = Descripci\u00F3n del fichero -VersionInfo.copyright = Copyright -VersionInfo.product.version = Versi\u00F3n del producto, deber\u00EDa ser 'x.x.x.x' -VersionInfo.txt.product.version = Forma libre de versi\u00F3n del producto -VersionInfo.product.name = Nombre del producto -VersionInfo.company.name = Nombre de la organizaci\u00F3n -VersionInfo.internal.name = Nombre interno -VersionInfo.internal.name.not.exe = El nombre interno no deber\u00EDa tener extensi\u00F3n .exe. -VersionInfo.original.filename = Nombre original del fichero -VersionInfo.original.filename.exe = El nombre original del fichero debe acabar con extensi\u00F3n .exe. -Jre.min.version = La versi\u00F3n m\u00EDnima del JRE deber\u00EDa ser x.x.x[_xx] -Jre.max.version = La versi\u00F3n m\u00E1xima del JRE deber\u00EDa ser x.x.x[_xx] -Jre.specify.jre.min.version.or.path=Specify minimum JRE version and/or bundled JRE path. -Jre.bundled.path.rel = La ruta del JRE debe ser relativa al ejecutable. -Jre.specify.min.version = Especifique la versi\u00F3n m\u00EDnima del JRE. -Jre.max.greater.than.min = La versi\u00F3n m\u00E1xima del JRE debe ser mayor que la m\u00EDnima.\nPara usar cierta versi\u00F3n del JRE, puede esyablecer el rango m\u00EDnimo/m\u00E1ximo a [1.4.2 - 1.4.2_10], por ejemplo. -Jre.jvm.options = Argumentos de la JVM - -Msg.startupErr=Startup error message -Msg.bundledJreErr=Bundled JRE error message -Msg.jreVersionErr=JRE version error message -Msg.launcherErr=Launcher error message - -SingleInstance.mutexName=Mutex name -SingleInstance.windowTitle=Window title - diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/BasicForm.java b/3rdparty/launch4j/src/net/sf/launch4j/form/BasicForm.java deleted file mode 100644 index 4dadbb983..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/BasicForm.java +++ /dev/null @@ -1,283 +0,0 @@ -package net.sf.launch4j.form; - -import com.jeta.forms.components.separator.TitledSeparator; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JTextField; - -public abstract class BasicForm extends JPanel -{ - protected final JButton _outfileButton = new JButton(); - protected final JLabel _outfileLabel = new JLabel(); - protected final JLabel _iconLabel = new JLabel(); - protected final JLabel _jarLabel = new JLabel(); - protected final JButton _jarButton = new JButton(); - protected final JButton _iconButton = new JButton(); - protected final JLabel _cmdLineLabel = new JLabel(); - protected final JLabel _optionsLabel = new JLabel(); - protected final JLabel _chdirLabel = new JLabel(); - protected final JLabel _processPriorityLabel = new JLabel(); - protected final JRadioButton _normalPriorityRadio = new JRadioButton(); - protected final ButtonGroup _buttongroup1 = new ButtonGroup(); - protected final JRadioButton _idlePriorityRadio = new JRadioButton(); - protected final JRadioButton _highPriorityRadio = new JRadioButton(); - protected final JCheckBox _customProcNameCheck = new JCheckBox(); - protected final JCheckBox _stayAliveCheck = new JCheckBox(); - protected final JTextField _cmdLineField = new JTextField(); - protected final JTextField _chdirField = new JTextField(); - protected final JTextField _iconField = new JTextField(); - protected final JCheckBox _dontWrapJarCheck = new JCheckBox(); - protected final JTextField _jarField = new JTextField(); - protected final JTextField _outfileField = new JTextField(); - protected final JLabel _errorTitleLabel = new JLabel(); - protected final JTextField _errorTitleField = new JTextField(); - protected final JLabel _downloadUrlLabel = new JLabel(); - protected final JTextField _downloadUrlField = new JTextField(); - protected final JLabel _supportUrlLabel = new JLabel(); - protected final JTextField _supportUrlField = new JTextField(); - protected final JTextField _manifestField = new JTextField(); - protected final JButton _manifestButton = new JButton(); - - /** - * Default constructor - */ - public BasicForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _outfileButton.setIcon(loadImage("images/open16.png")); - _outfileButton.setName("outfileButton"); - jpanel1.add(_outfileButton,cc.xy(12,2)); - - _outfileLabel.setIcon(loadImage("images/asterix.gif")); - _outfileLabel.setName("outfileLabel"); - _outfileLabel.setText(Messages.getString("outfile")); - jpanel1.add(_outfileLabel,cc.xy(2,2)); - - _iconLabel.setName("iconLabel"); - _iconLabel.setText(Messages.getString("icon")); - jpanel1.add(_iconLabel,cc.xy(2,10)); - - _jarLabel.setIcon(loadImage("images/asterix.gif")); - _jarLabel.setName("jarLabel"); - _jarLabel.setText(Messages.getString("jar")); - jpanel1.add(_jarLabel,cc.xy(2,4)); - - _jarButton.setIcon(loadImage("images/open16.png")); - _jarButton.setName("jarButton"); - jpanel1.add(_jarButton,cc.xy(12,4)); - - _iconButton.setIcon(loadImage("images/open16.png")); - _iconButton.setName("iconButton"); - jpanel1.add(_iconButton,cc.xy(12,10)); - - _cmdLineLabel.setName("cmdLineLabel"); - _cmdLineLabel.setText(Messages.getString("cmdLine")); - _cmdLineLabel.setToolTipText(""); - jpanel1.add(_cmdLineLabel,cc.xy(2,14)); - - _optionsLabel.setName("optionsLabel"); - _optionsLabel.setText(Messages.getString("options")); - jpanel1.add(_optionsLabel,cc.xy(2,18)); - - _chdirLabel.setName("chdirLabel"); - _chdirLabel.setText(Messages.getString("chdir")); - jpanel1.add(_chdirLabel,cc.xy(2,12)); - - _processPriorityLabel.setName("processPriorityLabel"); - _processPriorityLabel.setText(Messages.getString("priority")); - jpanel1.add(_processPriorityLabel,cc.xy(2,16)); - - _normalPriorityRadio.setActionCommand(Messages.getString("normalPriority")); - _normalPriorityRadio.setName("normalPriorityRadio"); - _normalPriorityRadio.setText(Messages.getString("normalPriority")); - _buttongroup1.add(_normalPriorityRadio); - jpanel1.add(_normalPriorityRadio,cc.xy(4,16)); - - _idlePriorityRadio.setActionCommand(Messages.getString("idlePriority")); - _idlePriorityRadio.setName("idlePriorityRadio"); - _idlePriorityRadio.setText(Messages.getString("idlePriority")); - _buttongroup1.add(_idlePriorityRadio); - jpanel1.add(_idlePriorityRadio,cc.xy(6,16)); - - _highPriorityRadio.setActionCommand(Messages.getString("highPriority")); - _highPriorityRadio.setName("highPriorityRadio"); - _highPriorityRadio.setText(Messages.getString("highPriority")); - _buttongroup1.add(_highPriorityRadio); - jpanel1.add(_highPriorityRadio,cc.xy(8,16)); - - _customProcNameCheck.setActionCommand("Custom process name"); - _customProcNameCheck.setName("customProcNameCheck"); - _customProcNameCheck.setText(Messages.getString("customProcName")); - jpanel1.add(_customProcNameCheck,cc.xywh(4,18,7,1)); - - _stayAliveCheck.setActionCommand("Stay alive after launching a GUI application"); - _stayAliveCheck.setName("stayAliveCheck"); - _stayAliveCheck.setText(Messages.getString("stayAlive")); - jpanel1.add(_stayAliveCheck,cc.xywh(4,20,7,1)); - - _cmdLineField.setName("cmdLineField"); - _cmdLineField.setToolTipText(Messages.getString("cmdLineTip")); - jpanel1.add(_cmdLineField,cc.xywh(4,14,7,1)); - - _chdirField.setName("chdirField"); - _chdirField.setToolTipText(Messages.getString("chdirTip")); - jpanel1.add(_chdirField,cc.xywh(4,12,7,1)); - - _iconField.setName("iconField"); - _iconField.setToolTipText(Messages.getString("iconTip")); - jpanel1.add(_iconField,cc.xywh(4,10,7,1)); - - _dontWrapJarCheck.setActionCommand("Don't wrap the jar, launch it only"); - _dontWrapJarCheck.setName("dontWrapJarCheck"); - _dontWrapJarCheck.setText(Messages.getString("dontWrapJar")); - jpanel1.add(_dontWrapJarCheck,cc.xywh(4,6,7,1)); - - _jarField.setName("jarField"); - _jarField.setToolTipText(Messages.getString("jarTip")); - jpanel1.add(_jarField,cc.xywh(4,4,7,1)); - - _outfileField.setName("outfileField"); - _outfileField.setToolTipText(Messages.getString("outfileTip")); - jpanel1.add(_outfileField,cc.xywh(4,2,7,1)); - - TitledSeparator titledseparator1 = new TitledSeparator(); - titledseparator1.setText(Messages.getString("downloadAndSupport")); - jpanel1.add(titledseparator1,cc.xywh(2,22,11,1)); - - _errorTitleLabel.setName("errorTitleLabel"); - _errorTitleLabel.setText(Messages.getString("errorTitle")); - jpanel1.add(_errorTitleLabel,cc.xy(2,24)); - - _errorTitleField.setName("errorTitleField"); - _errorTitleField.setToolTipText(Messages.getString("errorTitleTip")); - jpanel1.add(_errorTitleField,cc.xywh(4,24,7,1)); - - _downloadUrlLabel.setIcon(loadImage("images/asterix.gif")); - _downloadUrlLabel.setName("downloadUrlLabel"); - _downloadUrlLabel.setText(Messages.getString("downloadUrl")); - jpanel1.add(_downloadUrlLabel,cc.xy(2,26)); - - _downloadUrlField.setName("downloadUrlField"); - jpanel1.add(_downloadUrlField,cc.xywh(4,26,7,1)); - - _supportUrlLabel.setName("supportUrlLabel"); - _supportUrlLabel.setText(Messages.getString("supportUrl")); - jpanel1.add(_supportUrlLabel,cc.xy(2,28)); - - _supportUrlField.setName("supportUrlField"); - jpanel1.add(_supportUrlField,cc.xywh(4,28,7,1)); - - JLabel jlabel1 = new JLabel(); - jlabel1.setText(Messages.getString("manifest")); - jpanel1.add(jlabel1,cc.xy(2,8)); - - _manifestField.setName("manifestField"); - _manifestField.setToolTipText(Messages.getString("manifestTip")); - jpanel1.add(_manifestField,cc.xywh(4,8,7,1)); - - _manifestButton.setIcon(loadImage("images/open16.png")); - _manifestButton.setName("manifestButton"); - jpanel1.add(_manifestButton,cc.xy(12,8)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/BasicForm.jfrm b/3rdparty/launch4j/src/net/sf/launch4j/form/BasicForm.jfrm deleted file mode 100644 index 1d8a9ad58..000000000 Binary files a/3rdparty/launch4j/src/net/sf/launch4j/form/BasicForm.jfrm and /dev/null differ diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/ClassPathForm.java b/3rdparty/launch4j/src/net/sf/launch4j/form/ClassPathForm.java deleted file mode 100644 index 9f4f52471..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/ClassPathForm.java +++ /dev/null @@ -1,193 +0,0 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; - -public abstract class ClassPathForm extends JPanel -{ - protected final JTextField _classpathField = new JTextField(); - protected final JLabel _classpathFieldLabel = new JLabel(); - protected final JLabel _classpathListLabel = new JLabel(); - protected final JList _classpathList = new JList(); - protected final JLabel _mainclassLabel = new JLabel(); - protected final JTextField _mainclassField = new JTextField(); - protected final JButton _acceptClasspathButton = new JButton(); - protected final JButton _removeClasspathButton = new JButton(); - protected final JButton _importClasspathButton = new JButton(); - protected final JButton _classpathUpButton = new JButton(); - protected final JButton _classpathDownButton = new JButton(); - protected final JCheckBox _classpathCheck = new JCheckBox(); - protected final JButton _newClasspathButton = new JButton(); - - /** - * Default constructor - */ - public ClassPathForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _classpathField.setName("classpathField"); - jpanel1.add(_classpathField,cc.xywh(4,11,7,1)); - - _classpathFieldLabel.setIcon(loadImage("images/asterix.gif")); - _classpathFieldLabel.setName("classpathFieldLabel"); - _classpathFieldLabel.setText(Messages.getString("editClassPath")); - jpanel1.add(_classpathFieldLabel,cc.xy(2,11)); - - _classpathListLabel.setName("classpathListLabel"); - _classpathListLabel.setText(Messages.getString("classPath")); - jpanel1.add(_classpathListLabel,cc.xy(2,6)); - - _classpathList.setName("classpathList"); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_classpathList); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xywh(4,6,7,4)); - - _mainclassLabel.setIcon(loadImage("images/asterix.gif")); - _mainclassLabel.setName("mainclassLabel"); - _mainclassLabel.setText(Messages.getString("mainClass")); - jpanel1.add(_mainclassLabel,cc.xy(2,4)); - - _mainclassField.setName("mainclassField"); - jpanel1.add(_mainclassField,cc.xywh(4,4,7,1)); - - _acceptClasspathButton.setActionCommand("Add"); - _acceptClasspathButton.setIcon(loadImage("images/ok16.png")); - _acceptClasspathButton.setName("acceptClasspathButton"); - _acceptClasspathButton.setText(Messages.getString("accept")); - jpanel1.add(_acceptClasspathButton,cc.xy(8,13)); - - _removeClasspathButton.setActionCommand("Remove"); - _removeClasspathButton.setIcon(loadImage("images/cancel16.png")); - _removeClasspathButton.setName("removeClasspathButton"); - _removeClasspathButton.setText(Messages.getString("remove")); - jpanel1.add(_removeClasspathButton,cc.xy(10,13)); - - _importClasspathButton.setIcon(loadImage("images/open16.png")); - _importClasspathButton.setName("importClasspathButton"); - _importClasspathButton.setToolTipText(Messages.getString("importClassPath")); - jpanel1.add(_importClasspathButton,cc.xy(12,4)); - - _classpathUpButton.setIcon(loadImage("images/up16.png")); - _classpathUpButton.setName("classpathUpButton"); - jpanel1.add(_classpathUpButton,cc.xy(12,6)); - - _classpathDownButton.setIcon(loadImage("images/down16.png")); - _classpathDownButton.setName("classpathDownButton"); - jpanel1.add(_classpathDownButton,cc.xy(12,8)); - - _classpathCheck.setActionCommand("Custom classpath"); - _classpathCheck.setName("classpathCheck"); - _classpathCheck.setText(Messages.getString("customClassPath")); - jpanel1.add(_classpathCheck,cc.xy(4,2)); - - _newClasspathButton.setActionCommand("New"); - _newClasspathButton.setIcon(loadImage("images/new16.png")); - _newClasspathButton.setName("newClasspathButton"); - _newClasspathButton.setText(Messages.getString("new")); - jpanel1.add(_newClasspathButton,cc.xy(6,13)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/ClassPathForm.jfrm b/3rdparty/launch4j/src/net/sf/launch4j/form/ClassPathForm.jfrm deleted file mode 100644 index 764329d2b..000000000 Binary files a/3rdparty/launch4j/src/net/sf/launch4j/form/ClassPathForm.jfrm and /dev/null differ diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/ConfigForm.java b/3rdparty/launch4j/src/net/sf/launch4j/form/ConfigForm.java deleted file mode 100644 index b3c6fffed..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/ConfigForm.java +++ /dev/null @@ -1,132 +0,0 @@ -package net.sf.launch4j.form; - -import com.jeta.forms.components.separator.TitledSeparator; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; - -public abstract class ConfigForm extends JPanel -{ - protected final JTextArea _logTextArea = new JTextArea(); - protected final TitledSeparator _logSeparator = new TitledSeparator(); - protected final JTabbedPane _tab = new JTabbedPane(); - - /** - * Default constructor - */ - public ConfigForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:3DLU:NONE,FILL:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _logTextArea.setName("logTextArea"); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_logTextArea); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xy(2,6)); - - _logSeparator.setName("logSeparator"); - _logSeparator.setText(Messages.getString("log")); - jpanel1.add(_logSeparator,cc.xy(2,4)); - - _tab.setName("tab"); - jpanel1.add(_tab,cc.xywh(1,2,3,1)); - - addFillComponents(jpanel1,new int[]{ 1,2,3 },new int[]{ 1,3,4,5,6,7 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/ConfigForm.jfrm b/3rdparty/launch4j/src/net/sf/launch4j/form/ConfigForm.jfrm deleted file mode 100644 index 2c6721e14..000000000 Binary files a/3rdparty/launch4j/src/net/sf/launch4j/form/ConfigForm.jfrm and /dev/null differ diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java b/3rdparty/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java deleted file mode 100644 index f2b79e6e7..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java +++ /dev/null @@ -1,127 +0,0 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; - -public abstract class EnvironmentVarsForm extends JPanel -{ - protected final JTextArea _envVarsTextArea = new JTextArea(); - protected final JLabel _envVarsLabel = new JLabel(); - - /** - * Default constructor - */ - public EnvironmentVarsForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _envVarsTextArea.setName("envVarsTextArea"); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_envVarsTextArea); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xy(4,2)); - - _envVarsLabel.setName("envVarsLabel"); - _envVarsLabel.setText(Messages.getString("setVariables")); - jpanel1.add(_envVarsLabel,new CellConstraints(2,2,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.jfrm b/3rdparty/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.jfrm deleted file mode 100644 index 6e89ec4d1..000000000 Binary files a/3rdparty/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.jfrm and /dev/null differ diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/HeaderForm.java b/3rdparty/launch4j/src/net/sf/launch4j/form/HeaderForm.java deleted file mode 100644 index 91c40024a..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/HeaderForm.java +++ /dev/null @@ -1,171 +0,0 @@ -package net.sf.launch4j.form; - -import com.jeta.forms.components.separator.TitledSeparator; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; - -public abstract class HeaderForm extends JPanel -{ - protected final JLabel _headerTypeLabel = new JLabel(); - protected final JRadioButton _guiHeaderRadio = new JRadioButton(); - protected final ButtonGroup _headerButtonGroup = new ButtonGroup(); - protected final JRadioButton _consoleHeaderRadio = new JRadioButton(); - protected final JTextArea _headerObjectsTextArea = new JTextArea(); - protected final JTextArea _libsTextArea = new JTextArea(); - protected final JCheckBox _headerObjectsCheck = new JCheckBox(); - protected final JCheckBox _libsCheck = new JCheckBox(); - protected final TitledSeparator _linkerOptionsSeparator = new TitledSeparator(); - - /** - * Default constructor - */ - public HeaderForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(0.2),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _headerTypeLabel.setName("headerTypeLabel"); - _headerTypeLabel.setText(Messages.getString("headerType")); - jpanel1.add(_headerTypeLabel,cc.xy(2,2)); - - _guiHeaderRadio.setActionCommand("GUI"); - _guiHeaderRadio.setName("guiHeaderRadio"); - _guiHeaderRadio.setText(Messages.getString("gui")); - _headerButtonGroup.add(_guiHeaderRadio); - jpanel1.add(_guiHeaderRadio,cc.xy(4,2)); - - _consoleHeaderRadio.setActionCommand("Console"); - _consoleHeaderRadio.setName("consoleHeaderRadio"); - _consoleHeaderRadio.setText(Messages.getString("console")); - _headerButtonGroup.add(_consoleHeaderRadio); - jpanel1.add(_consoleHeaderRadio,cc.xy(6,2)); - - _headerObjectsTextArea.setName("headerObjectsTextArea"); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_headerObjectsTextArea); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xywh(4,6,4,1)); - - _libsTextArea.setName("libsTextArea"); - JScrollPane jscrollpane2 = new JScrollPane(); - jscrollpane2.setViewportView(_libsTextArea); - jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane2,cc.xywh(4,8,4,1)); - - _headerObjectsCheck.setActionCommand("Object files"); - _headerObjectsCheck.setName("headerObjectsCheck"); - _headerObjectsCheck.setText(Messages.getString("objectFiles")); - jpanel1.add(_headerObjectsCheck,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - _libsCheck.setActionCommand("w32api"); - _libsCheck.setName("libsCheck"); - _libsCheck.setText(Messages.getString("libs")); - jpanel1.add(_libsCheck,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - _linkerOptionsSeparator.setName("linkerOptionsSeparator"); - _linkerOptionsSeparator.setText(Messages.getString("linkerOptions")); - jpanel1.add(_linkerOptionsSeparator,cc.xywh(2,4,6,1)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8 },new int[]{ 1,2,3,4,5,6,7,8,9 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/HeaderForm.jfrm b/3rdparty/launch4j/src/net/sf/launch4j/form/HeaderForm.jfrm deleted file mode 100644 index a7cbed144..000000000 Binary files a/3rdparty/launch4j/src/net/sf/launch4j/form/HeaderForm.jfrm and /dev/null differ diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/JreForm.java b/3rdparty/launch4j/src/net/sf/launch4j/form/JreForm.java deleted file mode 100644 index ed16c50b6..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/JreForm.java +++ /dev/null @@ -1,266 +0,0 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.JTextField; - -public abstract class JreForm extends JPanel -{ - protected final JLabel _jrePathLabel = new JLabel(); - protected final JLabel _jreMinLabel = new JLabel(); - protected final JLabel _jreMaxLabel = new JLabel(); - protected final JLabel _jvmOptionsTextLabel = new JLabel(); - protected final JTextField _jrePathField = new JTextField(); - protected final JTextField _jreMinField = new JTextField(); - protected final JTextField _jreMaxField = new JTextField(); - protected final JTextArea _jvmOptionsTextArea = new JTextArea(); - protected final JLabel _initialHeapSizeLabel = new JLabel(); - protected final JLabel _maxHeapSizeLabel = new JLabel(); - protected final JTextField _initialHeapSizeField = new JTextField(); - protected final JTextField _maxHeapSizeField = new JTextField(); - protected final JComboBox _varCombo = new JComboBox(); - protected final JButton _propertyButton = new JButton(); - protected final JButton _optionButton = new JButton(); - protected final JButton _envPropertyButton = new JButton(); - protected final JButton _envOptionButton = new JButton(); - protected final JTextField _envVarField = new JTextField(); - protected final JTextField _maxHeapPercentField = new JTextField(); - protected final JTextField _initialHeapPercentField = new JTextField(); - protected final JComboBox _jdkPreferenceCombo = new JComboBox(); - - /** - * Default constructor - */ - public JreForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:50DLU:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _jrePathLabel.setName("jrePathLabel"); - _jrePathLabel.setText(Messages.getString("jrePath")); - jpanel1.add(_jrePathLabel,cc.xy(2,2)); - - _jreMinLabel.setName("jreMinLabel"); - _jreMinLabel.setText(Messages.getString("jreMin")); - jpanel1.add(_jreMinLabel,cc.xy(2,4)); - - _jreMaxLabel.setName("jreMaxLabel"); - _jreMaxLabel.setText(Messages.getString("jreMax")); - jpanel1.add(_jreMaxLabel,cc.xy(2,6)); - - _jvmOptionsTextLabel.setName("jvmOptionsTextLabel"); - _jvmOptionsTextLabel.setText(Messages.getString("jvmOptions")); - jpanel1.add(_jvmOptionsTextLabel,new CellConstraints(2,12,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - _jrePathField.setName("jrePathField"); - _jrePathField.setToolTipText(Messages.getString("jrePathTip")); - jpanel1.add(_jrePathField,cc.xywh(4,2,7,1)); - - _jreMinField.setName("jreMinField"); - jpanel1.add(_jreMinField,cc.xy(4,4)); - - _jreMaxField.setName("jreMaxField"); - jpanel1.add(_jreMaxField,cc.xy(4,6)); - - _jvmOptionsTextArea.setName("jvmOptionsTextArea"); - _jvmOptionsTextArea.setToolTipText(Messages.getString("jvmOptionsTip")); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_jvmOptionsTextArea); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xywh(4,12,7,1)); - - _initialHeapSizeLabel.setName("initialHeapSizeLabel"); - _initialHeapSizeLabel.setText(Messages.getString("initialHeapSize")); - jpanel1.add(_initialHeapSizeLabel,cc.xy(2,8)); - - _maxHeapSizeLabel.setName("maxHeapSizeLabel"); - _maxHeapSizeLabel.setText(Messages.getString("maxHeapSize")); - jpanel1.add(_maxHeapSizeLabel,cc.xy(2,10)); - - JLabel jlabel1 = new JLabel(); - jlabel1.setText("MB"); - jpanel1.add(jlabel1,cc.xy(6,8)); - - JLabel jlabel2 = new JLabel(); - jlabel2.setText("MB"); - jpanel1.add(jlabel2,cc.xy(6,10)); - - _initialHeapSizeField.setName("initialHeapSizeField"); - jpanel1.add(_initialHeapSizeField,cc.xy(4,8)); - - _maxHeapSizeField.setName("maxHeapSizeField"); - jpanel1.add(_maxHeapSizeField,cc.xy(4,10)); - - jpanel1.add(createPanel1(),cc.xywh(2,14,9,1)); - _maxHeapPercentField.setName("maxHeapPercentField"); - jpanel1.add(_maxHeapPercentField,cc.xy(8,10)); - - _initialHeapPercentField.setName("initialHeapPercentField"); - jpanel1.add(_initialHeapPercentField,cc.xy(8,8)); - - _jdkPreferenceCombo.setName("jdkPreferenceCombo"); - jpanel1.add(_jdkPreferenceCombo,cc.xywh(8,4,3,1)); - - JLabel jlabel3 = new JLabel(); - jlabel3.setText(Messages.getString("freeMemory")); - jpanel1.add(jlabel3,cc.xy(10,8)); - - JLabel jlabel4 = new JLabel(); - jlabel4.setText(Messages.getString("freeMemory")); - jpanel1.add(jlabel4,cc.xy(10,10)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }); - return jpanel1; - } - - public JPanel createPanel1() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _varCombo.setName("varCombo"); - jpanel1.add(_varCombo,cc.xy(3,1)); - - _propertyButton.setActionCommand("Add"); - _propertyButton.setIcon(loadImage("images/edit_add16.png")); - _propertyButton.setName("propertyButton"); - _propertyButton.setText(Messages.getString("property")); - _propertyButton.setToolTipText(Messages.getString("propertyTip")); - jpanel1.add(_propertyButton,cc.xy(5,1)); - - _optionButton.setActionCommand("Add"); - _optionButton.setIcon(loadImage("images/edit_add16.png")); - _optionButton.setName("optionButton"); - _optionButton.setText(Messages.getString("option")); - _optionButton.setToolTipText(Messages.getString("optionTip")); - jpanel1.add(_optionButton,cc.xy(7,1)); - - _envPropertyButton.setActionCommand("Add"); - _envPropertyButton.setIcon(loadImage("images/edit_add16.png")); - _envPropertyButton.setName("envPropertyButton"); - _envPropertyButton.setText(Messages.getString("property")); - _envPropertyButton.setToolTipText(Messages.getString("propertyTip")); - jpanel1.add(_envPropertyButton,cc.xy(5,3)); - - JLabel jlabel1 = new JLabel(); - jlabel1.setText(Messages.getString("varsAndRegistry")); - jpanel1.add(jlabel1,cc.xy(1,1)); - - JLabel jlabel2 = new JLabel(); - jlabel2.setIcon(loadImage("images/asterix.gif")); - jlabel2.setText(Messages.getString("envVar")); - jpanel1.add(jlabel2,cc.xy(1,3)); - - _envOptionButton.setActionCommand("Add"); - _envOptionButton.setIcon(loadImage("images/edit_add16.png")); - _envOptionButton.setName("envOptionButton"); - _envOptionButton.setText(Messages.getString("option")); - _envOptionButton.setToolTipText(Messages.getString("optionTip")); - jpanel1.add(_envOptionButton,cc.xy(7,3)); - - _envVarField.setName("envVarField"); - jpanel1.add(_envVarField,cc.xy(3,3)); - - addFillComponents(jpanel1,new int[]{ 2,4,6 },new int[]{ 2 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/JreForm.jfrm b/3rdparty/launch4j/src/net/sf/launch4j/form/JreForm.jfrm deleted file mode 100644 index 1e61237e0..000000000 Binary files a/3rdparty/launch4j/src/net/sf/launch4j/form/JreForm.jfrm and /dev/null differ diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/Messages.java b/3rdparty/launch4j/src/net/sf/launch4j/form/Messages.java deleted file mode 100644 index aaf995f80..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/Messages.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.form; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.form.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/MessagesForm.java b/3rdparty/launch4j/src/net/sf/launch4j/form/MessagesForm.java deleted file mode 100644 index f2e8723da..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/MessagesForm.java +++ /dev/null @@ -1,183 +0,0 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; - -public abstract class MessagesForm extends JPanel -{ - protected final JTextArea _startupErrTextArea = new JTextArea(); - protected final JTextArea _bundledJreErrTextArea = new JTextArea(); - protected final JTextArea _jreVersionErrTextArea = new JTextArea(); - protected final JTextArea _launcherErrTextArea = new JTextArea(); - protected final JCheckBox _messagesCheck = new JCheckBox(); - protected final JTextArea _instanceAlreadyExistsMsgTextArea = new JTextArea(); - - /** - * Default constructor - */ - public MessagesForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _startupErrTextArea.setName("startupErrTextArea"); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_startupErrTextArea); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xy(4,4)); - - _bundledJreErrTextArea.setName("bundledJreErrTextArea"); - JScrollPane jscrollpane2 = new JScrollPane(); - jscrollpane2.setViewportView(_bundledJreErrTextArea); - jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane2,cc.xy(4,6)); - - _jreVersionErrTextArea.setName("jreVersionErrTextArea"); - _jreVersionErrTextArea.setToolTipText(Messages.getString("jreVersionErrTip")); - JScrollPane jscrollpane3 = new JScrollPane(); - jscrollpane3.setViewportView(_jreVersionErrTextArea); - jscrollpane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane3,cc.xy(4,8)); - - _launcherErrTextArea.setName("launcherErrTextArea"); - JScrollPane jscrollpane4 = new JScrollPane(); - jscrollpane4.setViewportView(_launcherErrTextArea); - jscrollpane4.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane4.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane4,cc.xy(4,10)); - - JLabel jlabel1 = new JLabel(); - jlabel1.setText(Messages.getString("startupErr")); - jpanel1.add(jlabel1,new CellConstraints(2,4,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - JLabel jlabel2 = new JLabel(); - jlabel2.setText(Messages.getString("bundledJreErr")); - jpanel1.add(jlabel2,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - JLabel jlabel3 = new JLabel(); - jlabel3.setText(Messages.getString("jreVersionErr")); - jpanel1.add(jlabel3,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - JLabel jlabel4 = new JLabel(); - jlabel4.setText(Messages.getString("launcherErr")); - jpanel1.add(jlabel4,new CellConstraints(2,10,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - _messagesCheck.setActionCommand("Add version information"); - _messagesCheck.setName("messagesCheck"); - _messagesCheck.setText(Messages.getString("addMessages")); - jpanel1.add(_messagesCheck,cc.xy(4,2)); - - JLabel jlabel5 = new JLabel(); - jlabel5.setText(Messages.getString("instanceAlreadyExistsMsg")); - jpanel1.add(jlabel5,new CellConstraints(2,12,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - _instanceAlreadyExistsMsgTextArea.setName("instanceAlreadyExistsMsgTextArea"); - _instanceAlreadyExistsMsgTextArea.setToolTipText(Messages.getString("instanceAlreadyExistsMsgTip")); - JScrollPane jscrollpane5 = new JScrollPane(); - jscrollpane5.setViewportView(_instanceAlreadyExistsMsgTextArea); - jscrollpane5.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane5.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane5,cc.xy(4,12)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm b/3rdparty/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm deleted file mode 100644 index e8044dfd7..000000000 Binary files a/3rdparty/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm and /dev/null differ diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java b/3rdparty/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java deleted file mode 100644 index 2bfe724a6..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java +++ /dev/null @@ -1,141 +0,0 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -public abstract class SingleInstanceForm extends JPanel -{ - protected final JLabel _splashFileLabel = new JLabel(); - protected final JTextField _mutexNameField = new JTextField(); - protected final JCheckBox _singleInstanceCheck = new JCheckBox(); - protected final JTextField _windowTitleField = new JTextField(); - protected final JLabel _splashFileLabel1 = new JLabel(); - - /** - * Default constructor - */ - public SingleInstanceForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _splashFileLabel.setIcon(loadImage("images/asterix.gif")); - _splashFileLabel.setName("splashFileLabel"); - _splashFileLabel.setText(Messages.getString("mutexName")); - jpanel1.add(_splashFileLabel,cc.xy(2,4)); - - _mutexNameField.setName("mutexNameField"); - _mutexNameField.setToolTipText(Messages.getString("mutexNameTip")); - jpanel1.add(_mutexNameField,cc.xywh(4,4,2,1)); - - _singleInstanceCheck.setActionCommand("Enable splash screen"); - _singleInstanceCheck.setName("singleInstanceCheck"); - _singleInstanceCheck.setText(Messages.getString("enableSingleInstance")); - jpanel1.add(_singleInstanceCheck,cc.xywh(4,2,2,1)); - - _windowTitleField.setName("windowTitleField"); - _windowTitleField.setToolTipText(Messages.getString("windowTitleTip")); - jpanel1.add(_windowTitleField,cc.xywh(4,6,2,1)); - - _splashFileLabel1.setName("splashFileLabel"); - _splashFileLabel1.setText(Messages.getString("windowTitle")); - jpanel1.add(_splashFileLabel1,cc.xy(2,6)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6 },new int[]{ 1,2,3,4,5,6,7 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.jfrm b/3rdparty/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.jfrm deleted file mode 100644 index c9d7ce28d..000000000 Binary files a/3rdparty/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.jfrm and /dev/null differ diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/SplashForm.java b/3rdparty/launch4j/src/net/sf/launch4j/form/SplashForm.java deleted file mode 100644 index 22a0ed8a3..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/SplashForm.java +++ /dev/null @@ -1,166 +0,0 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -public abstract class SplashForm extends JPanel -{ - protected final JLabel _splashFileLabel = new JLabel(); - protected final JLabel _waitForWindowLabel = new JLabel(); - protected final JLabel _timeoutLabel = new JLabel(); - protected final JCheckBox _timeoutErrCheck = new JCheckBox(); - protected final JTextField _splashFileField = new JTextField(); - protected final JTextField _timeoutField = new JTextField(); - protected final JButton _splashFileButton = new JButton(); - protected final JCheckBox _splashCheck = new JCheckBox(); - protected final JCheckBox _waitForWindowCheck = new JCheckBox(); - - /** - * Default constructor - */ - public SplashForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _splashFileLabel.setIcon(loadImage("images/asterix.gif")); - _splashFileLabel.setName("splashFileLabel"); - _splashFileLabel.setText(Messages.getString("splashFile")); - jpanel1.add(_splashFileLabel,cc.xy(2,4)); - - _waitForWindowLabel.setName("waitForWindowLabel"); - _waitForWindowLabel.setText(Messages.getString("waitForWindow")); - jpanel1.add(_waitForWindowLabel,cc.xy(2,6)); - - _timeoutLabel.setIcon(loadImage("images/asterix.gif")); - _timeoutLabel.setName("timeoutLabel"); - _timeoutLabel.setText(Messages.getString("timeout")); - jpanel1.add(_timeoutLabel,cc.xy(2,8)); - - _timeoutErrCheck.setActionCommand("Signal error on timeout"); - _timeoutErrCheck.setName("timeoutErrCheck"); - _timeoutErrCheck.setText(Messages.getString("timeoutErr")); - _timeoutErrCheck.setToolTipText(Messages.getString("timeoutErrTip")); - jpanel1.add(_timeoutErrCheck,cc.xywh(4,10,2,1)); - - _splashFileField.setName("splashFileField"); - _splashFileField.setToolTipText(Messages.getString("splashFileTip")); - jpanel1.add(_splashFileField,cc.xywh(4,4,2,1)); - - _timeoutField.setName("timeoutField"); - _timeoutField.setToolTipText(Messages.getString("timeoutTip")); - jpanel1.add(_timeoutField,cc.xy(4,8)); - - _splashFileButton.setIcon(loadImage("images/open16.png")); - _splashFileButton.setName("splashFileButton"); - jpanel1.add(_splashFileButton,cc.xy(7,4)); - - _splashCheck.setActionCommand("Enable splash screen"); - _splashCheck.setName("splashCheck"); - _splashCheck.setText(Messages.getString("enableSplash")); - jpanel1.add(_splashCheck,cc.xywh(4,2,2,1)); - - _waitForWindowCheck.setActionCommand("Close splash screen when an application window appears"); - _waitForWindowCheck.setName("waitForWindowCheck"); - _waitForWindowCheck.setText(Messages.getString("waitForWindowText")); - jpanel1.add(_waitForWindowCheck,cc.xywh(4,6,2,1)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/SplashForm.jfrm b/3rdparty/launch4j/src/net/sf/launch4j/form/SplashForm.jfrm deleted file mode 100644 index 114f0e31d..000000000 Binary files a/3rdparty/launch4j/src/net/sf/launch4j/form/SplashForm.jfrm and /dev/null differ diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java b/3rdparty/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java deleted file mode 100644 index 5a4d9440c..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java +++ /dev/null @@ -1,232 +0,0 @@ -package net.sf.launch4j.form; - -import com.jeta.forms.components.separator.TitledSeparator; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -public abstract class VersionInfoForm extends JPanel -{ - protected final JCheckBox _versionInfoCheck = new JCheckBox(); - protected final JLabel _fileVersionLabel = new JLabel(); - protected final JTextField _fileVersionField = new JTextField(); - protected final TitledSeparator _addVersionInfoSeparator = new TitledSeparator(); - protected final JLabel _productVersionLabel = new JLabel(); - protected final JTextField _productVersionField = new JTextField(); - protected final JLabel _fileDescriptionLabel = new JLabel(); - protected final JTextField _fileDescriptionField = new JTextField(); - protected final JLabel _copyrightLabel = new JLabel(); - protected final JTextField _copyrightField = new JTextField(); - protected final JLabel _txtFileVersionLabel = new JLabel(); - protected final JTextField _txtFileVersionField = new JTextField(); - protected final JLabel _txtProductVersionLabel = new JLabel(); - protected final JTextField _txtProductVersionField = new JTextField(); - protected final JLabel _productNameLabel = new JLabel(); - protected final JTextField _productNameField = new JTextField(); - protected final JLabel _originalFilenameLabel = new JLabel(); - protected final JTextField _originalFilenameField = new JTextField(); - protected final JLabel _internalNameLabel = new JLabel(); - protected final JTextField _internalNameField = new JTextField(); - protected final JLabel _companyNameLabel = new JLabel(); - protected final JTextField _companyNameField = new JTextField(); - - /** - * Default constructor - */ - public VersionInfoForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:7DLU:NONE,RIGHT:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _versionInfoCheck.setActionCommand("Add version information"); - _versionInfoCheck.setName("versionInfoCheck"); - _versionInfoCheck.setText(Messages.getString("addVersionInfo")); - jpanel1.add(_versionInfoCheck,cc.xywh(4,2,5,1)); - - _fileVersionLabel.setIcon(loadImage("images/asterix.gif")); - _fileVersionLabel.setName("fileVersionLabel"); - _fileVersionLabel.setText(Messages.getString("fileVersion")); - jpanel1.add(_fileVersionLabel,cc.xy(2,4)); - - _fileVersionField.setName("fileVersionField"); - _fileVersionField.setToolTipText(Messages.getString("fileVersionTip")); - jpanel1.add(_fileVersionField,cc.xy(4,4)); - - _addVersionInfoSeparator.setName("addVersionInfoSeparator"); - _addVersionInfoSeparator.setText("Additional information"); - jpanel1.add(_addVersionInfoSeparator,cc.xywh(2,10,7,1)); - - _productVersionLabel.setIcon(loadImage("images/asterix.gif")); - _productVersionLabel.setName("productVersionLabel"); - _productVersionLabel.setText(Messages.getString("productVersion")); - jpanel1.add(_productVersionLabel,cc.xy(2,12)); - - _productVersionField.setName("productVersionField"); - _productVersionField.setToolTipText(Messages.getString("productVersionTip")); - jpanel1.add(_productVersionField,cc.xy(4,12)); - - _fileDescriptionLabel.setIcon(loadImage("images/asterix.gif")); - _fileDescriptionLabel.setName("fileDescriptionLabel"); - _fileDescriptionLabel.setText(Messages.getString("fileDescription")); - jpanel1.add(_fileDescriptionLabel,cc.xy(2,6)); - - _fileDescriptionField.setName("fileDescriptionField"); - _fileDescriptionField.setToolTipText(Messages.getString("fileDescriptionTip")); - jpanel1.add(_fileDescriptionField,cc.xywh(4,6,5,1)); - - _copyrightLabel.setIcon(loadImage("images/asterix.gif")); - _copyrightLabel.setName("copyrightLabel"); - _copyrightLabel.setText(Messages.getString("copyright")); - jpanel1.add(_copyrightLabel,cc.xy(2,8)); - - _copyrightField.setName("copyrightField"); - jpanel1.add(_copyrightField,cc.xywh(4,8,5,1)); - - _txtFileVersionLabel.setIcon(loadImage("images/asterix.gif")); - _txtFileVersionLabel.setName("txtFileVersionLabel"); - _txtFileVersionLabel.setText(Messages.getString("txtFileVersion")); - jpanel1.add(_txtFileVersionLabel,cc.xy(6,4)); - - _txtFileVersionField.setName("txtFileVersionField"); - _txtFileVersionField.setToolTipText(Messages.getString("txtFileVersionTip")); - jpanel1.add(_txtFileVersionField,cc.xy(8,4)); - - _txtProductVersionLabel.setIcon(loadImage("images/asterix.gif")); - _txtProductVersionLabel.setName("txtProductVersionLabel"); - _txtProductVersionLabel.setText(Messages.getString("txtProductVersion")); - jpanel1.add(_txtProductVersionLabel,cc.xy(6,12)); - - _txtProductVersionField.setName("txtProductVersionField"); - _txtProductVersionField.setToolTipText(Messages.getString("txtProductVersionTip")); - jpanel1.add(_txtProductVersionField,cc.xy(8,12)); - - _productNameLabel.setIcon(loadImage("images/asterix.gif")); - _productNameLabel.setName("productNameLabel"); - _productNameLabel.setText(Messages.getString("productName")); - jpanel1.add(_productNameLabel,cc.xy(2,14)); - - _productNameField.setName("productNameField"); - jpanel1.add(_productNameField,cc.xywh(4,14,5,1)); - - _originalFilenameLabel.setIcon(loadImage("images/asterix.gif")); - _originalFilenameLabel.setName("originalFilenameLabel"); - _originalFilenameLabel.setText(Messages.getString("originalFilename")); - jpanel1.add(_originalFilenameLabel,cc.xy(2,20)); - - _originalFilenameField.setName("originalFilenameField"); - _originalFilenameField.setToolTipText(Messages.getString("originalFilenameTip")); - jpanel1.add(_originalFilenameField,cc.xywh(4,20,5,1)); - - _internalNameLabel.setIcon(loadImage("images/asterix.gif")); - _internalNameLabel.setName("internalNameLabel"); - _internalNameLabel.setText(Messages.getString("internalName")); - jpanel1.add(_internalNameLabel,cc.xy(2,18)); - - _internalNameField.setName("internalNameField"); - _internalNameField.setToolTipText(Messages.getString("internalNameTip")); - jpanel1.add(_internalNameField,cc.xywh(4,18,5,1)); - - _companyNameLabel.setName("companyNameLabel"); - _companyNameLabel.setText(Messages.getString("companyName")); - jpanel1.add(_companyNameLabel,cc.xy(2,16)); - - _companyNameField.setName("companyNameField"); - jpanel1.add(_companyNameField,cc.xywh(4,16,5,1)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/VersionInfoForm.jfrm b/3rdparty/launch4j/src/net/sf/launch4j/form/VersionInfoForm.jfrm deleted file mode 100644 index 32eb136c8..000000000 Binary files a/3rdparty/launch4j/src/net/sf/launch4j/form/VersionInfoForm.jfrm and /dev/null differ diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/messages.properties b/3rdparty/launch4j/src/net/sf/launch4j/form/messages.properties deleted file mode 100644 index 1be6c9584..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/messages.properties +++ /dev/null @@ -1,146 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -log=Log - -outfile=Output file: -outfileTip=Output executable file. -customProcName=Custom process name and XP style manifest -stayAlive=Stay alive after launching a GUI application -manifest=Manifest: -manifestTip=Wrapper's manifest for User Account Control, will not enable XP styles! -icon=Icon: -iconTip=Application icon. -jar=Jar: -jarTip=Application jar. -dontWrapJar=Dont't wrap the jar, launch only -cmdLine=Command line args: -cmdLineTip=Constant command line arguments passed to the application. -options=Options: -chdir=Change dir: -chdirTip=Change current directory to a location relative to the executable. Empty field has no effect, . - changes directory to the exe location. -priority=Process priority: -normalPriority=Normal -idlePriority=Idle -highPriority=High -downloadAndSupport=Java download and support -errorTitle=Error title: -errorTitleTip=Launch4j signals errors using a message box, you can set it's title to the application's name. -downloadUrl=Java download URL: -supportUrl=Support URL: - -new=New -accept=Accept -remove=Remove -customClassPath=Custom classpath -classPath=Classpath: -mainClass=Main class: -editClassPath=Edit item: -importClassPath=Import attributes from a jar's manifest. - -headerType=Header type: -gui=GUI -console=Console -objectFiles=Object files: -libs=w32api: -linkerOptions=Custom header - linker options - -enableSingleInstance=Allow only a single instance of the application -mutexName=Mutex name -mutexNameTip=Mutex name that will uniquely identify your application. -windowTitle=Window title -windowTitleTip=Title of the GUI application window to bring up on attempt to start a next instance. - -jrePath=Bundled JRE path: -jrePathTip=Bundled JRE path relative to the executable or absolute. -jreMin=Min JRE version: -jreMax=Max JRE version: -dontUsePrivateJres=Don't use private JREs -jvmOptions=JVM options: -jvmOptionsTip=Accepts everything you would normally pass to java/javaw launcher: assertion options, system properties and X options. -initialHeapSize=Initial heap size: -maxHeapSize=Max heap size: -freeMemory=% of free memory -jdkPreference=JDK/JRE preference: -addVariables=Add variables: -addVariablesTip=Add special variable or map environment variables to system properties. -exeDirVarTip=Executable's runtime directory path. -exeFileVarTip=Executable's runtime file path (directory and filename). -varsAndRegistry=Variables / registry: -envVar=Environment var: -property=Property -propertyTip=Map a variable to a system property. -option=Option -optionTip=Pass a JVM option using a variable. - -setVariables=Set variables: - -enableSplash=Enable splash screen -splashFile=Splash file: -splashFileTip=Splash screen file in BMP format. -waitForWindow=Wait for window -waitForWindowText=Close splash screen when an application window appears -timeout=Timeout [s]: -timeoutTip=Number of seconds after which the splash screen must close. Splash timeout may cause an error depending on splashTimeoutErr property. -timeoutErr=Signal error on timeout -timeoutErrTip=True signals an error on splash timeout, false closes the splash screen quietly. - -version=Version -additionalInfo=Additional information -addVersionInfo=Add version information -fileVersion=File version: -fileVersionTip=Version number 'x.x.x.x' -productVersion=Product version: -productVersionTip=Version number 'x.x.x.x' -fileDescription=File description: -fileDescriptionTip=File description presented to the user. -copyright=Copyright: -txtFileVersion=Free form: -txtFileVersionTip=Free form file version, for example '1.20.RC1'. -txtProductVersion=Free form: -txtProductVersionTip=Free form product version, for example '1.20.RC1'. -productName=Product name: -originalFilename=Original filename: -originalFilenameTip=Original name of the file without the path. Allows to determine whether a file has been renamed by a user. -internalName=Internal name: -internalNameTip=Internal name without extension, original filename or module name for example. -companyName=Company name: - -addMessages=Add custom messages -startupErr=Startup error: -bundledJreErr=Bundled JRE error: -jreVersionErr=JRE version error: -jreVersionErrTip=Launch4j will append the required version number at the end of this message. -launcherErr=Launcher error: -instanceAlreadyExistsMsg=Inst. already exists: -instanceAlreadyExistsMsgTip=Message displayed by single instance console applications if an instance already exists. diff --git a/3rdparty/launch4j/src/net/sf/launch4j/form/messages_es.properties b/3rdparty/launch4j/src/net/sf/launch4j/form/messages_es.properties deleted file mode 100644 index 50e2d7587..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/form/messages_es.properties +++ /dev/null @@ -1,118 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -log = Registro - -outfile = Fichero de salida -outfileTip = Fichero ejecutable de salida. -errorTitle = T\u00EDtulo de error -errorTitleTip = Launch4j indica los errores usando una ventana de mensaje, usted puede ponerle el nombre de la aplicaci\u00F3n a esta ventana. -customProcName = Nombre personalizado del proceso -stayAlive = Mantener abierto despu\u00E9s de lanzar una aplicaci\u00F3n GUI -icon = Icono -iconTip = Icono de la aplicaci\u00F3n. -jar = Jar -jarTip = Jar de la aplicaci\u00F3n. -dontWrapJar = No empaquetar el jar, s\u00F3lo lanzar -cmdLine = Argumentos del jar -cmdLine = Argumentos de l\u00EDnea de \u00F3rdenes pasados a la aplicaci\u00F3n. -options = Opciones -chdir = Cambiar al directorio -chdirTip = Cambia el directorio actual a la localizaci\u00F3n relativa al ejecutable. Si el campo se deja vac\u00EDo, no tiene efecto, . - cambia el directorio a la localizaci\u00F3n del exe. -headerType = Tipo de cabecera -gui = GUI -console = Consola -objectFiles = Ficheros objeto -libs = w32api -linkerOptions = Cabecera personalizada - opciones del enlazador -jrePath = Ruta del JRE -jrePathTip = Ruta relativa al ejecutable del JRE. -jreMin = Versi\u00F3n m\u00EDnima del JRE -jreMax = Versi\u00F3n m\u00E1xima del JRE -jvmOptions = Argumentos de la JVM -jvmOptionsTip = Acepta cualquier argumento que normalmente se le pasar\u00EDa al lanzador java/javaw\: opciones assertion, propiedades de sistema y opciones X. -initialHeapSize = Tama\u00F1o inicial de la pila -maxHeapSize = Tama\u00F1o m\u00E1ximo de la pila -freeMemory=% of free memory -addVariables = A\u00F1adir variables -addVariablesTip = A\u00F1adir una variable especial o mapear variables de entorno a las propiedades del sistema. -exeDirVarTip = Ruta del directorio del ejecutable. -exeFileVarTip = Ruta del fichero ejecutable (directorio y nombre del fichero). -other = Otra -otherTip = Mapear una variable de entorno a una propiedad del sistema. -otherVarTip = Variable de entorno que mapear. -add = A\u00F1adir -specifyVar = Especificar variable de entorno que a\u00F1adir. -enableSplash = Activar pantalla de bienvenida -splashFile = Imagen -splashFileTip = Imagen en formato BMP para la pantalla de bienvenida. -waitForWindow = Esperar la ventana -waitForWindowText = Cerrar la pantalla de bienvenida cuando aparezca una ventana de la aplicaci\u00F3n -timeout = Tiempo de espera [s] -timeoutTip = Numero de segundos despu\u00E9s de los que la pantalla de bienvenida se debe cerrar. Esta propiedad puede causar provocar un error dependiendo de la propiedad splashTimeoutErr. -timeoutErr = Se\u00F1al de error asociada al tiempo de espera -timeoutErrTip = Marcado (true) se\u00F1ala un error despu\u00E9s del tiempo de espera de la pantalla de bienvenida, no marcado (false) cierra la pantalla de bienvenida silenciosamente -addVersionInfo = A\u00F1ade informaci\u00F3n sobre la versi\u00F3n -fileVersion = Versi\u00F3n del fichero -fileVersionTip = N\u00FAmero de versi\u00F3n 'x.x.x.x' -additionalInfo = Informaci\u00F3n adicional -productVersion = Versi\u00F3n del producto -productVersionTip = N\u00FAmero de versi\u00F3n 'x.x.x.x' -fileDescription = Descripci\u00F3n del fichero -fileDescriptionTip = Descripci\u00F3n del fichero que se le muestra al usuario. -copyright = Copyright -txtFileVersion = Forma libre -txtFileVersionTip = Forma libre de versi\u00F3n, por ejemplo '1.20.RC1'. -txtProductVersion = Forma libre -txtProductVersionTip = Forma libre del producto, por ejemplo '1.20.RC1'. -productName = Nombre del producto -originalFilename = Nombre original del fichero -originalFilenameTip = Nombre original del fichero sin la ruta. Permite determinar si un fichero ha sido renombrado por un usuario. -internalName = Nombre interno -internalNameTip = Nombre interno sin extensi\u00F3n, el nombre original del fichero o el m\u00F3dulo, por ejemplo. -companyName = Nombre de la organizaci\u00F3n - -addMessages=Add custom messages -startupErr=Startup error: -bundledJreErr=Bundled JRE error: -jreVersionErr=JRE version error: -jreVersionErrTip=Launch4j will append the required version number at the end of this message. -launcherErr=Launcher error: -instanceAlreadyExistsMsg=Inst. already exists: -instanceAlreadyExistsMsgTip=Message displayed by single instance console applications if an instance already exists. - -enableSingleInstance=Allow only a single instance of the application -mutexName=Mutex name -mutexNameTip=Mutex name that will uniquely identify your application. -windowTitle=Window title -windowTitleTip=Title of the application window to bring up on attempt to start a next instance. diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java deleted file mode 100644 index 5265e6436..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.awt.Color; -import java.awt.event.ActionListener; - -import javax.swing.JTextField; - -import net.sf.launch4j.binding.Binding; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public abstract class AbstractAcceptListener implements ActionListener { - final JTextField _field; - - public AbstractAcceptListener(JTextField f, boolean listen) { - _field = f; - if (listen) { - _field.addActionListener(this); - } - } - - protected String getText() { - return _field.getText(); - } - - protected void clear() { - _field.setText(""); - _field.requestFocusInWindow(); - } - - protected void signalViolation(String msg) { - final Color bg = _field.getBackground(); - _field.setBackground(Binding.INVALID_COLOR); - MainFrame.getInstance().warn(msg); - _field.setBackground(bg); - _field.requestFocusInWindow(); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java deleted file mode 100644 index 01ebe8adf..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import javax.swing.JFileChooser; -import javax.swing.JRadioButton; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import net.sf.launch4j.FileChooserFilter; -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.Config; -import net.sf.launch4j.form.BasicForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class BasicFormImpl extends BasicForm { - - public BasicFormImpl(Bindings bindings, JFileChooser fc) { - bindings.add("outfile", _outfileField) - .add("dontWrapJar", _dontWrapJarCheck) - .add("jar", _jarField) - .add("manifest", _manifestField) - .add("icon", _iconField) - .add("cmdLine", _cmdLineField) - .add("errTitle", _errorTitleField) - .add("downloadUrl", _downloadUrlField, Config.DOWNLOAD_URL) - .add("supportUrl", _supportUrlField) - .add("chdir", _chdirField) - .add("priorityIndex", new JRadioButton[] { _normalPriorityRadio, - _idlePriorityRadio, - _highPriorityRadio }) - .add("customProcName", _customProcNameCheck) - .add("stayAlive", _stayAliveCheck); - - _dontWrapJarCheck.addChangeListener(new DontWrapJarChangeListener()); - - _outfileButton.addActionListener(new BrowseActionListener(true, fc, - new FileChooserFilter("Windows executables (.exe)", ".exe"), - _outfileField)); - _jarButton.addActionListener(new BrowseActionListener(false, fc, - new FileChooserFilter("Jar files", ".jar"), _jarField)); - _manifestButton.addActionListener(new BrowseActionListener(false, fc, - new FileChooserFilter("Manifest files (.manifest)", ".manifest"), - _manifestField)); - _iconButton.addActionListener(new BrowseActionListener(false, fc, - new FileChooserFilter("Icon files (.ico)", ".ico"), _iconField)); - } - - private class DontWrapJarChangeListener implements ChangeListener { - - public void stateChanged(ChangeEvent e) { - boolean dontWrap = _dontWrapJarCheck.isSelected(); - if (dontWrap) { - _jarLabel.setIcon(loadImage("images/asterix-o.gif")); - _jarLabel.setText(Messages.getString("jarPath")); - _jarField.setToolTipText(Messages.getString("jarPathTip")); - } else { - _jarLabel.setIcon(loadImage("images/asterix.gif")); - _jarLabel.setText(Messages.getString("jar")); - _jarField.setToolTipText(Messages.getString("jarTip")); - } - _jarButton.setEnabled(!dontWrap); - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java deleted file mode 100644 index 89a5017ee..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; - -import javax.swing.JFileChooser; -import javax.swing.JTextField; - -import net.sf.launch4j.FileChooserFilter; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class BrowseActionListener implements ActionListener { - private final boolean _save; - private final JFileChooser _fileChooser; - private final FileChooserFilter _filter; - private final JTextField _field; - - public BrowseActionListener(boolean save, JFileChooser fileChooser, - FileChooserFilter filter, JTextField field) { - _save = save; - _fileChooser = fileChooser; - _filter = filter; - _field = field; - } - - public void actionPerformed(ActionEvent e) { - if (!_field.isEnabled()) { - return; - } - _fileChooser.setFileFilter(_filter); - _fileChooser.setSelectedFile(new File("")); - int result = _save - ? _fileChooser.showSaveDialog(MainFrame.getInstance()) - : _fileChooser.showOpenDialog(MainFrame.getInstance()); - if (result == JFileChooser.APPROVE_OPTION) { - _field.setText(_fileChooser.getSelectedFile().getPath()); - } - _fileChooser.removeChoosableFileFilter(_filter); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java deleted file mode 100644 index 65d82096e..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.IOException; -import java.util.jar.Attributes; -import java.util.jar.JarFile; - -import javax.swing.DefaultListModel; -import javax.swing.JFileChooser; -import javax.swing.JTextField; -import javax.swing.ListSelectionModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -import net.sf.launch4j.FileChooserFilter; -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.binding.Validator; -import net.sf.launch4j.config.ClassPath; -import net.sf.launch4j.form.ClassPathForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class ClassPathFormImpl extends ClassPathForm { - private final JFileChooser _fileChooser; - private final FileChooserFilter _filter - = new FileChooserFilter("Executable jar", ".jar"); - - public ClassPathFormImpl(Bindings bindings, JFileChooser fc) { - bindings.addOptComponent("classPath", ClassPath.class, _classpathCheck) - .add("classPath.mainClass", _mainclassField) - .add("classPath.paths", _classpathList); - _fileChooser = fc; - - ClasspathCheckListener cpl = new ClasspathCheckListener(); - _classpathCheck.addChangeListener(cpl); - cpl.stateChanged(null); - - _classpathList.setModel(new DefaultListModel()); - _classpathList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - _classpathList.addListSelectionListener(new ClasspathSelectionListener()); - - _newClasspathButton.addActionListener(new NewClasspathListener()); - _acceptClasspathButton.addActionListener( - new AcceptClasspathListener(_classpathField)); - _removeClasspathButton.addActionListener(new RemoveClasspathListener()); - _importClasspathButton.addActionListener(new ImportClasspathListener()); - _classpathUpButton.addActionListener(new MoveUpListener()); - _classpathDownButton.addActionListener(new MoveDownListener()); - } - - private class ClasspathCheckListener implements ChangeListener { - public void stateChanged(ChangeEvent e) { - boolean on = _classpathCheck.isSelected(); - _importClasspathButton.setEnabled(on); - _classpathUpButton.setEnabled(on); - _classpathDownButton.setEnabled(on); - _classpathField.setEnabled(on); - _newClasspathButton.setEnabled(on); - _acceptClasspathButton.setEnabled(on); - _removeClasspathButton.setEnabled(on); - } - } - - private class NewClasspathListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - _classpathList.clearSelection(); - _classpathField.setText(""); - _classpathField.requestFocusInWindow(); - } - } - - private class AcceptClasspathListener extends AbstractAcceptListener { - public AcceptClasspathListener(JTextField f) { - super(f, true); - } - - public void actionPerformed(ActionEvent e) { - String cp = getText(); - if (Validator.isEmpty(cp)) { - signalViolation(Messages.getString("specifyClassPath")); - return; - } - DefaultListModel model = (DefaultListModel) _classpathList.getModel(); - if (_classpathList.isSelectionEmpty()) { - model.addElement(cp); - clear(); - } else { - model.setElementAt(cp, _classpathList.getSelectedIndex()); - } - } - } - - private class ClasspathSelectionListener implements ListSelectionListener { - public void valueChanged(ListSelectionEvent e) { - if (e.getValueIsAdjusting()) { - return; - } - if (_classpathList.isSelectionEmpty()) { - _classpathField.setText(""); - } else { - _classpathField.setText((String) _classpathList.getSelectedValue()); - } - _classpathField.requestFocusInWindow(); - } - } - - private class RemoveClasspathListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (_classpathList.isSelectionEmpty() - || !MainFrame.getInstance().confirm( - Messages.getString("confirmClassPathRemoval"))) { - return; - } - DefaultListModel model = (DefaultListModel) _classpathList.getModel(); - while (!_classpathList.isSelectionEmpty()) { - model.remove(_classpathList.getSelectedIndex()); - } - } - } - - private class MoveUpListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - int x = _classpathList.getSelectedIndex(); - if (x < 1) { - return; - } - DefaultListModel model = (DefaultListModel) _classpathList.getModel(); - Object o = model.get(x - 1); - model.set(x - 1, model.get(x)); - model.set(x, o); - _classpathList.setSelectedIndex(x - 1); - } - } - - private class MoveDownListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - DefaultListModel model = (DefaultListModel) _classpathList.getModel(); - int x = _classpathList.getSelectedIndex(); - if (x == -1 || x >= model.getSize() - 1) { - return; - } - Object o = model.get(x + 1); - model.set(x + 1, model.get(x)); - model.set(x, o); - _classpathList.setSelectedIndex(x + 1); - } - } - - private class ImportClasspathListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - try { - _fileChooser.setFileFilter(_filter); - _fileChooser.setSelectedFile(new File("")); - if (_fileChooser.showOpenDialog(MainFrame.getInstance()) - == JFileChooser.APPROVE_OPTION) { - JarFile jar = new JarFile(_fileChooser.getSelectedFile()); - if (jar.getManifest() == null) { - jar.close(); - MainFrame.getInstance().info(Messages.getString("noManifest")); - return; - } - Attributes attr = jar.getManifest().getMainAttributes(); - String mainClass = (String) attr.getValue("Main-Class"); - String classPath = (String) attr.getValue("Class-Path"); - jar.close(); - _mainclassField.setText(mainClass != null ? mainClass : ""); - DefaultListModel model = new DefaultListModel(); - if (classPath != null) { - String[] paths = classPath.split(" "); - for (int i = 0; i < paths.length; i++) { - model.addElement(paths[i]); - } - } - _classpathList.setModel(model); - } - } catch (IOException ex) { - MainFrame.getInstance().warn(ex.getMessage()); - } - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java deleted file mode 100644 index d29720642..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 10, 2005 - */ -package net.sf.launch4j.formimpl; - -import javax.swing.BorderFactory; -import javax.swing.JFileChooser; -import javax.swing.JTextArea; - -import net.sf.launch4j.binding.Binding; -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.form.ConfigForm; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class ConfigFormImpl extends ConfigForm { - private final Bindings _bindings = new Bindings(); - private final JFileChooser _fileChooser = new FileChooser(ConfigFormImpl.class); - - public ConfigFormImpl() { - _tab.setBorder(BorderFactory.createMatteBorder(0, -1, -1, -1, getBackground())); - _tab.addTab(Messages.getString("tab.basic"), - new BasicFormImpl(_bindings, _fileChooser)); - _tab.addTab(Messages.getString("tab.classpath"), - new ClassPathFormImpl(_bindings, _fileChooser)); - _tab.addTab(Messages.getString("tab.header"), - new HeaderFormImpl(_bindings)); - _tab.addTab(Messages.getString("tab.singleInstance"), - new SingleInstanceFormImpl(_bindings)); - _tab.addTab(Messages.getString("tab.jre"), - new JreFormImpl(_bindings, _fileChooser)); - _tab.addTab(Messages.getString("tab.envVars"), - new EnvironmentVarsFormImpl(_bindings)); - _tab.addTab(Messages.getString("tab.splash"), - new SplashFormImpl(_bindings, _fileChooser)); - _tab.addTab(Messages.getString("tab.version"), - new VersionInfoFormImpl(_bindings, _fileChooser)); - _tab.addTab(Messages.getString("tab.messages"), - new MessagesFormImpl(_bindings)); - } - - public void clear(IValidatable bean) { - _bindings.clear(bean); - } - - public void put(IValidatable bean) { - _bindings.put(bean); - } - - public void get(IValidatable bean) { - _bindings.get(bean); - } - - public boolean isModified() { - return _bindings.isModified(); - } - - public JTextArea getLogTextArea() { - return _logTextArea; - } - - public Binding getBinding(String property) { - return _bindings.getBinding(property); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java deleted file mode 100644 index 2f325fe3c..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jun 10, 2006 - */ -package net.sf.launch4j.formimpl; - -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.form.EnvironmentVarsForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class EnvironmentVarsFormImpl extends EnvironmentVarsForm { - - public EnvironmentVarsFormImpl(Bindings bindings) { - bindings.add("variables", _envVarsTextArea); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java deleted file mode 100644 index c1b984e58..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jul 19, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.io.File; -import java.util.prefs.Preferences; - -import javax.swing.JFileChooser; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class FileChooser extends JFileChooser { - private final Preferences _prefs; - private final String _key; - - public FileChooser(Class clazz) { - _prefs = Preferences.userNodeForPackage(clazz); - _key = "currentDir-" - + clazz.getName().substring(clazz.getName().lastIndexOf('.') + 1); - String path = _prefs.get(_key, null); - if (path != null) { - setCurrentDirectory(new File(path)); - } - } - - public void approveSelection() { - _prefs.put(_key, getCurrentDirectory().getPath()); - super.approveSelection(); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/GlassPane.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/GlassPane.java deleted file mode 100644 index c1b1d8dd4..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/GlassPane.java +++ /dev/null @@ -1,67 +0,0 @@ -package net.sf.launch4j.formimpl; - -import java.awt.AWTEvent; -import java.awt.Component; -import java.awt.Cursor; -import java.awt.Toolkit; -import java.awt.Window; -import java.awt.event.AWTEventListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; - -import javax.swing.JComponent; -import javax.swing.SwingUtilities; - -/** - * This is the glass pane class that intercepts screen interactions during - * system busy states. - * - * Based on JavaWorld article by Yexin Chen. - */ -public class GlassPane extends JComponent implements AWTEventListener { - private final Window _window; - - public GlassPane(Window w) { - _window = w; - addMouseListener(new MouseAdapter() {}); - addKeyListener(new KeyAdapter() {}); - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - } - - /** - * Receives all key events in the AWT and processes the ones that originated - * from the current window with the glass pane. - * - * @param event - * the AWTEvent that was fired - */ - public void eventDispatched(AWTEvent event) { - Object source = event.getSource(); - if (event instanceof KeyEvent - && source instanceof Component) { - /* - * If the event originated from the window w/glass pane, - * consume the event. - */ - if ((SwingUtilities.windowForComponent((Component) source) == _window)) { - ((KeyEvent) event).consume(); - } - } - } - - /** - * Sets the glass pane as visible or invisible. The mouse cursor will be set - * accordingly. - */ - public void setVisible(boolean visible) { - if (visible) { - // Start receiving all events and consume them if necessary - Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK); - } else { - // Stop receiving all events - Toolkit.getDefaultToolkit().removeAWTEventListener(this); - } - super.setVisible(visible); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java deleted file mode 100644 index accfaa9de..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JRadioButton; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import net.sf.launch4j.binding.Binding; -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.ConfigPersister; -import net.sf.launch4j.form.HeaderForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class HeaderFormImpl extends HeaderForm { - private final Bindings _bindings; - - public HeaderFormImpl(Bindings bindings) { - _bindings = bindings; - _bindings.add("headerTypeIndex", new JRadioButton[] { _guiHeaderRadio, - _consoleHeaderRadio }) - .add("headerObjects", "customHeaderObjects", _headerObjectsCheck, - _headerObjectsTextArea) - .add("libs", "customLibs", _libsCheck, _libsTextArea); - - _guiHeaderRadio.addChangeListener(new HeaderTypeChangeListener()); - _headerObjectsCheck.addActionListener(new HeaderObjectsActionListener()); - _libsCheck.addActionListener(new LibsActionListener()); - } - - private class HeaderTypeChangeListener implements ChangeListener { - public void stateChanged(ChangeEvent e) { - Config c = ConfigPersister.getInstance().getConfig(); - c.setHeaderType(_guiHeaderRadio.isSelected() ? Config.GUI_HEADER - : Config.CONSOLE_HEADER); - if (!_headerObjectsCheck.isSelected()) { - Binding b = _bindings.getBinding("headerObjects"); - b.put(c); - } - } - } - - private class HeaderObjectsActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (!_headerObjectsCheck.isSelected()) { - ConfigPersister.getInstance().getConfig().setHeaderObjects(null); - Binding b = _bindings.getBinding("headerObjects"); - b.put(ConfigPersister.getInstance().getConfig()); - } - } - } - - private class LibsActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (!_libsCheck.isSelected()) { - ConfigPersister.getInstance().getConfig().setLibs(null); - Binding b = _bindings.getBinding("libs"); - b.put(ConfigPersister.getInstance().getConfig()); - } - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java deleted file mode 100644 index 48a2f18e8..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.DefaultComboBoxModel; -import javax.swing.JFileChooser; -import javax.swing.JTextField; - -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.binding.Validator; -import net.sf.launch4j.form.JreForm; -import net.sf.launch4j.config.Jre; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class JreFormImpl extends JreForm { - - public JreFormImpl(Bindings bindings, JFileChooser fc) { - _jdkPreferenceCombo.setModel(new DefaultComboBoxModel(new String[] { - Messages.getString("jdkPreference.jre.only"), - Messages.getString("jdkPreference.prefer.jre"), - Messages.getString("jdkPreference.prefer.jdk"), - Messages.getString("jdkPreference.jdk.only")})); - bindings.add("jre.path", _jrePathField) - .add("jre.minVersion", _jreMinField) - .add("jre.maxVersion", _jreMaxField) - .add("jre.jdkPreferenceIndex", _jdkPreferenceCombo, - Jre.DEFAULT_JDK_PREFERENCE_INDEX) - .add("jre.initialHeapSize", _initialHeapSizeField) - .add("jre.initialHeapPercent", _initialHeapPercentField) - .add("jre.maxHeapSize", _maxHeapSizeField) - .add("jre.maxHeapPercent", _maxHeapPercentField) - .add("jre.options", _jvmOptionsTextArea); - - _varCombo.setModel(new DefaultComboBoxModel(new String[] { - "EXEDIR", "EXEFILE", "PWD", "OLDPWD", - "HKEY_CLASSES_ROOT", "HKEY_CURRENT_USER", "HKEY_LOCAL_MACHINE", - "HKEY_USERS", "HKEY_CURRENT_CONFIG" })); - - _varCombo.addActionListener(new VarComboActionListener()); - _varCombo.setSelectedIndex(0); - - _propertyButton.addActionListener(new PropertyActionListener()); - _optionButton.addActionListener(new OptionActionListener()); - - _envPropertyButton.addActionListener(new EnvPropertyActionListener(_envVarField)); - _envOptionButton.addActionListener(new EnvOptionActionListener(_envVarField)); - } - - private class VarComboActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - _optionButton.setEnabled(((String) _varCombo.getSelectedItem()) - .startsWith("HKEY_")); - } - } - - private class PropertyActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - final int pos = _jvmOptionsTextArea.getCaretPosition(); - final String var = (String) _varCombo.getSelectedItem(); - if (var.startsWith("HKEY_")) { - _jvmOptionsTextArea.insert("-Dreg.key=\"%" - + var + "\\\\...%\"\n", pos); - } else { - _jvmOptionsTextArea.insert("-Dlaunch4j." + var.toLowerCase() - + "=\"%" + var + "%\"\n", pos); - } - } - } - - private class OptionActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - final int pos = _jvmOptionsTextArea.getCaretPosition(); - final String var = (String) _varCombo.getSelectedItem(); - if (var.startsWith("HKEY_")) { - _jvmOptionsTextArea.insert("%" + var + "\\\\...%\n", pos); - } else { - _jvmOptionsTextArea.insert("%" + var + "%\n", pos); - } - } - } - - private abstract class EnvActionListener extends AbstractAcceptListener { - public EnvActionListener(JTextField f, boolean listen) { - super(f, listen); - } - - public void actionPerformed(ActionEvent e) { - final int pos = _jvmOptionsTextArea.getCaretPosition(); - final String var = getText() - .replaceAll("\"", "") - .replaceAll("%", ""); - if (Validator.isEmpty(var)) { - signalViolation(Messages.getString("specifyVar")); - return; - } - add(var, pos); - clear(); - } - - protected abstract void add(String var, int pos); - } - - private class EnvPropertyActionListener extends EnvActionListener { - public EnvPropertyActionListener(JTextField f) { - super(f, true); - } - - protected void add(String var, int pos) { - final String prop = var - .replaceAll(" ", ".") - .replaceAll("_", ".") - .toLowerCase(); - _jvmOptionsTextArea.insert("-Denv." + prop + "=\"%" + var - + "%\"\n", pos); - } - } - - private class EnvOptionActionListener extends EnvActionListener { - public EnvOptionActionListener(JTextField f) { - super(f, false); - } - - protected void add(String var, int pos) { - _jvmOptionsTextArea.insert("%" + var + "%\n", pos); - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java deleted file mode 100644 index 4a2cc8715..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java +++ /dev/null @@ -1,358 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2005-05-09 - */ -package net.sf.launch4j.formimpl; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.File; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JToolBar; -import javax.swing.UIManager; - -import com.jgoodies.looks.Options; -import com.jgoodies.looks.plastic.PlasticXPLookAndFeel; - -import foxtrot.Task; -import foxtrot.Worker; - -import net.sf.launch4j.Builder; -import net.sf.launch4j.BuilderException; -import net.sf.launch4j.ExecException; -import net.sf.launch4j.FileChooserFilter; -import net.sf.launch4j.Log; -import net.sf.launch4j.Main; -import net.sf.launch4j.Util; -import net.sf.launch4j.binding.Binding; -import net.sf.launch4j.binding.BindingException; -import net.sf.launch4j.binding.InvariantViolationException; -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.ConfigPersister; -import net.sf.launch4j.config.ConfigPersisterException; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class MainFrame extends JFrame { - private static MainFrame _instance; - - private final JToolBar _toolBar; - private final JButton _runButton; - private final ConfigFormImpl _configForm; - private final JFileChooser _fileChooser = new FileChooser(MainFrame.class); - private File _outfile; - private boolean _saved = false; - - public static void createInstance() { - try { - Toolkit.getDefaultToolkit().setDynamicLayout(true); - System.setProperty("sun.awt.noerasebackground","true"); - - // JGoodies - Options.setDefaultIconSize(new Dimension(16, 16)); // menu icons - Options.setUseNarrowButtons(false); - Options.setPopupDropShadowEnabled(true); - - UIManager.setLookAndFeel(new PlasticXPLookAndFeel()); - _instance = new MainFrame(); - } catch (Exception e) { - System.err.println(e); - } - } - - public static MainFrame getInstance() { - return _instance; - } - - public MainFrame() { - showConfigName(null); - setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - addWindowListener(new MainFrameListener()); - setGlassPane(new GlassPane(this)); - _fileChooser.setFileFilter(new FileChooserFilter( - Messages.getString("MainFrame.config.files"), - new String[] {".xml", ".cfg"})); - - _toolBar = new JToolBar(); - _toolBar.setFloatable(false); - _toolBar.setRollover(true); - addButton("images/new.png", Messages.getString("MainFrame.new.config"), - new NewActionListener()); - addButton("images/open.png", Messages.getString("MainFrame.open.config"), - new OpenActionListener()); - addButton("images/save.png", Messages.getString("MainFrame.save.config"), - new SaveActionListener()); - _toolBar.addSeparator(); - addButton("images/build.png", Messages.getString("MainFrame.build.wrapper"), - new BuildActionListener()); - _runButton = addButton("images/run.png", - Messages.getString("MainFrame.test.wrapper"), - new RunActionListener()); - setRunEnabled(false); - _toolBar.addSeparator(); - addButton("images/info.png", Messages.getString("MainFrame.about.launch4j"), - new AboutActionListener()); - - _configForm = new ConfigFormImpl(); - getContentPane().setLayout(new BorderLayout()); - getContentPane().add(_toolBar, BorderLayout.NORTH); - getContentPane().add(_configForm, BorderLayout.CENTER); - pack(); - Dimension scr = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension fr = getSize(); - fr.width += 25; - fr.height += 100; - setBounds((scr.width - fr.width) / 2, (scr.height - fr.height) / 2, - fr.width, fr.height); - setVisible(true); - } - - private JButton addButton(String iconPath, String tooltip, ActionListener l) { - ImageIcon icon = new ImageIcon(MainFrame.class.getClassLoader() - .getResource(iconPath)); - JButton b = new JButton(icon); - b.setToolTipText(tooltip); - b.addActionListener(l); - _toolBar.add(b); - return b; - } - - public void info(String text) { - JOptionPane.showMessageDialog(this, - text, - Main.getName(), - JOptionPane.INFORMATION_MESSAGE); - } - - public void warn(String text) { - JOptionPane.showMessageDialog(this, - text, - Main.getName(), - JOptionPane.WARNING_MESSAGE); - } - - public void warn(InvariantViolationException e) { - Binding b = e.getBinding(); - if (b != null) { - b.markInvalid(); - } - warn(e.getMessage()); - if (b != null) { - e.getBinding().markValid(); - } - } - - public boolean confirm(String text) { - return JOptionPane.showConfirmDialog(MainFrame.this, - text, - Messages.getString("MainFrame.confirm"), - JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; - } - - private boolean isModified() { - return (!_configForm.isModified()) - || confirm(Messages.getString("MainFrame.discard.changes")); - } - - private boolean save() { - // XXX - try { - _configForm.get(ConfigPersister.getInstance().getConfig()); - if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) { - File f = _fileChooser.getSelectedFile(); - if (!f.getPath().endsWith(".xml")) { - f = new File(f.getPath() + ".xml"); - } - ConfigPersister.getInstance().save(f); - _saved = true; - showConfigName(f); - return true; - } - return false; - } catch (InvariantViolationException ex) { - warn(ex); - return false; - } catch (BindingException ex) { - warn(ex.getMessage()); - return false; - } catch (ConfigPersisterException ex) { - warn(ex.getMessage()); - return false; - } - } - - private void showConfigName(File config) { - setTitle(Main.getName() + " - " + (config != null ? config.getName() - : Messages.getString("MainFrame.untitled"))); - } - - private void setRunEnabled(boolean enabled) { - if (!enabled) { - _outfile = null; - } - _runButton.setEnabled(enabled); - } - - private void clearConfig() { - ConfigPersister.getInstance().createBlank(); - _configForm.clear(ConfigPersister.getInstance().getConfig()); - } - - private class MainFrameListener extends WindowAdapter { - public void windowOpened(WindowEvent e) { - clearConfig(); - } - - public void windowClosing(WindowEvent e) { - if (isModified()) { - System.exit(0); - } - } - } - - private class NewActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (isModified()) { - clearConfig(); - } - _saved = false; - showConfigName(null); - setRunEnabled(false); - } - } - - private class OpenActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - try { - if (isModified() && _fileChooser.showOpenDialog(MainFrame.this) - == JOptionPane.YES_OPTION) { - final File f = _fileChooser.getSelectedFile(); - if (f.getPath().endsWith(".xml")) { - ConfigPersister.getInstance().load(f); - _saved = true; - } else { - ConfigPersister.getInstance().loadVersion1(f); - _saved = false; - } - _configForm.put(ConfigPersister.getInstance().getConfig()); - showConfigName(f); - setRunEnabled(false); - } - } catch (ConfigPersisterException ex) { - warn(ex.getMessage()); - } catch (BindingException ex) { - warn(ex.getMessage()); - } - } - } - - private class SaveActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - save(); - } - } - - private class BuildActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - final Log log = Log.getSwingLog(_configForm.getLogTextArea()); - try { - if ((!_saved || _configForm.isModified()) - && !save()) { - return; - } - log.clear(); - ConfigPersister.getInstance().getConfig().checkInvariants(); - Builder b = new Builder(log); - _outfile = b.build(); - setRunEnabled(ConfigPersister.getInstance().getConfig() - .getHeaderType() == Config.GUI_HEADER // TODO fix console app test - && (Util.WINDOWS_OS || !ConfigPersister.getInstance() - .getConfig().isDontWrapJar())); - } catch (InvariantViolationException ex) { - setRunEnabled(false); - ex.setBinding(_configForm.getBinding(ex.getProperty())); - warn(ex); - } catch (BuilderException ex) { - setRunEnabled(false); - log.append(ex.getMessage()); - } - } - } - - private class RunActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - try { - getGlassPane().setVisible(true); - Worker.post(new Task() { - public Object run() throws ExecException { - Log log = Log.getSwingLog(_configForm.getLogTextArea()); - log.clear(); - String path = _outfile.getPath(); - if (Util.WINDOWS_OS) { - log.append(Messages.getString("MainFrame.executing") + path); - Util.exec(new String[] { path }, log); - } else { - log.append(Messages.getString("MainFrame.jar.integrity.test") - + path); - Util.exec(new String[] { "java", "-jar", path }, log); - } - return null; - } - }); - } catch (Exception ex) { - // XXX errors logged by exec - } finally { - getGlassPane().setVisible(false); - } - }; - } - - private class AboutActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - info(Main.getDescription()); - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/Messages.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/Messages.java deleted file mode 100644 index 5e1c64110..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/Messages.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.formimpl; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.formimpl.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java deleted file mode 100644 index c05d7f047..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Oct 7, 2006 - */ -package net.sf.launch4j.formimpl; - -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.Msg; -import net.sf.launch4j.form.MessagesForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class MessagesFormImpl extends MessagesForm { - - public MessagesFormImpl(Bindings bindings) { - Msg m = new Msg(); - bindings.addOptComponent("messages", Msg.class, _messagesCheck) - .add("messages.startupErr", _startupErrTextArea, m.getStartupErr()) - .add("messages.bundledJreErr", _bundledJreErrTextArea, m.getBundledJreErr()) - .add("messages.jreVersionErr", _jreVersionErrTextArea, m.getJreVersionErr()) - .add("messages.launcherErr", _launcherErrTextArea, m.getLauncherErr()) - .add("messages.instanceAlreadyExistsMsg", _instanceAlreadyExistsMsgTextArea, - m.getInstanceAlreadyExistsMsg()); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java deleted file mode 100644 index c916a9184..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - * Created on 2007-09-22 - */ -package net.sf.launch4j.formimpl; - -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.SingleInstance; -import net.sf.launch4j.form.SingleInstanceForm; - -/** - * @author Copyright (C) 2007 Grzegorz Kowal - */ -public class SingleInstanceFormImpl extends SingleInstanceForm { - - public SingleInstanceFormImpl(Bindings bindings) { - bindings.addOptComponent("singleInstance", SingleInstance.class, - _singleInstanceCheck) - .add("singleInstance.mutexName", _mutexNameField) - .add("singleInstance.windowTitle", _windowTitleField); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java deleted file mode 100644 index 7413d4a21..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import javax.swing.JFileChooser; - -import net.sf.launch4j.FileChooserFilter; -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.Splash; -import net.sf.launch4j.form.SplashForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class SplashFormImpl extends SplashForm { - - public SplashFormImpl(Bindings bindings, JFileChooser fc) { - bindings.addOptComponent("splash", Splash.class, _splashCheck) - .add("splash.file", _splashFileField) - .add("splash.waitForWindow", _waitForWindowCheck, true) - .add("splash.timeout", _timeoutField, "60") - .add("splash.timeoutErr", _timeoutErrCheck, true); - - _splashFileButton.addActionListener(new BrowseActionListener(false, fc, - new FileChooserFilter("Bitmap files (.bmp)", ".bmp"), _splashFileField)); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java deleted file mode 100644 index c2f60d1d3..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Launch4j nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import javax.swing.JFileChooser; - -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.VersionInfo; -import net.sf.launch4j.form.VersionInfoForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class VersionInfoFormImpl extends VersionInfoForm { - - public VersionInfoFormImpl(Bindings bindings, JFileChooser fc) { - bindings.addOptComponent("versionInfo", VersionInfo.class, _versionInfoCheck) - .add("versionInfo.fileVersion", _fileVersionField) - .add("versionInfo.productVersion", _productVersionField) - .add("versionInfo.fileDescription", _fileDescriptionField) - .add("versionInfo.internalName", _internalNameField) - .add("versionInfo.originalFilename", _originalFilenameField) - .add("versionInfo.productName", _productNameField) - .add("versionInfo.txtFileVersion", _txtFileVersionField) - .add("versionInfo.txtProductVersion", _txtProductVersionField) - .add("versionInfo.companyName", _companyNameField) - .add("versionInfo.copyright", _copyrightField); - } -} diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/messages.properties b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/messages.properties deleted file mode 100644 index 53a2442a8..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/messages.properties +++ /dev/null @@ -1,74 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -tab.basic=Basic -tab.classpath=Classpath -tab.header=Header -tab.singleInstance=Single instance -tab.jre=JRE -tab.envVars=Set env. variables -tab.splash=Splash -tab.version=Version Info -tab.messages=Messages - -# Basic -jar=Jar: -jarPath=Jar runtime path: -jarTip=Application jar. -jarPathTip=Optional runtime path of the jar relative to the executable. For example, if the executable launcher and the application jar named calc.exe and calc.jar are in the same directory, it would be: calc.jar. - -# Classpath -specifyClassPath=Specify classpath item to add. -confirmClassPathRemoval=Remove selected classpath items? -noManifest=The selected jar does not have a manifest. - -# JRE -specifyVar=Specify environment variable to add. -otherVar=Other var -jdkPreference.jre.only=Only use public JREs -jdkPreference.prefer.jre=Prefer public JRE, but use JDK runtime if newer -jdkPreference.prefer.jdk=Prefer JDK runtime, but use public JRE if newer -jdkPreference.jdk.only=Only use private JDK runtimes - -MainFrame.config.files=launch4j config files (.xml, .cfg) -MainFrame.new.config=New configuration -MainFrame.open.config=Open configuration or import 1.x -MainFrame.save.config=Save configuration -MainFrame.build.wrapper=Build wrapper -MainFrame.test.wrapper=Test wrapper -MainFrame.about.launch4j=About launch4j -MainFrame.discard.changes=Discard changes? -MainFrame.confirm=Confirm -MainFrame.untitled=untitled -MainFrame.executing=Executing: -MainFrame.jar.integrity.test=Jar integrity test, executing: diff --git a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties b/3rdparty/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties deleted file mode 100644 index 1d2fac25f..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties +++ /dev/null @@ -1,56 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -tab.basic = B\u00E1sico -tab.header = Cabecera -tab.jre = JRE -tab.splash = Pantalla de bienvenida -tab.version = Informaci\u00F3n de la versi\u00F3n - -jar = Jar -jarPath = Ruta del jar -jarTip = Jar de la aplicaci\u00F3n. -jarPathTip = Ruta del jar relativa al ejecutable. Por ejemplo, si el lanzador ejecutable y el jar de la aplicaci\u00F3n, llamados calc.exe y calc.jar respectivamente, est\u00E1n en el mismo directorio, ser\u00EDa\: calc.jar. - -MainFrame.config.files = Ficheros de configuraci\u00F3n de launch4j (.xml, .cfg) -MainFrame.new.config = Nueva configuraci\u00F3n -MainFrame.open.config = Abrir configuraci\u00F3n o importar 1.x -MainFrame.save.config = Guardar configuraci\u00F3n -MainFrame.build.wrapper = Construir el empaquetador -MainFrame.test.wrapper = Comprobar el empaquetador -MainFrame.about.launch4j = Acerca de launch4j -MainFrame.discard.changes = \u00BFDescartar cambios? -MainFrame.confirm = Confirmar -MainFrame.untitled = Sin nombre -MainFrame.executing = Ejecutando\: -MainFrame.jar.integrity.test = Prueba de integridad jar, ejecutando\: diff --git a/3rdparty/launch4j/src/net/sf/launch4j/messages.properties b/3rdparty/launch4j/src/net/sf/launch4j/messages.properties deleted file mode 100644 index cf28d15af..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/messages.properties +++ /dev/null @@ -1,45 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Main.usage=usage - -Builder.compiling.resources=Compiling resources -Builder.linking=Linking -Builder.wrapping=Wrapping -Builder.success=Successfully created -Builder.generated.resource.file=Generated resource file...\n -Builder.line.has.errors=Line {0} has errors... - -Util.exec.failed=Exec failed -Util.tmpdir=Temporary file directory path (launch4j.tmpdir) cannot contain spaces. -Util.use.double.backslash=Use \\\\ to code Windows paths in fields that don't represent files or paths! diff --git a/3rdparty/launch4j/src/net/sf/launch4j/messages_es.properties b/3rdparty/launch4j/src/net/sf/launch4j/messages_es.properties deleted file mode 100644 index b179d9bd5..000000000 --- a/3rdparty/launch4j/src/net/sf/launch4j/messages_es.properties +++ /dev/null @@ -1,45 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the Launch4j nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Main.usage=Uso - -Builder.compiling.resources=Compilando recursos -Builder.linking=Enlazando -Builder.wrapping=Empaquetando -Builder.success=Creado con \ufffdxito -Builder.generated.resource.file=Fichero de recursos generado...\n -Builder.line.has.errors=Line {0} has errors... - -Util.exec.failed=Fallo en la ejecuci\ufffd -Util.tmpdir=Temporary file directory path (launch4j.tmpdir) cannot contain spaces. -Util.use.double.backslash=Use \\\\ to code Windows paths in fields that don't represent files or paths! \ No newline at end of file diff --git a/3rdparty/launch4j/w32api/MinGW.LICENSE.txt b/3rdparty/launch4j/w32api/MinGW.LICENSE.txt deleted file mode 100644 index 141412dd9..000000000 --- a/3rdparty/launch4j/w32api/MinGW.LICENSE.txt +++ /dev/null @@ -1,25 +0,0 @@ -MinGW - Licensing Terms - -Various pieces distributed with MinGW come with its own copyright and license: - -Basic MinGW runtime - MinGW base runtime package is uncopyrighted and placed in the public domain. - This basically means that you can do what you want with the code. - -w32api - You are free to use, modify and copy this package. - No restrictions are imposed on programs or object files compiled with this library. - You may not restrict the the usage of this library. - You may distribute this library as part of another package or as a modified package - if and only if you do not restrict the usage of the portions consisting - of this (optionally modified) library. - If distributed as a modified package then this file must be included. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -MinGW profiling code - MinGW profiling code is distributed under the GNU General Public License. - -The development tools such as GCC, GDB, GNU Make, etc all covered by GNU General Public License. diff --git a/3rdparty/launch4j/w32api/crt2.o b/3rdparty/launch4j/w32api/crt2.o deleted file mode 100644 index f81f836cf..000000000 Binary files a/3rdparty/launch4j/w32api/crt2.o and /dev/null differ diff --git a/3rdparty/launch4j/w32api/libadvapi32.a b/3rdparty/launch4j/w32api/libadvapi32.a deleted file mode 100644 index c471853c7..000000000 Binary files a/3rdparty/launch4j/w32api/libadvapi32.a and /dev/null differ diff --git a/3rdparty/launch4j/w32api/libgcc.a b/3rdparty/launch4j/w32api/libgcc.a deleted file mode 100644 index d3f89479e..000000000 Binary files a/3rdparty/launch4j/w32api/libgcc.a and /dev/null differ diff --git a/3rdparty/launch4j/w32api/libkernel32.a b/3rdparty/launch4j/w32api/libkernel32.a deleted file mode 100644 index 5d3eb074f..000000000 Binary files a/3rdparty/launch4j/w32api/libkernel32.a and /dev/null differ diff --git a/3rdparty/launch4j/w32api/libmingw32.a b/3rdparty/launch4j/w32api/libmingw32.a deleted file mode 100644 index d1f7888d8..000000000 Binary files a/3rdparty/launch4j/w32api/libmingw32.a and /dev/null differ diff --git a/3rdparty/launch4j/w32api/libmsvcrt.a b/3rdparty/launch4j/w32api/libmsvcrt.a deleted file mode 100644 index 6714146b6..000000000 Binary files a/3rdparty/launch4j/w32api/libmsvcrt.a and /dev/null differ diff --git a/3rdparty/launch4j/w32api/libshell32.a b/3rdparty/launch4j/w32api/libshell32.a deleted file mode 100644 index d35fbdaf3..000000000 Binary files a/3rdparty/launch4j/w32api/libshell32.a and /dev/null differ diff --git a/3rdparty/launch4j/w32api/libuser32.a b/3rdparty/launch4j/w32api/libuser32.a deleted file mode 100644 index 387fb650d..000000000 Binary files a/3rdparty/launch4j/w32api/libuser32.a and /dev/null differ diff --git a/3rdparty/launch4j/web/bullet.gif b/3rdparty/launch4j/web/bullet.gif deleted file mode 100644 index f3f133bb8..000000000 Binary files a/3rdparty/launch4j/web/bullet.gif and /dev/null differ diff --git a/3rdparty/launch4j/web/changelog.html b/3rdparty/launch4j/web/changelog.html deleted file mode 100644 index 83511a554..000000000 --- a/3rdparty/launch4j/web/changelog.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - Launch4j - Cross-platform Java executable wrapper - - - - - - - -
-
- launch4j 3.0.1 -
- -
-

Changelog

- -

Changes in version 3.0.1 (20-07-2008)

-
    -
  • Enhanced the runtime logging (--l4j-debug).
  • -
  • Fixed critical bug #1925387 64-bit JDK detection problem caused a runtime search error (found by Stivo).
  • -
  • Fixed bug #1919406, #1989479 Not every option is loaded from saved xml file (found by Robert Lachner, Jan-Philipp Rathje).
  • -
  • Fixed bug #1930222 Simple typo (found by Daniel).
  • -
- -

Changes in version 3.0.0 (16-03-2008)

-
    -
  • FR #1390075 Added dynamic initial/max heap values.
  • -
  • FR #1707827 Allow to prefer JDK private runtimes over JREs (Ian Roberts).
  • -
  • FR #1730245 Allow to run only a single aplication instance (Sylvain Mina).
  • -
  • FR #1391610 Added IBM JRE/JDK support.
  • -
  • Added environment variable expansion in bundled JRE path.
  • -
  • Fixed critical bug #1882524 JRE detection problem on 64-bit Windows.
  • -
  • Fixed bug #1758912 Vista elevation to full administrator privileges.
  • -
  • Fixed bug #1784341 Problems with spaces in paths under linux (Michael Piefel).
  • -
  • Fixed bug where /bin was appended to path environment variable instead of jre_path/bin.
  • -
- -

Changed license to BSD, MIT (26-01-2008)

-
    -
  • - The upcoming Launch4j 3.0.0 release will be licensed under the much more - liberal new BSD license. The head subproject (the binary header attached to wrapped jars) - will be licensed under the similar MIT license. -
  • -
- -

Changes in version 3.0.0-pre2 (29-10-2006)

-
    -
  • Enhanced GUI.
  • -
  • Redesigned error reporting.
  • -
  • Added custom error messages.
  • -
  • Added support website feature.
  • -
  • Added PWD and OLDPWD special variables and access to the registry.
  • -
  • Runtime ini file extension changed to .l4j.ini, added comments (#).
  • -
  • FR #1427811 Initial process priority.
  • -
  • FR #1547339 Added VarFileInfo structure to Version Info (Stephan Laertz).
  • -
  • FR #1584295 Updated documentation for --l4j-debug. -
  • Fixed <jarArgs/> and <args/> config conversion bug (found by Dafe Simonek).
  • -
  • Fixed the Ant task exception reporting bug, added tmpdir and bindir attributes.
  • -
  • Fixed bug #1563415 Problem with launching application when ini file exists (found by mojomax).
  • -
  • Fixed bug #1527619 Console header wildcard expansion (found by erikjv).
  • -
  • Fixed bug #1544167 NPE when dontwrap and only classpath given (found by Hendrik Schreiber).
  • -
  • Fixed bug #1584264 Dropdown boxes get mixed up (found by Larsen).
  • -
- -

News (17-10-2006)

- - -

Changes in version 3.0.0-pre1 (21-07-2006)

-
    -
  • Improved configuration file format and embedded Ant config.
  • -
  • Launch executable jars, regular jars and class files.
  • -
  • Added dynamic classpath resolution with environment variable references and wildcards.
  • -
  • Added option to set environment variables before launching the application.
  • -
  • New command line switches to change the compiled options.
  • -
  • Improved debug information.
  • -
  • Added support for XP visual style manifests.
  • -
  • Added option to disable use of private JREs.
  • -
  • Many small fixes and improvements...
  • -
- -

Configuration file changes in 3.x

-
    -
  • Previous formats (1.x and 2.x) are supported.
  • -
  • <headerType> accepts gui|console
  • -
  • <jarArgs> was changed to <cmdLine>
  • -
  • - <launch4jConfig><headerObjects><file> was changed to - <launch4jConfig><obj> -
  • -
  • - <launch4jConfig><libs><file> was changed to - <launch4jConfig><lib> -
  • -
  • - <launch4jConfig><jre><args> was changed to multiple - <launch4jConfig><jre><opt> -
  • -
- -

Embedded Ant configuration changes in 3.x

-
    -
  • - <jre args="value"> was changed to - <jre><opt>value</opt></jre> -
  • -
  • Now it's possible to define headerObjects, libs and classpath.
  • -
- -

Changes in version 2.1.5 (21-07-2006)

-
    -
  • Changed the Java download site to http://java.com/download.
  • -
  • Now it's possible to use absolute and relative paths to specify the bundled JRE.
  • -
- -

Changes in version 2.1.4 (15-06-2006)

-
    -
  • - Fixed bug #1503996 Only the first wrapper instance had a custom process name - (found by Helge Böhme). -
  • -
- -

Changes in version 2.1.3 (31-05-2006)

-
    -
  • - Fixed bug #1497453 Ant task doesn't support relative jar path with '..' - (found by Aston, Pavel Moukhataev). -
  • -
  • Jar argument size limit is now 16KB.
  • -
  • Environment variable size limit raised to 32KB.
  • -
  • Allow to concatenate multiple env. variables in one property (Maria D.)
  • -
  • Added launch4j.tmpdir property.
  • -
- -

Changes in version 2.1.2 (03-04-2006)

-
    -
  • Important bugfix: insufficient command line buffer size was increased to 32KB - (found by Sebastian Kopsan).
  • -
  • Added runtime JVM options from an .ini file.
  • -
  • Launch4j's bin directory is now configurable through launch4j.bindir - system property.
  • -
- -

Changes in version 2.1.1 (25-01-2006)

-
    -
  • Fixed bug #1402748. Validation error occurred when using an Ant task with - embedded config and dontWrapJar option (found by Chris Nokleberg).
  • -
- -

Changes in version 2.1.0 (10-01-2006)

-
    -
  • More features and smaller header: 18 KB!!
  • -
  • Added launcher mode, you can choose whether or not to wrap the jar.
  • -
  • Spanish translation of the website/docs and program messages - (Patricio Martínez Ros).
  • -
  • JRE's bin directory is appended to the Path environment variable - (Ianiv Schweber).
  • -
  • Added special variables EXEDIR and EXEFILE that hold the executable's - directory and full path.
  • -
  • Support for mapping environment variables to system properties.
  • -
  • Added debug launching mode - various information is displayed before - starting the Java application.
  • -
  • Fixed min/max JRE version checking, previous versions allowed these - to be equal (found by Ryan).
  • -
  • Bug fixed. Quotes in jar/JVM arguments were handled incorrectly (found by Juan Alvarez Ferrando).
  • -
  • A few other enhancements.
  • -
- -

Changes in version 2.0.0 (31-10-2005)

-
    -
  • Launch4j for Mac OS X is available thanks to Peter Centgraf.
  • -
  • Added support for custom headers.
  • -
  • Fixed bug #1343908, command line arguments with spaces were handled - incorrectly by the console header (found by Oliver Schaefer / Steve Alberty).
  • -
  • Fixed stdin redirection bug (found by Timo Santasalo).
  • -
- -

Changes in version 2.0 RC3 (13-08-2005) - final RC

-
    -
  • Correct handling of pathnames with spaces.
  • -
  • Fixed the '%20' pathname bug.
  • -
  • Fixed basedir bug (Richard Xing).
  • -
  • Splash screen can be closed when the application window becomes visible - with out specifying it's title (Martin Busik). - Update your config file: <waitForTitle>title</waitForTitle> - is now <waitForWindow>true</waitForWindow>. -
  • -
  • Fixed build.bat files in demo directories.
  • -
- -

Changes in version 2.0 RC2 (21-06-2005)

-
    -
  • chdir allows to change the current directory to arbitrary paths - relative to the executable (FR #1144907). It's incompatible with - previous versions, update your config file: - <chdir>true</chdir> - is now <chdir>.</chdir>. -
  • -
  • Bundled JRE path no longer depends on chdir function.
  • -
  • Fixed Ant task bug, build files outside launch4j's directory - wouldn't work. Josh Elsasser submitted a patch that works without - setting launch4j's home dir in the build file. Thanks! -
  • -
  • Removed static edge from splash screen (Serge Baranov).
  • -
  • Program checks that the output file path doesn't contain spaces.
  • -
  • Fixed a NPE bug caused by a missing maxVersion property - (found by Morgan Schweers). -
  • -
  • Fixed relative JRE path bug (found by Nili_).
  • -
  • Cleaned up the Builder class.
  • -
  • Fixed Ant task NPE where the config was entirely defined in the - build file (Josh Elsasser). -
  • -
- -

Changes in version 2.0 RC (07-06-2005)

-
    -
  • Added an Ant task for better build integration.
  • -
  • Added 2.x documentation.
  • -
  • Updated the demo configuration files.
  • -
  • Fixed issues with relative paths in the configuration.
  • -
  • Removed the '-1' option in console mode.
  • -
  • Minor fixes.
  • -
- -

Changes in version 2.0 beta2 (23-05-2005)

-
    -
  • # comments are recognized when importing 1.x cfg files.
  • -
  • Added version information.
  • -
  • Resource file is displayed when a resource error occurs.
  • -
  • Fixed a bug found by Max, options on the first tab were always enabled.
  • -
- -

Changes in version 2.0 beta1 (13-05-2005)

-
    -
  • Completely new, cross-platform wrapper - create windows executables on Linux.
  • -
  • New .xml configuration file.
  • -
  • Application icon with multiple resolutions and color depths.
  • -
  • Swing GUI interface.
  • -
  • Header compiled with MinGW port of gcc instead of VC++.
  • -
- -

Changes in version 1.4.2 (12-03-2005)

-
    -
  • Fixed bug #1158143, stayAlive without a splash screen caused - an infinite loop (found by Gregory Kotsaftis). -
  • -
- -

Changes in version 1.4.1 (04-03-2005)

-
    -
  • Fixed bug #1119040, buffer for reading config properties - was too short (found by Tom Jensen and Neil). -
  • -
  • Added configurable splash timeout (FR #1102951).
  • -
  • Added option to disable the error message on splash timeout (FR #1109159).
  • -
  • Option to keep the gui launcher 'alive' after starting an application (FR #1124653).
  • -
  • Removed version info.
  • -
  • 'waitfor' property is now optional.
  • -
- -

Changes in version 1.4.0 (26-01-2005)

-
    -
  • Removed .lch4j suffix from process name, now it has the - form of the executable filename. The temporary launchers are stored in - launch4j-tmp directory (suggested by Emmanuel). -
  • -
  • Added support for console apps (FR #1050053).
  • -
- -

Changes in version 1.3.1 (05-11-2004)

-
    -
  • Fixed a bug where explorer window was opened instead of - launching the application when setProcName was set to false - (found by Rob Jones). -
  • -
  • Fixed temporary launcher deletion bug.
  • -
- -

Changes in version 1.3.0 (01-11-2004)

-
    -
  • Now you can configure launch4j to: -
      -
    • Use a bundled JRE.
    • -
    • Search for java, show an error message if the - right version cannot be found and open the java download page.
    • -
    • And a feature you asked for: use bundled JRE, if - that fails search for java and bring up the java download page on error.
    • -
    -
  • -
  • Enhanced code that sets the custom process name. In - case launch4j can't refresh the temporary launcher, bundled JRE on a - read only file system for example, it will use one created previously, - if it's present and has the correct size. If not, launching will still - continue, but with javaw.exe process name.Temporary launchers are - now created in the jre directory instead of jre/bin. -
  • -
  • errTitle property allows to set the title of the error message box.
  • -
- -

Changes in version 1.2.1 (25-09-2004)

-
    -
  • Bugfix that allows launching from command line using short - name (#1026514 / found by Zach Del) -
  • -
- -

Changes in version 1.2.0 (10-09-2004)

-
    -
  • Custom process name (myapp.lch4j.exe)
  • -
  • 9 KB stub!
  • -
  • Jar arguments
  • -
  • Bugfix that allows launching from command line.
  • -
  • Hide splash on javaw error.
  • -
  • Easier configuration with case insensitive parameters + show unrecognized parameter.
  • -
  • 12 KB demo application, 34 KB with splash screen.
  • -
  • Configuration parameter 'args' changed to 'jvmArgs'
  • -
-
- -
- - diff --git a/3rdparty/launch4j/web/docs.html b/3rdparty/launch4j/web/docs.html deleted file mode 100644 index 67f898eb2..000000000 --- a/3rdparty/launch4j/web/docs.html +++ /dev/null @@ -1,585 +0,0 @@ - - - - Launch4j - Cross-platform Java executable wrapper - - - - - - - -
-
- launch4j 3.0.1 -
- -
-Running launch4j
-Configuration file
-Importing 1.x configuration
-Ant Task
-Additional JVM options at runtime
-Runtime options
-Settings
- -

Running launch4j

-Run launch4j.exe or launch4j script without command -line arguments to enter the GUI mode. - -
launch4j.exe
- -To wrap a jar in console mode use launch4jc.exe and -specify the configuration file. - -
launch4jc.exe config.xml
- -On Linux use the launch4j script. - -
launch4j ./demo/l4j/config.xml
- -

Configuration file

-Launch4j requires an xml configuration file for each output executable. -You can create and edit it conveniently using the graphic user -interface or your favorite editor. Alternatively it's possible to pass -all of the configuration parameters through the Ant task. All files -may be absolute paths or relative to the configuration file path. - -
-<!-- Bold elements are required -->
-<launch4jConfig>
-  <headerType>gui|console</headerType>
-  <outfile>file.exe</outfile>
-  <jar>file</jar>
-  <dontWrapJar>true|false</dontWrapJar>
-  <errTitle>text</errTitle>
-  <downloadUrl>http://java.com/download</downloadUrl>
-  <supportUrl>url</supportUrl>
-  <cmdLine>text</cmdLine>
-  <chdir>path</chdir>
-  <priority>normal|idle|high</priority>
-  <customProcName>true|false</customProcName>
-  <stayAlive>true|false</stayAlive>
-  <icon>file</icon>
-  <obj>header object file</obj>
-  ...
-  <lib>w32api lib</lib>
-  ...
-  <var>var=text</var>
-  ...
-  <classPath>
-    <mainClass>main class</mainClass>
-    <cp>classpath</cp>
-    ...
-  </classPath>
-  <singleInstance>
-    <mutexName>text</mutexName>
-    <windowTitle>text</windowTitle>
-  </singleInstance> 
-  <jre>
-    <!-- Specify one of the following or both -->
-    <path>bundled JRE path</path>
-    <minVersion>x.x.x[_xx]</minVersion>
-    <maxVersion>x.x.x[_xx]</maxVersion>
-    <jdkPreference>jreOnly|preferJre|preferJdk|jdkOnly</jdkPreference>
-    <!-- Heap sizes in MB and % of free memory -->
-    <initialHeapSize>MB</initialHeapSize>
-    <initialHeapPercent>%</initialHeapPercent>
-    <maxHeapSize>MB</maxHeapSize>
-    <maxHeapPercent>%</maxHeapPercent>
-    <opt>text</opt>
-    ...
-  </jre>
-  <splash>
-    <file>file</file>
-    <waitForWindow>true|false</waitForWindow>
-    <timeout>seconds [60]</timeout>
-    <timeoutErr>true|false</timeoutErr>
-  </splash>
-  <versionInfo>
-    <fileVersion>x.x.x.x</fileVersion>
-    <txtFileVersion>text</txtFileVersion>
-    <fileDescription>text</fileDescription>
-    <copyright>text</copyright>
-    <productVersion>x.x.x.x</productVersion>
-    <txtProductVersion>text</txtProductVersion>
-    <productName>text</productName>
-    <companyName>text</companyName>
-    <internalName>filename</internalName>
-    <originalFilename>filename.exe</originalFilename>
-  </versionInfo>
-  <messages>
-    <startupErr>text</startupErr>
-    <bundledJreErr>text</bundledJreErr>
-    <jreVersionErr>text</jreVersionErr>
-    <launcherErr>text</launcherErr>
-  </messages>
-</launch4jConfig>
-
- -
-
<headerType>
-
- Type of the header used to wrap the application. - - - - - - - - - - - - - - - - - - - - - - - -
Header typeLauncherSplash screenWait for the application to close
guijavawyeswrapper waits only if stayAlive is set to true, - otherwise it terminates immediately or after closing - the splash screen. -
consolejavanoalways waits and returns application's exit code.
-
-
-
-
<outfile>
-
Output executable file.
-
-
-
<jar>
-
- Optional, by default specifies the jar to wrap. To launch a jar without - wrapping it enter the runtime path of the jar relative to - the executable and set <dontWrapJar> to true. - For example, if the executable launcher and the application jar named - calc.exe and calc.jar are in the same directory - then you would use <jar>calc.jar</jar> - and <dontWrapJar>true</dontWrapJar>. -
-
-
-
<dontWrapJar>
-
- Optional, defaults to false. Launch4j by default wraps jars in native - executables, you can prevent this by setting <dontWrapJar> to true. - The exe acts then as a launcher and starts the application specified in - <jar> or <classPath><mainClass> -
-
-
-
<errTitle>
-
- Optional, sets the title of the error message box that's displayed if Java cannot - be found for instance. This usually should contain the name of your - application. The console header prefixes error messages with this - property (myapp: error...) -
-
-
-
<cmdLine>
-
Optional, constant command line arguments.
-
-
-
<chdir>
-
Optional. Change current directory to an arbitrary path relative to the executable. - If you omit this property or leave it blank it will have no effect. - Setting it to . will change the current dir to the same directory - as the executable. .. will change it to the parent directory, and so on. -
-
-
<chdir>.</chdir>
-
-
-
<chdir>../somedir</chdir>
-
-
-
-
<customProcName>
-
Optional, defaults to false. - Set the process name as the executable filename and use Xp style manifests - (if any). - Creates a temporary file in launch4j-tmp directory inside the used JRE. - These files are deleted by any launch4j wrapped application, which sets - the process name and uses the same JRE. The removal takes place - when the application starts, - so at least one copy of this file will always be present. -
-
-
-
<stayAlive>
-
Optional, defaults to false in GUI header, always true in console header. - When enabled the launcher waits for the Java application - to finish and returns it's exit code. -
-
-
-
<icon>
-
Application icon in ICO format. May contain multiple color depths/resolutions.
-
-
-
<obj>
-
Optional, custom headers only. Ordered list of header object files.
-
-
-
<lib>
-
Optional, custom headers only. Ordered list of libraries used by header.
-
-
-
<singleInstance>
-
Optional, allow to run only a single instance of the application.
-
-
-
-
<mutexName>
-
Unique mutex name that will identify the application.
-
<windowTitle>
-
Optional, recognized by GUI header only. Title or title part of a window - to bring up instead of running a new instance. -
-
-
-
-
<jre>
-
Required element that groups JRE settings.
-
-
-
-
<path>, <minVersion>, <maxVersion>
-
The <path> property is used - to specify the absolute or relative path (to the executable) of a bundled JRE, it - does not rely on the current directory or <chdir>. - Note that this path is not checked until the actual application execution. - If you'd like the wrapper to search for a JRE (public or SDK private) - use the <minVersion> property, you may also specify - the <maxVersion> to prevent it from using higher Java versions. - Launch4j will always use the highest version available (in the min/max range of course). - If a Sun's JRE is not available or does not satisfy the search criteria, - the search will be repeated on IBM runtimes. - You can also combine these properties to change the startup process... -
-
-
-
-
<path>
-
Run if bundled JRE and javaw.exe are present, otherwise stop with error.
-
<path> + <minVersion>  [+ <maxVersion>]
-
Use bundled JRE first, if it cannot be located search for Java, - if that fails display error message and open the Java download page. -
-
<minVersion>  [+ <maxVersion>]
-
Search for Java, if an appropriate version cannot be found display - error message and open the Java download page. -
-
-
-
-
-
-
<jdkPreference>
-
Optional, defaults to preferJre; Allows you to specify a preference - for a public JRE or a private JDK runtime. Valid values are: -
-
-
-
-
jreOnly
-
Always use a public JRE (equivalent to the - old option dontUsePrivateJres=true)
-
preferJre
-
Prefer a public JRE, but use a JDK private - runtime if it is newer than the public - JRE (equivalent to the old option - dontUsePrivateJres=false)
-
preferJdk
-
Prefer a JDK private runtime, but use a - public JRE if it is newer than the - JDK
-
jdkOnly
-
Always use a private JDK runtime (fails - if there is no JDK installed)
-
-
-
-
HeapSize, HeapPercent
-
If size and percent are specified, then the setting which yields - more memory will be chosen at runtime. In other words, setting both values - means: percent of free memory no less than size in MB. -
-
-
-
-
<initialHeapSize>
-
Optional, initial heap size in MB.
-
-
-
<initialHeapPercent>
-
Optional, initial heap size in % of free memory.
-
-
-
<maxHeapSize>
-
Optional, max heap size in MB.
-
-
-
<maxHeapPercent>
-
Optional, max heap size in % of free memory.
-
-
-
-
<opt>
-
Optional, accepts everything you would normally pass to - java/javaw launcher: assertion options, system properties and X options. - Here you can map environment and special variables EXEDIR - (exe's runtime directory), EXEFILE (exe's runtime full file path) - to system properties. All variable references must be surrounded with - percentage signs and quoted. -
-<opt>-Dlaunch4j.exedir="%EXEDIR%"</opt>
-<opt>-Dlaunch4j.exefile="%EXEFILE%"</opt>
-<opt>-Denv.path="%Path%"</opt>
-<opt>-Dsettings="%HomeDrive%%HomePath%\\settings.ini"</opt>
-
-
-
-
- -
-
<splash>
-
Optional, groups the splash screen settings. Allowed only in GUI header.
-
-
-
-
<file>
-
Splash screen image in BMP format.
-
-
-
<waitForWindow>
-
Optional, defaults to true. Close the splash screen when an application - window or Java error message box appears. If set to false, - the splash screen will be closed on timeout. -
-
-
-
<timeout>
-
Optional, defaults to 60. Number of seconds after which the splash screen - must be closed. Splash timeout may cause an error depending on - <timeoutErr>. -
-
-
-
<timeoutErr>
-
Optional, defaults to true. True signals an error on splash timeout, - false closes the splash screen quietly. -
-
-
- -
-
<versionInfo>
-
Optional, version information to be displayed by the Windows Explorer.
-
-
-
-
<fileVersion>
-
Version number 'x.x.x.x'
-
-
-
<txtFileVersion>
-
Free form file version, for example '1.20.RC1'.
-
-
-
<fileDescription>
-
File description presented to the user.
-
-
-
<copyright>
-
Legal copyright.
-
-
-
<productVersion>
-
Version number 'x.x.x.x'
-
-
-
<txtProductVersion>
-
Free form file version, for example '1.20.RC1'.
-
-
-
<productName>
-
Text.
-
-
-
<companyName>
-
Optional text.
-
-
-
<internalName>
-
Internal name without extension, original filename or module name for example.
-
-
-
<originalFilename>
-
Original name of the file without the path. Allows to determine - whether a file has been renamed by a user. -
-
-
- -

Importing 1.x configuration

-It's possible to import a 1.x configuration file using the GUI -interface. Open the file, correct the paths and save it as a new xml -configuration. - -

Ant task

-You may set a launch4j directory property or change the task definition. - -
<property name="launch4j.dir" location="/opt/launch4j" />
- -Define the task in your Ant build script. - -
-<taskdef name="launch4j"
-    classname="net.sf.launch4j.ant.Launch4jTask"
-    classpath="${launch4j.dir}/launch4j.jar
-        :${launch4j.dir}/lib/xstream.jar" />
-
- -Execute the task! - -
<launch4j configFile="./l4j/demo.xml" />
- -You can set or override the following configuration properties... -

- jar="absolute path or relative to basedir"
- jarPath="relative path"
- outfile
- fileVersion
- txtFileVersion
- productVersion
- txtProductVersion
- bindir="alternate bin directory..."
- tmpdir="alternate working directory..." -

- -
-<launch4j configFile="./l4j/demo.xml" outfile="mydemo.exe"
-    fileVersion="1.0.0.0" txtFileVersion="1.0 RC2" />
-
- -You can also define the entire configuration in the task, but it will -not be possible to edit such a file in the GUI mode. All paths except -for <chdir>, <jre><path> and jarPath -are calculated using the basedir project attribute. - -
-<launch4j>
-  <config headerType="gui" outfile="demo.exe"
-      dontWrapJar="true" jarPath="demo.jar" >
-    <var>SETTINGS="%HomeDrive%%HomePath%\\settings.ini"</var>
-    <classPath mainClass="org.demo.DemoApp">
-        <cp>./lib/looks.jar</cp>
-        <cp>%USER_LIBS%/*.jar</cp>
-    </classPath>
-    <jre minVersion="1.4.0">
-        <opt>-Dlaunch4j.exedir="%EXEDIR%"</opt>
-        <opt>-Dlaunch4j.exefile="%EXEFILE%"</opt>
-    </jre>
-  </config>
-</launch4j>
-
- -

Additional JVM options at runtime

-When you create a wrapper or launcher all configuration details are compiled into the -executable and cannot be changed without recreating it or hacking with a resource editor. -Launch4j 2.1.2 introduces a new feature that allows to pass additional JVM options -at runtime from an .l4j.ini file. Now you can specify the options in the configuration file, -ini file or in both, but you cannot override them. The ini file's name must correspond -to the executable's (myapp.exe : myapp.l4j.ini). -The arguments should be separated with spaces or new lines, environment variable -expansion is supported, for example: -
-# Launch4j runtime config
--Dswing.aatext=true
--Dsomevar="%SOMEVAR%"
--Xms16m
-
- -

Runtime options

-
-
--l4j-debug
-
- To make sure the output executable is configured correctly you can use the - debug launching mode to log various information to the launch4j.log file. -
- -
--l4j-default-proc
-
- Use default process name. -
- -
--l4j-dont-wait
-
- Disable the "stay alive" function. -
- -
--l4j-no-splash
-
- Disable the splash screen. -
- -
--l4j-no-splash-err
-
- Disable splash screen error on timeout, might be useful on very slow computers. -
-
- -

Settings

-
-
Alternate bin directory: launch4j.bindir
-
- It's possible to override the default bin directory location which contains windres and ld - tools using the launch4j.bindir system property. The property can have two forms: - a path relative to Launch4j's directory (altbin for example) or an absolute path. -
- -
Working directory: launch4j.tmpdir
-
Change the working directory if the default path contains spaces which windres cannot handle.
-
-
- -
- - diff --git a/3rdparty/launch4j/web/index.html b/3rdparty/launch4j/web/index.html deleted file mode 100644 index d1f928e6e..000000000 --- a/3rdparty/launch4j/web/index.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - Launch4j - Cross-platform Java executable wrapper - - - - - - - -
-
- launch4j 3.0.1 -
- -
-

Cross-platform Java executable wrapper

-

- Launch4j is a cross-platform tool for wrapping - Java applications distributed as jars in lightweight Windows - native executables. The executable can be - configured to search for a certain JRE version or - use a bundled one, and it's possible to set - runtime options, like the initial/max heap size. - The wrapper also provides better user experience - through an application icon, a native pre-JRE - splash screen, a custom process name, and a Java - download page in case the appropriate JRE cannot - be found. -

-How to use Launch4 -

Features

-
    -
  • Launch4j wraps jars in Windows native executables and allows to run them - like a regular Windows program. It's possible to wrap applications - on Windows, Linux, Mac OS X and Solaris! -
  • -
  • Also creates launchers for jars and class files without wrapping.
  • -
  • - Supports executable jars and dynamic classpath resolution using - environment variables and wildcards. -
  • -
  • Doesn't extract the jar from the executable.
  • -
  • Custom application icon with multiple resolutions and color depths.
  • -
  • Native pre-JRE splash screen in BMP format shown until - the Java application starts. -
  • -
  • Process name as the executable filename to easily - identify your application, initial priority and - single aplication instance features. -
  • -
  • Works with a bundled JRE or searches for newest Sun or IBM JRE / JDK in given - version range.
  • -
  • Opens Java download page if an appropriate Java version cannot be - found or a support website in case of an error. -
  • -
  • Supports GUI and console apps.
  • -
  • Supports Vista manifests and XP visual style manifests.
  • -
  • Passes command line arguments, also supports constant arguments.
  • -
  • Allows to set the initial/max heap size also dynamically in percent of free memory.
  • -
  • JVM options: set system properties, tweak the garbage collection...
  • -
  • Runtime JVM options from an .l4j.ini file.
  • -
  • Runtime command line switches to change the compiled options.
  • -
  • Access to environment variables, the registry and executable file path through system properties.
  • -
  • Set environment variables.
  • -
  • Option to change current directory to the executable location.
  • -
  • The JRE's bin directory is appended to the Path environment variable.
  • -
  • Custom version information shown by Windows Explorer.
  • -
  • GUI and command line interface.
  • -
  • Build integration through an Ant task and a Maven Plugin.
  • -
  • Lightweight: 26 KB!
  • -
  • It's free and may be used for commercial purposes.
  • -
  • Includes a sample application and Ant script - that automates the build process from Java sources to native executable. -
  • -
  • The wrapped program works on all Windows platforms (98/Me/NT/2K/XP/Vista), - Launch4j works on NT/2K/XP/Vista, Linux, Mac OS X (build on 10.4) and Sparc Solaris 8-10. -
  • -
-

License

-

- This program is free software licensed under the - BSD license, the head subproject - (the code which is attached to the wrapped jars) is licensed under the - MIT license. - Launch4j may be used for wrapping closed source, commercial applications. -

-

Info

-

- Running Launch4j on other Java enabled platforms is a matter of getting a binary version - of MinGW binutils 2.15.90 (windres and ld only) - for your system or compiling them. If you'll provide these, I'll be able to create a binary package - available for download. -

- -
- -
- - diff --git a/3rdparty/launch4j/web/launch4j-use.gif b/3rdparty/launch4j/web/launch4j-use.gif deleted file mode 100644 index ccb888247..000000000 Binary files a/3rdparty/launch4j/web/launch4j-use.gif and /dev/null differ diff --git a/3rdparty/launch4j/web/launch4j.gif b/3rdparty/launch4j/web/launch4j.gif deleted file mode 100644 index 27552074a..000000000 Binary files a/3rdparty/launch4j/web/launch4j.gif and /dev/null differ diff --git a/3rdparty/launch4j/web/links.html b/3rdparty/launch4j/web/links.html deleted file mode 100644 index 4213b86f9..000000000 --- a/3rdparty/launch4j/web/links.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - Launch4j - Cross-platform Java executable wrapper - - - - - - - - - - diff --git a/3rdparty/launch4j/web/style.css b/3rdparty/launch4j/web/style.css deleted file mode 100644 index f57c086d6..000000000 --- a/3rdparty/launch4j/web/style.css +++ /dev/null @@ -1,159 +0,0 @@ -body, table { - font: 12px/20px Verdana, Arial, Helvetica, sans-serif; -} - - -pre { - padding: 8px; - border: 1px dashed #999999; - background-color: #f1f1f1; - font: 13px/20px "Courier New", Courier, monospace; -} - - -.version { - color: #307fe1; - font-weight: bold; -} - - -.codeword { - color: #3333ff; -} -.attrib { - color: #404040; -} -.option { - font-family: "Courier New", Courier, monospace; - font-weight: bold; -} - - -dt { - margin-top: 1.5em; - color: #404040; - font-size: 115%; - border-bottom: 1px solid #cccccc; -} -dd { - margin-left: 1em; -} - - -.warn, ul.changes em { - color: #ff0000; -} - - -table { - margin-top: 1em; - padding: 0; - border: 1px solid #999999; - border-collapse: collapse; - text-align: center; -} -table th { - padding: 2px 4px; - border: 1px solid #999999; - background-color: #f1f1f1; -} -table td { - padding: 2px 4px; - border: 1px solid #999999; -} -.description { - text-align: left; -} - - -#container { - width: 90%; - margin: 10px auto; - border-width: 0; - background-color: #ffffff; -} - - -#top { - padding: 0.5em; - background-color: #ffffff; -} -#top h1 { - margin: 0; - padding: 0; -} - - -#leftnav { - float: left; - width: 170px; - margin: 0; - padding: 0.5em; - background-color: #ffffff; -} -#leftnav ul { - margin: 0; - padding: 0; - border: none; - list-style-type: none; - font-size: 115%; -} -#leftnav a { - width: 170px; - height: 1.6em; - line-height: 1.6em; - display: block; - padding-left: 0.2em; -} -#leftnav a:link, #leftnav a:visited { - text-decoration: none; - color: #666666; -} -#leftnav a:hover { - background-color: #307fe1; - color: #ffffff; -} - - -#content { - max-width: 52em; - margin-left: 190px; - padding: 1em; - border-left: 1px solid #cccccc; - background-color: #ffffff; -} - -#content ul { - list-style-image: url('bullet.gif'); -} - -#content a:link { - text-decoration: none; - color: #307fe1; -} -#content a:visited { - text-decoration: none; - color: #307fe1; -} -#content a:hover { - color: #307fe1; - text-decoration: underline; -} - -#content h2 { - font-size: 150%; -} -#content h2:first-child { - margin: 0 0 0.5em; -} - - -.footer { - clear: both; - margin: 0; - padding: 0.5em; - background-color: #ffffff; - color: #333333; - text-align: center; - font-size: 90%; -} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..786ca97de --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +# See: https://hub.docker.com/r/romraider/builder Overview for run details + +FROM --platform="linux/386" i386/ubuntu:18.04 AS rr_builder + +RUN apt-get -y update && \ + apt-get -y upgrade && \ + apt-get -y install ant openjdk-8-jdk unzip && \ + apt-get clean + +ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-i386/jre +RUN /usr/bin/update-alternatives --set java ${JAVA_HOME}/bin/java + +RUN useradd -ms /bin/bash romraider && \ + mkdir /home/romraider/RomRaider && \ + mkdir /home/romraider/java && \ + chown romraider:romraider /home/romraider/RomRaider && \ + chown romraider:romraider /home/romraider/java + +WORKDIR /home/romraider/java +ARG JAVA6_SRC=jre-6u45-windows-i586.zip +ADD --chown=romraider:romraider https://romraider.com/roms/dl.php?file=${JAVA6_SRC} ./${JAVA6_SRC} + +USER romraider:romraider +RUN unzip -q /home/romraider/java/${JAVA6_SRC} + +ARG maven_url="https://search.maven.org/remotecontent?filepath=" +ARG junit_url="${maven_url}junit/junit/4.13.2/junit-4.13.2.jar" +ARG hamcrest_core_url="${maven_url}org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" +ENV JRE_DIR=/home/romraider/java + +USER root +ADD ${junit_url} ${JRE_DIR}/lib/junit.jar +ADD ${hamcrest_core_url} ${JRE_DIR}/lib/hamcrest-core.jar +RUN chmod 644 ${JRE_DIR}/lib/junit.jar && \ + chmod 644 ${JRE_DIR}/lib/hamcrest-core.jar + +USER romraider:romraider +WORKDIR /home/romraider/RomRaider +RUN java -version && \ + echo "RomRaider build environment created." diff --git a/build.xml b/build.xml index 1681f8c0a..d2d419ea5 100644 --- a/build.xml +++ b/build.xml @@ -3,7 +3,7 @@ - + @@ -32,332 +32,399 @@ - - - - - - - - - - + + + + + + + + + + + + - - + + - - + + + + + project.setProperty("mnth.day", + project.getProperty("mnth.day").toUpperCase()); + + + - - - - + + + + - + - + - - - - - - - - - - - - + + + + + + + - - + + - - - - - - - - + + + + + + + + - - - + + + + - + + value="${name.package}${version.major}.${version.minor}.${version.patch}-${version.buildnumber}" /> - + - + + + + + + + + - + - - - + + - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + ${javadoc.footer} - + - + - - - - + + + + - + - + - + - + - + - + + - - + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - + - - + + - + - - + + - - + + - - - - + + + - + + - + - - + + - - - + + + - - + - + + + + - - - + + + + + + + - + - - - - - - - - - - - - - + + + + + + + + + + + diff --git a/customize/j2534Libraries.properties b/customize/j2534Libraries.properties new file mode 100644 index 000000000..8910fb5c8 --- /dev/null +++ b/customize/j2534Libraries.properties @@ -0,0 +1,6 @@ +# use a ; (semicolon) to separate possible library names/locations +# names containing a path separator are treated as absolute paths +# names not containing a path separator are expected to be in the java.library.path directory +# Windows path separators must be escaped (\\) or changed to / +windows= +linux=j2534.so ; /usr/local/lib/j2534.so ; j2534.dylib ; /usr/local/lib/j2534.dylib diff --git a/customize/nameSequences.properties b/customize/nameSequences.properties new file mode 100644 index 000000000..d3b5564d6 --- /dev/null +++ b/customize/nameSequences.properties @@ -0,0 +1,6 @@ +RomRaider = +Profile = +Logger = +EcuFlashBase = + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/profile.dtd b/definitions/profile.dtd similarity index 96% rename from profile.dtd rename to definitions/profile.dtd index 5add89150..d34b131b2 100644 --- a/profile.dtd +++ b/definitions/profile.dtd @@ -1,4 +1,4 @@ - + diff --git a/Building_RomRaider.txt b/docs/Building_RomRaider.txt similarity index 100% rename from Building_RomRaider.txt rename to docs/Building_RomRaider.txt diff --git a/docs/Building_RomRaider_VSCode.md b/docs/Building_RomRaider_VSCode.md new file mode 100644 index 000000000..d3e764008 --- /dev/null +++ b/docs/Building_RomRaider_VSCode.md @@ -0,0 +1,93 @@ +Here are steps to setup Visual Studio Code to build and debug RomRaider. + +1. Download Git for your operating system. You'll use git to clone the RomRaider repository. + > https://git-scm.com/downloads + +1. Download a Java OpenJDK 8 32bit version, several options are available: RedHat, Oracle, Adopt, etc. I use AdoptOpenJdk 8 just because I don't have to register to download it. + + When installing, if there's a option to set JAVA_HOME variable, have the installer do it. You may have to edit it manually later, Adopt lets you set this during OpenJDK install. + + > Links: + > + > [Red Hat OpenJdk](https://developers.redhat.com/products/openjdk/download?extIdCarryOver=true&sc_cid=701f2000000RWTnAAO) + > + > [Adopt OpenJdk](https://adoptopenjdk.net/releases.html?variant=openjdk8&jvmVariant=openj9) + +1. Download ANT: https://ant.apache.org/bindownload.cgi + > - 1.10.7 release - requires minimum of Java 8 at runtime + > - Unzip **ANT** to a known location. + > + > For example, I use windows and decided on: 'C:\Users\Walter\ANT' + +1. Add '**ANT_HOME**' as a System Environment variable excluding the quotes. + > - For the value use the unzipped ANT path from the previous step. For Example: 'C:\Users\\ANT' + > - If you do not know how to add a environment variable, see: https://docs.oracle.com/javase/tutorial/essential/environment/paths.html + +1. Add '**JRE_DIR**' as a System Environment variable excluding the quotes. + > - For the value use the directory from the Java install. For Example: 'C:\Program Files (x86)\Java\jre-1.8' + > - If you do not know how to add a environment variable, see: https://docs.oracle.com/javase/tutorial/essential/environment/paths.html + +1. Edit the existing '**PATH**' System Environment, add the directory you unzipped ANT to with the \bin directory appended. + > For Example: 'C:\Users\\ANT\bin' + +1. Download & Install '**Visual Studio Code**': + > https://code.visualstudio.com/ + +1. Download & Install '**Java Extension Pack**' VsCode Extension: + > https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack + +1. Optional: Download & Install '**Ant Target Runner**' Extension: https://marketplace.visualstudio.com/items?itemName=nickheap.vscode-ant + +1. Open the RomRaider folder in VS Code. Ensure the Explorer panel is open. + > 'View Menu > Explorer' + +1. Open the terminal window '**View Menu > Terminal**' + > - Type the following and press enter: ant all + > - Alternately, you can use the 'Ant Target Runner' panel, it should be underneath the files list. Right click the 'all' node and select 'Run Ant Target' + > - *You will need to do one of the above each time you make a code change.* + +1. Open the Debug Panel. + > 'View Menu > Debug' + +1. On the debug panel, click the '**create and launch.json file**' link. You may get a popup asking for Environment select Java. This will generate a launch.json file and open it. + +1. When this file is generated, you'll need to delete all but two json entries. You want to keep ECUExec and EcuLoggerExec. The end result should look similar to below. + ``` + { + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Debug (Launch)-ECUExec", + "request": "launch", + "mainClass": "com.romraider.ECUExec", + "projectName": "romraider" + }, + { + "type": "java", + "name": "Debug (Launch)-EcuLoggerExec", + "request": "launch", + "mainClass": "com.romraider.logger.ecu.EcuLoggerExec", + "projectName": "romraider" + } + ] + } + +1. At the top of the debug panel, you'll see a label '**Run And Debug**' and a drop down box. + > - From the dropdown box select the appropriate option depending on whether you want to debug RomRaider Editor or RomRaider Logger. + > - Press the play button next to the dropdown or press F5. + > - You will likely get a popup: 'Build failed, do you want to continue?' Click Proceed. + > - RomRaider should launch. + +1. If you're still here, Congrats! You are now able to debug RomRaider. You can set breakpoints in the source code, and step through the code. + +1. If the steps above didn't work, please review them to make sure you didn't miss anything. If it still doesn't work contact me via my github account below. + +Thanks, + +Walter Stypula + +https://github.com/walterstypula \ No newline at end of file diff --git a/docs/logger/ssm_info.txt b/docs/ssm_info.txt similarity index 94% rename from docs/logger/ssm_info.txt rename to docs/ssm_info.txt index 127f2a354..cd68e2a2b 100644 --- a/docs/logger/ssm_info.txt +++ b/docs/ssm_info.txt @@ -1,4 +1,4 @@ -The subaru select monitor protocol uses an ISO9141 interface and uses UART settings: 4800 bps n, 8, 1 +The Subaru Select Monitor protocol uses an ISO9141 interface and uses UART settings: 4800 bps n, 8, 1 All data is sent and recieved using small packets that all share a common header. @@ -42,6 +42,11 @@ These are the known commands: 0xB8 Write single address 0xBF ECU init +After the command byte is the read mode byte, if reading continues the ECU will continue to output until it receives another command. +These are the known modes: + +0x00 Read Once +0x01 Read Continuous -------------------------------- Command Formats -------------------------------- @@ -49,7 +54,7 @@ A0 Block Read Request A0 PP AA AA AA CC -PP == pad? +PP == read mode AA AA AA = address CC == byte count - 1 @@ -57,7 +62,7 @@ A8 Address Read Request A8 PP A1 A1 A1 A2 A2 A2 A3 A3 A3... -PP == pad? +PP == read mode A1 A1 A1 == address A2 A2 A2 ... == optional addresses @@ -100,13 +105,13 @@ Received: ----------------------- -Address Read: Read Address 0x000008 and 0x00001C (ecu returns values 0x7D and 0xB1) +Address Read: Continiously Read Address 0x000008 and 0x00001C (ecu returns values 0x7D and 0xB1) Sent: -0x80 0x10 0xF0 0x08 0xA8 0x00 0x00 0x00 0x08 0x00 0x00 0x1C 0x54 +0x80 0x10 0xF0 0x08 0xA8 0x01 0x00 0x00 0x08 0x00 0x00 0x1C 0x55 Received: -0x80 0xF0 0x10 0x03 0xE8 0x7D 0xB1 0x99 +0x80 0xF0 0x10 0x03 0xE8 0x7D 0xB1 0x99 0x80 0xF0 0x10 0x03 0xE8 0x7D 0xB1 0x99 0x80 0xF0 0x10 0x03 0xE8 0x7D 0xB1 0x99... ----------------------- @@ -251,6 +256,7 @@ The individual bits are flags that will be set to one if the parameter can be re 2 ------------------------- 1 ------------------------- 0 ------------------------- + ********** BYTE 21 ********** 7 Neutral Position Switch 6 Idle Switch @@ -260,17 +266,17 @@ The individual bits are flags that will be set to one if the parameter can be re 2 Power Steering Switch 1 Air Conditioning Switch 0 ------------------------- + ********** BYTE 22 ********** -7 Handle Switchv +7 Handle Switch 6 Starter Switch - 5 Front O2 Rich Signal 4 Rear O2 Rich Signal - 3 Front O2 #2 Rich Signal 2 Knock Signal 1 1 Knock Signal 2 0 Electrical Load Signal + ********** BYTE 23 ********** 7 Crank Position Sensor 6 Cam Position Senso diff --git a/i18n/com/romraider/ECUExec.properties b/i18n/com/romraider/ECUExec.properties new file mode 100644 index 000000000..f4ad34e2d --- /dev/null +++ b/i18n/com/romraider/ECUExec.properties @@ -0,0 +1,6 @@ +SUPPORT = When requesting assistance at {0}, please include the System Properties information below: +COMPATJRE = Incompatible JRE detected.\n{0} Editor requires a {1}-bit JRE for full feature support. +JREWARN = JRE Compatibility Warning +ISRUNNING = {0} is already running. +ERRROM = Error opening ROM +ERROR = Error occurred diff --git a/i18n/com/romraider/ECUExec_fr_CA.properties b/i18n/com/romraider/ECUExec_fr_CA.properties new file mode 100644 index 000000000..58b06d80a --- /dev/null +++ b/i18n/com/romraider/ECUExec_fr_CA.properties @@ -0,0 +1,8 @@ +# Single quote character must be escaped with two single quotes when using substitution +# Le caractère guillemet simple doit être échappé avec deux guillemets simples lorsque vous utilisez la substitution +SUPPORT = Lorsque vous demandez de l''aide sur {0}, veuillez inclure les informations sur les propriétés du système ci-dessous: +COMPATJRE = JRE incompatible détecté.\n{0} nécessite un environnement JRE 32 bits pour certaines opérations.\nCertaines fonctionnalités peuvent être indisponibles. +JREWARN = Avertissement de compatibilité JRE +ISRUNNING = {0} est déjà en cours d'exécution. +ERRROM = Erreur d''ouverture de la ROM +ERROR = Erreur est survenue diff --git a/i18n/com/romraider/editor/ecu/ECUEditor.properties b/i18n/com/romraider/editor/ecu/ECUEditor.properties new file mode 100644 index 000000000..8c93c6905 --- /dev/null +++ b/i18n/com/romraider/editor/ecu/ECUEditor.properties @@ -0,0 +1,40 @@ +TITLE = {0} v{1} | ECU Editor +OPENIMAGES = Open Images +RRECUED = RomRaider ECU Editor +EDTOOLS = Editor Tools +YES = Yes +NO = No +ECUDEFNOTCFG = ECU definitions not configured.\nGo online to download the latest definition files? +EDCONFIG = Editor Configuration +CFGEDFSMENU = ECU definition files need to be configured before ROM images can be opened.\nMenu: ECU Definitions > ECU Definition Manager... +# Use the exact System Font name to change the font of the release notes when displayed +RELEASENOTESFONT = Tahoma +RELEASENOTES = Release Notes +STATUSREADY = Ready ... +CHECKSUMSTATE = %d/%d Checksums are correct. Checksums will be updated when file is saved. +OBSOLETEROM = A newer version of this ECU revision exists. Please visit the following link to download the latest revision: +DISPLAYMSG = Always display this message +ISOBSOLETE = ECU Revision is Obsolete +IMAGENOTFOUND = Image Not Found +ERRORLOADING = Error Loading Image(s) +EXCEPTION = Exception +POPULATEFAIL = Failed to visually populate table - {0}\n{1} + +#Inner Class messages +LAUNCHLOGGER = Launching Logger ... +STATUSPARSING = Parsing ECU definitions ... +STATUSFINDING = Finding ECU definition ... +MISSINGMOVED = ECU Definition file missing or moved. Please correct the ECU Definition Manager listing.\n{0} +MISSINGFILE = Missing ECU Definition File - {0} +LOADEXCEPTION = Error Loading. Unknown Exception. +ERRORFILE = Error Loading {0} +POPULATING = Populating tables ... +FINALIZING = Finalizing ... +DONELOAD = Done loading image ... +CHECKSUM = Validating checksum ... +DEFNOTFOUND = ECU Definition not found, do you want to choose one? +DEFNOMATCH = This Definition does not seem to match, do you want to load it anyway? The first Rom in the Definition will be chosen. +UNREADABLEDEF = Unable to read XML definitions. Please make sure the definition file is correct. If it is in a ZIP archive, unzip the file and try again. +LOOPEDBASE = Looped "base" attribute in XML definitions. +OUTOFMEMORY = Error loading Image. Out of memory. +CAUGHTEXCEPTION = Error Loading. Caught Exception:\n{0} diff --git a/i18n/com/romraider/editor/ecu/ECUEditor_fr_CA.properties b/i18n/com/romraider/editor/ecu/ECUEditor_fr_CA.properties new file mode 100644 index 000000000..fddfcc9af --- /dev/null +++ b/i18n/com/romraider/editor/ecu/ECUEditor_fr_CA.properties @@ -0,0 +1,42 @@ +TITLE = {0} v{1} | Editeur d'ECU +OPENIMAGES = Images ouvertes +RRECUED = RomRaider Editeur d'ECU +EDTOOLS = Outils de l'éditeur +YES = Oui +NO = Non +ECUDEFNOTCFG = Définitions de calculateur non configurées.\nAller en ligne pour télécharger les derniers fichiers de définition? +EDCONFIG = Configuration de l'éditeur +CFGEDFSMENU = Les fichiers de définition de calculateur doivent être configurés avant que les images ROM ne puissent être ouvertes.\nMenu: Définitions de l'ECU> Gestionnaire de définitions d'ECU ... +# Use the exact System Font name to change the font of the release notes when displayed +RELEASENOTESFONT = Tahoma +RELEASENOTES = Notes de version +STATUSREADY = Prêt ... +CHECKSUMSTATE = %d/%d les sommes de contrôle sont correctes. Les sommes de contrôle seront mises à jour lors de l'enregistrement du fichier. +OBSOLETEROM = Il existe une version plus récente de cette révision du calculateur. Veuillez visiter le lien suivant pour télécharger la dernière révision: +DISPLAYMSG = Toujours afficher ce message +ISOBSOLETE = La révision de l'ECU est obsolète +IMAGENOTFOUND = Image non trouvée +ERRORLOADING = Erreur lors du chargement des images +EXCEPTION = Exception +POPULATEFAIL = Échec du remplissage visuel du tableau - {0}\n{1} + +#Inner Class messages +LAUNCHLOGGER = Lancement de l'enregistreur ... +STATUSPARSING = Analyser les définitions d'ECU ... +STATUSFINDING = Trouver la définition de l'ECU ... +MISSINGMOVED = Fichier de définition de l''ECU manquant ou déplacé. Veuillez corriger la liste de ECU Definition Manager.\n{0} +# Single quote character must be escaped with two single quotes when using substitution +# Le caractère guillemet simple doit être échappé avec deux guillemets simples lorsque vous utilisez la substitution +MISSINGFILE = Fichier de définition d''ECU manquant - {0} +LOADEXCEPTION = Erreur de chargement. Exception inconnue. +ERRORFILE = Erreur de chargement {0} +POPULATING = Remplir des tables ... +FINALIZING = Finaliser ... +DONELOAD = Terminé chargement de l'image ... +CHECKSUM = Validation de la somme de contrôle ... +DEFNOTFOUND = Définition de l'ECU non trouvée +DEFNOMATCH = Cette définition ne semble pas correspondre, voulez-vous quand même la charger? Le premier Rom de la Définition sera choisi. +UNREADABLEDEF = Impossible de lire les définitions XML. Assurez-vous que le fichier de définition est correct. S'il se trouve dans une archive ZIP, décompressez le fichier et réessayez. +LOOPEDBASE = Attribut "base" en boucle dans les définitions XML. +OUTOFMEMORY = Erreur de chargement de l'image. Mémoire insuffisante. +CAUGHTEXCEPTION = Erreur de chargement. Pris Surprise:\n{0} diff --git a/i18n/com/romraider/logger/ecu/EcuLogger.properties b/i18n/com/romraider/logger/ecu/EcuLogger.properties new file mode 100644 index 000000000..12a247fce --- /dev/null +++ b/i18n/com/romraider/logger/ecu/EcuLogger.properties @@ -0,0 +1,43 @@ +TITLE = ECU/TCU Logger +FILENAMEEXTENTION = Right-click to select or type text to add to the saved logfile name. +TTTEXTF11 = Hides the parameter list and saves the state on exit (F11) +TTTEXTF9 = Un-select all selected parameters/switches on all tabs! (F9) +STARTFILELOG = Start file log +STOPFILELOG = Stop file log +TTTEXTF1 = Start/stop file logging (F1) +INITIALIZELOGGER = Initializing Logger ... +INCOMPJRE = Incompatible JRE detected.\n{0} Logger requires a {1}-bit JRE.\nLogger will now exit. +INCOMPJREERR = JRE Incompatibility Error +LOADINGDEFS = Loading Logger Defs ... +LOADINGPLUG = Loading Plugins ... +LOADINGPARAMS = Loading Logging Parameters ... +STARTINGLOGGER = Starting Logger ... +COMPLETE = Complete ... +READY = Ready ... +YES = Yes +NO = No +LOGGERDEFERROR = Error loading definition: +LOGGERDEFNOTCFG = Logger definition not configured.\nGo online to download the latest definition file? +LOGGERCONFIG = Logger Configuration +CFGEDFSMENU = The Logger definition file needs to be configured before connecting to the ECU.\nMenu: Settings > Logger Definition Location ...\nOnce configured, restart the Logger application. +PROFILENAME = Profile: {0} +LOAD = Load +CANCEL = Cancel +PROFILEWRONGPROTO = This profile was created for logging protocol {0}.\nSome parameters may not be selected by this profile if\nyou continue. Change protocols in the Settings menu\nthen reload this profile. +PROTOCOLMISMATCH = Protocol Mismatch +LOADPLUGINERR = Error loading plugin: {0} v{1} +BTNGAUGESTYLE = Gauge Style +BTNUNSELECTALL = Un-select ALL +BTNPARAMLIST = Parameter List +LOGFILETEXT = Logfile Text +TARGETID = Use Current {0} ID +PT = Part Throttle +WOT = Wide Open Throttle +CLT = Clear Logfile Text +COMPORT = COM Port: +TTTEXTRECON = Reconnect to {0} +TTTEXTDISCON = Disconnect from {0} +TTTEXTEXTERNALS = {0} Polling. Uncheck all boxes for Externals logging only. +RESET = Reset {0} [{1}] +RESETDATA = Reset Data +ERROR = Error: {0} diff --git a/i18n/com/romraider/logger/ecu/EcuLogger_fr_CA.properties b/i18n/com/romraider/logger/ecu/EcuLogger_fr_CA.properties new file mode 100644 index 000000000..dcb56b472 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/EcuLogger_fr_CA.properties @@ -0,0 +1,42 @@ +TITLE = Enregistreur ECU / TCU +FILENAMEEXTENTION = Cliquez avec le bouton droit de la souris pour sélectionner ou taper du texte à ajouter au nom du fichier journal enregistré. +TTTEXTF11 = Masque la liste des paramètres et enregistre l'état à la sortie (F11) +TTTEXTF9 = Désélectionnez tous les paramètres / commutateurs sélectionnés sur tous les onglets! (F9) +STARTFILELOG = Démarrer le fichier journal +STOPFILELOG = Arrêter le fichier journal +TTTEXTF1 = Démarrer / arrêter la journalisation de fichier (F1) +INITIALIZELOGGER = Initialisation de l'enregistreur ... +INCOMPJRE = JRE incompatible détecté.\n{0} RomRaider Logger requiert un environnement d''exécution Java 32 bits.\nL''enregistreur va maintenant quitter. +INCOMPJREERR = Erreur d'incompatibilité JRE +LOADINGDEFS = Chargement des paramètres de l'enregistreur ... +LOADINGPLUG = Chargement des plugins ... +LOADINGPARAMS = Chargement des paramètres de journalisation ... +STARTINGLOGGER = Démarrage de l'enregistreur ... +COMPLETE = Achevée ... +READY = Prêt ... +YES = Oui +NO = Non +LOGGERDEFNOTCFG = La définition de l'enregistreur n'est pas configurée.\nAller en ligne pour télécharger le dernier fichier de définition? +LOGGERCONFIG = Configuration du logger +CFGEDFSMENU = Le fichier de définition de l'enregistreur doit être configuré avant la connexion à l'ECU.\nMenu: Paramètres> Emplacement de définition de l'enregistreur ...\nUne fois la configuration terminée, redémarrez l'application Enregistreur. +PROFILENAME = Profil: {0} +LOAD = Charge +CANCEL = Annuler +PROFILEWRONGPROTO = Ce profil a été créé pour le protocole de journalisation {0}.\nCertains paramètres peuvent ne pas être sélectionnés par ce\nprofil si vous continuez. Modifiez les protocoles dans le\nmenu Paramètres, puis rechargez ce profil. +PROTOCOLMISMATCH = Non correspondance de protocole +LOADPLUGINERR = Erreur lors du chargement du plug-in: {0} v{1} +BTNGAUGESTYLE = Style de jauge +BTNUNSELECTALL = Tout déselectionner +BTNPARAMLIST = Liste de paramètres +LOGFILETEXT = Texte du fichier journal +TARGETID = Utiliser l''ID actuel {0} +PT = Partie papillon +WOT = Papillon large ouvert +CLT = Effacer le texte du fichier journal +COMPORT = Port COM: +TTTEXTRECON = Reconnecter à {0} +TTTEXTDISCON = Se déconnecter de {0} +TTTEXTEXTERNALS = {0} Polling. Décochez toutes les cases pour la journalisation externe uniquement. +RESET = Réinitialiser {0} [{1}] +RESETDATA = Réinitialiser les données +ERROR = Erreur: {0} diff --git a/i18n/com/romraider/logger/ecu/comms/globaladjust/SSMGlobalAdjustManager.properties b/i18n/com/romraider/logger/ecu/comms/globaladjust/SSMGlobalAdjustManager.properties new file mode 100644 index 000000000..c9318db50 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/globaladjust/SSMGlobalAdjustManager.properties @@ -0,0 +1,3 @@ +GLOBALVALUES = Retrieving current ECU global values ... +GLOBALDONE = Current ECU global values retrieved. +NOCONNECTION = Unable to retrieve current ECU timing value - check correct serial port\nhas been selected, cable is connected and ignition is on. diff --git a/i18n/com/romraider/logger/ecu/comms/globaladjust/SSMGlobalAdjustManager_fr_CA.properties b/i18n/com/romraider/logger/ecu/comms/globaladjust/SSMGlobalAdjustManager_fr_CA.properties new file mode 100644 index 000000000..2e223ad0e --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/globaladjust/SSMGlobalAdjustManager_fr_CA.properties @@ -0,0 +1,3 @@ +GLOBALVALUES = Récupération des valeurs globales actuelles du calculateur ... +GLOBALDONE = Valeurs globales actuelles de l'ECU récupérées. +NOCONNECTION = Impossible de récupérer la valeur de synchronisation actuelle de l'ECU - vérifiez\nque le port série correct a été sélectionné, que le câble est connecté et\nque le contact est mis. diff --git a/i18n/com/romraider/logger/ecu/comms/io/connection/DS2LoggerConnection.properties b/i18n/com/romraider/logger/ecu/comms/io/connection/DS2LoggerConnection.properties new file mode 100644 index 000000000..91d9c7cae --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/io/connection/DS2LoggerConnection.properties @@ -0,0 +1 @@ +TOOLARGE = Parameter request too large (maximum 32), un-select some parameters diff --git a/i18n/com/romraider/logger/ecu/comms/io/connection/NCSLoggerConnection.properties b/i18n/com/romraider/logger/ecu/comms/io/connection/NCSLoggerConnection.properties new file mode 100644 index 000000000..69e34de5e --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/io/connection/NCSLoggerConnection.properties @@ -0,0 +1 @@ +TOOLARGE = Request message too large, un-select some parameters diff --git a/i18n/com/romraider/logger/ecu/comms/io/connection/NCSLoggerConnection_fr_CA.properties b/i18n/com/romraider/logger/ecu/comms/io/connection/NCSLoggerConnection_fr_CA.properties new file mode 100644 index 000000000..f86d0cea0 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/io/connection/NCSLoggerConnection_fr_CA.properties @@ -0,0 +1 @@ +TOOLARGE = Demander un message trop volumineux, désélectionner certains paramètres diff --git a/i18n/com/romraider/logger/ecu/comms/learning/DS2LearningTableValues.properties b/i18n/com/romraider/logger/ecu/comms/learning/DS2LearningTableValues.properties new file mode 100644 index 000000000..9663b4dba --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/learning/DS2LearningTableValues.properties @@ -0,0 +1,11 @@ +DEFNOTFOUND = ECU definition file not found or undefined. Adaptation\nTable Values cannot be properly retrieved until an ECU\ndefinition is defined in the Editor's Definition Manager. +DEFMISSING = ECU Definition Missing +GETAFVALUES = Retrieving vehicle info & A/F values ... +GETKNOCKRANGES = Retrieving Knock Load ranges ... +GETRPMRANGES = Retrieving Knock RPM ranges ... +GETTABLEKNOCK = Retrieving Table {0} Knock values ... +ERRTABLEKNOCK = Error retrieving Knock data values, missing Knock reference +ADAPTSUCCESS = Adaptation Table Values retrieved successfully. +ERRADAPT = Unable to retrieve current ECU adaptation values +ERRCONNECT = {0}\nError performing Adaptation Table Values read.\nCheck the following:\n* Logger has successfully connected to the ECU\n* Correct COM port is selected (if not Openport 2)\n* Cable is connected properly\n* Ignition is ON +ATV = Adaptation Table Values diff --git a/i18n/com/romraider/logger/ecu/comms/learning/DS2LearningTableValues_fr_CA.properties b/i18n/com/romraider/logger/ecu/comms/learning/DS2LearningTableValues_fr_CA.properties new file mode 100644 index 000000000..c79db6bc3 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/learning/DS2LearningTableValues_fr_CA.properties @@ -0,0 +1,11 @@ +DEFNOTFOUND = Fichier de définition de l'ECU non trouvé ou non défini. Les\nvaleurs de la table d'adaptation ne peuvent pas être récupérées\ncorrectement tant qu'une définition d'écus n'a pas été définie dans le\ngestionnaire de définitions de l'éditeur. +DEFMISSING = Définition de l'ECU manquante +GETAFVALUES = Récupération des informations du véhicule et des valeurs A / F ... +GETKNOCKRANGES = Récupération des plages de charge de frappe ... +GETRPMRANGES = Récupération des gammes de RPM de Knock ... +GETTABLEKNOCK = Récupération des valeurs de Knock du tableau {0} ... +ERRTABLEKNOCK = Erreur lors de la récupération des valeurs de données Knock, référence Knock manquante +ADAPTSUCCESS = Valeurs de la table d'adaptation récupérées avec succès. +ERRADAPT = Impossible de récupérer les valeurs d'adaptation actuelles du calculateur +ERRCONNECT = {0}\nErreur lors de la lecture des valeurs du tableau d\u2019adaptation.\nVérifiez les points suivants:\n* L''enregistreur s''est connecté avec succès à l''ECU\n* Le port COM correct est sélectionné (si ce n''est pas Openport 2)\n* Le câble est connecté correctement\n* Le contact est allumé +ATV = Tableau des valeurs d'adaptation diff --git a/i18n/com/romraider/logger/ecu/comms/learning/NCSLearningTableValues.properties b/i18n/com/romraider/logger/ecu/comms/learning/NCSLearningTableValues.properties new file mode 100644 index 000000000..b222ad67e --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/learning/NCSLearningTableValues.properties @@ -0,0 +1,11 @@ +DEFNOTFOUND = ECU definition file not found or undefined. Learning\nTable Values cannot be properly retrieved until an ECU\ndefinition is defined in the Editor's Definition Manager. +DEFMISSING = ECU Definition Missing +GETLTFTVALUES = Retrieving vehicle info & LTFT values ... +GETCOLRANGES = Retrieving LTFT column ranges ... +GETROWRANGES = Retrieving LTFT row ranges ... +GETTABLELTFT = Retrieving Table {0} LTFT row {1} values ... +ERRTABLELTFT = Error retrieving LTFT data values, missing LTFT reference +LTFTSUCCESS = Learning Table Values retrieved successfully. +ERRLTFT = Unable to retrieve current ECU learning values +ERRCONNECT = {0}\nError performing Learning Table Values read.\nCheck the following:\n* Logger has successfully connected to the ECU\n* Correct COM port is selected (if not Openport 2)\n* Cable is connected properly\n* Ignition is ON +LTV = Learning Table Values diff --git a/i18n/com/romraider/logger/ecu/comms/learning/NCSLearningTableValues_fr_CA.properties b/i18n/com/romraider/logger/ecu/comms/learning/NCSLearningTableValues_fr_CA.properties new file mode 100644 index 000000000..50e6ddedd --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/learning/NCSLearningTableValues_fr_CA.properties @@ -0,0 +1,11 @@ +DEFNOTFOUND = Fichier de définition de l'ECU non trouvé ou non défini.\nLes valeurs nTable d'apprentissage ne peuvent pas être\nrécupérées correctement tant qu'une définition d'écus n'est\npas définie dans le gestionnaire de définitions de l'éditeur. +DEFMISSING = Définition de l'ECU manquante +GETLTFTVALUES = Récupération des informations du véhicule et des valeurs LTFT ... +GETCOLRANGES = Récupération des plages de colonnes LTFT ... +GETROWRANGES = Récupération des plages de lignes LTFT ... +GETTABLELTFT = Récupération des valeurs de la ligne {1} de la table {0} de LTFT ... +ERRTABLELTFT = Erreur lors de l'extraction des valeurs de données LTFT, référence LTFT manquante +LTFTSUCCESS = Apprentissage des valeurs de la table récupérées avec succès. +ERRLTFT = Impossible de récupérer les valeurs d'apprentissage actuelles du calculateur +ERRCONNECT = {0}\nErreur lors de la lecture des valeurs de la table d''apprentissage.\nVérifiez les éléments suivants:\n* L''enregistreur s''est connecté avec succès à l''ECU\n* Le port COM correct est sélectionné (si ce n''est pas Openport 2)\n* Le câble est connecté correctement\n* Le contact est activé +LTV = Apprentissage des valeurs de la table diff --git a/i18n/com/romraider/logger/ecu/comms/learning/SSMLearningTableValues.properties b/i18n/com/romraider/logger/ecu/comms/learning/SSMLearningTableValues.properties new file mode 100644 index 000000000..07a80a9d3 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/learning/SSMLearningTableValues.properties @@ -0,0 +1,12 @@ +DEFNOTFOUND = ECU definition file not found or undefined. Learning\nTable Values cannot be properly retrieved until an ECU\ndefinition is defined in the Editor's Definition Manager. +DEFMISSING = ECU Definition Missing +GETAFVALUES = Retrieving vehicle info & A/F values ... +GETAFSUCCESS = Retrieving A/F Learning ranges ... +GETKNOCKRANGES = Retrieving FLKC Load ranges ... +GETRPMRANGES = Retrieving FLKC RPM ranges ... +GETKNOCKROW = Retrieving FLKC row {0} values ... +ERRTABLEKNOCK = Error retrieving FLKC data values, missing FLKC reference +LTVSUCCESS = Learning Table Values retrieved successfully. +ERRLTV = Unable to retrieve current ECU learning values +ERRCONNECT = {0}\nError performing Learning Table Values read.\nCheck the following:\n* Logger has successfully connected to the ECU\n* Correct COM port is selected (if not Openport 2)\n* Cable is connected properly\n* Ignition is ON +LTV = Learning Table Values diff --git a/i18n/com/romraider/logger/ecu/comms/manager/QueryManagerImpl.properties b/i18n/com/romraider/logger/ecu/comms/manager/QueryManagerImpl.properties new file mode 100644 index 000000000..33fb7a5a7 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/manager/QueryManagerImpl.properties @@ -0,0 +1,12 @@ +DISCONNECTED = Disconnected +SENDINIT = Sending {0} Init: {1} ... +INITDONE = Sending {0} Init: {1} ... done +INITFAIL = Unable to send {0} init - check cable is connected and ignition is on +SELECTPARAMS = Select parameters to be logged ... +QUERYING = Querying {0} ... +SLOWK = {0} Slow-K: +FASTK = {0} Fast-K: +CANBUS = {0} CAN bus: +EXTERNALS = Externals: +QUERYSTATS = {0}[ {1,number,0.00} queries/sec, {2,number,0.000} sec/query ] +STOPPING = Stopping ... \ No newline at end of file diff --git a/i18n/com/romraider/logger/ecu/comms/readcodes/ReadCodesManagerImpl.properties b/i18n/com/romraider/logger/ecu/comms/readcodes/ReadCodesManagerImpl.properties new file mode 100644 index 000000000..45075c5ef --- /dev/null +++ b/i18n/com/romraider/logger/ecu/comms/readcodes/ReadCodesManagerImpl.properties @@ -0,0 +1,3 @@ +READCODES = Reading {0} DTC codes ... +COMPLETE = Reading {0} DTC codes ... complete +FAILED = Unable to read {0} DTC codes - check correct serial port has been selected, cable is connected and ignition is on. diff --git a/i18n/com/romraider/logger/ecu/definition/EcuDataLoaderImpl.properties b/i18n/com/romraider/logger/ecu/definition/EcuDataLoaderImpl.properties new file mode 100644 index 000000000..e642d8875 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/definition/EcuDataLoaderImpl.properties @@ -0,0 +1,4 @@ +UNZIPECU = Unable to read ECU definition file {0}. Please make sure the definition file is correct. If it is in a ZIP archive, unzip the file and try again. +ECUFNF = The specified ECU definition file {0} does not exist. +LOGFNF = The specified Logger Config file {0} does not exist. +UNZIPLOG = Unable to read Logger Config file {0}. Please make sure the configuration file is correct. If it is in a ZIP archive, unzip the file and try again. \ No newline at end of file diff --git a/i18n/com/romraider/logger/ecu/profile/UserProfileFileFilter.properties b/i18n/com/romraider/logger/ecu/profile/UserProfileFileFilter.properties new file mode 100644 index 000000000..de48ba728 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/profile/UserProfileFileFilter.properties @@ -0,0 +1 @@ +FILTER = ECU Logger User Profiles \ No newline at end of file diff --git a/i18n/com/romraider/logger/ecu/profile/UserProfileImpl.properties b/i18n/com/romraider/logger/ecu/profile/UserProfileImpl.properties new file mode 100644 index 000000000..03e72d368 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/profile/UserProfileImpl.properties @@ -0,0 +1,3 @@ +UNKNDEFAULT = Unknown default units, '{0}', specified for [{1}] {2} +UNSUPPORTEDENCODE = Unsupported Document Encoding: {0} +UNKNLOGGERDATA = Unknown LoggerData type: {0} diff --git a/i18n/com/romraider/logger/ecu/ui/StatusIndicator.properties b/i18n/com/romraider/logger/ecu/ui/StatusIndicator.properties new file mode 100644 index 000000000..5a48f655f --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/StatusIndicator.properties @@ -0,0 +1,6 @@ +# Each of these lines has a trailing space, do not remove it +CONNECTING = Connecting +READING = Reading data +READING_EXTERNAL = Reading plugins only +LOGGING = Logging to file +STOPPED = Stopped diff --git a/i18n/com/romraider/logger/ecu/ui/handler/dash/PlainGaugeStyle.properties b/i18n/com/romraider/logger/ecu/ui/handler/dash/PlainGaugeStyle.properties new file mode 100644 index 000000000..ece203b57 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/handler/dash/PlainGaugeStyle.properties @@ -0,0 +1,5 @@ +ABOVE = above +BELOW = below +LBLWARN = Warn +LBLMAX = max +LBLMIN = min diff --git a/i18n/com/romraider/logger/ecu/ui/handler/file/FileLoggerImpl.properties b/i18n/com/romraider/logger/ecu/ui/handler/file/FileLoggerImpl.properties new file mode 100644 index 000000000..7c51d66c7 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/handler/file/FileLoggerImpl.properties @@ -0,0 +1,3 @@ +STARTLOG = Started logging to file: {0} +STOPLOG = Stopped logging to file + \ No newline at end of file diff --git a/i18n/com/romraider/logger/ecu/ui/handler/graph/GraphUpdateHandler.properties b/i18n/com/romraider/logger/ecu/ui/handler/graph/GraphUpdateHandler.properties new file mode 100644 index 000000000..8d10ed4d2 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/handler/graph/GraphUpdateHandler.properties @@ -0,0 +1,5 @@ +COMBINE = Combine Graphs +PAUSE = Pause Graphs +COMBINED = Combined Data +DATA = Data +LBLXAXIS = Time (sec) diff --git a/i18n/com/romraider/logger/ecu/ui/handler/livedata/LiveDataTableModel.properties b/i18n/com/romraider/logger/ecu/ui/handler/livedata/LiveDataTableModel.properties new file mode 100644 index 000000000..3710591f8 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/handler/livedata/LiveDataTableModel.properties @@ -0,0 +1,6 @@ +LBLCOL1 = Logger Data +LBLCOL2 = Min Value +LBLCOL3 = Current Value +LBLCOL4 = Max Value +LBLCOL5 = Units +ERROR = Error! diff --git a/i18n/com/romraider/logger/ecu/ui/paramlist/ParameterListTableModel.properties b/i18n/com/romraider/logger/ecu/ui/paramlist/ParameterListTableModel.properties new file mode 100644 index 000000000..14bd50635 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/paramlist/ParameterListTableModel.properties @@ -0,0 +1,3 @@ +LBLCOL1 = Selected? +LBLCOL3 = Units +ERROR = Error! diff --git a/i18n/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.properties b/i18n/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.properties new file mode 100644 index 000000000..dd5de1cbe --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.properties @@ -0,0 +1,51 @@ +# File menu +FILE = File +LOADPROFILE = Load Profile ... +RELOADPROFILE = Reload Profile +SAVEPROFILE = Save Profile +SAVEPROFILEAS = Save Profile As ... +EXIT = Exit + +#Settings menu +SETTINGS = Settings +DEFLOCATION = Logger Definition Location ... +OUTLOCATION = Log File Output Location ... +PROTOOPTIONS = Select Logging Protocol Options ... +PROTOOPTIONSTT = Select to switch logging communications protocol +DEFOGGERSW = Control File Logging With Defogger Switch +AUTOCONNECT= Automatically Connect On Startup +COMREFRESH = Enable COM port Auto Refresh +COMREFRESHTT = Select to enable automatic COM port refreshing +ELM327ENABLED = Enable ELM327 OBD Support +ELM327ENABLEDTT = Select to enable search for the ELM327 +FASTPOLL = Enable Fast Polling Mode +FASTPOLLTT = Select to enable faster K-line polling of the ECU +ABSTIMESTAMP = Use Absolute Timestamp in log file +USNUMBERS = Use US English number format in log file +USNUMBERSTT = Select to force log files to be written with . decimal point and , field separator + +# Connection menu +CONNECTION = Connection +RESET = Reset +DISCONNECT = Disconnect + +# Tools menu +TOOLS = Tools +RESETECU = Reset ECU +READDTC = Read Diagnostic Codes +GLOBALADJ = Global Timing & Idle RPM Adjustment +LTV = Learning Table Values + +# Plugins menu +PLUGINS = Plugins + +# Help menu +HELP = Help +UPDATEDEF = Update Logger Definition ... +DEBUGLVL = Debugging Level ... +DEBUGLVLTT = Level of detail recorded in the rr_system.log file +INFO = INFO - normal +DEBUG = DEBUG - detailed +TRACE = TRACE - verbose +DEBUGLOC = Open Debug Log Location ... +ABOUT = About {0} diff --git a/i18n/com/romraider/logger/ecu/ui/swing/menubar/util/FileHelper.properties b/i18n/com/romraider/logger/ecu/ui/swing/menubar/util/FileHelper.properties new file mode 100644 index 000000000..d2018f957 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/swing/menubar/util/FileHelper.properties @@ -0,0 +1,2 @@ +LOGUSERPROFILE = ECU Logger User Profiles +LOGDEFINITIONS = ECU Logger Definitions diff --git a/i18n/com/romraider/logger/ecu/ui/swing/tools/DS2LearningTableValuesResultsPanel.properties b/i18n/com/romraider/logger/ecu/ui/swing/tools/DS2LearningTableValuesResultsPanel.properties new file mode 100644 index 000000000..71697fbf7 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/swing/tools/DS2LearningTableValuesResultsPanel.properties @@ -0,0 +1,21 @@ +DIALOGTITLE = Adaptation Table Values +FLKCNAME = Knock Adaptation (\u00B0 of correction) +VEHICLEINFOTITLE = Vehicle Information +AFSTORED = A/F Adaptation (Stored) +APPLIEDADAPTIONS = Applied Adaptations +BANK = Bank +AFNODATA = No data - A/F Adaptation parameter IDs not defined +ENGINELOAD = Engine Load (mg/stroke) +ENGINESPEED = Engine Speed (RPM) +TABLE = Table {0,number,integer} +KNKNODATA = No data - Knock Adaptation parameter ID not defined +SAVETOFILE = Save to File +SAVETOFILETT = Save tables to a text file +SAVETOIMAGE = Save as Image +SAVETOIMAGETT = Save tables as an image +SAVEMSG = Table''s text saved to: {0} +SAVEMSGTITLE = Save Success +SAVEFAILED = Failed to save tables, check path:\n{0} +SAVEFAILEDTITLE = Save Failed +SAVEIMAGE = Adaptation Table Values image saved to: {0} +FAILEDIMAGE = Failed to save image, check path:\n{0} diff --git a/i18n/com/romraider/logger/ecu/ui/swing/tools/DS2ResetPanel.properties b/i18n/com/romraider/logger/ecu/ui/swing/tools/DS2ResetPanel.properties new file mode 100644 index 000000000..6c740e717 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/swing/tools/DS2ResetPanel.properties @@ -0,0 +1,17 @@ +DIALOGTITLE = Reset DS2 Adaptation Selection +OKBTN = OK +CANCELBTN = Cancel +PANELTT = Unsupported items are ignored by the ECU if selected. +SELECTALL = Select All +CHKBOX1 = Knock Adaptations +CHKBOX2 = Idle Speed Adaptations +CHKBOX3 = Lambda Adaptations +CHKBOX4 = Throttle Adaptations +CHKBOX5 = Altitude Correction +CHKBOX6 = Undefined Adaptation +CHKBOX7 = Undefined Adaptation +CHKBOX8 = Undefined Adaptation +CHKBOX9 = Undefined Adaptation +CHKBOX10 = External Load History (M3 only) +CHKBOX11 = Undefined Adaptation (MS43 only) +CHKBOX12 = Undefined Adaptation (MS43 only) diff --git a/i18n/com/romraider/logger/ecu/ui/swing/tools/GlobalAdjustmentsPanel.properties b/i18n/com/romraider/logger/ecu/ui/swing/tools/GlobalAdjustmentsPanel.properties new file mode 100644 index 000000000..1f9f32a40 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/swing/tools/GlobalAdjustmentsPanel.properties @@ -0,0 +1,9 @@ +DIALOGTITLE = Global Parameter Adjustments +TIMINGADJ = Timing Adjustment +IDLEACOFF = Idle Engine Speed A/C Off +RPM = RPM +IDLERPMTT = valid range: -100 to 300 in steps of 25 +IDLEACON = Idle Engine Speed A/C On +RESETWARNING = NOTE: These values will be set to 0 by a Reset +APPLY = Apply +CANCEL = Cancel diff --git a/i18n/com/romraider/logger/ecu/ui/swing/tools/NCSLearningTableValuesResultsPanel.properties b/i18n/com/romraider/logger/ecu/ui/swing/tools/NCSLearningTableValuesResultsPanel.properties new file mode 100644 index 000000000..5bbf820d7 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/swing/tools/NCSLearningTableValuesResultsPanel.properties @@ -0,0 +1,20 @@ +DIALOGTITLE = Learning Table Values +LTFTNAME = Learned Fuel Trim Tables +VITITLE = Vehicle Information +INJPWLABEL = Injector Pulse Width (msec) +ENGINESPEED = Engine Speed (RPM) +LBTRIM = Left Bank - Trim (%) +RBTRIM = Right Bank - Trim (%) +LBCOUNT = Left Bank - Count +RBCOUNT = Right Bank - Count +NOKNDATA = No data - Knock Adaptation parameter ID not defined +SAVETOFILE = Save to File +SAVETOFILETT = Save tables to a text file +SAVEASIMAGE = Save as Image +SAVEASIMAGETT = Save tables as an image +TABLESAVED = Table''s text saved to: {0} +SUCCESS = Save Success +SAVEFAILED = Failed to save tables, check path:\n{0} +FAILED = Save Failed +IMAGESAVED = Learning Table Values image saved to: {0} +IMAGEFAILED = Failed to save image, check path:\n{0} diff --git a/i18n/com/romraider/logger/ecu/ui/swing/tools/ReadCodesResultsPanel.properties b/i18n/com/romraider/logger/ecu/ui/swing/tools/ReadCodesResultsPanel.properties new file mode 100644 index 000000000..c963651eb --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/swing/tools/ReadCodesResultsPanel.properties @@ -0,0 +1,16 @@ +READRESULTS = Diagnostic Code Read Results +SAVETITLE = Save Results +COPYTIP = Click table, press Ctrl-A then Ctrl-C to copy table to clip board, or ... +SAVETOFILE = Save to File +SAVETOFILETT = Save table to a text file +SAVETOIMAGE = Save as Image +SAVETOIMAGETT = Save table as an image +TABLEHEADER = Diagnostic Code Name,Temporary,Memorized +FALSE = false +TRUE = true +TABLESAVED = Table text saved to: {0} +SUCCESS = Save Success +TABLEFAILED = Failed to save table, check path:\n{0} +FAILED = Save Failed +IMAGESAVED = Table image saved to: {0} +IMAGEFAILED = Failed to save image, check path:\n{0} diff --git a/i18n/com/romraider/logger/ecu/ui/swing/tools/SSMLearningTableValuesResultsPanel.properties b/i18n/com/romraider/logger/ecu/ui/swing/tools/SSMLearningTableValuesResultsPanel.properties new file mode 100644 index 000000000..5e855741a --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/swing/tools/SSMLearningTableValuesResultsPanel.properties @@ -0,0 +1,20 @@ +DIALOGTITLE = Learning Table Values +FLKCNAME = Fine Learning Knock Correction (\u00B0 of correction) +VITITLE = Vehicle Information +AFLEARNING = A/F Learning (Stored) +AFRANGES = Air/Fuel Ranges (g/s) +BANK = Bank +AFNODATA = No data - A/F Extended parameter IDs not defined +ENGINELOAD = Engine Load Ranges (g/rev) +ENGINESPEED = Engine Speed Ranges (RPM) +FLKCNODATA = No data - FLKC reference parameter ID not defined +SAVETOFILE = Save to File +SAVETOFILETT = Save tables to a text file +SAVETOIMAGE = Save as Image +SAVETOIMAGETT = Save tables as an image +TABLESAVED = Table''s text saved to: {0} +SUCCESS = Save Success +TABLEFAILED = Failed to save tables, check path:\n{0} +FAILED = Save Failed +IMAGESAVED = Learning Table Values image saved to: {0} +IMAGEFAILED = Failed to save image, check path:\n{0} diff --git a/i18n/com/romraider/logger/ecu/ui/swing/tools/tablemodels/ReadCodesTableModel.properties b/i18n/com/romraider/logger/ecu/ui/swing/tools/tablemodels/ReadCodesTableModel.properties new file mode 100644 index 000000000..0f713d1d4 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/swing/tools/tablemodels/ReadCodesTableModel.properties @@ -0,0 +1,4 @@ +# These values should match TABLEHEADER in ../ReadCodesResultsPanel.properties +DTCNAME = Diagnostic Code Name +TEMPORARY = Temporary +MEMORIZED = Memorized diff --git a/i18n/com/romraider/logger/ecu/ui/tab/TableFinder.properties b/i18n/com/romraider/logger/ecu/ui/tab/TableFinder.properties new file mode 100644 index 000000000..2e132185f --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/tab/TableFinder.properties @@ -0,0 +1,2 @@ +NOTABLENAME = No table found for name: "{0}" +MULTITABLENAME = Multiple tables found for name: "{0}" diff --git a/i18n/com/romraider/logger/ecu/ui/tab/XYTrendline.properties b/i18n/com/romraider/logger/ecu/ui/tab/XYTrendline.properties new file mode 100644 index 000000000..fa7bd6718 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/tab/XYTrendline.properties @@ -0,0 +1 @@ +INTERPREQD = Interpolation required diff --git a/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoChartPanel.properties b/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoChartPanel.properties new file mode 100644 index 000000000..9eb1d7885 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoChartPanel.properties @@ -0,0 +1,24 @@ +STARTPROMPT = Accelerate using WOT when ready!! +ETPROMPTI = Accelerate for 1/4 mile when ready!! +ETPROMPTM = Accelerate for 402 meters when ready!! +MAXHP = Max HP +MAXTQ = Max TQ +REFERENCE = Reference: {0} ({1,number,0.00}; {2,number,0.00}; {3,number,0.00}; {4,number,0.00}) +S60TEXTI = 60 ft +S330TEXTI = 330 ft +S660TEXTI = 1/2 track +S1000TEXTI = 1,000 ft +S1320TEXTI = 1/4 mile +ZTO60TEXTI = 60 mph +S60TEXTM = 18.3m +S330TEXTM = 100m +S1000TEXTM = 305m +S1320TEXTM = 402m +ZTO60TEXTM = 97 km/h +HPAXISLBL = Vehicle Speed ({0}) +CARTEXT = LANE 1: {0} - ET: {1,number,0.000}" / {2,number,0.00} {3} +ETXAXISLBL = Time (seconds) +ETHPAXISLBL = Vehicle Speed +DYNOXAXISLBL = Engine Speed (RPM) +DYNOHPAXISLBL = Calculated Wheel Power +DYNOTQAXISLBL = Calculated Engine Torque diff --git a/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoControlPanel.properties b/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoControlPanel.properties new file mode 100644 index 000000000..348710fbe --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoControlPanel.properties @@ -0,0 +1,67 @@ +# Tool tip +CAR_MASS_TT = Base mass of car from factory +DELTA_MASS_TT = Mass of all occupants and accessories added +HUMIDITY_TT = Current relative Humidity +TIRE_WIDTH_TT = Tire width in millimetres +TIRE_ASPECT_TT = Tire aspect ratio in percentage +WHEEL_SIZE_TT = Wheel (rim) size in inches +CAR_SELECT_TT = Select car, default is first in list +GEAR_SELECT_TT = Select gear, default is 2nd for 4AT, 3rd for 5MT and 4th for 6MT +RPM_MIN_TT = RPM min is updated after WOT +RPM_MAX_TT = RPM max is updated after WOT +ELEVATION_TT = Elevation is calculated from ECU ATM sensor +AMB_TEMP_TT = Ambient Temperature is updated from IAT sensor +ORDER_TT = Lower number provides more smoothing +RESET_TT = This clears all recorded or file loaded data +RECORD_TT = Press to acquire data, multiple sets of Dyno data can be acquired +DYNO_TT = Use this mode to estimate Power & Torque +ET_TT = Use this mode to measure trap times +TPS_SELECT_TT = Set to a value less than TPS at WOT to trigger start of WOT pull +TPS_MODE_TT = Monitor throttle in % or volts + +# Messages +ERROR = Error +NOTICE = Notice +MISSING = Missing cars_def.xml +MISSINGID = Unable to find Logger parameter ID: {0} +INVALIDRPM = Invalid PRM range specified. +TANOSUPPORT = Throttle Angle parameter not supported, recording disabled +TVNOSUPPORT = Throttle Volts parameter not supported, recording disabled +PARSEERROR = Parsing error, line {0}, {1}.\n{2} +CDNOTFOUND = Cars definition file not found.\nGo online to download the latest definition file? +CONFIGURATION = Configuration +MISSINGCD = {0} file from the installation or profiles or definitions directory.\nDyno feature will not be available until this file is present. + +# Labels +ELEVATION_I = Elevation (ft) +AIRTEMP_I = Air Temperature (\u00b0F) +ELEVATION_M = Elevation (m) +AIRTEMP_M = Air Temperature (\u00b0C) +DELTAWEIGHT_I = Delta Weight (lbs) +BASEWEIGHT_I = Base Weight (lbs) +DELTAWEIGHT_M = Delta Weight (kg) +BASEWEIGHT_M = Base Weight (kg) +RECALC = Recalculate +RECORD = Record Data +IMPERIAL = Imperial +METRIC = Metric +LOADFILE = Load From File +MEASUREMENT = Measurement Units +MODE = Mode +SMOOTHFAC = Smoothing Factor +RPMRANGE = RPM Range +HUMIDITY = Rel Humidity (%) +REFTRACE = Reference Trace +ELAPSEDTIME = Elapsed Time +SELECTCAR = Select Car +DYNOSETTINGS = Dyno Settings +MINTHROTTLE = Minimum Throttle value to indicate WOT +WHEELDIM = Wheel (Width/Aspect-Diam.) +SELECTGEAR = Select Gear +CLEARDATA = Clear Data +READFF = Read From File +LOADFF = Load From File +RECORDET = Record ET +OPEN = Open +SAVE = Save +CLEAR = Clear diff --git a/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoControlPanel_fr_CA.properties b/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoControlPanel_fr_CA.properties new file mode 100644 index 000000000..6a3cc2376 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoControlPanel_fr_CA.properties @@ -0,0 +1,67 @@ +# Tool tip +CAR_MASS_TT = Masse de base de la voiture de l'usine +DELTA_MASS_TT = Masse de tous les occupants et accessoires ajoutés +HUMIDITY_TT = Humidité relative actuelle +TIRE_WIDTH_TT = Largeur du pneu en millimètres +TIRE_ASPECT_TT = Ratio d'aspect des pneus en pourcentage +WHEEL_SIZE_TT = Taille de la roue (jante) en pouces +CAR_SELECT_TT = Sélectionnez la voiture, la valeur par défaut est la première de la liste +GEAR_SELECT_TT = Sélectionnez le rapport, la valeur par défaut est la 2ème pour 4AT, la 3ème pour 5MT et la 4ème pour 6MT +RPM_MIN_TT = RPM min est mis à jour après WOT +RPM_MAX_TT = RPM max est mis à jour après WOT +ELEVATION_TT = L''élévation est calculée à partir du capteur ATM de l'ECU +AMB_TEMP_TT = La température ambiante est mise à jour à partir du capteur IAT +ORDER_TT = Plus le nombre est faible, plus le lissage est efficace +RESET_TT = Ceci efface toutes les données enregistrées ou les fichiers chargés. +RECORD_TT = Appuyez pour acquérir des données, vous pouvez acquérir plusieurs jeux de données Dyno. +DYNO_TT = Utilisez ce mode pour estimer la puissance et le couple +ET_TT = Utilisez ce mode pour mesurer les temps d'interruption +TPS_SELECT_TT = Définissez une valeur inférieure à TPS chez WOT pour déclencher le démarrage de l'extraction de WOT +TPS_MODE_TT = Surveiller les gaz en% ou en volts + +# Messages +ERROR = Erreur +NOTICE = Remarquer +MISSING = cars_def.xml manquant +MISSINGID = Impossible de trouver l'ID du paramètre de journalisation: {0} +INVALIDRPM = Plage PRM non valide spécifiée. +TANOSUPPORT = Paramètre Angle de papillon non pris en charge, enregistrement désactivé +TVNOSUPPORT = Paramètre Volts des gaz non pris en charge, enregistrement désactivé +PARSEERROR = Erreur d\u2019analyse, ligne {0}, {1}.\n{2} +CDNOTFOUND = Fichier de définition de voitures non trouvé.\nAller en ligne pour télécharger le dernier fichier de définition? +CONFIGURATION = Configuration +MISSINGCD = {0} fichier à partir du répertoire d''installation ou des profils ou des définitions.\nLa fonctionnalité Dyno ne sera disponible que lorsque ce fichier sera présent. + +# Labels +ELEVATION_I = Élévation (ft) +AIRTEMP_I = Température de l'air (\u00b0F) +ELEVATION_M = Élévation (m) +AIRTEMP_M = Température de l'air (\u00b0C) +DELTAWEIGHT_I = Poids Delta (lbs) +BASEWEIGHT_I = Poids de base (lbs) +DELTAWEIGHT_M = Poids Delta (kg) +BASEWEIGHT_M = Poids de base (kg) +RECALC = Recalculer +RECORD = Données d'enregistrement +IMPERIAL = Impériale +METRIC = Métrique +LOADFILE = Charger à partir d'un fichier +MEASUREMENT = Unités de mesure +MODE = Mode +SMOOTHFAC = Facteur de lissage +RPMRANGE = Plage de régime +HUMIDITY = Humidité Rel (%) +REFTRACE = Trace de référence +ELAPSEDTIME = Temps écoulé +SELECTCAR = Sélectionner une voiture +DYNOSETTINGS = Paramètres Dyno +MINTHROTTLE = Valeur minimale de l'accélérateur pour indiquer WOT +WHEELDIM = Roue (Largeur / Aspect-Diam.) +SELECTGEAR = Sélectionnez un équipement +CLEARDATA = Effacer les données +READFF = Lire du fichier +LOADFF = Charger à partir d'un fichier +RECORDET = Record ET +OPEN = Ouvrir +SAVE = Sauvegarder +CLEAR = Effacer diff --git a/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoTabImpl.properties b/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoTabImpl.properties new file mode 100644 index 000000000..39470545a --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/tab/dyno/DynoTabImpl.properties @@ -0,0 +1,3 @@ +XAXISLBL = Engine Speed (RPM) +HPAXISLBL = Calculated Wheel Power +TQAXISLBL = Calculated Engine Torque diff --git a/i18n/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.properties b/i18n/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.properties new file mode 100644 index 000000000..76d2a77b5 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.properties @@ -0,0 +1,42 @@ +RECORDDATA = Record Data +FUELAFR = Fuel Stoich. AFR +FUELDENSITY = Fuel Density +AFR = AFR +RPM = RPM +MAF = MAF +MAFV = MAFv +ECT = Coolant Temp. +IAT = Intake Air Temp. +DMAFVDT = dMAFv/dt +ERROR = Error +INVALIDVALUE = Invalid {0} value specified. +INVALIDRANGE = Invalid {0} range specified. +INVALIDMINMAX = Invalid {0} specified. +RESET = Reset +INTERPOLATE = Interpolate +UPDATEINJ = Update Injector +FLOWSCALING = Flow Scaling (cc/min) +LATENCYOFFSET = Latency Offset (ms) +FUELPROPERTIES = Fuel Properties +STOICHAFR = Stoich. AFR +DENSITY = Density (kg/m3) +FILTERDATA = Filter Data +AFRRANGE = AFR Range +RPMRANGE = RPM Range +MAFRANGE = MAF Range (g/s) +MINECT = Min. Coolant Temp. +MAXIAT = Max. Intake Temp. +MAXDELTA = Max. dMAFv/dt (V/s) +RESETDATA = Reset Data +UPDATESCALING = Update Scaling +INVALIDSCALING = Invalid Injector Flow Scaling value. +INJTABLENOTFND = Injector Flow Scaling table not found. +UNKNOWN = Unknown +ERRORMSG = Error: {0} +UPDATELAT = Update Latency +INVALIFINJOFF = Invalid Injector Latency Offset value. +LATTBLNOTFND = Error finding Injector Latency table. +UPDATETABLE = Update {0}? +CONFIRM = Confirm Update +INJFLOWSCALING = Injector Flow Scaling +INJLAT = Injector Latency diff --git a/i18n/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.properties b/i18n/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.properties new file mode 100644 index 000000000..b8ff29092 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.properties @@ -0,0 +1,2 @@ +PWMS = Pulse Width (ms) +FPCE = Fuel per Combustion Event (cc) diff --git a/i18n/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.properties b/i18n/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.properties new file mode 100644 index 000000000..32220afd9 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.properties @@ -0,0 +1,30 @@ +RECORDDATA = Record Data +AFR = AFR +RPM = RPM +MAF = MAF +MAFV = MAFv +ECT = Coolant Temp. +IAT = Intake Air Temp. +DMAFVDT = dMAFv/dt +ERROR = Error +INVALIDRANGE = Invalid {0} range specified. +INVALIDMINMAX = Invalid {0} specified. +AFRSRC = AFR Source +RESET = Reset +UPDATEMAF = Update MAF +MAFVRANGE = MAFv Range +INTERPOLATE = Interpolate +POLYORDER = Poly. order +FILTERDATA = Filter Data +AFRRANGE = AFR Range +RPMRANGE = RPM Range +MAFRANGE = MAF Range (g/s) +MINECT = Min. Coolant Temp. +MAXIAT = Max. Intake Temp. +MAXDELTA = Max. dMAFv/dt (V/s) +RESETDATA = Reset Data +INVALIDMAFRANGE = Invalid MAFv range specified. +MAFTBLNOTFND = Error finding MAF Sensor Scaling table. +ERRORMSG = Error: {0} +UPDATETABLE = Update MAF Sensor Scaling table? +CONFIRM = Confirm Update diff --git a/i18n/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.properties b/i18n/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.properties new file mode 100644 index 000000000..c32721e55 --- /dev/null +++ b/i18n/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.properties @@ -0,0 +1,2 @@ +MAFV = MAF (v) +TOTALCORR = Total Correction (%) diff --git a/i18n/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitConvertorPanel.properties b/i18n/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitConvertorPanel.properties new file mode 100644 index 000000000..001232ed4 --- /dev/null +++ b/i18n/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitConvertorPanel.properties @@ -0,0 +1,12 @@ +TITLE = Phidget InterfaceKit User Defined Convertors +TIP0 = Sensor module serial number and input number +TIP1 = Equation used to convert raw data to real value +TIP2 = Format of real value for display and logging +TIP3 = Units of measure of the real value +TIP4 = Minimum real value expected +TIP5 = Maximum real value expected +TIP6 = Tick mark step for Gauge Tab display, typically (max-min)/10 +SAVE = Save +SAVESETTINGS = Save convertor settings +CANCEL = Cancel +CANCELSAVE = Cancel without saving changes diff --git a/i18n/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitTableModel.properties b/i18n/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitTableModel.properties new file mode 100644 index 000000000..bad4906f4 --- /dev/null +++ b/i18n/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitTableModel.properties @@ -0,0 +1,7 @@ +SENSORID = Sensor serial:input Number +EXPR = Expression +FORMAT = Format +UNITS = Units +MIN = Min +MAX = Max +STEP = Step diff --git a/i18n/com/romraider/maps/Rom.properties b/i18n/com/romraider/maps/Rom.properties new file mode 100644 index 000000000..e0d97b084 --- /dev/null +++ b/i18n/com/romraider/maps/Rom.properties @@ -0,0 +1,12 @@ +POPTABLES = Populating tables ... +ADDROUTOFBNDS = Storage address for table {0} is out of bounds.\nPlease check ECU definition file. +ECUDEFERROR = ECU Definition Error +TABLELOADERR = There was an error loading table {0} +YES = Yes +NO = No +CHECKSUMFIXED = %d of %d Checksums updated. +CHKSUMINVALID = One or more ROM image Checksums is invalid. Calculate new Checksums?\n(NOTE: this will only fix the Checksums it will NOT repair a corrupt ROM image. +CHECKSUMFIX = Checksum Fix +INVLAIDCHKSUM = Checksum is invalid.\nThe ROM image may be corrupt or it has been hex edited manually.\nThe checksum can be corrected when the ROM is saved if you trust it is not corrupt. +CHKSUMFAIL = ERROR - Checksum Failed +NOMATCHES = No table name matches the current filter... diff --git a/i18n/com/romraider/maps/Table3DView.properties b/i18n/com/romraider/maps/Table3DView.properties new file mode 100644 index 000000000..9136dbe7c --- /dev/null +++ b/i18n/com/romraider/maps/Table3DView.properties @@ -0,0 +1,2 @@ +USERLVLTOLOW = This table can only be modified by users with a userlevel of \n{0} or greater. Click View->User Level to change your userlevel. +TBLNOTMODIFY = Table cannot be modified diff --git a/i18n/com/romraider/maps/TableBitwiseSwitch.properties b/i18n/com/romraider/maps/TableBitwiseSwitch.properties new file mode 100644 index 000000000..2b3ad57fd --- /dev/null +++ b/i18n/com/romraider/maps/TableBitwiseSwitch.properties @@ -0,0 +1,2 @@ +OUTOFRANGE = Table: {0}\nDefinition file specified an out of range bit switch! Only values >= 0 and < size * 8 are allowed! +DEFERROR = ERROR - Incorrect definition diff --git a/i18n/com/romraider/maps/TableSwitch.properties b/i18n/com/romraider/maps/TableSwitch.properties new file mode 100644 index 000000000..50a342582 --- /dev/null +++ b/i18n/com/romraider/maps/TableSwitch.properties @@ -0,0 +1,6 @@ +CHKSUMINVALID = Checksum No. {0} is invalid in table: {1}\nThe ROM image may be corrupt or it has been \nhex edited manually.\nThe checksum can be corrected when the ROM is saved. +CHKSUMSFAILED = ERROR - Checksums Failed +ALLDISABLED = All Checksums are disabled. +CHKSUMSTATUS = Warning - Checksum Status +EDITDISABLE = Table: {0}\nTable editing has been disabled.\nDefinition file or ROM image may be corrupt. +DATAMISMATCH = ERROR - Data Mismatch diff --git a/i18n/com/romraider/maps/TableView.properties b/i18n/com/romraider/maps/TableView.properties new file mode 100644 index 000000000..0bb7f545c --- /dev/null +++ b/i18n/com/romraider/maps/TableView.properties @@ -0,0 +1,7 @@ +USERLVLTOLOW = This table can only be modified by users with a userlevel of \n{0} or greater. Click View->User Level to change your userlevel. +TBLNOTMODIFY = Table cannot be modified +REALBYTEINVALID = The real value and byte value conversion expressions for table {0} are invalid. +REALVALUE = To real value: {0} +BYTEVALUE = To byte: {0} +DISPLAYMSG = Always display this message +WARNING = Warning diff --git a/i18n/com/romraider/maps/checksum/ChecksumFactory.properties b/i18n/com/romraider/maps/checksum/ChecksumFactory.properties new file mode 100644 index 000000000..0dce67058 --- /dev/null +++ b/i18n/com/romraider/maps/checksum/ChecksumFactory.properties @@ -0,0 +1,3 @@ +MISSING = Error in checksum definition, 'type' attribute missing. +NOCLASS = Error loading Checksum Manager of type: {0} +LOADERR = Error Loading Checksum Manager diff --git a/i18n/com/romraider/swing/CompareImagesForm.properties b/i18n/com/romraider/swing/CompareImagesForm.properties new file mode 100644 index 000000000..4156ddc65 --- /dev/null +++ b/i18n/com/romraider/swing/CompareImagesForm.properties @@ -0,0 +1,16 @@ +TITLE = Compare Images +LBLSELECTED = Selected Images +TTSELECTIMG = Select an image to compare. +BTNCOMPARE = Compare +LBLRESULTS = Results: +LBLCOMPAREIMGS = Compare images ... +LBLEQUALS = Images are equal. +LBLNOTEQUAL = Images are NOT equal. Equal Tables: {0}, Changed Tables: {1}, Missing Tables: {2} +LBLNOEDM = No tables are equal, different, or missing. +NOCOMPARE = Unable to compare images. +NOEQUAL = No Equal Tables. +NOCHANGED = No Changed Tables. +NOMISSING = No Missing Tables. +UNCHANGED = [unchanged] {0} +MODIFIED = [modified] {0} +MISSING = [missing] {0} diff --git a/i18n/com/romraider/swing/DebugPanel.properties b/i18n/com/romraider/swing/DebugPanel.properties new file mode 100644 index 000000000..256739b30 --- /dev/null +++ b/i18n/com/romraider/swing/DebugPanel.properties @@ -0,0 +1,4 @@ +LABEL1 = {0} has encountered an exception. Please review the details below. +LABEL2 = If you are unable to fix this problem please visit the following website +LABEL3 = and provide these details and the steps that lead to this error. +LABEL4 = Details: diff --git a/i18n/com/romraider/swing/DefinitionFilter.properties b/i18n/com/romraider/swing/DefinitionFilter.properties new file mode 100644 index 000000000..53043c215 --- /dev/null +++ b/i18n/com/romraider/swing/DefinitionFilter.properties @@ -0,0 +1 @@ +DESC = Editor Definition Files diff --git a/i18n/com/romraider/swing/DefinitionManager.properties b/i18n/com/romraider/swing/DefinitionManager.properties new file mode 100644 index 000000000..3ab0f441b --- /dev/null +++ b/i18n/com/romraider/swing/DefinitionManager.properties @@ -0,0 +1,13 @@ +TITLE = Definition File Manager +FILEPRIORITY = Editor Definition File Priority +MOVEUP = Move Up +MOVEDOWN = Move Down +ADD = Add ... +REMOVE = Remove +SAVE = Save +CANCEL = Cancel +APPLY = Apply +UNDO = Undo +CONVERSIONTITLE = Conversion Layer Warning +INVALIDFILE = Invalid RomRaider Editor definition file +INVALIDMSG = {0}: ''{1}'' is not a valid RomRaider Editor definition file diff --git a/i18n/com/romraider/swing/ECUEditorMenuBar.properties b/i18n/com/romraider/swing/ECUEditorMenuBar.properties new file mode 100644 index 000000000..628a91f8b --- /dev/null +++ b/i18n/com/romraider/swing/ECUEditorMenuBar.properties @@ -0,0 +1,48 @@ +FILE = File +OPENIMG = Open Image ... +OPENIMGS = Open Image(s) ... +SAVE = Save Image ... +QUICKSAVE = Save {0} +SAVEAS = Save Image As ... +SAVEFAS = Save {0} As ... +SAVEREPO = Save Image As Repository ... +SAVEFREPO = Save {0} As Repository ... +REFRESH = Refresh Image +REFRESHF = Refresh {0} +CLOSE = Close Image +CLOSEF = Close {0} +CLOSEALL = Close All Images +EXPORTDEFF = Export Definition of Rom +EXPORTDEF = Export Definition of {0} +EXIT = Exit +ECUDEF = Definitions +ECUDEFMAN = Definition Manager ... +EDITDEF = Edit Definitions ... +GETDEF = Get Definitions ... +EDIT = Edit +SETTINGS = {0} Settings ... +COMPARE = Compare Images ... +CONVERT = Convert Image +ONE60 = 160KB --> 192KB ... +ONE92 = 192KB --> 160KB ... +VIEW = View +PROPERTIES = Image Properties +PROPERTIESF = {0} Properties +USERLVL = User Level +BEGIN = 1 Beginner +INTER = 2 Intermediate +ADVND = 3 Advanced +HIGH = 4 Highest +DEBUG = 5 Debug Mode +LOGGER = Logger +LLOGGER = Launch Logger ... +TOOLS = Tools +TESTAPP = Launch Test App ... +DATAFLOW = Dataflow Simulations ... +HELP = Help +ABOUT = About {0} +ABOUTMSG = {0} - Editor\nVersion: {1}\nBuild: {2}\nHome Page: {3}\nJava: {4} {5} ({6}) +EXCEPTN = Exception +OVERWRITE = {0} already exists! Overwrite? +SELECTDIR = Select Repository Directory +CONVERTERR = Error converting image. Image size is invalid. diff --git a/i18n/com/romraider/swing/ECUEditorToolBar.properties b/i18n/com/romraider/swing/ECUEditorToolBar.properties new file mode 100644 index 000000000..d8910325d --- /dev/null +++ b/i18n/com/romraider/swing/ECUEditorToolBar.properties @@ -0,0 +1,5 @@ +OPEN = Open Image +SAVEAS = Save {0} As New Image... +REFRESH = Refresh {0} from saved copy +CLOSE = Close {0} +EXCEPTION = Exception diff --git a/i18n/com/romraider/swing/ECUImageFilter.properties b/i18n/com/romraider/swing/ECUImageFilter.properties new file mode 100644 index 000000000..84b584d9b --- /dev/null +++ b/i18n/com/romraider/swing/ECUImageFilter.properties @@ -0,0 +1 @@ +IMAGEFILE = Image Files diff --git a/i18n/com/romraider/swing/JProgressPane.properties b/i18n/com/romraider/swing/JProgressPane.properties new file mode 100644 index 000000000..b2ca78147 --- /dev/null +++ b/i18n/com/romraider/swing/JProgressPane.properties @@ -0,0 +1,2 @@ +# Read value has a leading whitespace character +READY = \ Ready ... diff --git a/i18n/com/romraider/swing/JTableChooser.properties b/i18n/com/romraider/swing/JTableChooser.properties new file mode 100644 index 000000000..631d5e6f4 --- /dev/null +++ b/i18n/com/romraider/swing/JTableChooser.properties @@ -0,0 +1,3 @@ +COMPARE = Compare +CANCEL = Cancel +SELECT = Select an image and map diff --git a/i18n/com/romraider/swing/RomFilterPanel.properties b/i18n/com/romraider/swing/RomFilterPanel.properties new file mode 100644 index 000000000..4a35f40a3 --- /dev/null +++ b/i18n/com/romraider/swing/RomFilterPanel.properties @@ -0,0 +1,2 @@ +LBLFILTER = Filter: +LBLTOOLTIP = Type to filter tables... \ No newline at end of file diff --git a/i18n/com/romraider/swing/RomPropertyPanel.properties b/i18n/com/romraider/swing/RomPropertyPanel.properties new file mode 100644 index 000000000..02143c4b1 --- /dev/null +++ b/i18n/com/romraider/swing/RomPropertyPanel.properties @@ -0,0 +1,18 @@ +LBLCHKSUM = Checksum: +LBLEDIT = Edit Stamp: +LBLFN = Filename: +LBLECU = ECU Revision: +LBLFS = Filesize: +LBLVER = ECU Version: +LBLID = Internal ID: +LBLADDR = ID Storage Address: +LBLMAKE = Make: +LBLMRKT = Market: +LBLTRANS = Transmission: +LBLMDL = Model: +LBLSMDL = Submodel: +LBLYR = Year: +LBLTBLS = Tables (%d): +LBLAUT = Def. Author: +LBLDEFVER = Def. Version: +LBLTBLCNT = Amount Of Tables: \ No newline at end of file diff --git a/i18n/com/romraider/swing/SettingsForm.properties b/i18n/com/romraider/swing/SettingsForm.properties new file mode 100644 index 000000000..f8e207010 --- /dev/null +++ b/i18n/com/romraider/swing/SettingsForm.properties @@ -0,0 +1,63 @@ +CLROVERLAYV = Color of live overlay cell visited +CLROVERLAYLIVE = Color of current live overlay cell +RRDEFAULT = RomRaider Default +ABSS = Airboy's Spreadsheet +CUSTOM = Custom (manually specify formats in settings.xml) +RRSETTINGS = {0} Settings +WARNOOD = Warn me when opening out of date image revision +USNUMBER = Use US English number format (Dot Notation) +WARNREAL = Warn me when real and byte value calculations conflict +DEBUG = Debug mode +CANCEL = Cancel +OK = OK +APPLY = Apply +RESTOREDEF = Restore Defaults +BAKGND = Background +AXIS = Axis Cell: +HLTCELL = Highlighted Cell: +SLTDCELL = Selected Cell: +MINVALUE = Minimum Value: +MAXVALUE = Maximum Value: +WARNING = Warning: +CELLBDR = Cell Borders +INCRSD = Increased: +DECRSD = Decreased: +STLLIVE = Stale Live Value: +CNTLIVE = Current Live Value: +CELLHT = Cell Height: +CELLWD = Cell Width: +FONT = Font: +CHOOSE = Choose +SAVEDEBUG = Save changes made on tables in debug mode +LISTTBLS = List tables that are above my userlevel +WARNUSER = Warn when values exceed limits +CLRAXIS = Color Axis +TABGEN = General +TABTABL = Table Display +TABCLIP = Clipboard +TABICON = Icons +TABSCAL = Scale +SCLHEADER = Scale Headers and Data. +SCLHEADERTT = If checked, the header scale will change when the data scale is selected. Otherwise click on a header row or column to select the scale. +DEFSCALE = Default Scale: +UISETTINGS = UI Settings +ORNE = Open ROM node expanded +STTB = Show table toolbar border +RTS = ROM Tree Settings +AOA00 = Always open tables at [0,0] +CTOT = Click to open tables +SINGLE = Single +DOUBLE = Double +OPENCLOSE = open/close +OPENFOCUS = open/focus +TCB = Table click behavior +ETI = Editor Toolbar Icons +TTI = Table Toolbar Icons +SCALE = Scale: +SCALEPER = The percentage of the icons original size. +BGCOLOR = Background Color +WARNCOLOR = Warning Color +LOCALEMSG = The Editor has been set to use the {0} number format.\n\nExit and restart the Editor to apply the new setting. +LOCALETITLE = Editor Number Format Change +STLABEL = Sort ROM table tree alphabetically +STLABELTT = Unchecked will order tables as per the definition file. Close and reopen ROM after changing. diff --git a/i18n/com/romraider/swing/TableFrame.properties b/i18n/com/romraider/swing/TableFrame.properties new file mode 100644 index 000000000..73252d9a3 --- /dev/null +++ b/i18n/com/romraider/swing/TableFrame.properties @@ -0,0 +1 @@ +TBLPROP = {0} Table Properties diff --git a/i18n/com/romraider/swing/TableMenuBar.properties b/i18n/com/romraider/swing/TableMenuBar.properties new file mode 100644 index 000000000..23cf8b314 --- /dev/null +++ b/i18n/com/romraider/swing/TableMenuBar.properties @@ -0,0 +1,33 @@ +TABLE = Table +VIEWGRAPH = View Graph +COMPARE = Compare +SHOWCHNG = Show Changes +COMPAREMAP = Compare to Another Map +COMPARETBL = Compare to Table +OFF = Off +DISPLAY = Display +PERDIFF = Percent Difference +ABSDIFF = Absolute Difference +COMAPRETO = Compare to +COMPARETOOV = Compare to Original Value +COMPARETOBV = Compare to Bin Value +EDIT = Edit +UNDOCHNGS = Undo Selected Changes +UNDOALL = Undo All Changes +SETREVERT = Set Revert Point +COPYSEL = Copy Selection +COPYTBL = Copy Table +PASTE = Paste +INTERP = Interpolate +VINTERP = Vertical Interpolate +HINTERP = Horizontal Interpolate +VIEW = View +TBLPROP = Table Properties +CLOSETBL = Close Table +CLOSEFRM = Close {0} +TBLPROPTT = Select to view the table properties. +COMPARETT = Compares the current values to the original or revert point values. +COMPARETBLTT = Compares this table and a selected table in another open ROM. +COMPARESIMTT = Compares this table to the same table name in another open ROM. +COMPARETHIS = Compares this table to the selected table's original or revert point values. +COMPARECURRENT = Compares this table to the selected table's current values. diff --git a/i18n/com/romraider/swing/TablePropertyPanel.properties b/i18n/com/romraider/swing/TablePropertyPanel.properties new file mode 100644 index 000000000..ca208b927 --- /dev/null +++ b/i18n/com/romraider/swing/TablePropertyPanel.properties @@ -0,0 +1,15 @@ +LVL1 = Beginner +LVL2 = Intermediate +LVL3 = Advanced +LVL4 = Highest +LVL5 = Debug +TABLE = Table: +CATEGORY = Category: +CONV = Conversions +STORAGE = Storage +STORAGEADDR = Storage Address: +DATATYPE = Data Type: +ENDIAN = Endian: +DESC = Description +USERLVL = User Level: +LOGPARAM = Log Param: diff --git a/i18n/com/romraider/swing/TableToolBar.properties b/i18n/com/romraider/swing/TableToolBar.properties new file mode 100644 index 000000000..8f195cbcc --- /dev/null +++ b/i18n/com/romraider/swing/TableToolBar.properties @@ -0,0 +1,17 @@ +SET = Set +MUL = Mul +OVERLAYLOG = Overlay Log +CLEAROVERLAY = Clear Overlay +INCFTT = Increment Value (Fine) +DECFTT = Decrement Value (Fine) +INCCTT = Increment Value (Coarse) +DECCTT = Decrement Value (Coarse) +RENDERTT = Render data in 3D +SETABSTT = Set Absolute Value +FINEVALUETT = Fine Value Adjustment +COURSEVALUETT = Coarse Value Adjustment +MULTVALUETT = Multiply Value +OVERLAYLOGTT = Enable Overlay of Real Time Log Data +CLEAROVERLAYTT = Clear Log Data Overlay Highlights +CTCTT = Color Table Cells +RTCTT = Refresh Table Compare diff --git a/i18n/com/romraider/swing/menubar/action/AbstractAction.properties b/i18n/com/romraider/swing/menubar/action/AbstractAction.properties new file mode 100644 index 000000000..af66b5516 --- /dev/null +++ b/i18n/com/romraider/swing/menubar/action/AbstractAction.properties @@ -0,0 +1,77 @@ +# AboutAction +ABOUT = About {0} +VERSIONSTR = {0} - Logger\nVersion: {1}\nBuild: {2}\nHome Page: {3}\nLogger Def Version: {4}\nJava: {5} {6} ({7}) + +# GenericPluginMenuAction +PLUGINSETTINGS = {0} Plugin Settings +SELECTPORT = Select COM port: + +# GlobalAdjustmentAction +GAATITLE = Adjust ECU Global Parameters +GAACONFIRM = Do you want to adjust the ECU's Global Timing or Idle RPM values? +GAASUCCESSMSG = ECU global adjustment successful! +GAAERRORMSG = Error performing ECU Global Timing or Idle RPM adjustment.\nCheck the following:\n* Logger has successfully connected to the ECU\n* Correct COM port is selected (if not Openport 2)\n* CAN bus logging mode is disabled\n* Cable is connected properly\n* Ignition is ON\n* Logger definition XML file is up to date\n +GAACANCELMSG = User cancelled ECU global adjustments. + +# LearningTableValuesAction +LTVTITLE = Learning Table Values +LTVINITMSG = To read Learning Table Values the Logger must first initialize with the\n{0}. Press the Restart button to connect with the Logger then try\nreading the Learning Table Values again.\n +LTVINTTITLE = Not Initialized +LTVINTERRUPT = Interrupt Logging to read the Learning Table values? + +# LoadProfileAction +LPASUCCESS = Profile successfully loaded: {0} + +# LogFileLocationAction +LFLAUPDATE = Log file output location successfully updated: {0} + +# LogFileNumberFormatAction +LFNFATITLE = Log File Number Format Change +LFNFAMSG = The Logger has been set to use the {0} number format.\n\nExit and restart the Logger to apply the new setting. + +# LoggerDefinitionLocationAction +LDLASUCCESS = Logger definition location successfully updated: {0} + +# ReadEcuCodesAction +RECADEFERROR = To read diagnostic codes the Logger requires a logger definition\nXML file containing compatible DTC parameter definitions.\nUse the Help menu 'Update Logger Definition' item to\ngo online and download the latest logger definition.\n +RECADEFERRORTITLE = Definition Error +RECANOINIT = To read diagnostic codes the Logger must first initialize with the\n{0}. Press the Restart button to connect with the Logger then\ntry reading the codes again.\n +RECANOINITTITLE = Not Initialized +RECACONFIRM = Do you want to read the {0} diagnostic codes? +RECACONFIRMTITLE = Read {0} diagnostic codes +RECANOCODES = No diagnostic codes set +RECANOCODESTILTE = Read Success +RECAREADERROR = Error reading {0} diagnostic codes.\nCheck the following:\n* Logger has successfully connected to the ECU\n* Correct COM port is selected (if not Openport 2)\n* Cable is connected properly\n* Ignition is ON\n* Logger definition XML file is up to date +RECAREADERRORTITLE = Error Read {0} +RECAREPORTERROR = Error performing {0} codes read + +# ResetEcuAction +REATITLE = Reset {0} +REACONFIM = Do you want to reset the {0}? +REASUCCESS = Reset Successful!\nTurn your ignition OFF and then\nback ON to complete the process. +REAERROR = Error performing {0} reset.\nCheck the following:\n* Correct COM port selected\n* Cable is connected properly\n* Ignition is ON\n* Logger is stopped +REAREPORTERROR = Error performing {0} reset + +# SaveProfileAsAction & SaveProfileAction +SPATITLE = Profile: {0} +SPAMSG = Profile successfully saved: {0} +SPAACONFIRM = {0} already exists! Overwrite? + +# SelectProtocolAction +SPRABTN = Select +SPRATITLE = Communications Settings +SPRACANCEL = Cancel +SPRATRANSPORT = Select the transport to use under the desired protocol to query the target control module +SPRATREE = Protocol and Transport Selection +SPRACONFIRM = Are you sure you want to change the logging protocol? +SPRACONFIRMTITLE = Confirm new selection + +# Lm2MtsPluginMenuAction +LPMAPORT = Select MTS port: +LPMAPORTTITLE = {0} Plugin Settings +LPMANOPORTS = -1 - [ no ports found ] +LPMAPORTS = {0,number,integer} - [ {1}: {2,number,integer} sensors ] + +# IntfKitPluginMenuAction +IPMAMSG = Un-select each updated External Phidget data item on each Data,\nGraph and Dashboard Logger tabs to complete the update.\n\nLogging profiles using the old Phidget settings must be loaded\nand re-saved with the new settings. +IPMAMSGTITLE = Phidget InterfaceKit Settings Applied diff --git a/i18n/com/romraider/swing/util/NumberVerifier.properties b/i18n/com/romraider/swing/util/NumberVerifier.properties new file mode 100644 index 000000000..19edaf677 --- /dev/null +++ b/i18n/com/romraider/swing/util/NumberVerifier.properties @@ -0,0 +1,3 @@ +EMPTY = {0} value cannot be empty. +INVALID = Invalid {0} value entered. +ERROR = Error diff --git a/i18n/com/romraider/swing/util/NumberVerifier_fr_CA.properties b/i18n/com/romraider/swing/util/NumberVerifier_fr_CA.properties new file mode 100644 index 000000000..5dd60f3d8 --- /dev/null +++ b/i18n/com/romraider/swing/util/NumberVerifier_fr_CA.properties @@ -0,0 +1,3 @@ +EMPTY = {0} la valeur ne peut pas être vide. +INVALID = Valeur {0} invalide entrée. +ERROR = Erreur diff --git a/i18n/com/romraider/util/SettingsManager.properties b/i18n/com/romraider/util/SettingsManager.properties new file mode 100644 index 000000000..38a1a910e --- /dev/null +++ b/i18n/com/romraider/util/SettingsManager.properties @@ -0,0 +1,2 @@ +FNF =Settings file not found.\nUsing default settings. +ERROR = Error Loading Settings diff --git a/i18n/com/romraider/xml/ConversionLayer/BMWCodingConversionLayer.properties b/i18n/com/romraider/xml/ConversionLayer/BMWCodingConversionLayer.properties new file mode 100644 index 000000000..2cc541a34 --- /dev/null +++ b/i18n/com/romraider/xml/ConversionLayer/BMWCodingConversionLayer.properties @@ -0,0 +1,5 @@ +MISSINGFILE = Failed to find +ERRORFILE = Failed to open +ERRORFILESTART = Failed to find start of file for +NCSHINT = Are you loading this CXX file from the original SP-Daten structure? +LOADINGWARNING = Warning: The identification procedure for NCS Expert files is auto-generated. This is not always reliable, especially on small files.\nIt is recommended that you select the binary first and load the correct Cxx file. You can then convert it to a RomRaider definition and add the identification manually. diff --git a/i18n/com/romraider/xml/ConversionLayer/XDFConversionLayer.properties b/i18n/com/romraider/xml/ConversionLayer/XDFConversionLayer.properties new file mode 100644 index 000000000..675439b4a --- /dev/null +++ b/i18n/com/romraider/xml/ConversionLayer/XDFConversionLayer.properties @@ -0,0 +1,6 @@ +NOXDFHEADER = XDF file does not have an XDFHEADER element! +NOXDFFORMAT = XDF file does not have an XDFFORMAT element! +ONLYXML = Sorry, only XML XDFs are currently supported! +LOADINGWARNING = Warning: XDF files do not have an identification component. This means this definition will always be chosen if no previous definition is found first.\nIt is recommended to load the binary first and manually select the definition. You can then export it as a RomRaider definition and add the identification component. + + diff --git a/i18n/com/romraider/xml/DOMRomUnmarshaller.properties b/i18n/com/romraider/xml/DOMRomUnmarshaller.properties new file mode 100644 index 000000000..701af78a7 --- /dev/null +++ b/i18n/com/romraider/xml/DOMRomUnmarshaller.properties @@ -0,0 +1 @@ +CREATETABLES = Creating {0} tables ... diff --git a/i18n/com/romraider/xml/DOMSettingsBuilder.properties b/i18n/com/romraider/xml/DOMSettingsBuilder.properties new file mode 100644 index 000000000..4516d8d53 --- /dev/null +++ b/i18n/com/romraider/xml/DOMSettingsBuilder.properties @@ -0,0 +1,8 @@ +SAVEWIN = Saving window settings ... +SAVEFILE = Saving file settings ... +SAVEOPTN = Saving options ... +SAVEDISP = Saving display settings ... +SAVELOGR = Saving logger settings ... +SAVECLIP = Saving table clipboard format settings ... +SAVEICON = Saving icon scale settings ... +WTOF = Writing to file ... diff --git a/jre_warning.html b/jre_warning.html index 7bd579c41..6e4bd7954 100644 --- a/jre_warning.html +++ b/jre_warning.html @@ -1,35 +1,24 @@ - - Java Runtime Warning - - -
-

Java Runtime Warning

+ + Java Runtime Warning + + +
+

Java Runtime Warning

+

64-bit Java detected

-

This application and its installer both require a 32-bit Java Runtime - Environment, even if the operating system is 64-bit.

+

This application requires a 32-bit Java Runtime Environment, even if the operating system is 64-bit.

-

If this installer is run with a 64-bit version of Java, it will not complete - successfully.

+

If RomRaider is run with a 64-bit version of Java, some functions will not work properly.

-

If RomRaider is run with a 64-bit version of Java, it will not function - properly.

+

Please ensure that a 32-bit version of Java with a minimum version of 1.6 is installed.

-

Please ensure that a 32-bit version of Java with a minimum version of 1.6 is - installed.

- -

For further information, please consult the
-RomRaider - Troubleshooting Forum.

- -

To download a 32-bit version of Java, please visit - Java SE Downloads - and choose a x86 JRE for your operating system.

+

For further information, please consult the RomRaider Troubleshooting Forum

It is recommended that you cancel the RomRaider installation now by pressing the Quit button below.

-
- +
+ diff --git a/lib/linux/Graph3d.jar b/lib/common/Graph3d.jar similarity index 100% rename from lib/linux/Graph3d.jar rename to lib/common/Graph3d.jar diff --git a/lib/common/Jama.jar b/lib/common/Jama.jar deleted file mode 100644 index f3cad2778..000000000 Binary files a/lib/common/Jama.jar and /dev/null differ diff --git a/lib/common/RXTXcomm.jar b/lib/common/RXTXcomm.jar deleted file mode 100644 index 84e5f01df..000000000 Binary files a/lib/common/RXTXcomm.jar and /dev/null differ diff --git a/lib/common/cmu_time_awb.jar b/lib/common/cmu_time_awb.jar deleted file mode 100644 index 31f9a1ae2..000000000 Binary files a/lib/common/cmu_time_awb.jar and /dev/null differ diff --git a/lib/common/cmu_us_kal.jar b/lib/common/cmu_us_kal.jar deleted file mode 100644 index 6e0a9208e..000000000 Binary files a/lib/common/cmu_us_kal.jar and /dev/null differ diff --git a/lib/common/cmudict04.jar b/lib/common/cmudict04.jar deleted file mode 100644 index d953ce2f4..000000000 Binary files a/lib/common/cmudict04.jar and /dev/null differ diff --git a/lib/common/cmulex.jar b/lib/common/cmulex.jar deleted file mode 100644 index 88b3ccd05..000000000 Binary files a/lib/common/cmulex.jar and /dev/null differ diff --git a/lib/common/cmutimelex.jar b/lib/common/cmutimelex.jar deleted file mode 100644 index 9a2fbf568..000000000 Binary files a/lib/common/cmutimelex.jar and /dev/null differ diff --git a/lib/common/com4j-amd64.dll b/lib/common/com4j-amd64.dll new file mode 100644 index 000000000..e582d77dd Binary files /dev/null and b/lib/common/com4j-amd64.dll differ diff --git a/lib/common/en_us.jar b/lib/common/en_us.jar deleted file mode 100644 index 470a51f77..000000000 Binary files a/lib/common/en_us.jar and /dev/null differ diff --git a/lib/common/freetts.jar b/lib/common/freetts.jar deleted file mode 100644 index 5a4660eef..000000000 Binary files a/lib/common/freetts.jar and /dev/null differ diff --git a/lib/linux/j3dcore.jar b/lib/common/j3dcore.jar similarity index 100% rename from lib/linux/j3dcore.jar rename to lib/common/j3dcore.jar diff --git a/lib/linux/j3dutils.jar b/lib/common/j3dutils.jar similarity index 100% rename from lib/linux/j3dutils.jar rename to lib/common/j3dutils.jar diff --git a/lib/common/jSerialComm-2.9.1.jar b/lib/common/jSerialComm-2.9.1.jar new file mode 100644 index 000000000..ec3d0b0c2 Binary files /dev/null and b/lib/common/jSerialComm-2.9.1.jar differ diff --git a/lib/common/jdic.jar b/lib/common/jdic.jar deleted file mode 100644 index c1773fe2f..000000000 Binary files a/lib/common/jdic.jar and /dev/null differ diff --git a/lib/common/swing-layout-1.0.jar b/lib/common/swing-layout-1.0.jar deleted file mode 100644 index 50f159011..000000000 Binary files a/lib/common/swing-layout-1.0.jar and /dev/null differ diff --git a/lib/linux/vecmath.jar b/lib/common/vecmath.jar similarity index 100% rename from lib/linux/vecmath.jar rename to lib/common/vecmath.jar diff --git a/lib/linux/32/j2534.so b/lib/linux/32/j2534.so new file mode 100644 index 000000000..c510044fd Binary files /dev/null and b/lib/linux/32/j2534.so differ diff --git a/lib/linux/libj3dcore-ogl-cg.so b/lib/linux/32/libj3dcore-ogl-cg.so similarity index 100% rename from lib/linux/libj3dcore-ogl-cg.so rename to lib/linux/32/libj3dcore-ogl-cg.so diff --git a/lib/linux/libj3dcore-ogl.so b/lib/linux/32/libj3dcore-ogl.so similarity index 100% rename from lib/linux/libj3dcore-ogl.so rename to lib/linux/32/libj3dcore-ogl.so diff --git a/lib/linux/libphidget21.so b/lib/linux/32/libphidget21.so similarity index 100% rename from lib/linux/libphidget21.so rename to lib/linux/32/libphidget21.so diff --git a/lib/linux/64/j2534.so b/lib/linux/64/j2534.so new file mode 100644 index 000000000..ecf81326e Binary files /dev/null and b/lib/linux/64/j2534.so differ diff --git a/lib/linux/64/libj3dcore-ogl.so b/lib/linux/64/libj3dcore-ogl.so new file mode 100644 index 000000000..a0ac8c873 Binary files /dev/null and b/lib/linux/64/libj3dcore-ogl.so differ diff --git a/lib/linux/64/libphidget21.so b/lib/linux/64/libphidget21.so new file mode 100644 index 000000000..052cdf4f9 Binary files /dev/null and b/lib/linux/64/libphidget21.so differ diff --git a/lib/linux/jdic_stub.jar b/lib/linux/jdic_stub.jar deleted file mode 100644 index 11f324359..000000000 Binary files a/lib/linux/jdic_stub.jar and /dev/null differ diff --git a/lib/linux/libjdic.so b/lib/linux/libjdic.so deleted file mode 100644 index 547d4417e..000000000 Binary files a/lib/linux/libjdic.so and /dev/null differ diff --git a/lib/linux/libmozembed-linux-gtk1.2.so b/lib/linux/libmozembed-linux-gtk1.2.so deleted file mode 100644 index 26f7c78be..000000000 Binary files a/lib/linux/libmozembed-linux-gtk1.2.so and /dev/null differ diff --git a/lib/linux/libmozembed-linux-gtk2.so b/lib/linux/libmozembed-linux-gtk2.so deleted file mode 100644 index 8414010bc..000000000 Binary files a/lib/linux/libmozembed-linux-gtk2.so and /dev/null differ diff --git a/lib/linux/librxtxSerial.so b/lib/linux/librxtxSerial.so deleted file mode 100644 index e60c5e674..000000000 Binary files a/lib/linux/librxtxSerial.so and /dev/null differ diff --git a/lib/linux/libtray.so b/lib/linux/libtray.so deleted file mode 100644 index ba03deaf9..000000000 Binary files a/lib/linux/libtray.so and /dev/null differ diff --git a/lib/linux/mozembed-linux-gtk1.2 b/lib/linux/mozembed-linux-gtk1.2 deleted file mode 100644 index 9e8a7b02d..000000000 Binary files a/lib/linux/mozembed-linux-gtk1.2 and /dev/null differ diff --git a/lib/linux/mozembed-linux-gtk2 b/lib/linux/mozembed-linux-gtk2 deleted file mode 100644 index eb3e5835b..000000000 Binary files a/lib/linux/mozembed-linux-gtk2 and /dev/null differ diff --git a/lib/log4j.properties b/lib/log4j.properties new file mode 100644 index 000000000..78872c7cb --- /dev/null +++ b/lib/log4j.properties @@ -0,0 +1,11 @@ +log4j.rootLogger=info, stdout, file + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%t] - %m%n + +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=${user.home}/.RomRaider/rr_system.log +log4j.appender.file.MaxBackupIndex=1 +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%t] - %m%n \ No newline at end of file diff --git a/lib/testing/hamcrest.jar b/lib/testing/hamcrest.jar new file mode 100644 index 000000000..71065788d Binary files /dev/null and b/lib/testing/hamcrest.jar differ diff --git a/lib/testing/junit.jar b/lib/testing/junit.jar new file mode 100644 index 000000000..3a7fc266c Binary files /dev/null and b/lib/testing/junit.jar differ diff --git a/lib/windows/j3dcore-d3d.dll b/lib/windows/32/j3dcore-d3d.dll similarity index 100% rename from lib/windows/j3dcore-d3d.dll rename to lib/windows/32/j3dcore-d3d.dll diff --git a/lib/windows/j3dcore-ogl-cg.dll b/lib/windows/32/j3dcore-ogl-cg.dll similarity index 100% rename from lib/windows/j3dcore-ogl-cg.dll rename to lib/windows/32/j3dcore-ogl-cg.dll diff --git a/lib/windows/j3dcore-ogl-chk.dll b/lib/windows/32/j3dcore-ogl-chk.dll similarity index 100% rename from lib/windows/j3dcore-ogl-chk.dll rename to lib/windows/32/j3dcore-ogl-chk.dll diff --git a/lib/windows/j3dcore-ogl.dll b/lib/windows/32/j3dcore-ogl.dll similarity index 100% rename from lib/windows/j3dcore-ogl.dll rename to lib/windows/32/j3dcore-ogl.dll diff --git a/lib/windows/phidget21.dll b/lib/windows/32/phidget21.dll similarity index 100% rename from lib/windows/phidget21.dll rename to lib/windows/32/phidget21.dll diff --git a/lib/windows/64/j3dcore-ogl.dll b/lib/windows/64/j3dcore-ogl.dll new file mode 100644 index 000000000..2afec5f94 Binary files /dev/null and b/lib/windows/64/j3dcore-ogl.dll differ diff --git a/lib/windows/64/phidget21.dll b/lib/windows/64/phidget21.dll new file mode 100644 index 000000000..935a1d7e3 Binary files /dev/null and b/lib/windows/64/phidget21.dll differ diff --git a/lib/windows/Graph3d.jar b/lib/windows/Graph3d.jar deleted file mode 100644 index b78cefa9e..000000000 Binary files a/lib/windows/Graph3d.jar and /dev/null differ diff --git a/lib/windows/IeEmbed.exe b/lib/windows/IeEmbed.exe deleted file mode 100644 index dc7be69e6..000000000 Binary files a/lib/windows/IeEmbed.exe and /dev/null differ diff --git a/lib/windows/MozEmbed.exe b/lib/windows/MozEmbed.exe deleted file mode 100644 index ee2568f82..000000000 Binary files a/lib/windows/MozEmbed.exe and /dev/null differ diff --git a/lib/windows/j3dcore.jar b/lib/windows/j3dcore.jar deleted file mode 100644 index f28c75445..000000000 Binary files a/lib/windows/j3dcore.jar and /dev/null differ diff --git a/lib/windows/j3dutils.jar b/lib/windows/j3dutils.jar deleted file mode 100644 index 90201b3ec..000000000 Binary files a/lib/windows/j3dutils.jar and /dev/null differ diff --git a/lib/windows/jdic.dll b/lib/windows/jdic.dll deleted file mode 100644 index 634903662..000000000 Binary files a/lib/windows/jdic.dll and /dev/null differ diff --git a/lib/windows/jdic_stub.jar b/lib/windows/jdic_stub.jar deleted file mode 100644 index 0afd2f468..000000000 Binary files a/lib/windows/jdic_stub.jar and /dev/null differ diff --git a/lib/windows/rxtxSerial.dll b/lib/windows/rxtxSerial.dll deleted file mode 100644 index c0e6b5822..000000000 Binary files a/lib/windows/rxtxSerial.dll and /dev/null differ diff --git a/lib/windows/tray.dll b/lib/windows/tray.dll deleted file mode 100644 index 33175ac5f..000000000 Binary files a/lib/windows/tray.dll and /dev/null differ diff --git a/lib/windows/vecmath.jar b/lib/windows/vecmath.jar deleted file mode 100644 index 3eda5f9e9..000000000 Binary files a/lib/windows/vecmath.jar and /dev/null differ diff --git a/log4j.properties b/log4j.properties deleted file mode 100644 index d917be2ab..000000000 --- a/log4j.properties +++ /dev/null @@ -1,12 +0,0 @@ -log4j.rootLogger=info, stdout, file - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%-5r %-5p [%t] - %m%n - -log4j.appender.file=org.apache.log4j.RollingFileAppender -log4j.appender.file.File=${user.home}/.RomRaider/rr_system.log -log4j.appender.file.MaxBackupIndex=1 -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%-5r %-5p [%t] - %m%n - diff --git a/logger.dtd b/logger.dtd deleted file mode 100644 index 9c4c4c892..000000000 --- a/logger.dtd +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/manifest b/manifest deleted file mode 100644 index c3acd77e5..000000000 --- a/manifest +++ /dev/null @@ -1,30 +0,0 @@ -Manifest-Version: 1.0 -Ant-Version: Apache Ant 1.6.5 -Created-By: 1.5.0_07-b03 (Sun Microsystems Inc.) -Main-Class: com.romraider.ECUExec -Class-Path: - lib/BareBonesBrowserLaunch.jar - lib/jep.jar - lib/log4j-1.2.14.jar - lib/Jama.jar - lib/jamlab.jar - lib/swing-layout-1.0.jar - lib/jcommon-1.0.12.jar - lib/jfreechart-1.0.9.jar - lib/jinvoke-3.0.3.jar - lib/RXTXcomm.jar - lib/jdic.jar - lib/jama-1.0.2.jar - lib/Graph3d.jar - lib/j3dcore.jar - lib/j3dutils.jar - lib/vecmath.jar - lib/swing-layout-1.0.jar - lib/jdic_stub.jar - lib/log4j-1.2.14.jar - lib/cmu_time_awb.jar - lib/cmu_us_kal.jar - lib/cmutimelex.jar - lib/en_us.jar - lib/freetts.jar -X-COMMENT: Main-Class will be added automatically by build \ No newline at end of file diff --git a/plugins/apsx.plugin b/plugins/apsx.plugin new file mode 100644 index 000000000..3f6e6cea0 --- /dev/null +++ b/plugins/apsx.plugin @@ -0,0 +1,5 @@ +datasource.class=com.romraider.logger.external.apsx.plugin.ApsxDataSource +datasource.baudrate=9600 +datasource.databits=8 +datasource.parity=0 +datasource.stopbits=1 diff --git a/plugins/ecotrons.plugin b/plugins/ecotrons.plugin new file mode 100644 index 000000000..1d065bb15 --- /dev/null +++ b/plugins/ecotrons.plugin @@ -0,0 +1 @@ +datasource.class=com.romraider.logger.external.ecotrons.plugin.AlmDataSource \ No newline at end of file diff --git a/plugins/lm2_mts.plugin b/plugins/lm2_mts.plugin index 7dcedb9e8..03c7db8fb 100644 --- a/plugins/lm2_mts.plugin +++ b/plugins/lm2_mts.plugin @@ -1 +1,2 @@ -datasource.class=com.romraider.logger.external.innovate.lm2.mts.plugin.Lm2MtsDataSource \ No newline at end of file +datasource.class=com.romraider.logger.external.innovate.lm2.mts.plugin.Lm2MtsDataSource +datasource.pollmode=true \ No newline at end of file diff --git a/release_notes.txt b/release_notes.txt index 60d49aac4..5f4c41385 100644 --- a/release_notes.txt +++ b/release_notes.txt @@ -1,5 +1,5 @@ - - RomRaider 0.5.8 RC1 - - Open-Source ECU Tuning -- www.romraider.com + - RomRaider 1.1.0 NOV26 2025 - + Open-Source ECU Tuning and Logging -- www.romraider.com PLEASE MAKE SURE TO READ RELEASE _NOTES.TXT_ EACH TIME YOU DOWNLOAD @@ -33,21 +33,21 @@ RomRaider is still in beta status and changing frequently, documentation may be incomplete or out of date. -------------------------------------------- -- 0.5.8 RC1 Notes (05/31/2014) - +- 1.1.0 NOV26 2025 Notes (2025-11-26) - -------------------------------------------- -This is the latest release of the RomRaider from the GitHub repo: +This is the latest release of RomRaider from the GitHub repo: https://github.com/RomRaider/RomRaider -------------------------------------- -- 0.5.8 RC1 Known Issues - +- 1.1.0 NOV26 2025 Known Issues - -------------------------------------- - Logger - Gauge min/max/step limits incomplete in logger.xml - ECU connections under Linux are flaky (start the logger after you've started the engine) - Update latency via injector tab broken for some models (eg. 2007 2.5i) - - Switching between SSM and OBD protocol mode may not update the parameter - list completely. A Logger restart will update the list correctly. + - Switching between SSM, OBD, DS2 and NCS protocol mode may not update the + parameter list completely. A Logger restart will update the list correctly. Status of these items and more can be viewed at: https://github.com/RomRaider/RomRaider/issues?labels=bug&state=open @@ -55,6 +55,277 @@ Status of these items and more can be viewed at: - Change Log - -------------- +1.1.0 NOV26 2025 Notes (2025-11-26) +---------------------------------- + +- Editor + - Add table name filter box + - Add Drag & Drop Support to open ROM file + - Live data view, use closest cell for highlight + - Fix #241 Dataflow interpolation bug + - XDF Conversion, detect offset as hex or decimal value + - Hex utility, added ability to parse negative hex numbers + - Improve Checksum Fix processing + +- Logger + - Hex utility, added ability to parse negative hex numbers + - Add missing M42 VANOS query group + +- Docs + - Update SSM info, fix spelling errors and formatting, include information + about Continuous/Fast polling + - Update the VSCode doc for recent setup on windows + + +1.0.0 DEC01 2023 Notes (12/01/2023) +---------------------------------- + +- Editor + - Updates parent table when scale is changed in 1D tables + - Fix table sizing bug and add xdfconstant support + - Fix table opening bug, Fix Table1D axis label bug; Fix double loaded documents; Improve XDF support + - Add JDF/VDF conversion layer + - Add shortcut for raw scale, Add number of checksums in status bar + - Add DTCs + - Fix VDF scaling name error; Fix save definition bug + - Add alpha version of dataflow simulation + - Improve rendering performance; Dataflow bugfixes + +- Logger + - Fix issue #217, serial RTS for Openport 1.x cables + + +0.9.4 MAY23 2022 Notes (05/23/2022) +---------------------------------- + +- Editor + - Fix issue #192, table display with modified axis length + + +0.9.3 MAY20 2022 Notes (05/20/2022) +---------------------------------- + +- Editor + - Add ROM tree sorting option + - Fix GUI refresh on User level change + - Screen Editor definition files + - Display User level warning for Switch tables + + +0.9.2 MAY07 2022 Notes (05/07/2022) +---------------------------------- + +Prepare to support Java 6 thru 11 +Remove unneeded libraries +Prepare for limited 64bit Java support + +- Editor + - More performance improvements + - XDF definition support + - Improve Bitwise Switch map support + - Fix compare images + - Fix Nissan checksum issue #184 + +- Logger + - J2534 library cleanup, better support for Linux J2534 + - Replace RXTXcomm with JSerialComm + + +0.9.1 APR26 2022 Notes (04/26/2022) +---------------------------------- + +Prepare to support Java 6 thru 11 +Remove unneeded libraries +Prepare for limited 64bit Java support + +- Editor + - More performance improvements + - XDF definition support + - Improve Bitwise Switch map support + - Fix compare images + +- Logger + - J2534 library cleanup, better support for Linux J2534 + - Replace RXTXcomm with JSerialComm + + +0.9.0 APR18 2022 Notes (04/18/2022) +---------------------------------- + +Prepare to support Java 6 thru 11 +Remove unneeded libraries +Prepare for limited 64bit Java support + +- Editor + - More performance improvements + - XDF definition support + - Improve Bitwise Switch map support + +- Logger + - J2534 library cleanup, better support for Linux J2534 + - Replace RXTXcomm with JSerialComm + + +0.8.2 DEC04 2021 (12/04/2020) +---------------------------------- + +- Editor + - Restored Definition Manager directory filter + + +0.8.1 NOV27 2021 (11/27/2020) +---------------------------------- + +- Logger + - Logger fails to connect when the computer has no COM ports defined + +- Editor + - Restored Logger launch menu item + + +0.8.0 NOV14 2021 (11/14/2020) +---------------------------------- + +- Logger + - Nissan CAN Logger implementation + - Fixed dyno locale problem + - Fixed timestamps, dyno def warning, NaN loading, null pointer exceptions + - Refined NCS protocol processing in prep for NCS CAN logging, NCS ECU ID is now 6-bytes + +- Editor + - Fixed copy paste issue and reversed copying + - Performance improvement + - Changed Bosch axis layout to dataLayout='bosch_subtract' + - Implemented subcategories with // + - Editor redesign + - Added Bosch axis layout + - Enabled xml parser to use xinclude + - Corrections to ALT2 16-bit checksum after code tests + - Expand NCS ECU ID to 6 bytes + - Adjust RomServer socket number, fix for issue #88 + + +0.7.2 NOV11 2020 (11/11/2020) +---------------------------------- + +- Logger + - Fix reversed colours in LTV + + +0.7.1 AUG16 2020 (08/06/2020) +---------------------------------- + +- Logger + - Added missing locale translation entries + - Fix ECU/TCU relabelling of ECU ID in Logger GUI + + +0.7.0 MAY28 2020 (05/28/2020) +---------------------------------- + +- Logger + - (GTO2013) Refine support for ELM327 based cables + - DS2 protocol now supports "Telegram", logging arbitrary addresses, + requires a new logger definition v352 or later to take advantage of this mode + + +0.6.1 APR25 2020 (04/25/2020) +---------------------------------- + +- Editor + - Fix TableBitwiseSwitch not populating, issue #100 + +- Logger + - (GTO2013) Add initial support for ELM327 based cables for CAN bus, PR #99 + + +0.6.0 APR6 2020 (04/06/2020) +---------------------------------- + +RomRaider GUI is now ready for translation. +Visit https://github.com/RomRaider/RomRaider/wiki/GUI-Translation to see the +guide. + - All GUI text moved to resource bundle property files under i18n + +- Editor + - Change RomServer TCP port, issue #88 + - (GTO2013) Save Fine Course Values when Switching Tables, issue #61 + - (GTO2013) Implemented Maskable and Switchable 2D Tables + - (stirkac) Added bitwise map editing + - Expand MS42 address range, fix for issue RomRaider#90 + - Implement overlay enhancement to highlight current cell, issue #71 + - Added support for values encoded in SH-2A MOVI20 instruction + +- Logger + - Added Nissan logging support via J2534 cable using K-line + - Update Dyno tab to support different Throttle parameters + - Create SSM Learning table properties file + - Add the ability to read table names from properties file + - Enable a warning panel when a 64-bit JRE is detected + - Split SSM LTV queries into two sets to fix issue #72 + - Change LM2 MTS plugin to poll mode by default + - Fix Learning Tables View showing incorrect table axis values: issue#67 + + +0.5.9 RC3 (09/28/2016) +---------------------------------- + +- Editor + - Corrected a number of minor bugs with table copy/paste and overlay logging + - Enhanced table copy for non-contiguous cells and copy of overlay values if active + - Other optimizations to reduce ROM load time + + +0.5.9 RC2 (04/29/2015) +---------------------------------- + +- Logger + - Changed the way the Logger definition update or protocol change is handled + + +0.5.9 RC1 (04/21/2015) +---------------------------------- + +- Editor + - Implement a global endian attribute in ECU definitions + overriding table specific endian settings + - Rename SSM menu item as the Test App is no longer SSM specific + - Allow user to specific read block size in Editor Test App + - Fix for RomTree expand/collapse issue + - Fix for reversed min/max table colours + - Fix for table 3D view min/max ranges + - Changed Settings file search order for better portability, starting directory + is searched before user's home + - Added a missing ECU definition file Dialog to warn user to correct + - Added a catch-all exception notification branch + - Fix for category node open issue, Double click on node causes the node to + open and then close + - Changed code to use true Linear Interpolation rather than even cell distance + distribution + - Added warning log when a static table contains a storageType != 0 + - Added ability to parse and save the static table data if the storageType != 0 + +- Logger + - Add -logger.touch to make the Logger UI more 'touch' friendly + - BMW DS2 protocol implementation for MS41, MS42 and MS43 DME + - Implement DS2 Learning (Adaptation) Table Values read functionality + - Added DS2 adaptation reset tool + - Group individual DS2 ECU queries into a single memory read start address + and length query + - Add APSX D1|D2 Wideband O2 Externals Plugin + - Added support for the ECOTRONS ALM wideband O2 controller + - Allow setting event mode or polled mode in the lm2_mts.plugin Properties file + - Implement endian processing in the data converter defined in logger definition + - Update Logger definition DTD for new elements of DS2 protocol + - Added new protocol selection menu populated with all the protocols defined + in the Logger definition file + - Add protocol to query status message display + - Add support to use Linux Openport 2.0 library if available + - Add serial data bit and parity configuration setting items + - Added a new BitWise Logger converter to process bits in query results, see + Java source file for usage details com/romraider/util/BitWise.java + + 0.5.8 RC1 (05/31/2014) ---------------------------------- @@ -85,7 +356,7 @@ Status of these items and more can be viewed at: - Added support for additional Checksum validation/corrections found in BRZ ROMs - Removed BareBonesBrowser library, now uses existing class - Updated Java 3D libraries to version 1.5.2 - + - Logger - Fixed Learning Table Values international character support - Added support for PLX SM-AFR Gen 3 @@ -94,7 +365,6 @@ Status of these items and more can be viewed at: - Add protocol attribute to user Logging Profiles to indicate OBD and SSM profiles - 0.5.7 RC2 (08/28/2013) ---------------------------------- @@ -143,7 +413,7 @@ Operational Notes - The use of ISO15765 requires a J2534 compliant cable. Since the J2534 specification only defines Windows 32bit systems as a valid platform, Linux systems are not officially supported. When/if a Linux J2534 driver - becomes available then support can be enabled for non-Windows platforms. + becomes available then support can be enabled for non-Windows platforms. 0.5.6 RC6 (03/24/2013) @@ -163,7 +433,7 @@ Operational Notes - fix for issue #4 (multiple Query Managers could be started) - update 'Log to file' button to switch between 'Start/Stop' in the label - add a rudimentary test app to read some OBD-II parameters [*4] - - reformat (shorten) display of Profile and log file names in Logger title bar + - reformat (shorten) display of Profile and log file names in Logger title bar - Application Installer - added a Java 64bit VM check and warning during installation: by lizzardo [*1] @@ -183,7 +453,7 @@ Notes [3] - The use of ISO15765 requires a J2534 compliant cable. Since the J2534 specification only defines Windows 32bit systems as a valid platform, Linux systems are not officially supported. When/if a Linux J2534 driver - becomes available then support can be enabled for non-Windows platforms. + becomes available then support can be enabled for non-Windows platforms. [4] - This rudimentary test app ONLY works with J2534 compliant cables and ONLY supports the ISO15765 protocol. It can currently read out the vehicle information and any active DTCs. The app can only be started from a @@ -356,13 +626,13 @@ Application Installer - Moved settings.xml & profile_backup.xml to the /.RomRaider/ directory under the users home directory. - Added support to reset the TCU. The reset target is selected via the action bar - Checkbox items ECU or TCU just like logging. + Checkbox items ECU or TCU just like logging. --- Editor --- - Set JInternalFrame.isPalette in TableFarme.java so table titles are visible on Mac OS. - Added a Checksum recalculation option when saving ROM images that have a bad Checksum (re: Diesel ROMs seem to have an invalid fifth Checksum) - + 0.5.3b RC10 (09/12/2011) ------------------------ diff --git a/run.bat b/run.bat deleted file mode 100644 index 5906f85c4..000000000 --- a/run.bat +++ /dev/null @@ -1,9 +0,0 @@ -:: Uncomment the line for the mode you wish to run. Comment all other lines. -:: Adjust path to javaw.exe as required for your Java system installation -rem start javaw -Djava.library.path=lib/windows -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=true -Xms64M -Xmx512M -jar RomRaider.jar 1>>"%HOMEPATH%\.RomRaider\romraider_sout.log" 2>&1 -:: Start Editor -start javaw.exe -Djava.library.path=lib/windows -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=true -Xms64M -Xmx512M -jar RomRaider.jar -:: Start Logger in full screen mode -rem start javaw -Djava.library.path=lib/windows -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=true -Xms64M -Xmx512M -jar RomRaider.jar -logger.fullscreen -:: Start Logger -rem start javaw -Djava.library.path=lib/windows -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=true -Xms64M -Xmx512M -jar RomRaider.jar -logger diff --git a/run.sh b/run.sh deleted file mode 100755 index bf1d68dfe..000000000 --- a/run.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# To change your ZIP install startup preference, uncomment the preferred line. -# Make sure only one line is uncommented -# Java is expected to be available on your PATH - -java -Djava.library.path=lib/linux -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms64M -Xmx512M -XX:-UseParallelGC -XX:CompileThreshold=10000 -jar RomRaider.jar >> "$HOME/.RomRaider/romraider_sout.log" 2>&1 -#java -Djava.library.path=lib/linux -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms64M -Xmx512M -XX:-UseParallelGC -XX:CompileThreshold=10000 -jar RomRaider.jar -logger >> "$HOME/.RomRaider/romraider_sout.log" 2>&1 -#java -Djava.library.path=lib/linux -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms64M -Xmx512M -XX:-UseParallelGC -XX:CompileThreshold=10000 -jar RomRaider.jar -logger.fullscreen >> "$HOME/.RomRaider/romraider_sout.log" 2>&1 - -exit 0 diff --git a/post-install-tasks.bat b/scripts/post-install-tasks.bat similarity index 100% rename from post-install-tasks.bat rename to scripts/post-install-tasks.bat diff --git a/post-install-tasks.sh b/scripts/post-install-tasks.sh similarity index 100% rename from post-install-tasks.sh rename to scripts/post-install-tasks.sh diff --git a/scripts/run.bat b/scripts/run.bat new file mode 100644 index 000000000..60519015d --- /dev/null +++ b/scripts/run.bat @@ -0,0 +1,22 @@ +@echo off +:: Uncomment the line for the mode you wish to run. Comment all other lines. +:: Adjust java_path to javaw.exe as required for your Java system installation, +:: or if you wish to run RomRaider on a different version of Java. +:: Note: an installation specific settings.xml file can be saved to the same +:: directory as this run.bat to keep it separate from an installed version of +:: RomRaider. +:: If the path has spaces in it make sure it is within the quotes of java_path. +:: End the path with a \ directory separator. +set "java_path=" + +:: Start Editor with console redirected to %HOMEPATH%\.RomRaider\romraider_sout.log +start "Editor" /NORMAL "%java_path%javaw.exe" -Djava.library.path=lib/windows/32 -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=true -Xms64M -Xmx512M -jar RomRaider.jar + +:: Start Logger +rem start "Logger" /NORMAL "%java_path%javaw.exe" -Djava.library.path=lib/windows/32 -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=true -Xms64M -Xmx512M -jar RomRaider.jar -logger 1>>"%HOMEPATH%\.RomRaider\romraider_sout.log" 2>&1 + +:: Start Logger in full screen mode +rem start "Logger Full Screen" /NORMAL "%java_path%javaw.exe" -Djava.library.path=lib/windows/32 -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=true -Xms64M -Xmx512M -jar RomRaider.jar -logger.fullscreen 1>>"%HOMEPATH%\.RomRaider\romraider_sout.log" 2>&1 + +:: Start Logger in Touch screen mode +rem start "Logger Touch Screen" /NORMAL "%java_path%javaw.exe" -Djava.library.path=lib/windows/32 -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=true -Xms64M -Xmx512M -jar RomRaider.jar -logger.touch 1>>"%HOMEPATH%\.RomRaider\romraider_sout.log" 2>&1 diff --git a/scripts/run.sh b/scripts/run.sh new file mode 100755 index 000000000..3cafb8019 --- /dev/null +++ b/scripts/run.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# To change your ZIP install startup preference, uncomment the preferred line. +# Make sure only one line is uncommented +# Java is expected to be available on your PATH + +java -Djava.library.path=lib/linux/32 -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms64M -Xmx512M -XX:-UseParallelGC -XX:CompileThreshold=10000 -jar RomRaider.jar >> "$HOME/.RomRaider/romraider_sout.log" 2>&1 +#java -Djava.library.path=lib/linux/32 -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms64M -Xmx512M -XX:-UseParallelGC -XX:CompileThreshold=10000 -jar RomRaider.jar -logger >> "$HOME/.RomRaider/romraider_sout.log" 2>&1 +#java -Djava.library.path=lib/linux/32 -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms64M -Xmx512M -XX:-UseParallelGC -XX:CompileThreshold=10000 -jar RomRaider.jar -logger.fullscreen >> "$HOME/.RomRaider/romraider_sout.log" 2>&1 +#java -Djava.library.path=lib/linux/32 -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms64M -Xmx512M -XX:-UseParallelGC -XX:CompileThreshold=10000 -jar RomRaider.jar -logger.touch >> "$HOME/.RomRaider/romraider_sout.log" 2>&1 + +exit 0 \ No newline at end of file diff --git a/src/main/java/com/romraider/ECUExec.java b/src/main/java/com/romraider/ECUExec.java index ee9f47980..45cde25d0 100644 --- a/src/main/java/com/romraider/ECUExec.java +++ b/src/main/java/com/romraider/ECUExec.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,62 +19,73 @@ package com.romraider; +import static com.romraider.Settings.COMMA; import static com.romraider.Version.BUILDNUMBER; import static com.romraider.Version.PRODUCT_NAME; import static com.romraider.Version.SUPPORT_URL; import static com.romraider.Version.VERSION; -import static com.romraider.editor.ecu.ECUEditorManager.getECUEditor; +import static com.romraider.editor.ecu.ECUEditorManager.*; import static com.romraider.logger.ecu.EcuLogger.startLogger; import static com.romraider.swing.LookAndFeelManager.initLookAndFeel; import static com.romraider.util.LogManager.initDebugLogging; -import static com.romraider.util.RomServer.isRunning; -import static com.romraider.util.RomServer.sendRomToOpenInstance; -import static com.romraider.util.RomServer.waitForRom; +import static com.romraider.EditorLoggerCommunication.*; import static javax.swing.JOptionPane.INFORMATION_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.showMessageDialog; -import static javax.swing.SwingUtilities.invokeLater; -import static javax.swing.WindowConstants.EXIT_ON_CLOSE; +import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE; import static org.apache.log4j.Logger.getLogger; -import java.io.File; +import java.io.IOException; import java.text.DateFormat; +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.ResourceBundle; import org.apache.log4j.Logger; import com.romraider.editor.ecu.ECUEditor; -import com.romraider.util.JREChecker; +import com.romraider.editor.ecu.ECUEditorManager; +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.util.ResourceUtil; public class ECUExec { private static final Logger LOGGER = getLogger(ECUExec.class); private static final String START_LOGGER_ARG = "-logger"; private static final String START_LOGGER_FULLSCREEN_ARG = "-logger.fullscreen"; + private static final String LOGGER_TOUCH_ARG = "-logger.touch"; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + ECUExec.class.getName()); private ECUExec() { throw new UnsupportedOperationException(); } public static void main(String args[]) { + // init i18n resources + if (rb == null) return; // init debug logging initDebugLogging(); // dump the system properties to the log file as early as practical to // help debugging/support LOGGER.info(PRODUCT_NAME + " " + VERSION + " Build: " + BUILDNUMBER); - LOGGER.info("When requesting assistance at " + SUPPORT_URL + " please include the System Properties information below:"); - LOGGER.info(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.LONG).format(System.currentTimeMillis())); + LOGGER.info(MessageFormat.format(rb.getString("SUPPORT"), SUPPORT_URL)); + LOGGER.info(DateFormat.getDateTimeInstance( + DateFormat.FULL, + DateFormat.LONG).format(System.currentTimeMillis())); LOGGER.info("System Properties: \n\t" - + System.getProperties().toString().replace(",", "\n\t")); + + System.getProperties().toString().replace(COMMA, "\n\t")); - // 64-bit won't work with the native libs (e.g. serial rxtx) but won't - // fail until we actually try to use them we'll just warn here - if (!JREChecker.is32bit() && + /** + * Bitness of supporting libraries must match the bitness of RomRaider + * and the running JRE. Notify if mixed bitness is detected. + */ + if (!System.getProperty("sun.arch.data.model").equals(Version.BUILD_ARCH) && !containsLoggerArg(args)) { showMessageDialog(null, - "Incompatible JRE detected.\n" + - PRODUCT_NAME + - " requires a 32-bit JRE for some operations.\nSome features may be unavailable.", - "JRE Incompatibility Warning", - WARNING_MESSAGE); + MessageFormat.format( + rb.getString("COMPATJRE"), PRODUCT_NAME, Version.BUILD_ARCH), + rb.getString("JREWARN"), + WARNING_MESSAGE); } // check for dodgy threading - dev only @@ -82,74 +93,93 @@ public static void main(String args[]) { // set look and feel initLookAndFeel(); + setExecType(args); // check if already running if (isRunning()) { - if (args.length == 0 || containsLoggerArg(args)) { - showAlreadyRunningMessage(); - } else { - sendRomToOpenInstance(args[0]); - } + // The other executable will open us, close this app + EditorLoggerCommunication.sendTypeToOtherExec(args); } else { // open editor or logger if (containsLoggerArg(args)) { - openLogger(args); + openLogger(DISPOSE_ON_CLOSE, args); } else { - openEditor(args); + openEditor(DISPOSE_ON_CLOSE, args); } + + startExecCommunication(); } } - private static void showAlreadyRunningMessage() { - showMessageDialog(null, PRODUCT_NAME + " is already running.", PRODUCT_NAME, INFORMATION_MESSAGE); + private static void setExecType(String[] args) { + Exec_type execType = containsLoggerArg(args) ? Exec_type.LOGGER : Exec_type.EDITOR; + EditorLoggerCommunication.setExectable(execType, args); + } + + public static void showAlreadyRunningMessage() { + showMessageDialog(null, + MessageFormat.format(rb.getString("ISRUNNING"), PRODUCT_NAME), + PRODUCT_NAME, INFORMATION_MESSAGE); } private static boolean containsLoggerArg(String[] args) { for (String arg : args) { - if (arg.equalsIgnoreCase(START_LOGGER_ARG) || arg.equalsIgnoreCase(START_LOGGER_FULLSCREEN_ARG)) { + if ( arg.equalsIgnoreCase(START_LOGGER_ARG) || + arg.equalsIgnoreCase(START_LOGGER_FULLSCREEN_ARG) || + arg.equalsIgnoreCase(LOGGER_TOUCH_ARG)) { return true; } } return false; } - private static void openLogger(String[] args) { - startLogger(EXIT_ON_CLOSE, args); + public static void openLogger(int defaultCloseOperation, String[] args) { + startLogger(defaultCloseOperation, getECUEditorWithoutCreation(), args); } - private static void openRom(final ECUEditor editor, final String rom) { - invokeLater(new Runnable() { - @Override - public void run() { - try { - File file = new File(rom); - editor.openImage(file); - } catch (Exception ex) { - LOGGER.error("Error opening rom", ex); - } - } - }); - } - - private static void openEditor(String[] args) { + private static void openEditor(int defaultCloseOperation, String[] args) { ECUEditor editor = getECUEditor(); + editor.setDefaultCloseOperation(defaultCloseOperation); editor.initializeEditorUI(); editor.checkDefinitions(); if (args.length > 0) { - openRom(editor, args[0]); + editor.openImage(args[0]); } - startRomListener(editor); } - private static void startRomListener(ECUEditor editor) { - try { - while (true) { - String rom = waitForRom(); - openRom(editor, rom); - } - } catch (Throwable e) { - LOGGER.error("Error occurred", e); - } + private static void startExecCommunication() { + while (true) { + try { + ExecutableInstance instance = EditorLoggerCommunication.waitForOtherExec(); + + if(instance.execType == Exec_type.LOGGER) { + if(EditorLoggerCommunication.getExecutableType() == Exec_type.LOGGER || + EcuLogger.getEcuLoggerWithoutCreation() != null) { + showAlreadyRunningMessage(); + continue; + } + + openLogger(DISPOSE_ON_CLOSE, instance.currentArgs); + LOGGER.info("Opening Logger with args: " + Arrays.toString(instance.currentArgs)); + } + else if(instance.execType == Exec_type.EDITOR) { + openEditor(DISPOSE_ON_CLOSE, instance.currentArgs); + + if(EditorLoggerCommunication.getExecutableType() == Exec_type.LOGGER) { + EcuLogger.getEcuLoggerWithoutCreation().setEcuEditor( + ECUEditorManager.getECUEditorWithoutCreation()); + } + + LOGGER.info("Opening Editor with args: " + Arrays.toString(instance.currentArgs)); + } + else { + LOGGER.error("Unknown type in Editor/Logger communication with args: " + Arrays.toString(instance.currentArgs)); + } + + } catch (IOException e) { + e.printStackTrace(); + } + } } } diff --git a/src/main/java/com/romraider/EditorLoggerCommunication.java b/src/main/java/com/romraider/EditorLoggerCommunication.java new file mode 100644 index 000000000..cd14cdf2c --- /dev/null +++ b/src/main/java/com/romraider/EditorLoggerCommunication.java @@ -0,0 +1,121 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.net.ServerSocket; +import java.net.Socket; + +public final class EditorLoggerCommunication { + + public enum Exec_type {EDITOR, LOGGER, UNKNOWN}; + + private static final String HOST = "localhost"; + private static final int PORT = 23272; + + private static Exec_type currentExecType; + private static String[] currentArgs; + + static public class ExecutableInstance { + public Exec_type execType; + public String[] currentArgs; + } + + public static void setExectable(Exec_type t, String[] a) { + currentExecType = t; + currentArgs = a; + } + + public static Exec_type getExecutableType() { + return currentExecType; + } + + public static String[] getExecutableArgs() { + return currentArgs; + } + + public static boolean isRunning() { + try { + ServerSocket sock = new ServerSocket(PORT); + sock.close(); + return false; + } catch (IOException ex) { + return true; + } + } + + public static ExecutableInstance waitForOtherExec() throws IOException { + ServerSocket sock = new ServerSocket(PORT); + + try { + Socket client = sock.accept(); + + BufferedReader br = new BufferedReader(new InputStreamReader(client.getInputStream())); + String type_String = br.readLine(); + String args_String = br.readLine(); + + ExecutableInstance instance = new ExecutableInstance(); + + if(type_String.equalsIgnoreCase(Exec_type.EDITOR.toString())) { + instance.execType = Exec_type.EDITOR; + } + else if(type_String.equalsIgnoreCase(Exec_type.LOGGER.toString())) { + instance.execType = Exec_type.LOGGER; + } + else { + instance.execType = Exec_type.UNKNOWN; + } + + instance.currentArgs = args_String.split(" "); + return instance; + + } finally { + sock.close(); + } + } + + public static void sendTypeToOtherExec(String[] args) { + try { + Socket socket = new Socket(HOST, PORT); + OutputStream os = socket.getOutputStream(); + + try { + PrintWriter pw = new PrintWriter(os, true); + pw.println(getExecutableType().toString()); + + String argsSend = ""; + + for (String arg: args) { + argsSend += arg + " "; + } + + pw.println(argsSend); + } finally { + socket.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/romraider/Settings.java b/src/main/java/com/romraider/Settings.java index 503966c9d..fd9b42d75 100644 --- a/src/main/java/com/romraider/Settings.java +++ b/src/main/java/com/romraider/Settings.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ import com.romraider.io.connection.ConnectionProperties; import com.romraider.logger.ecu.definition.EcuDefinition; +import com.romraider.logger.ecu.definition.Module; import com.romraider.logger.external.phidget.interfacekit.io.IntfKitSensor; public class Settings implements Serializable { @@ -46,6 +47,8 @@ public class Settings implements Serializable { public static final String NEW_LINE = System.getProperty("line.separator"); public static final String TAB = "\t"; public static final String BLANK = ""; + public static final String COMMA = ","; + public static final String SEMICOLON = ";"; /* Clipboard Settings */ public static final String TABLE_CLIPBOARD_FORMAT_ELEMENT = "table-clipboard-format"; @@ -87,30 +90,41 @@ public class Settings implements Serializable { /* Table Settings */ public static final String defaultTableToolBarName = "Table Tools"; - public static final int ENDIAN_LITTLE = 1; - public static final int ENDIAN_BIG = 2; + public enum Endian { + LITTLE(1), + BIG(2); - public static final int TABLE_1D = 1; - public static final int TABLE_2D = 2; - public static final int TABLE_3D = 3; - public static final int TABLE_X_AXIS = 4; - public static final int TABLE_Y_AXIS = 5; - public static final int TABLE_SWITCH = 6; + private final int marshallingCode; - public static final int DATA_TYPE_ORIGINAL = 0; - public static final int DATA_TYPE_BIN = 1; - public static final int DATA_TYPE_REAL = 3; + Endian(int marshallingCode) { + this.marshallingCode = marshallingCode; + } + + public String getMarshallingString() { + return String.valueOf(marshallingCode); + } + } - public static final int COMPARE_DISPLAY_PERCENT = 1; - public static final int COMPARE_DISPLAY_ABSOLUTE = 2; + public enum DataType { + ORIGINAL, + BIN + } + + public enum CompareDisplay { + PERCENT, + ABSOLUTE + } + public static final int MOVI20_MIN_VALUE = 0xfff80000; + public static final int MOVI20_MAX_VALUE = 0x0007ffff; + public static final int MOVI20S_MIN_VALUE = 0xf8000000; + public static final int MOVI20S_MAX_VALUE = 0x07ffff00; + public static final int STORAGE_TYPE_MOVI20 = 20; + public static final int STORAGE_TYPE_MOVI20S = 28; public static final int STORAGE_TYPE_FLOAT = 99; - public static final boolean STORAGE_DATA_SIGNED = false; public static final Color UNCHANGED_VALUE_COLOR = new Color(160, 160, 160); - public static final String INVALID_ATTRIBUTE_TEXT = "invalid"; - public static final String DEFAULT_TABLE_NAME = "Unknown"; /* Rom Settings */ @@ -131,10 +145,6 @@ public class Settings implements Serializable { public static Color TABLE_DIFFERENT_COLOR = new Color(193, 27, 23); public static Color TABLE_MISSING_COLOR = new Color(251,185,23); - /* Compare DTC Foreground Colors */ - public static Color TABLESWITCH_DEFAULT_COLOR = Color.black; - public static Color TABLESWITCH_DIFFERENT_COLOR = new Color(193, 27, 23); - /* MDI Desktop Settings*/ public static int FRAME_OFFSET = 20; @@ -166,6 +176,7 @@ public class Settings implements Serializable { private String recentVersion = "x"; private Vector ecuDefinitionFiles = new Vector(); + private File lastDefDir = new File("definitions"); private File lastImageDir = new File("images"); private File lastRepositoryDir = new File("repositories"); private boolean obsoleteWarning = true; @@ -184,6 +195,7 @@ public class Settings implements Serializable { private Color selectColor = new Color(204, 204, 204); private Color highlightColor = new Color(27, 161, 226); private Color liveValueColor = new Color (0, 255, 0); + private Color curLiveValueColor = new Color (255, 0, 255); private Color decreaseBorder = new Color(0, 0, 255); private Color increaseBorder = new Color(255, 0, 0); @@ -192,35 +204,39 @@ public class Settings implements Serializable { private Color warningColor = new Color(255, 0, 0); private int tableClickCount = 1; // number of clicks to open table private int tableClickBehavior = 0; // TableTreeNode click behavior. 0=open/close frame, 1=open/focus frame + private boolean sortTableTree = false; // false - Table Tree is in definition order, true - alphabetical private boolean colorAxis = false; private String loggerPort; - private String loggerPortDefault; + private String loggerPortDefault = ""; private static String loggerProtocol = SSM; - private static String loggerDefinitionFilePath; - private static String loggerProfileFilePath; + private static String loggerDefinitionFilePath = ""; + private static String loggerProfileFilePath = ""; private static String loggerOutputDirPath = System.getProperty("user.home"); private String fileLoggingControllerSwitchId = "S20"; // defogger switch by default - private boolean fileLoggingControllerSwitchActive = true; + private boolean fileLoggingControllerSwitchActive = false; private boolean fileLoggingAbsoluteTimestamp; private String logfileNameText; private boolean logExternalsOnly; + private boolean autoConnectOnStartup = true; private static String userLocale = SYSTEM_NUMFORMAT; private Dimension loggerWindowSize = new Dimension(1000, 600); private Point loggerWindowLocation = new Point(); private boolean loggerWindowMaximized; private int loggerSelectedTabIndex; + private int loggerSelectedGaugeIndex = 0; private boolean loggerParameterListState = true; private ConnectionProperties loggerConnectionProperties; private Map loggerEcuDefinitionMap; private Map loggerPluginPorts; private boolean loggerRefreshMode; - private static byte loggerDestinationId = 0x10; + private static String loggerTargetModule = "ecu"; + private static Module loggerDestinationTarget; private boolean fastPoll = true; private double loggerDividerLocation = 400; private String loggerDebuggingLevel = "info"; - private static String j2534Device; + private static String j2534Device = ""; private static String transportProtocol = ISO9141; private String tableClipboardFormat = DEFAULT_CLIPBOARD_FORMAT; // Currently 2 options. Default and Airboy. Custom is not hooked up. @@ -241,6 +257,31 @@ public class Settings implements Serializable { private Map phidgetSensors; + /** + * Car selection for Dyno tab + */ + private String selectedCar = ""; + + /** + * Gear selection for selected car on Dyno tab + */ + private String selectedGear = "3"; + + /** + * Throttle threshold value to indicate WOT on Dyno tab + */ + private String tpsThreshold = "98"; + + /** + * Throttle value units % or VDC on Dyno tab, not all cars support both + */ + private String tpsThresholdPID = "%"; + + /** + * Sets if we search for the ELM327 on startup (small delay) + */ + private Boolean searchElm327 = false; + public Settings() { //center window by default Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); @@ -284,6 +325,14 @@ public void setLastImageDir(File lastImageDir) { this.lastImageDir = lastImageDir; } + public File getLastDefinitionDir() { + return lastDefDir; + } + + public void setLastDefinitionDir(File lastDefDir) { + this.lastDefDir = lastDefDir; + } + public File getLastRepositoryDir() { return lastRepositoryDir; } @@ -380,6 +429,14 @@ public void setLiveValueColor(Color liveValueColor) { this.liveValueColor = liveValueColor; } + public Color getCurLiveValueColor() { + return this.curLiveValueColor; + } + + public void setCurLiveValueColor(Color curLiveValueColor) { + this.curLiveValueColor = curLiveValueColor; + } + public Color getSelectColor() { return selectColor; } @@ -512,6 +569,14 @@ public void setLoggerPortDefault(String loggerPortDefault) { this.loggerPortDefault = loggerPortDefault; } + public void setAutoConnectOnStartup(boolean value) { + autoConnectOnStartup = value; + } + + public boolean getAutoConnectOnStartup() { + return autoConnectOnStartup; + } + public void setLoggerProtocol(String protocol) { Settings.loggerProtocol = protocol; } @@ -625,6 +690,14 @@ public int getLoggerSelectedTabIndex() { return loggerSelectedTabIndex; } + public void setLoggerSelectedGaugeIndex(int loggerSelectGaugeIndex) { + this.loggerSelectedGaugeIndex = loggerSelectGaugeIndex; + } + + public int getLoggerSelectedGaugeIndex() { + return loggerSelectedGaugeIndex; + } + public Map getLoggerPluginPorts() { return loggerPluginPorts; } @@ -649,12 +722,20 @@ public boolean getRefreshMode() { return loggerRefreshMode; } - public void setDestinationId(byte id) { - loggerDestinationId = id; + public void setTargetModule(String string) { + loggerTargetModule = string; + } + + public String getTargetModule() { + return loggerTargetModule; } - public byte getDestinationId() { - return loggerDestinationId; + public void setDestinationTarget(Module module) { + loggerDestinationTarget = module; + } + + public Module getDestinationTarget() { + return loggerDestinationTarget; } public void setFastPoll(boolean state) { @@ -870,4 +951,52 @@ public void setPhidgetSensors( this.phidgetSensors = phidgetSensors; } + + public String getSelectedCar() { + return this.selectedCar; + } + + public String getSelectedGear() { + return this.selectedGear; + } + + public String getDynoThrottle() { + return this.tpsThresholdPID; + } + + public String getDynoThreshold() { + return this.tpsThreshold; + } + + public boolean getElm327Enabled() { + return this.searchElm327; + } + + public void setSelectedCar(final String value) { + this.selectedCar = value; + } + + public void setSelectedGear(final String value) { + this.selectedGear = value; + } + + public void setDynoThrottle(final String value) { + this.tpsThresholdPID = value; + } + + public void setDynoThreshold(final String value) { + this.tpsThreshold = value; + } + + public void setElm327Enabled(Boolean value) { + this.searchElm327 = value; + } + + public void setTableTreeSorted(Boolean value) { + this.sortTableTree = value; + } + + public boolean isTableTreeSorted() { + return this.sortTableTree; + } } diff --git a/src/main/java/com/romraider/Version.java.template b/src/main/java/com/romraider/Version.java.template index 88732ede8..8dffdd34a 100644 --- a/src/main/java/com/romraider/Version.java.template +++ b/src/main/java/com/romraider/Version.java.template @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-@time.year@ RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,17 +24,18 @@ package com.romraider; import javax.swing.ImageIcon; public final class Version { - public static final String PRODUCT_NAME = "@name.package@"; - public static final String VERSION = "@version.major@.@version.minor@.@version.patch@ @version.extra@ @version.extra1@"; - public static final String BUILDNUMBER = "@version.buildnumber@"; - public static final String SUPPORT_URL = "@supporturl@"; - public static final String ROM_REVISION_URL = "@romrevisionurl@"; - public static final String ECU_DEFS_URL = "@ecudefsurl@"; - public static final String LOGGER_DEFS_URL = "@loggerdefsurl@"; - public static final String CARS_DEFS_URL = "@carsdefsurl@"; - public static final String RELEASE_NOTES = "@release_notes@"; - public static final ImageIcon ABOUT_ICON = new ImageIcon(Version.class.getClass().getResource("/graphics/romraider-ico-large.gif")); - public static final int MIN_LOG_DEF_VERSION = @min.logger.def.version@; + public static final String PRODUCT_NAME = "@name.package@"; + public static final String VERSION = "@version.major@.@version.minor@.@version.patch@ @version.extra@ @version.extra1@"; + public static final String BUILDNUMBER = "@version.buildnumber@"; + public static final String SUPPORT_URL = "@supporturl@"; + public static final String ROM_REVISION_URL = "@romrevisionurl@"; + public static final String ECU_DEFS_URL = "@ecudefsurl@"; + public static final String LOGGER_DEFS_URL = "@loggerdefsurl@"; + public static final String CARS_DEFS_URL = "@carsdefsurl@"; + public static final String RELEASE_NOTES = "@release_notes@"; + public static final ImageIcon ABOUT_ICON = new ImageIcon(Version.class.getResource("/graphics/romraider-ico-large.gif")); + public static final int MIN_LOG_DEF_VERSION = @min.logger.def.version@; + public static final String BUILD_ARCH = "@build.arch@"; private Version() { } diff --git a/src/main/java/com/romraider/dataflowSimulation/CalculationAction.java b/src/main/java/com/romraider/dataflowSimulation/CalculationAction.java new file mode 100644 index 000000000..28315a899 --- /dev/null +++ b/src/main/java/com/romraider/dataflowSimulation/CalculationAction.java @@ -0,0 +1,126 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2023 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package com.romraider.dataflowSimulation; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; + +import com.romraider.maps.Rom; +import com.romraider.maps.Table; +import com.romraider.util.JEPUtil; + +public class CalculationAction extends GenericAction { + private final String expression; + private String currentOutputText; + private String currentInputText = ""; + private String currentCenterText; + + public CalculationAction(String output, String expression) { + super(output); + this.expression = expression; + } + + public String getExpression() { + return expression; + } + + private void updateCurrentInputText(HashMap variables) { + currentInputText = ""; + for (Map.Entry entry : variables.entrySet()) { + if (expression.matches(".*\\b" + entry.getKey() + "\\b.*")) { + currentInputText += entry.getKey() + ": " + DEFAULT_FORMATTER.format(entry.getValue()) + "
"; + } + } + } + + private void updateCurrentCenterText(Map variables) { + currentCenterText = expression; + synchronized (variables) { + for (Map.Entry entry : variables.entrySet()) { + String newValue = DEFAULT_FORMATTER.format(entry.getValue()); + currentCenterText = currentCenterText.replaceAll("(\\b)" + entry.getKey() + "(\\b)", + entry.getKey() + "(" + newValue + ")"); + } + } + } + + public Double calculate(Map variables) { + Double output = 0.0; + synchronized (variables) { + output = JEPUtil.evaluate(expression, variables); + } + currentOutputText = super.getOutputName() + ": " + + (Double.isNaN(output) || Double.isInfinite(output) ? "Error" : DEFAULT_FORMATTER.format(output)); + + // Not needed with replaced center value I think + // updateCurrentInputText(variables); + updateCurrentCenterText(variables); + return output; + } + + public boolean isSetupValid() { + return super.isSetupValid() && !expression.isEmpty(); + } + + public boolean isCurrentlyValid(Map variables) { + try { + synchronized (variables) { + Double value = JEPUtil.evaluate(expression, variables); + return !Double.isNaN(value) && !Double.isInfinite(value); + } + } catch (NullPointerException e) { + return false; + } + } + + @Override + public GenericActionType getType() { + return GenericActionType.CALCULATION; + } + + @Override + public String getInputText() { + return currentInputText; + } + + @Override + public String getOutputText() { + return currentOutputText; + } + + @Override + public String getCenterTextReference() { + return currentCenterText; + } + + @Override + public Table getTable() { + return null; + } + + @Override + public void init(Rom rom) { + } + + @Override + public LinkedList getInputs() { + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/dataflowSimulation/DataflowSimulation.java b/src/main/java/com/romraider/dataflowSimulation/DataflowSimulation.java new file mode 100644 index 000000000..0c6afd08e --- /dev/null +++ b/src/main/java/com/romraider/dataflowSimulation/DataflowSimulation.java @@ -0,0 +1,152 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2023 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.dataflowSimulation; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Map; + +import javax.swing.SwingUtilities; + +import org.apache.log4j.Logger; +import static java.util.Collections.synchronizedMap; + +import com.romraider.maps.Rom; +import com.romraider.swing.DataflowFrame; + +public class DataflowSimulation { + protected static final Logger LOGGER = Logger.getLogger(DataflowSimulation.class); + + private String name; + private Rom rom; + private String description = ""; + private HashSet inputsWithLogParams = new HashSet(); + private LinkedList inputs = new LinkedList(); + private Map variables = synchronizedMap(new HashMap()); + private LinkedList dataflow = new LinkedList(); + private boolean updateFromLogger = false; + private DataflowFrame frame = null; + + public DataflowSimulation(Rom rom, String name) { + this.name = name; + this.rom = rom; + } + + public void setDescription(String desc) { + this.description = desc; + } + + public String getDescription() { + return description; + } + + public void setFrame(DataflowFrame frame) { + this.frame = frame; + } + + public void setUpdateFromLogger(boolean value) { + this.updateFromLogger = value; + } + + public String getName() { + return this.name; + } + + public void addInput(String name, boolean hasLogParam) { + if (!name.isEmpty()) { + if (!inputs.contains(name)) { + inputs.add(name); + variables.put(name, 0.0); + if (hasLogParam) { + inputsWithLogParams.add(name); + } + } else { + LOGGER.warn("Variable name " + name + " already exists!"); + } + } else { + LOGGER.warn("Ignoring empty input name!"); + } + } + + public void addAction(GenericAction action) { + // Check if the user is playing by our rules + if (action.isSetupValid()) { + dataflow.add(action); + } else { + LOGGER.warn("Action with output " + action.getOutputName() + " is not valid!"); + } + } + + public int getNumberOfActions() { + return dataflow.size(); + } + + public LinkedList getInputs() { + return inputs; + } + + public HashSet getInputsWithLogParam() { + return inputsWithLogParams; + } + + public Double getVariableValue(String varName) { + return variables.get(varName); + } + + public Double setVariableValue(String varName, Double value) { + return variables.put(varName, value); + } + + public GenericAction getAction(int index) { + return dataflow.get(index); + } + + public Rom getRom() { + return this.rom; + } + + public Double simulate(int index) { + Double result = 0.0; + GenericAction a = dataflow.get(index); + if (a.isCurrentlyValid(variables)) { + result = a.calculate(variables); + variables.put(a.outputName, result); + } else { + LOGGER.warn("Action with output " + a.getOutputName() + " is not valid!"); + } + + return result; + } + + public void updateVariableFromLogger(String key, double dataValue) { + if (updateFromLogger) { + setVariableValue(key, dataValue); + if (frame != null) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + frame.updateContentPanel(); + } + }); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/dataflowSimulation/GenericAction.java b/src/main/java/com/romraider/dataflowSimulation/GenericAction.java new file mode 100644 index 000000000..d145b68fd --- /dev/null +++ b/src/main/java/com/romraider/dataflowSimulation/GenericAction.java @@ -0,0 +1,68 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2023 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.dataflowSimulation; + +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; + +import com.romraider.maps.Rom; +import com.romraider.maps.Table; + +public abstract class GenericAction { + public static final DecimalFormat DEFAULT_FORMATTER = new DecimalFormat("#.##"); + String outputName; + + public enum GenericActionType { + TABLE, CALCULATION + }; + + public GenericAction(String output) { + this.outputName = output; + } + + public String getOutputName() { + return outputName; + } + + public abstract LinkedList getInputs(); + + public abstract void init(Rom rom); + + public abstract Double calculate(Map variables); + + public abstract boolean isCurrentlyValid(Map variables); + + public boolean isSetupValid() { + return !outputName.isEmpty(); + } + + public abstract GenericAction.GenericActionType getType(); + + public abstract String getInputText(); + + public abstract String getOutputText(); + + public abstract String getCenterTextReference(); + + public abstract Table getTable(); + +} \ No newline at end of file diff --git a/src/main/java/com/romraider/dataflowSimulation/TableAction.java b/src/main/java/com/romraider/dataflowSimulation/TableAction.java new file mode 100644 index 000000000..8070911b9 --- /dev/null +++ b/src/main/java/com/romraider/dataflowSimulation/TableAction.java @@ -0,0 +1,132 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2023 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.dataflowSimulation; + +import java.text.DecimalFormat; +import java.util.LinkedList; +import java.util.Map; + +import com.romraider.maps.Rom; +import com.romraider.maps.Table; + +public class TableAction extends GenericAction { + protected static final DecimalFormat TABLE_FORMATTER = new DecimalFormat(); + + private String refTable; + private String input_x; + private String input_y; + + private String currentInputText; + private String currentOutputText; + private Table resolvedTable; + private LinkedList currentInputs = new LinkedList(); + + public TableAction(String output, String reference, String input_x, String input_y) { + super(output); + this.refTable = reference; + this.input_x = input_x; + this.input_y = input_y; + } + + public boolean isSetupValid() { + return super.isSetupValid() && !refTable.isEmpty() && (!input_x.isEmpty() || !input_y.isEmpty()); + } + + public boolean isCurrentlyValid(Map variables) { + return (input_x.isEmpty() ? true : variables.containsKey(input_x)) + && (input_y.isEmpty() ? true : variables.containsKey(input_y)); + } + + private String updateInputText(Double inputXValue, Double inputYValue) { + currentInputText = ""; + // currentInputText += resolvedTable.getName() + "

"; + + if (inputXValue != null) { + currentInputText += input_x + " : " + DEFAULT_FORMATTER.format(inputXValue); + } + if (inputYValue != null) { + if (inputXValue != null) { + currentInputText += "
"; + } + currentInputText += input_y + " : " + DEFAULT_FORMATTER.format(inputYValue); + } + return currentInputText; + } + + public Double calculate(Map variables) { + if (resolvedTable != null) { + Double inputXValue = variables.get(input_x); + Double inputYValue = variables.get(input_y); + + currentInputs.clear(); + if (!input_x.isEmpty() && inputXValue != null) + currentInputs.add(inputXValue); + if (!input_y.isEmpty() && inputYValue != null) + currentInputs.add(inputYValue); + + Double output = resolvedTable.queryTable((Double) inputXValue, (Double) inputYValue); + currentInputText = updateInputText(inputXValue, inputYValue); + currentOutputText = super.getOutputName() + ": " + TABLE_FORMATTER.format(output); + return output; + } else { + DataflowSimulation.LOGGER.warn("Failed to find table " + this.refTable); + return 0.0; + } + } + + public LinkedList getInputs() { + return currentInputs; + } + + @Override + public GenericActionType getType() { + return GenericActionType.TABLE; + } + + @Override + public String getInputText() { + return currentInputText; + } + + @Override + public String getOutputText() { + return currentOutputText; + } + + @Override + public String getCenterTextReference() { + return null; + } + + @Override + public Table getTable() { + return resolvedTable; + } + + @Override + public void init(Rom rom) { + resolvedTable = rom.getTableByName(this.refTable); + if (resolvedTable != null) { + TABLE_FORMATTER.applyPattern(resolvedTable.getCurrentScale().getFormat()); + } else { + DataflowSimulation.LOGGER.warn("Failed to find table " + this.refTable); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/editor/ecu/ECUEditor.java b/src/main/java/com/romraider/editor/ecu/ECUEditor.java index 5ed882b79..e145a218c 100644 --- a/src/main/java/com/romraider/editor/ecu/ECUEditor.java +++ b/src/main/java/com/romraider/editor/ecu/ECUEditor.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2025 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,21 +40,28 @@ import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridLayout; +import java.awt.datatransfer.DataFlavor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyVetoException; import java.io.BufferedReader; +import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; +import java.io.FileWriter; import java.io.IOException; +import java.text.MessageFormat; +import java.util.List; +import java.util.ResourceBundle; import java.util.Vector; import javax.swing.ImageIcon; import javax.swing.JCheckBox; +import javax.swing.JFileChooser; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JPanel; @@ -62,41 +69,62 @@ import javax.swing.JSplitPane; import javax.swing.JTextArea; import javax.swing.SwingWorker; +import javax.swing.TransferHandler; +import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.tree.TreePath; -import org.w3c.dom.Document; -import org.xml.sax.InputSource; -import org.xml.sax.SAXParseException; - -import com.romraider.net.BrowserControl; +import com.romraider.ECUExec; import com.romraider.Settings; import com.romraider.logger.ecu.EcuLogger; import com.romraider.maps.Rom; +import com.romraider.maps.Table; +import com.romraider.maps.Table1D; +import com.romraider.maps.Table1DView; +import com.romraider.maps.Table1DView.Table1DType; +import com.romraider.maps.Table2D; +import com.romraider.maps.Table2DView; +import com.romraider.maps.Table3D; +import com.romraider.maps.Table3DView; +import com.romraider.maps.TableBitwiseSwitch; +import com.romraider.maps.TableBitwiseSwitchView; +import com.romraider.maps.TableSwitch; +import com.romraider.maps.TableSwitchView; +import com.romraider.maps.TableView; +import com.romraider.net.BrowserControl; import com.romraider.net.URL; import com.romraider.swing.AbstractFrame; import com.romraider.swing.CustomToolbarLayout; +import com.romraider.swing.DebugPanel; import com.romraider.swing.ECUEditorMenuBar; import com.romraider.swing.ECUEditorToolBar; import com.romraider.swing.JProgressPane; import com.romraider.swing.MDIDesktopPane; +import com.romraider.swing.RomFilterPanel; import com.romraider.swing.RomTree; import com.romraider.swing.RomTreeRootNode; import com.romraider.swing.TableFrame; import com.romraider.swing.TableToolBar; +import com.romraider.swing.TableTreeNode; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; -import com.romraider.xml.DOMRomUnmarshaller; -import com.romraider.xml.RomNotFoundException; -import com.sun.org.apache.xerces.internal.parsers.DOMParser; +import com.romraider.util.ThreadUtil; +import com.romraider.xml.ConversionLayer.ConversionLayer; public class ECUEditor extends AbstractFrame { private static final long serialVersionUID = -7826850987392016292L; + protected static final ResourceBundle rb = new ResourceUtil().getBundle( + ECUEditor.class.getName()); - private final String titleText = PRODUCT_NAME + " v" + VERSION + " | ECU Editor"; + private final String titleText = MessageFormat.format( + rb.getString("TITLE"), PRODUCT_NAME, VERSION); - private final RomTreeRootNode imageRoot = new RomTreeRootNode("Open Images"); + private final RomTreeRootNode imageRoot = new RomTreeRootNode( + rb.getString("OPENIMAGES")); private final RomTree imageList = new RomTree(imageRoot); - public MDIDesktopPane rightPanel = new MDIDesktopPane(); - public JProgressPane statusPanel = new JProgressPane(); + private final MDIDesktopPane rightPanel = new MDIDesktopPane(); + private final JProgressPane statusPanel = new JProgressPane(); + private final JScrollPane leftScrollPane; + private final JScrollPane rightScrollPane; private JSplitPane splitPane = new JSplitPane(); private Rom lastSelectedRom = null; private ECUEditorToolBar toolBar; @@ -104,13 +132,12 @@ public class ECUEditor extends AbstractFrame { private TableToolBar tableToolBar; private final JPanel toolBarPanel = new JPanel(); private OpenImageWorker openImageWorker; - private CloseImageWorker closeImageWorker; private SetUserLevelWorker setUserLevelWorker; - private LaunchLoggerWorker launchLoggerWorker; - private final ImageIcon editorIcon = new ImageIcon(getClass().getResource("/graphics/romraider-ico.gif"), "RomRaider ECU Editor"); + private final ImageIcon editorIcon = new ImageIcon(getClass().getResource( + "/graphics/romraider-ico.gif"), rb.getString("RRECUED")); + private final Settings settings = SettingsManager.getSettings(); public ECUEditor() { - Settings settings = SettingsManager.getSettings(); if (!settings.getRecentVersion().equalsIgnoreCase(VERSION)) { showReleaseNotes(); } @@ -121,12 +148,18 @@ public ECUEditor() { setExtendedState(MAXIMIZED_BOTH); } - JScrollPane rightScrollPane = new JScrollPane(rightPanel, + rightScrollPane = new JScrollPane(rightPanel, VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); - JScrollPane leftScrollPane = new JScrollPane(imageList, + + leftScrollPane = new JScrollPane(imageList, VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); - splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftScrollPane, rightScrollPane); + JPanel leftAreaWithFilterBox = new JPanel(new BorderLayout()); + leftAreaWithFilterBox.add(leftScrollPane, BorderLayout.CENTER); + leftAreaWithFilterBox.add(new RomFilterPanel(imageRoot, imageList), BorderLayout.SOUTH); + + splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, + leftAreaWithFilterBox, rightScrollPane); splitPane.setDividerSize(3); splitPane.setDividerLocation(settings.getSplitPaneLocation()); splitPane.addPropertyChangeListener(this); @@ -140,7 +173,7 @@ public ECUEditor() { //set remaining window properties setIconImage(editorIcon.getImage()); - + setDefaultCloseOperation(EXIT_ON_CLOSE); addWindowListener(this); setTitle(titleText); @@ -150,16 +183,18 @@ public ECUEditor() { public void initializeEditorUI() { //create menubar + if(menuBar != null && toolBar != null) return; + menuBar = new ECUEditorMenuBar(); this.setJMenuBar(menuBar); // create toolbars - toolBar = new ECUEditorToolBar("Editor Tools"); + toolBar = new ECUEditorToolBar(rb.getString("EDTOOLS")); tableToolBar = new TableToolBar(); - tableToolBar.updateTableToolBar(); - CustomToolbarLayout toolBarLayout = new CustomToolbarLayout(FlowLayout.LEFT, 0, 0); + CustomToolbarLayout toolBarLayout = new CustomToolbarLayout( + FlowLayout.LEFT, 0, 0); toolBarPanel.setLayout(toolBarLayout); toolBarPanel.add(toolBar); @@ -167,16 +202,52 @@ public void initializeEditorUI() { toolBarPanel.setVisible(true); this.add(toolBarPanel, BorderLayout.NORTH); + setupDragAndDrop(); validate(); } + public void setupDragAndDrop() + { + setTransferHandler(new TransferHandler() { + private static final long serialVersionUID = 1L; + + @Override + public boolean canImport(TransferSupport support) { + // Accept drops of files only + return support.isDataFlavorSupported(DataFlavor.javaFileListFlavor); + } + + @Override + public boolean importData(TransferSupport support) { + if (!canImport(support)) { + return false; + } + + try { + @SuppressWarnings("unchecked") + List droppedFiles = + (List) support.getTransferable() + .getTransferData(DataFlavor.javaFileListFlavor); + + for (File file : droppedFiles) { + openImage(file); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } + }); + } + public void checkDefinitions() { - if (SettingsManager.getSettings().getEcuDefinitionFiles().size() <= 0) { + if (settings.getEcuDefinitionFiles().size() <= 0) { // no ECU definitions configured - let user choose to get latest or configure later - Object[] options = {"Yes", "No"}; + Object[] options = {rb.getString("YES"), rb.getString("NO")}; int answer = showOptionDialog(null, - "ECU definitions not configured.\nGo online to download the latest definition files?", - "Editor Configuration", + rb.getString("ECUDEFNOTCFG"), + rb.getString("EDCONFIG"), DEFAULT_OPTION, WARNING_MESSAGE, null, @@ -186,8 +257,8 @@ public void checkDefinitions() { BrowserControl.displayURL(ECU_DEFS_URL); } else { showMessageDialog(this, - "ECU definition files need to be configured before ROM images can be opened.\nMenu: ECU Definitions > ECU Definition Manager...", - "Editor Configuration", + rb.getString("CFGEDFSMENU"), + rb.getString("EDCONFIG"), INFORMATION_MESSAGE); } } @@ -195,14 +266,16 @@ public void checkDefinitions() { private void showReleaseNotes() { try { - BufferedReader br = new BufferedReader(new FileReader(SettingsManager.getSettings().getReleaseNotes())); + BufferedReader br = new BufferedReader(new FileReader( + settings.getReleaseNotes())); try { // new version being used, display release notes JTextArea releaseNotes = new JTextArea(); releaseNotes.setEditable(false); releaseNotes.setWrapStyleWord(true); releaseNotes.setLineWrap(true); - releaseNotes.setFont(new Font("Tahoma", Font.PLAIN, 12)); + releaseNotes.setFont(new Font(rb.getString("RELEASENOTESFONT"), + Font.PLAIN, 12)); StringBuffer sb = new StringBuffer(); while (br.ready()) { @@ -211,11 +284,13 @@ private void showReleaseNotes() { releaseNotes.setText(sb.toString()); releaseNotes.setCaretPosition(0); - JScrollPane scroller = new JScrollPane(releaseNotes, VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER); + JScrollPane scroller = new JScrollPane(releaseNotes, + VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER); scroller.setPreferredSize(new Dimension(600, 500)); showMessageDialog(this, scroller, - PRODUCT_NAME + VERSION + " Release Notes", INFORMATION_MESSAGE); + PRODUCT_NAME + VERSION + " " + rb.getString("RELEASENOTES"), + INFORMATION_MESSAGE); } finally { br.close(); } @@ -225,7 +300,6 @@ private void showReleaseNotes() { } public void handleExit() { - Settings settings = SettingsManager.getSettings(); settings.setSplitPaneLocation(splitPane.getDividerLocation()); settings.setWindowMaximized(getExtendedState() == MAXIMIZED_BOTH); settings.setWindowSize(getSize()); @@ -233,8 +307,43 @@ public void handleExit() { // Save when exit to save file settings. SettingsManager.save(settings, statusPanel); - statusPanel.update("Ready...", 0); + statusPanel.update(rb.getString("STATUSREADY"), 0); repaint(); + + if(EcuLogger.getEcuLoggerWithoutCreation()== null) { + System.exit(0); + } + else{ + ECUEditorManager.clearECUEditor(); + EcuLogger.getEcuLoggerWithoutCreation().setEcuEditor(null); + } + } + + public void handleExportDefinition() { + Rom r = getLastSelectedRom(); + + if(null != r) { + JFileChooser fileChooser = new JFileChooser(settings.getLastDefinitionDir()); + fileChooser.setFileFilter(new FileNameExtensionFilter("Editor Definition (.xml)","xml")); + int userSelection = fileChooser.showSaveDialog(this); + + if (userSelection == JFileChooser.APPROVE_OPTION) { + File fileToSave = fileChooser.getSelectedFile(); + + if(!fileToSave.getName().toLowerCase().endsWith(".xml")) + fileToSave = new File(fileToSave.getAbsoluteFile() + ".xml"); + + String s = ConversionLayer.convertDocumentToString(r.getDocument()); + + try { + BufferedWriter writer = new BufferedWriter(new FileWriter(fileToSave)); + writer.write(s); + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } } @Override @@ -271,7 +380,6 @@ public String getVersion() { } public void addRom(Rom input) { - Settings settings = SettingsManager.getSettings(); input.refreshDisplayedTables(); // add to ecu image list pane @@ -279,7 +387,6 @@ public void addRom(Rom input) { getImageList().setVisible(true); getImageList().expandPath(new TreePath(getImageRoot())); - getImageList().expandPath(new TreePath(input.getPath())); if(!settings.isOpenExpanded()) { @@ -297,84 +404,148 @@ public void addRom(Rom input) { if (input.getRomID().isObsolete() && settings.isObsoleteWarning()) { JPanel infoPanel = new JPanel(); infoPanel.setLayout(new GridLayout(3, 1)); - infoPanel.add(new JLabel("A newer version of this ECU revision exists. " + - "Please visit the following link to download the latest revision:")); + infoPanel.add(new JLabel(rb.getString("OBSOLETEROM"))); infoPanel.add(new URL(settings.getRomRevisionURL())); - JCheckBox check = new JCheckBox("Always display this message", true); + JCheckBox check = new JCheckBox(rb.getString("DISPLAYMSG"), true); check.setHorizontalAlignment(JCheckBox.RIGHT); check.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - SettingsManager.getSettings().setObsoleteWarning(((JCheckBox) e.getSource()).isSelected()); + settings.setObsoleteWarning( + ((JCheckBox) e.getSource()).isSelected()); } }); infoPanel.add(check); - showMessageDialog(this, infoPanel, "ECU Revision is Obsolete", INFORMATION_MESSAGE); + showMessageDialog(this, infoPanel, + rb.getString("ISOBSOLETE"), + INFORMATION_MESSAGE); } } - - public void displayTable(TableFrame frame) { + + private void handleAlreadyOpenTable(TableFrame frame) + { + // table is already open. + if(1 == settings.getTableClickBehavior()) { // open/focus frame + // table is already open, so set focus on the frame. + boolean selected = true; + frame.toFront(); + try { + frame.setSelected(true); + } catch (PropertyVetoException e) { + frame.toBack(); + selected = false; + } + if(selected) { + frame.requestFocusInWindow(); + } + } else { + // default to open/close frame + // table is already open, so close the frame. + rightPanel.remove(frame); + frame.getTable().setTableFrame(null); + try { + frame.setClosed(true); + } catch (PropertyVetoException e) { + // Do nothing. + } + frame.dispose(); + } + } + + public static TableView getTableViewForTable(Table t) + { + TableView v = null; + + if(t instanceof TableSwitch) + v = new TableSwitchView((TableSwitch)t); + else if(t instanceof TableBitwiseSwitch) + v = new TableBitwiseSwitchView((TableBitwiseSwitch)t); + else if(t instanceof Table1D) + v = new Table1DView((Table1D)t, Table1DType.NO_AXIS); + else if(t instanceof Table2D) + v = new Table2DView((Table2D)t); + else if(t instanceof Table3D) + v = new Table3DView((Table3D)t); + + return v; + } + + private void openClosedTable(TableTreeNode node) + { + Table t = node.getTable(); + TableView v = getTableViewForTable(t); + t.setTableView(v); try { - // check if frame has been added. - for(JInternalFrame curFrame : getRightPanel().getAllFrames()) { - if(curFrame.equals(frame)) { - // table is already open. - if(1 == SettingsManager.getSettings().getTableClickBehavior()) { // open/focus frame - // table is already open, so set focus on the frame. - boolean selected = true; - frame.toFront(); - try { - frame.setSelected(true); - } catch (PropertyVetoException e) { - frame.toBack(); - selected = false; - } - if(selected) { - frame.requestFocusInWindow(); - } - } else { // default to open/close frame - // table is already open, so close the frame. - rightPanel.remove(frame); - frame.setVisible(false); - try { - frame.setClosed(true); - } catch (PropertyVetoException e) { - ; // Do nothing. - } - frame.dispose(); - } - frame.pack(); - rightPanel.repaint(); - return; - } + if (t != null) { + v.populateTableVisual(); + v.drawTable(); + + Rom rom = RomTree.getRomNode(node); + TableFrame frame = new TableFrame(node.getTable().getName() + " | " + rom.getFileName(), v); + frame.pack(); + + rightPanel.add(frame); } + } + catch(Exception e) { + final String msg = MessageFormat.format( + rb.getString("POPULATEFAIL"), t.getName(), + e.toString()); + final Exception ex = new Exception(msg); + showMessageDialog(this, + new DebugPanel(ex, settings.getSupportURL()), + rb.getString("EXCEPTION"), + ERROR_MESSAGE); + } + + } + + public void displayTable(TableTreeNode node) { - // frame not added. Draw table and add the frame. - frame.getTable().drawTable(); - rightPanel.add(frame); - } catch (IllegalArgumentException ex) { - ;// Do nothing. + TableFrame frame = node.getFrame(); + + // check if frame has been added. + if (frame != null) + { + handleAlreadyOpenTable(frame); + } + else + { + openClosedTable(node); } - frame.pack(); + rightPanel.repaint(); + refreshTableCompareMenus(); } public void removeDisplayTable(TableFrame frame) { frame.setVisible(false); - this.getTableToolBar().updateTableToolBar(); rightPanel.remove(frame); rightPanel.validate(); refreshUI(); } public void closeImage() { - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - closeImageWorker = new CloseImageWorker(getLastSelectedRom()); - closeImageWorker.addPropertyChangeListener(getStatusPanel()); - closeImageWorker.execute(); + Rom rom = getLastSelectedRom(); + ECUEditor editor = ECUEditorManager.getECUEditor(); + RomTreeRootNode imageRoot = editor.getImageRoot(); + + rom.removeFromParent(); + + if (imageRoot.getChildCount() > 0) { + editor.setLastSelectedRom((Rom) imageRoot.getChildAt(0)); + } else { + editor.setLastSelectedRom(null); + } + + editor.getStatusPanel().setStatus(ECUEditor.rb.getString("STATUSREADY")); + editor.setCursor(null); + editor.refreshAfterNewRom(); + + rom.clearData(); } public void closeAllImages() { @@ -389,7 +560,7 @@ public Rom getLastSelectedRom() { public String getLastSelectedRomFileName() { Rom lastSelRom = getLastSelectedRom(); - return lastSelRom == null ? "" : lastSelRom.getFileName() + " "; + return lastSelRom == null ? "" : lastSelRom.getFileName(); } public void setLastSelectedRom(Rom lastSelectedRom) { @@ -423,7 +594,7 @@ public void redrawVisableTables(Settings settings) { public void setUserLevel(int userLevel) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - SettingsManager.getSettings().setUserLevel(userLevel); + settings.setUserLevel(userLevel); setUserLevelWorker = new SetUserLevelWorker(); setUserLevelWorker.addPropertyChangeListener(getStatusPanel()); setUserLevelWorker.execute(); @@ -444,52 +615,52 @@ public Vector getImages() { @Override public void propertyChange(PropertyChangeEvent evt) { - imageList.updateUI(); - imageList.repaint(); - rightPanel.updateUI(); - rightPanel.repaint(); + refreshUI(); } public void refreshUI() { - getToolBar().updateButtons(); - getEditorMenuBar().updateMenu(); - getTableToolBar().updateTableToolBar(); imageList.updateUI(); imageList.repaint(); rightPanel.updateUI(); rightPanel.repaint(); + + if(getToolBar() != null) + getToolBar().updateButtons(); + if(getEditorMenuBar() != null) + getEditorMenuBar().updateMenu(); + } + + public void refreshAfterNewRom() { + refreshTableCompareMenus(); + refreshUI(); } public void refreshTableCompareMenus() { - for (int i = 0; i < imageRoot.getChildCount(); i++) { - if(imageRoot.getChildAt(i) instanceof Rom) { - Rom rom = (Rom) imageRoot.getChildAt(i); - if(null != rom) { - rom.refreshTableCompareMenus(); - } - } + for(JInternalFrame curFrame : getRightPanel().getAllFrames()) { + TableFrame frame = (TableFrame) curFrame; + frame.refreshSimilarOpenTables(); } } - public void openImage(File inputFile) throws Exception { + public void openImage(String filePath){ + openImage(new File(filePath)); + } + + public void openImage(File inputFile){ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); openImageWorker = new OpenImageWorker(inputFile); openImageWorker.addPropertyChangeListener(getStatusPanel()); openImageWorker.execute(); } - public void openImages(File[] inputFiles) throws Exception { - if(inputFiles.length < 1) { - showMessageDialog(this, "Image Not Found", "Error Loading Image(s)", ERROR_MESSAGE); - return; - } + public void openImages(File[] inputFiles){ for(int j = 0; j < inputFiles.length; j++) { openImage(inputFiles[j]); } } - public byte[] readFile(File inputFile) throws IOException { + public static byte[] readFile(File inputFile) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); FileInputStream fis = new FileInputStream(inputFile); try { @@ -505,10 +676,18 @@ public byte[] readFile(File inputFile) throws IOException { } public void launchLogger() { - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - launchLoggerWorker = new LaunchLoggerWorker(); - launchLoggerWorker.addPropertyChangeListener(getStatusPanel()); - launchLoggerWorker.execute(); + if(EcuLogger.getEcuLoggerWithoutCreation() != null) { + ECUExec.showAlreadyRunningMessage(); + return; + } + else { + ThreadUtil.runAsDaemon(new Runnable() { + @Override + public void run() { + ECUExec.openLogger(DISPOSE_ON_CLOSE, new String[] {"-logger"}); + } + }); + } } public RomTreeRootNode getImageRoot() { @@ -526,44 +705,17 @@ public JProgressPane getStatusPanel() { public MDIDesktopPane getRightPanel() { return this.rightPanel; } -} - -class LaunchLoggerWorker extends SwingWorker { - public LaunchLoggerWorker() { - } - - @Override - protected Void doInBackground() throws Exception { - ECUEditor editor = ECUEditorManager.getECUEditor(); - editor.getStatusPanel().setStatus("Launching Logger..."); - setProgress(10); - EcuLogger.startLogger(javax.swing.WindowConstants.DISPOSE_ON_CLOSE, editor); - return null; - } - public void propertyChange(PropertyChangeEvent evnt) - { - SwingWorker source = (SwingWorker) evnt.getSource(); - if (null != source && "state".equals( evnt.getPropertyName() ) - && (source.isDone() || source.isCancelled() ) ) - { - source.removePropertyChangeListener(ECUEditorManager.getECUEditor().getStatusPanel()); - } + public JScrollPane getLeftScrollPane() { + return this.leftScrollPane; } - @Override - public void done() { - ECUEditor editor = ECUEditorManager.getECUEditor(); - editor.getStatusPanel().setStatus("Ready..."); - setProgress(0); - editor.setCursor(null); - editor.refreshUI(); + public JScrollPane getRightScrollPane() { + return this.rightScrollPane; } } class SetUserLevelWorker extends SwingWorker { - public SetUserLevelWorker() { - } @Override protected Void doInBackground() throws Exception { @@ -575,155 +727,7 @@ protected Void doInBackground() throws Exception { public void propertyChange(PropertyChangeEvent evnt) { - SwingWorker source = (SwingWorker) evnt.getSource(); - if (null != source && "state".equals( evnt.getPropertyName() ) - && (source.isDone() || source.isCancelled() ) ) - { - source.removePropertyChangeListener(ECUEditorManager.getECUEditor().getStatusPanel()); - } - } - - @Override - public void done() { - ECUEditor editor = ECUEditorManager.getECUEditor(); - editor.getStatusPanel().setStatus("Ready..."); - setProgress(0); - editor.setCursor(null); - editor.refreshUI(); - } -} - -class CloseImageWorker extends SwingWorker { - Rom rom; - - public CloseImageWorker(Rom romToRemove) { - this.rom = romToRemove; - } - - @Override - protected Void doInBackground() throws Exception { - ECUEditor editor = ECUEditorManager.getECUEditor(); - RomTreeRootNode imageRoot = editor.getImageRoot(); - - rom.clearData(); - rom.removeFromParent(); - rom = null; - - if (imageRoot.getChildCount() > 0) { - editor.setLastSelectedRom((Rom) imageRoot.getChildAt(0)); - } else { - // no other images open - editor.setLastSelectedRom(null); - } - - editor.refreshTableCompareMenus(); - - return null; - } - - @Override - public void done() { - ECUEditor editor = ECUEditorManager.getECUEditor(); - editor.getStatusPanel().setStatus("Ready..."); - setProgress(0); - editor.setCursor(null); - editor.refreshUI(); - System.gc(); - } -} - -class OpenImageWorker extends SwingWorker { - private final File inputFile; - - public OpenImageWorker(File inputFile) { - this.inputFile = inputFile; - } - - @Override - protected Void doInBackground() throws Exception { - ECUEditor editor = ECUEditorManager.getECUEditor(); - Settings settings = SettingsManager.getSettings(); - - DOMParser parser = new DOMParser(); - Document doc; - FileInputStream fileStream; - - try { - editor.getStatusPanel().setStatus("Parsing ECU definitions..."); - setProgress(0); - - byte[] input = editor.readFile(inputFile); - - editor.getStatusPanel().setStatus("Finding ECU definition..."); - setProgress(10); - - // parse ecu definition files until result found - for (int i = 0; i < settings.getEcuDefinitionFiles().size(); i++) { - fileStream = new FileInputStream(settings.getEcuDefinitionFiles().get(i)); - InputSource src = new InputSource(fileStream); - - parser.parse(src); - doc = parser.getDocument(); - - Rom rom; - - try { - rom = new DOMRomUnmarshaller().unmarshallXMLDefinition(doc.getDocumentElement(), input, editor.getStatusPanel()); - } catch (RomNotFoundException rex) { - // rom was not found in current file, skip to next - continue; - } catch (Exception ex) { - ex.printStackTrace(); - showMessageDialog(editor, "Error Loading. Unknown Exception.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE); - return null; - } finally { - // Release mem after unmarshall. - parser.reset(); - doc.removeChild(doc.getDocumentElement()); - doc = null; - fileStream.close(); - System.gc(); - } - - editor.getStatusPanel().setStatus("Populating tables..."); - setProgress(50); - - rom.setFullFileName(inputFile); - rom.populateTables(input, editor.getStatusPanel()); - - editor.getStatusPanel().setStatus("Finalizing..."); - setProgress(90); - - editor.addRom(rom); - editor.refreshTableCompareMenus(); - - editor.getStatusPanel().setStatus("Done loading image..."); - setProgress(100); - return null; - } - - // if code executes to this point, no ROM was found, report to user - showMessageDialog(editor, "ECU Definition Not Found", "Error Loading " + inputFile.getName(), ERROR_MESSAGE); - - } catch (SAXParseException spe) { - // catch general parsing exception - enough people don't unzip the defs that a better error message is in order - showMessageDialog(editor, "Unable to read XML definitions. Please make sure the definition file is correct. If it is in a ZIP archive, unzip the file and try again.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE); - - } catch (StackOverflowError ex) { - // handles looped inheritance, which will use up all available memory - showMessageDialog(editor, "Looped \"base\" attribute in XML definitions.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE); - - } catch (OutOfMemoryError ome) { - // handles Java heap space issues when loading multiple Roms. - showMessageDialog(editor, "Error loading Image. Out of memeory.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE); - - } - return null; - } - - public void propertyChange(PropertyChangeEvent evnt) - { - SwingWorker source = (SwingWorker) evnt.getSource(); + SwingWorker source = (SwingWorker) evnt.getSource(); if (null != source && "state".equals( evnt.getPropertyName() ) && (source.isDone() || source.isCancelled() ) ) { @@ -734,10 +738,9 @@ public void propertyChange(PropertyChangeEvent evnt) @Override public void done() { ECUEditor editor = ECUEditorManager.getECUEditor(); - editor.getStatusPanel().setStatus("Ready..."); + editor.getStatusPanel().setStatus(ECUEditor.rb.getString("STATUSREADY")); setProgress(0); editor.setCursor(null); editor.refreshUI(); - System.gc(); } } diff --git a/src/main/java/com/romraider/editor/ecu/ECUEditorManager.java b/src/main/java/com/romraider/editor/ecu/ECUEditorManager.java index a04d9a321..14f2a0b5e 100644 --- a/src/main/java/com/romraider/editor/ecu/ECUEditorManager.java +++ b/src/main/java/com/romraider/editor/ecu/ECUEditorManager.java @@ -28,7 +28,15 @@ public class ECUEditorManager { private ECUEditorManager() { throw new UnsupportedOperationException(); } - + + public static ECUEditor getECUEditorWithoutCreation() { + return editor; + } + + public static void clearECUEditor() { + editor = null; + } + public static ECUEditor getECUEditor() { if (editor == null) { try { diff --git a/src/main/java/com/romraider/editor/ecu/OpenImageWorker.java b/src/main/java/com/romraider/editor/ecu/OpenImageWorker.java new file mode 100644 index 000000000..532ecc43c --- /dev/null +++ b/src/main/java/com/romraider/editor/ecu/OpenImageWorker.java @@ -0,0 +1,341 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.editor.ecu; +import static javax.swing.JOptionPane.DEFAULT_OPTION; +import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; +import static javax.swing.JOptionPane.showOptionDialog; + +import java.beans.PropertyChangeEvent; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.text.MessageFormat; + +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import com.romraider.Settings; +import com.romraider.maps.Rom; +import com.romraider.swing.DefinitionFilter; +import com.romraider.util.SettingsManager; +import com.romraider.xml.DOMRomUnmarshaller; +import com.romraider.xml.ConversionLayer.ConversionLayer; +import com.romraider.xml.ConversionLayer.ConversionLayerFactory; + +public class OpenImageWorker extends SwingWorker { + private static final Logger LOGGER = Logger.getLogger(OpenImageWorker.class); + private final File inputFile; + private Rom rom; + private String finalStatus; + + + public OpenImageWorker(File inputFile) { + this.inputFile = inputFile; + } + + public Rom getRom() + { + return rom; + } + + private void loadRom(Rom rom, byte[] input) { + ECUEditor editor = ECUEditorManager.getECUEditor(); + editor.getStatusPanel().setStatus( + ECUEditor.rb.getString("POPULATING")); + setProgress(50); + + rom.setFullFileName(inputFile); + rom.populateTables(input, editor.getStatusPanel()); + + editor.getStatusPanel().setStatus( + ECUEditor.rb.getString("FINALIZING")); + setProgress(90); + + editor.getStatusPanel().setStatus( + ECUEditor.rb.getString("DONELOAD")); + setProgress(95); + + if(rom.getNumChecksumsManagers() == 0) { + finalStatus = ECUEditor.rb.getString("STATUSREADY"); + } + else { + editor.getStatusPanel().setStatus( + ECUEditor.rb.getString("CHECKSUM")); + + finalStatus = String.format(ECUEditor.rb.getString("CHECKSUMSTATE"), + rom.validateChecksum(), rom.getTotalAmountOfChecksums()); + } + + this.rom = rom; + } + + private Document createDocument(File f) throws Exception { + Document doc = null; + FileInputStream fileStream = null; + + try { + fileStream = new FileInputStream(f); + + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + factory.setXIncludeAware(true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); + + //Check if definition is standard or + //if it has to be converted first + if(ConversionLayerFactory.requiresConversionLayer(f)) { + ConversionLayer l = ConversionLayerFactory.getConversionLayerForFile(f); + + if(l != null) + doc = l.convertToDocumentTree(f); + + if(doc == null) + throw new SAXParseException(ECUEditor.rb.getString("UNREADABLEDEF"), null); + } + //Default case + else { + doc = docBuilder.parse(fileStream, f.getAbsolutePath()); + } + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + finally { + try { + fileStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + return doc; + } + + private void showExceptionPopup(Exception ex, File defFile) { + + String errorMessage = defFile.getName() + ": " + (ex.getMessage() == null || ex.getMessage().isEmpty() ? + ECUEditor.rb.getString("LOADEXCEPTION") : ex.getMessage()); + + final String errorLoading = MessageFormat.format( + ECUEditor.rb.getString("ERRORFILE"), + inputFile.getName()); + + ECUEditor editor = ECUEditorManager.getECUEditor(); + showMessageDialog(editor, + errorMessage, + errorLoading, + ERROR_MESSAGE); + + if(ex instanceof SAXException) + LOGGER.error(errorMessage); + else + ex.printStackTrace(); + } + + private Rom openRomWithDefinition(File f, Document doc, Node romNode, byte[] input) { + ECUEditor editor = ECUEditorManager.getECUEditor(); + final String errorLoading = MessageFormat.format( + ECUEditor.rb.getString("ERRORFILE"), + inputFile.getName()); + + try { + Rom rom = new DOMRomUnmarshaller().unmarshallXMLDefinition(f, doc.getDocumentElement(), romNode, + input, editor.getStatusPanel()); + rom.setDocument(doc); + rom.setDefinitionPath(f); + loadRom(rom, input); + + } catch (StackOverflowError ex) { + ex.printStackTrace(); + // handles looped inheritance, which will use up all available memory + showMessageDialog(editor, + ECUEditor.rb.getString("LOOPEDBASE"), + errorLoading, + ERROR_MESSAGE); + } catch (OutOfMemoryError ome) { + ome.printStackTrace(); + // handles Java heap space issues when loading multiple Roms. + showMessageDialog(editor, + ECUEditor.rb.getString("OUTOFMEMORY"), + errorLoading, + ERROR_MESSAGE); + } catch (Exception ex) { + showExceptionPopup(ex, f); + return null; + } + + return null; + } + + @Override + protected Void doInBackground() throws Exception { + Thread.currentThread().setName("Open Image Thread"); + + ECUEditor editor = ECUEditorManager.getECUEditor(); + Settings settings = SettingsManager.getSettings(); + + editor.getStatusPanel().setStatus( + ECUEditor.rb.getString("STATUSPARSING")); + setProgress(0); + + byte[] input = ECUEditor.readFile(inputFile); + + editor.getStatusPanel().setStatus( + ECUEditor.rb.getString("STATUSFINDING")); + setProgress(10); + + boolean found = false; + + // parse ecu definition files until result found + for (int i = 0; i < settings.getEcuDefinitionFiles().size(); i++) { + File f = settings.getEcuDefinitionFiles().get(i); + + if (!f.exists()) { + showMessageDialog(editor, + MessageFormat.format( + ECUEditor.rb.getString("MISSINGMOVED"), + settings.getEcuDefinitionFiles().get(i).getAbsolutePath()), + MessageFormat.format( + ECUEditor.rb.getString("MISSINGFILE"), + settings.getEcuDefinitionFiles().get(i).getName()), + ERROR_MESSAGE); + continue; + } + + Node romNode = null; + Document doc = null; + + try { + doc = createDocument(f); + romNode = new DOMRomUnmarshaller().checkDefinitionMatch(doc.getDocumentElement(), input); + } + catch(Exception e) { + showExceptionPopup(e, f); + } + + if(romNode != null) { + openRomWithDefinition(f, doc, romNode, input); + found = true; + break; + } + } + + if(!found) { + showNoDefinitionFoundPopup(input); + } + + return null; + } + + private void showNoDefinitionFoundPopup(byte[] input) { + // no ECU definitions configured - let user choose one + Object[] options = {ECUEditor.rb.getString("YES"), ECUEditor.rb.getString("NO")}; + int answer = showOptionDialog(null, + ECUEditor.rb.getString("DEFNOTFOUND"), + ECUEditor.rb.getString("EDCONFIG"), + DEFAULT_OPTION, + WARNING_MESSAGE, + null, + options, + options[0]); + + if (answer == 0) { + Settings settings = SettingsManager.getSettings(); + JFileChooser fc = new JFileChooser(settings.getLastDefinitionDir()); + fc.setFileFilter(new DefinitionFilter()); + + if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + settings.setLastDefinitionDir(file.getParentFile()); + + Node romNode; + Document doc = null; + + try { + doc = createDocument(file); + romNode = new DOMRomUnmarshaller().checkDefinitionMatch(doc.getDocumentElement(), input); + } catch (Exception e) { + showExceptionPopup(e, file); + return; + } + + if(romNode == null) { + int answerForceLoad = showOptionDialog(null, + ECUEditor.rb.getString("DEFNOMATCH"), + ECUEditor.rb.getString("EDCONFIG"), + DEFAULT_OPTION, + JOptionPane.INFORMATION_MESSAGE, + null, + options, + options[0]); + + if(answerForceLoad == 0) { + Node n = DOMRomUnmarshaller.findFirstRomNode(doc.getDocumentElement()); + openRomWithDefinition(file, doc, n, input); + } + } + else { + openRomWithDefinition(file, doc, romNode, input); + } + } + } + } + + public void propertyChange(PropertyChangeEvent evnt) + { + SwingWorker source = (SwingWorker) evnt.getSource(); + if (null != source && "state".equals( evnt.getPropertyName() ) + && (source.isDone() || source.isCancelled() ) ) + { + source.removePropertyChangeListener(ECUEditorManager.getECUEditor().getStatusPanel()); + } + } + + @Override + public void done() { + ECUEditor editor = ECUEditorManager.getECUEditor(); + + //Add the rom in the main thread + if(rom != null) { + editor.addRom(rom); + rom = null; + + editor.getStatusPanel().update(finalStatus, 0); + editor.setCursor(null); + editor.refreshAfterNewRom(); + } + else { + editor.getStatusPanel().update(ECUEditor.rb.getString("STATUSREADY"), 0); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/io/connection/ConnectionManager.java b/src/main/java/com/romraider/io/connection/ConnectionManager.java index 2083c6c3b..e2e760575 100644 --- a/src/main/java/com/romraider/io/connection/ConnectionManager.java +++ b/src/main/java/com/romraider/io/connection/ConnectionManager.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,11 +22,43 @@ import com.romraider.logger.ecu.comms.manager.PollingState; public interface ConnectionManager { + /** + * Use the open method when communications to a Module requires a + * StartCommunication sequence, such as Five Baud or Fast Init. + * Include the StopCommunication sequence in the open so that + * if something fails, the stop sequence is pre-loaded for use. + * @param start - the byte sequence used to start comms + * @param stop - the byte sequence used to stop comss + */ + void open(byte[] start, byte[] stop); + + /** + * Use this send method to send a request to a Module and return the + * Module's reply in response. Polling state can be slow or fast as + * provided by the PollingState parameter. + * @param request - the bytes to send to the Module + * @param response - a byte array sized to contain the Module's response + * @param pollState - polling state, State_0 (slow) or State_1 (fast) + */ void send(byte[] request, byte[] response, PollingState pollState); + /** + * Use this send method to send bytes to a Module and return the + * Module's reply. + * @param bytes - the bytes to send to the Module + * @return A byte array of the Module's response, variable sized + */ byte[] send(byte[] bytes); + /** + * Use this method to clear the communications line of any erroneous data. + * It can be called before closing off communications to clear buffers + * of stale data, or when changing polling modes. + */ void clearLine(); + /** + * Use this method to close communications with the Module. + */ void close(); } diff --git a/src/main/java/com/romraider/io/connection/ConnectionManagerFactory.java b/src/main/java/com/romraider/io/connection/ConnectionManagerFactory.java index ed7a19404..9955e72b8 100644 --- a/src/main/java/com/romraider/io/connection/ConnectionManagerFactory.java +++ b/src/main/java/com/romraider/io/connection/ConnectionManagerFactory.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,18 +19,14 @@ package com.romraider.io.connection; -import static com.romraider.util.Platform.WINDOWS; -import static com.romraider.util.Platform.isPlatform; +import static com.romraider.util.ParamChecker.isNullOrEmpty; import static com.romraider.util.proxy.Proxifier.proxy; import static org.apache.log4j.Logger.getLogger; -import java.util.Set; - import org.apache.log4j.Logger; import com.romraider.Settings; -import com.romraider.io.j2534.api.J2534DllLocator; -import com.romraider.io.j2534.api.J2534Library; +import com.romraider.io.elm327.ElmConnectionManager; import com.romraider.io.j2534.api.J2534TransportFactory; import com.romraider.io.serial.connection.SerialConnectionManager; import com.romraider.util.SettingsManager; @@ -44,86 +40,32 @@ private ConnectionManagerFactory() { } public static ConnectionManager getManager( - String portName, - ConnectionProperties connectionProperties) { - - ConnectionManager manager = manager(portName, connectionProperties); - if (ENABLE_TIMER) return proxy(manager, TimerWrapper.class); - return manager; - } - - private static ConnectionManager manager( - String portName, - ConnectionProperties connectionProperties) { - - Settings settings = SettingsManager.getSettings(); - - try { - - if (!isPlatform(WINDOWS)) - throw new RuntimeException("J2534 is not support on this platform"); - Set libraries = - J2534DllLocator.listLibraries( - settings.getTransportProtocol().toUpperCase()); - - if (libraries.isEmpty()) - throw new RuntimeException( - "No J2534 libraries found that support protocol " + - settings.getTransportProtocol());; - - // if the J2534 device has not been previously defined, search for it - // else use the defined device - if (settings.getJ2534Device() == null) { - for (J2534Library dll : libraries) { - LOGGER.info(String.format("Trying new J2534/%s connection: %s", - settings.getTransportProtocol(), - dll.getVendor())); - try { - settings.setJ2534Device(dll.getLibrary()); - return J2534TransportFactory.getManager( - settings.getTransportProtocol().toUpperCase(), - connectionProperties, - dll.getLibrary()); - - } - catch (Throwable t) { - settings.setJ2534Device(null); - LOGGER.info(String.format("%s is not available: %s", - dll.getVendor(), t.getMessage())); - } - } - } - else { - for (J2534Library dll : libraries) { - if (dll.getLibrary().toLowerCase().contains( - settings.getJ2534Device().toLowerCase())) { - - LOGGER.info(String.format( - "Re-trying previous J2534/%s connection: %s", - settings.getTransportProtocol(), - dll.getVendor())); - try { - settings.setJ2534Device(dll.getLibrary()); - return J2534TransportFactory.getManager( - settings.getTransportProtocol().toUpperCase(), - connectionProperties, - dll.getLibrary()); - } - catch (Throwable t) { - settings.setJ2534Device(null); - LOGGER.info(String.format("%s is not available: %s", - dll.getVendor(), t.getMessage())); - } - } - } - } - throw new RuntimeException("J2534 connection not available"); + final String portName, + final ConnectionProperties connectionProperties) { + + final Settings settings = SettingsManager.getSettings(); + ConnectionManager manager = null; + + // Try a serial connection + if (isNullOrEmpty(settings.getJ2534Device())) { + + if(SettingsManager.getSettings().getElm327Enabled()) { + LOGGER.info("Trying to connect to ELM327..."); + manager = new ElmConnectionManager(portName, connectionProperties); + } + else { + LOGGER.info("Trying serial connection..."); + manager = new SerialConnectionManager(portName, connectionProperties); + } } - catch (Throwable t) { - settings.setJ2534Device(null); - LOGGER.info(String.format("%s, trying serial connection...", - t.getMessage())); - return new SerialConnectionManager(portName, connectionProperties); + else { + // Try a J2534 connection + manager = J2534TransportFactory.getManager( + settings.getTransportProtocol().toUpperCase(), + connectionProperties, + settings.getJ2534Device()); } + if (ENABLE_TIMER) return proxy(manager, TimerWrapper.class); + return manager; } } diff --git a/src/main/java/com/romraider/io/connection/ConnectionPropertiesImpl.java b/src/main/java/com/romraider/io/connection/ConnectionPropertiesImpl.java deleted file mode 100644 index 7c00378a8..000000000 --- a/src/main/java/com/romraider/io/connection/ConnectionPropertiesImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.io.connection; - -public final class ConnectionPropertiesImpl implements ConnectionProperties { - private final int baudRate; - private final int dataBits; - private final int stopBits; - private final int parity; - private final int connectTimeout; - private final int sendTimeout; - - - public ConnectionPropertiesImpl(int baudRate, int dataBits, int stopBits, int parity, int connectTimeout, int sendTimeout) { - this.baudRate = baudRate; - this.dataBits = dataBits; - this.stopBits = stopBits; - this.parity = parity; - this.connectTimeout = connectTimeout; - this.sendTimeout = sendTimeout; - } - - public int getBaudRate() { - return baudRate; - } - - public void setBaudRate(int b) { - - } - - public int getDataBits() { - return dataBits; - } - - public int getStopBits() { - return stopBits; - } - - public int getParity() { - return parity; - } - - public int getConnectTimeout() { - return connectTimeout; - } - - public int getSendTimeout() { - return sendTimeout; - } - - public String toString() { - final String properties = String.format( - "%s[baudRate=%d, dataBits=%d, stopBits=%d, parity=%d, " + - "connectTimeout=%d, sendTimeout=%d]", - getClass().getSimpleName(), - getBaudRate(), - getDataBits(), - getStopBits(), - getParity(), - getConnectTimeout(), - getSendTimeout() - ); - return properties; - } -} diff --git a/src/main/java/com/romraider/io/connection/KwpConnectionProperties.java b/src/main/java/com/romraider/io/connection/KwpConnectionProperties.java new file mode 100644 index 000000000..97c260e59 --- /dev/null +++ b/src/main/java/com/romraider/io/connection/KwpConnectionProperties.java @@ -0,0 +1,28 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2018 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.connection; + +public interface KwpConnectionProperties extends ConnectionProperties { + public int getP1Max(); + + public int getP3Min(); + + public int getP4Min(); +} diff --git a/src/main/java/com/romraider/io/connection/KwpSerialConnectionProperties.java b/src/main/java/com/romraider/io/connection/KwpSerialConnectionProperties.java new file mode 100644 index 000000000..30d538c0a --- /dev/null +++ b/src/main/java/com/romraider/io/connection/KwpSerialConnectionProperties.java @@ -0,0 +1,105 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2018 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.connection; + +public final class KwpSerialConnectionProperties implements KwpConnectionProperties { + private final int baudRate; + private final int dataBits; + private final int stopBits; + private final int parity; + private final int connectTimeout; + private final int sendTimeout; + private final int p1_max; + private final int p3_min; + private final int p4_min; + + + public KwpSerialConnectionProperties(int baudRate, int dataBits, int stopBits, + int parity, int connectTimeout, int sendTimeout, int p1_max, int p3_min, + int p4_min) { + this.baudRate = baudRate; + this.dataBits = dataBits; + this.stopBits = stopBits; + this.parity = parity; + this.connectTimeout = connectTimeout; + this.sendTimeout = sendTimeout; + this.p1_max = p1_max; + this.p3_min = p3_min; + this.p4_min = p4_min; + } + + public int getBaudRate() { + return baudRate; + } + + public void setBaudRate(int b) { + + } + + public int getDataBits() { + return dataBits; + } + + public int getStopBits() { + return stopBits; + } + + public int getParity() { + return parity; + } + + public int getConnectTimeout() { + return connectTimeout; + } + + public int getSendTimeout() { + return sendTimeout; + } + + public int getP1Max() { + return p1_max; + } + + public int getP3Min() { + return p3_min; + } + + public int getP4Min() { + return p4_min; + } + + public String toString() { + final String properties = String.format( + "%s[baudRate=%d, dataBits=%d, stopBits=%d, parity=%d, " + + "connectTimeout=%d, sendTimeout=%d, p1_max=%d, p3_min=%d, p4_min=%d]", + getClass().getSimpleName(), + getBaudRate(), + getDataBits(), + getStopBits(), + getParity(), + getConnectTimeout(), + getSendTimeout(), + getP1Max(), + getP3Min(), + getP4Min() + ); + return properties; + } +} diff --git a/src/main/java/com/romraider/io/connection/SerialConnectionProperties.java b/src/main/java/com/romraider/io/connection/SerialConnectionProperties.java new file mode 100644 index 000000000..8c51c89a5 --- /dev/null +++ b/src/main/java/com/romraider/io/connection/SerialConnectionProperties.java @@ -0,0 +1,85 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.connection; + +public final class SerialConnectionProperties implements ConnectionProperties { + private int baudRate; + private final int dataBits; + private final int stopBits; + private final int parity; + private final int connectTimeout; + private final int sendTimeout; + + + public SerialConnectionProperties(int baudRate, int dataBits, int stopBits, + int parity, int connectTimeout, int sendTimeout) { + this.baudRate = baudRate; + this.dataBits = dataBits; + this.stopBits = stopBits; + this.parity = parity; + this.connectTimeout = connectTimeout; + this.sendTimeout = sendTimeout; + } + + public int getBaudRate() { + return baudRate; + } + + public void setBaudRate(int b) { + + } + + public int getDataBits() { + return dataBits; + } + + public int getStopBits() { + return stopBits; + } + + public int getParity() { + return parity; + } + + public int getConnectTimeout() { + return connectTimeout; + } + + public int getSendTimeout() { + return sendTimeout; + } + + public String toString() { + final String properties = String.format( + "%s[baudRate=%d, dataBits=%d, stopBits=%d, parity=%d, " + + "connectTimeout=%d, sendTimeout=%d]", + getClass().getSimpleName(), + getBaudRate(), + getDataBits(), + getStopBits(), + getParity(), + getConnectTimeout(), + getSendTimeout() + ); + return properties; + } + + +} diff --git a/src/main/java/com/romraider/io/elm327/ElmConnection.java b/src/main/java/com/romraider/io/elm327/ElmConnection.java new file mode 100644 index 000000000..fd7c99f63 --- /dev/null +++ b/src/main/java/com/romraider/io/elm327/ElmConnection.java @@ -0,0 +1,204 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.elm327; + +import static com.fazecast.jSerialComm.SerialPort.FLOW_CONTROL_DISABLED; +import static com.fazecast.jSerialComm.SerialPort.TIMEOUT_READ_SEMI_BLOCKING; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import static com.romraider.util.ThreadUtil.sleep; +import static org.apache.log4j.Logger.getLogger; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.PrintWriter; + +import org.apache.log4j.Logger; + +import com.fazecast.jSerialComm.SerialPort; +import com.fazecast.jSerialComm.SerialPortInvalidPortException; +import com.romraider.io.serial.connection.SerialConnectionImpl; +import com.romraider.logger.ecu.exception.ConfigurationException; +import com.romraider.logger.ecu.exception.NotConnectedException; +import com.romraider.logger.ecu.exception.SerialCommunicationException; + + +public final class ElmConnection { + private static final Logger LOGGER = getLogger(SerialConnectionImpl.class); + private SerialPort serialPort; + private PrintWriter os; + private BufferedInputStream is; + + public ElmConnection(String portName, int baudrate) { + checkNotNullOrEmpty(portName, "portName"); + + try { + serialPort = connect(portName, baudrate); + os = new PrintWriter(serialPort.getOutputStream()); + is = new BufferedInputStream(serialPort.getInputStream()); + + } catch (Exception e) { + close(); + throw new NotConnectedException(e); + } + } + + public void flush() { + try { + os.flush(); + } catch (Exception e) { + throw new SerialCommunicationException(e); + } + } + + + public void write(String command) { + try { + os.println(command); + os.flush(); + } catch (Exception e) { + throw new SerialCommunicationException(e); + } + } + + public int available() { + try { + return is.available(); + } catch (IOException e) { + e.printStackTrace(); + } + + return 0; + } + + public String read() { + try { + return "" + (char)is.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + return ""; + } + + //Reads up to numChars + public String read(int numChars) { + StringBuilder response = new StringBuilder(); + + try { + for(int i = 0; i < numChars && available() > 0; i++) { + response.append((char)is.read()); + } + + } catch (Exception e) { + throw new SerialCommunicationException(e); + } + + return response.toString(); + } + + //Reads everything that is available + public String readAvailable() { + String response = ""; + + response += read(available()); + return response; + } + + public void readStaleData() { + while(available() > 0) + try { + is.read(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void close() { + if (os != null) { + try { + os.close(); + } catch (Exception e) { + LOGGER.error("Error closing output stream", e); + } + } + if (is != null) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (serialPort != null) { + if (!serialPort.closePort()) + LOGGER.error("Error closing serial port: " + serialPort.getSystemPortName()); + } + LOGGER.info("Connection closed."); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void sendBreak(long duration) { + if (!serialPort.setBreak()) + throw new SerialCommunicationException("Send Break"); + sleep(duration); + if (!serialPort.clearBreak()) + throw new SerialCommunicationException("Clear Break"); + } + + private SerialPort connect(String portName, int baudrate) { + final SerialPort serialPort = openPort(portName); + serialPort.openPort(); + configSerialPort(serialPort, baudrate, 8, 1, 0); + LOGGER.info("Connected to: " + portName); + return serialPort; + } + + private SerialPort openPort(String portName) { + SerialPort serialPort; + try { + serialPort = SerialPort.getCommPort(portName); + if (!serialPort.openPort()) + throw new SerialCommunicationException("Failed to open port: " + portName); + } catch (SerialPortInvalidPortException e) { + throw new SerialCommunicationException("Port is unavailable: " + portName); + } + return serialPort; + } + + private void configSerialPort( + SerialPort serialPort, int baudrate, int dataBits, int stopBits, int parity) { + try { + if(!serialPort.setFlowControl(FLOW_CONTROL_DISABLED)) + throw new ConfigurationException("Flow control"); + if (!serialPort.setComPortParameters(baudrate, dataBits, stopBits, parity)) + throw new ConfigurationException("Connection properties"); + if (!serialPort.setComPortTimeouts(TIMEOUT_READ_SEMI_BLOCKING, 0, 0)) + throw new ConfigurationException("Timeout values"); + if (!serialPort.setRTS()) + throw new ConfigurationException("RTS value"); + } catch (ConfigurationException e) { + throw new UnsupportedOperationException(e); + } + } +} diff --git a/src/main/java/com/romraider/io/elm327/ElmConnectionManager.java b/src/main/java/com/romraider/io/elm327/ElmConnectionManager.java new file mode 100644 index 000000000..2a6f2787f --- /dev/null +++ b/src/main/java/com/romraider/io/elm327/ElmConnectionManager.java @@ -0,0 +1,302 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.elm327; + +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import static com.romraider.util.ThreadUtil.sleep; + +import static java.lang.System.currentTimeMillis; +import static org.apache.log4j.Logger.getLogger; + +import org.apache.log4j.Logger; + +import com.romraider.io.connection.ConnectionManager; +import com.romraider.io.connection.ConnectionProperties; + +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.exception.SerialCommunicationException; + +public final class ElmConnectionManager implements ConnectionManager { + private ElmConnection connection; + + private static final Logger LOGGER = getLogger(ElmConnectionManager.class); + private static int baudrate = 9600; + + private int elmMode = 0; + private String portName; + + public static enum ERROR_TYPE{NO_ERROR, UNKNOWN_PROTOCOL, ELM_NOT_FOUND, + ELM_REJECTED_REQUEST, ECU_NOT_FOUND} + + //private final long timeout; + //private long readTimeout; + + public ElmConnectionManager(String portName, ConnectionProperties connectionProperties) { + checkNotNullOrEmpty(portName, "portName"); + checkNotNull(connectionProperties, "connectionProperties"); + + this.portName = portName; + this.connection = new ElmConnection(this.portName, baudrate); + // this.connectionProperties = connectionProperties; + // timeout = connectionProperties.getConnectTimeout(); + // readTimeout = timeout; + } + + @Override + public void open(byte[] start, byte[] stop) { + } + + public int getCurrentProtocolMode() { + return elmMode; + } + + private int parseProtocolType(String protocol) { + String s = protocol.toLowerCase().trim(); + + if(s.equals("automatic")) + return 0; + else if(s.equals("saej1850-pwm")) + return 1; + else if(s.equals("sae1850-vpw")) + return 2; + else if(s.equals("iso19141-2")) + return 3; + else if(s.equals("iso14230-4kwp-5")) + return 4; + else if(s.equals("iso14230-4kwp-fast")) + return 5; + else if(s.equals("iso15765") || s.equals("iso15765-4can11-500")) + return 6; + else if(s.equals("iso15765-4can29-500")) + return 7; + else if(s.equals("iso15765-4can11-250")) + return 8; + else if(s.equals("iso15765-4can29-250")) + return 9; + else if(s.equals("isoj1939-250")) + return 10; + else + return -1; + } + + + public String getCurrentProtcol() { + String result = ""; + + result = sendAndWaitForChar("AT DP", 2500, ">").trim(); + return result; + } + + public byte[] extractResponseBytes(String input) { + byte responseBytes[] = {0}; + + input = input.trim(); + + String[] splitBytes = input.split(" "); + + for(int i = 0; i < splitBytes.length; i++) { + responseBytes[i] = (byte) Integer.parseInt(splitBytes[i],16); + } + + return responseBytes; + } + + //TODO: Test this for more protocols and different ELM versions + public ERROR_TYPE resetAndInit(String transportProtocol, String moduleString, + String testerString) { + moduleString = moduleString.trim(); + testerString = testerString.trim(); + + //Its possible to set a custom baudrate for iso14230 protocols with :96/:48 at the end + String splitTransport[] = transportProtocol.trim().split(":"); + transportProtocol = splitTransport[0]; + + elmMode = parseProtocolType(transportProtocol); + + if(elmMode == -1) { + return ERROR_TYPE.UNKNOWN_PROTOCOL; + } + + try { + String result = ""; + send(""); + result = sendAndWaitForChar("AT PC", 2000, ">"); + + clearLine(); + result = sendAndWaitForChar("AT Z", 3500, ">"); + + //ATZ could be sent if echo mode is on + if(!result.contains("ELM327")) { + LOGGER.error("Tried settings: " + this.portName + + ", Baudrate: " + baudrate); + return ERROR_TYPE.ELM_NOT_FOUND; + } + + clearLine(); + LOGGER.info("Found " + result); + + //Turn off echo + result = sendAndWaitForChar("AT E0", 1000, ">"); + + if(!result.contains("OK")) { + LOGGER.error("ELM327 rejected echo off!"); + return ERROR_TYPE.ELM_REJECTED_REQUEST; + } + + //Set custom baudrate with :96 or :48 at the end for iso14230 protocols + if(splitTransport.length > 1) { + result = sendAndWaitForChar("ATIB " + splitTransport[1], 2500, ">"); + + if(!result.contains("OK")) { + LOGGER.error("ELM rejected ATIB " + splitTransport[1] + "!"); + return ERROR_TYPE.ELM_REJECTED_REQUEST; + } + else + { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("ELM accepted ATIB " + splitTransport[1] + "!"); + } + } + + String reqATSH = ""; + + //If K-Line + if(elmMode == 4 || elmMode == 5) { + + //Also set init address for K-Line + //Not 100% sure if this is needed + result = sendAndWaitForNewLine("ATIIA " + moduleString, 2500); + + if(!result.contains("OK")) { + LOGGER.error("ELM327 rejected ATIIA Init (Only K-Line)!"); + return ERROR_TYPE.ELM_REJECTED_REQUEST; + } + else { + LOGGER.info("ELM327 accepted ATIIA Init!"); + } + + reqATSH = "ATSH 82" + moduleString + testerString; + } + else { + reqATSH = "ATSH " + testerString; + } + + clearLine(); + result = sendAndWaitForChar(reqATSH, 2500, ">"); + + if(!result.contains("OK")) { + LOGGER.error("ELM327 rejected ATSH Init!"); + return ERROR_TYPE.ELM_REJECTED_REQUEST; + } + else + if (LOGGER.isDebugEnabled()) + LOGGER.debug("ELM327 accepted ATSH Init!"); + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("ELM Mode: " + elmMode); + + //Set the correct protocol + result = sendAndWaitForChar("ATSP " + elmMode, 2500, ">"); + + if(!result.contains("OK")) { + LOGGER.error("ELM327 rejected Protocol Init!"); + return ERROR_TYPE.ELM_REJECTED_REQUEST; + } + else + if (LOGGER.isDebugEnabled()) + LOGGER.debug("ELM327 accepted Protocol Init!"); + + LOGGER.info("Current Protocol: " + getCurrentProtcol()); + + result = sendAndWaitForChar("0100", 5000, ">").trim(); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("ECU Init Response: " + result); + + //TODO: Check the actual Pids that are supported, + //this is more of an did-the-ecu-respond check. + //Might contain "SEARCHING..." + if(result.contains("NO DATA") || result.split(" ").length <= 4) { + return ERROR_TYPE.ECU_NOT_FOUND; + } + + //byte[] byteResponse = extractResponseBytes(result); + + return ERROR_TYPE.NO_ERROR; + + } catch (Exception e) { + throw new SerialCommunicationException(e); + } + + } + + + // Send request + public void send(String command) { + checkNotNull(command, "bytes"); + connection.readStaleData(); + connection.write(command); + } + + // Send request and wait specified time for response with exact length + public String sendAndWaitForNewLine(String command, int timeout) { + return sendAndWaitForChar(command, timeout, "\n"); + } + + // Send request and wait specified time for response with exact length + public String sendAndWaitForChar(String command, int timeout, String charac) { + connection.readStaleData(); + connection.write(command); + long lastChange = currentTimeMillis(); + + String response = ""; + while(!response.contains(charac)) { + response += connection.readAvailable(); + if(currentTimeMillis() - lastChange > timeout) break; + sleep(1); + } + + return response.replace(charac, "").trim(); + } + + + @Override + public void clearLine() { + connection.readStaleData(); + } + + @Override + public void close() { + connection.close(); + } + + @Override + public void send(byte[] request, byte[] response, PollingState pollState) { + throw new java.lang.UnsupportedOperationException("Send does not work" + + " with bytes on ELM Connection"); + + } + + @Override + public byte[] send(byte[] bytes) { + throw new java.lang.UnsupportedOperationException("Send does not work" + + " with bytes on ELM Connection"); + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/io/j2534/api/J2534.java b/src/main/java/com/romraider/io/j2534/api/J2534.java index b04032736..a59085c4c 100644 --- a/src/main/java/com/romraider/io/j2534/api/J2534.java +++ b/src/main/java/com/romraider/io/j2534/api/J2534.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,11 +36,17 @@ public interface J2534 { int startPassMsgFilter(int channelId, byte[] mask, byte[] pattern); + int startPassMsgFilter(int channelId, byte[] mask, byte[] pattern, TxFlags flag); + int startBlockMsgFilter(int channelId, byte[] mask, byte[] pattern); + int startBlockMsgFilter(int channelId, byte[] mask, byte[] pattern, TxFlags flag); + int startFlowCntrlFilter(int channelId, byte[] mask, byte[] pattern, byte[] flowCntrl, TxFlags flag); + byte[] fiveBaudInit(int channelId, byte[] input); + byte[] fastInit(int channelId, byte[] input); double getVbattery(int deviceId); diff --git a/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO14230.java b/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO14230.java new file mode 100644 index 000000000..77f741a03 --- /dev/null +++ b/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO14230.java @@ -0,0 +1,339 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.j2534.api; + +import static com.romraider.io.protocol.ncs.iso14230.NCSChecksumCalculator.calculateChecksum; +import static com.romraider.util.HexUtil.asHex; +import static com.romraider.util.ParamChecker.checkNotNull; +import static java.lang.System.arraycopy; +import static org.apache.log4j.Logger.getLogger; + +import org.apache.log4j.Logger; + +import com.romraider.io.connection.ConnectionManager; +import com.romraider.io.connection.ConnectionProperties; +import com.romraider.io.connection.KwpConnectionProperties; +import com.romraider.io.j2534.api.J2534Impl.Config; +import com.romraider.io.j2534.api.J2534Impl.Flag; +import com.romraider.io.j2534.api.J2534Impl.Protocol; +import com.romraider.io.j2534.api.J2534Impl.TxFlags; +import com.romraider.logger.ecu.comms.manager.PollingState; + +public final class J2534ConnectionISO14230 implements ConnectionManager { + private static final Logger LOGGER = getLogger(J2534ConnectionISO14230.class); + private J2534 api = null; + private int LOOPBACK = 0; + private int channelId; + private int deviceId; + private int msgId; + private byte[] lastResponse; + private long timeout; + private boolean commsStarted; + private PollingState.State currentPollState; + private ConnectionProperties connectionProperties; + private String library; + private byte[] startRequest; + private byte[] stopRequest; + + public J2534ConnectionISO14230(ConnectionProperties connectionProperties, String library) { + checkNotNull(connectionProperties, "connectionProperties"); + checkNotNull(library, "library"); + deviceId = -1; + msgId = -1; + commsStarted = false; + this.connectionProperties = connectionProperties; + timeout = connectionProperties.getConnectTimeout(); + this.library = library; + } + + @Override + public void open(byte[] start, byte[] stop) { + checkNotNull(start, "start"); + checkNotNull(stop, "stop"); + startRequest = start; + stopRequest = stop; + initJ2534(connectionProperties, library); + LOGGER.info("J2534/ISO14230 connection initialised"); + } + + // Send request and wait for response with known length + @Override + public void send(byte[] request, byte[] response, PollingState pollState) { + checkNotNull(request, "request"); + checkNotNull(response, "response"); + checkNotNull(pollState, "pollState"); + + if (pollState.getCurrentState() == PollingState.State.STATE_0 && + pollState.getLastState() == PollingState.State.STATE_1) { + clearLine(); + } + + try { + if (pollState.getCurrentState() == PollingState.State.STATE_0) { + api.writeMsg(channelId, request, timeout, TxFlags.NO_FLAGS); + } + api.readMsg(channelId, response, timeout); + } + catch (J2534Exception e) { + LOGGER.error(String.format( + "J2534/ISO14230 Send/Receive error: %s", e.getMessage())); + } + + if (pollState.getCurrentState() == PollingState.State.STATE_1){ + lastResponse = new byte[response.length]; + if ((response[0] + 2) == response.length + && response[response.length - 1] == calculateChecksum(response)) { + + arraycopy(response, 0, lastResponse, 0, response.length); + } + else{ + LOGGER.error(String.format( + "J2534/ISO14230 Bad Data response: %s", asHex(response))); + arraycopy(lastResponse, 0, response, 0, response.length); + pollState.setNewQuery(true); + } + } + currentPollState = pollState.getCurrentState(); + } + + // Send request and wait specified time for response with unknown length + @Override + public byte[] send(byte[] request) { + checkNotNull(request, "request"); + api.writeMsg(channelId, request, timeout, TxFlags.NO_FLAGS); + return api.readMsg(channelId, 1, timeout); + } + + @Override + public void clearLine() { + boolean repeat = true; + if (currentPollState == PollingState.State.STATE_0) { + // Slow poll, no need to send break and clear the line + return; + } + while (repeat) { + try { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("J2534/ISO14230 sending line break"); + int p3_min = getP3Min(); + setP3Min(2); + api.writeMsg( + channelId, + new byte[60], + 0L, + TxFlags.WAIT_P3_MIN_ONLY); + setP3Min(p3_min); + api.clearBuffers(channelId); + } + catch (J2534Exception e) { + // If get/set fails because the ECU is no longer responding, for + // a variety of reasons, ignore it and close off the connection + // cleanly + LOGGER.error(String.format( + "J2534/ISO14230 Error performing get/set before clearing line: %s", e.getMessage())); + continue; + } + boolean empty = false; + int i = 1; + do { + byte[] badBytes = api.readMsg(channelId, 700L); + if (badBytes.length > 0) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( + "J2534/ISO14230 clearing line (stale data %d): %s", i, asHex(badBytes))); + empty = false; + i++; + } + else { + empty = true; + repeat = false; + } + } while (!empty && i <= 3); + } + try { + // if we are clearing the line due to a comms error, re-init to continue logging + fastInit(); + } + catch (J2534Exception e) { + // If fastInit fails because the ECU is no longer responding, for + // a variety of reasons, ignore it and close off the connection + // cleanly + LOGGER.error(String.format( + "J2534/ISO14230 Error performing fast initialization after clearing line: %s", e.getMessage())); + } + } + + @Override + public void close() { + try { + if (commsStarted) stopComms(); + commsStarted = false; + } + catch (J2534Exception e) { + // If the stop command fails because the ECU is no longer responding, for + // a variety of reasons, ignore it and close off the connection + // cleanly + LOGGER.error(String.format( + "J2534/ISO14230 Error stopping communications after clearing line: %s", e.getMessage())); + } + stopMsgFilter(); + disconnectChannel(); + closeDevice(); + } + + private void initJ2534(ConnectionProperties connectionProperties, String library) { + api = new J2534Impl(Protocol.ISO14230, library); + deviceId = api.open(); + try { + version(deviceId); + channelId = api.connect( + deviceId, Flag.ISO9141_NO_CHECKSUM.getValue(), + connectionProperties.getBaudRate()); + setConfig(channelId, (KwpConnectionProperties) connectionProperties); + msgId = api.startPassMsgFilter(channelId, (byte) 0x00, (byte) 0x00); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( + "J2534/ISO14230 connection success: deviceId:%d, channelId:%d, msgId:%d, baud:%d", + deviceId, channelId, msgId, connectionProperties.getBaudRate())); + fastInit(); + } catch (Exception e) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( + "J2534/ISO14230 exception: deviceId:%d, channelId:%d, msgId:%d", + deviceId, channelId, msgId)); + close(); + throw new J2534Exception(String.format( + "J2534/ISO14230 Error opening device: %s",e.getMessage()), e); + } + } + + private void version(int deviceId) { + final Version version = api.readVersion(deviceId); + LOGGER.info(String.format( + "J2534 Version => firmware: %s, dll: %s, api: %s", + version.firmware, version.dll, version.api)); + } + + private void setConfig(int channelId, KwpConnectionProperties connectionProperties) { + final ConfigItem p1Max = new ConfigItem(Config.P1_MAX.getValue(), + (connectionProperties.getP1Max() * 2)); + final ConfigItem p3Min = new ConfigItem(Config.P3_MIN.getValue(), + (connectionProperties.getP3Min() * 2)); + final ConfigItem p4Min = new ConfigItem(Config.P4_MIN.getValue(), + (connectionProperties.getP4Min() * 2)); + final ConfigItem loopback = new ConfigItem(Config.LOOPBACK.getValue(), + LOOPBACK); + final ConfigItem dataBits = new ConfigItem( + Config.DATA_BITS.getValue(), + (connectionProperties.getDataBits() == 8 ? 0 : 1)); + final ConfigItem parity = new ConfigItem( + Config.PARITY.getValue(), + connectionProperties.getParity()); + api.setConfig(channelId, dataBits, parity, p1Max, p3Min, p4Min, loopback); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("J2534/ISO14230 connection properties: %s", + connectionProperties.toString())); + } + + private void stopMsgFilter() { + if (msgId == -1) return; + try { + api.stopMsgFilter(channelId, msgId); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( + "J2534/ISO14230 stopped message filter:%s", msgId)); + } catch (Exception e) { + LOGGER.warn(String.format( + "J2534/ISO14230 Error stopping msg filter: %s", e.getMessage())); + } + } + + private void disconnectChannel() { + if (deviceId == -1) return; + try { + api.disconnect(channelId); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( + "J2534/ISO14230 disconnected channel:%d", channelId)); + } catch (Exception e) { + LOGGER.warn(String.format( + "J2534/ISO14230 Error disconnecting channel: %s", e.getMessage())); + } + } + + private void closeDevice() { + try { + if (deviceId != -1) { + api.close(deviceId); + LOGGER.info(String.format( + "J2534/ISO14230 closed connection to device:%d", deviceId)); + } + } catch (Exception e) { + LOGGER.warn(String.format( + "J2534/ISO14230 Error closing device: %s", e.getMessage())); + } + finally { + deviceId = -1; + } + } + + private void fastInit() { + final byte[] timing = api.fastInit(channelId, startRequest); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( + "J2534/ISO14230 Fast Init: deviceId:%d, channelId:%d, timing:%s", + deviceId, channelId, asHex(timing))); + if (timing.length < 1) { + stopComms(); + return; + } + commsStarted = true; + } + + private void stopComms() { + final byte[] response = send(stopRequest); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Stop comms Response = %s", asHex(response))); + } + + private void setP3Min(int msec) { + final ConfigItem p3_min = new ConfigItem( + Config.P3_MIN.getValue(), + msec); + api.setConfig(channelId, p3_min); + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format("Config set P3_MIN value = %d msec", msec / 2)); + } + + private int getP3Min() { + final ConfigItem[] configs = api.getConfig( + channelId, + Config.P3_MIN.getValue()); + int i = 10; + for (ConfigItem item : configs) { + if (Config.get(item.parameter) == Config.P3_MIN) { + i = item.value; + } + } + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format("Config get P3_MIN value = %d msec", i / 2)); + return i; + } +} diff --git a/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO15765.java b/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO15765.java index a99aa75bb..207a14fd1 100644 --- a/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO15765.java +++ b/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO15765.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ package com.romraider.io.j2534.api; +import static com.romraider.util.HexUtil.asHex; import static com.romraider.util.ParamChecker.checkNotNull; import static org.apache.log4j.Logger.getLogger; @@ -39,17 +40,35 @@ public final class J2534ConnectionISO15765 implements ConnectionManager { private int deviceId; private int msgId; private final long timeout; + private byte[] stopRequest; public J2534ConnectionISO15765( ConnectionProperties connectionProperties, String library) { api = null; + deviceId = -1; + msgId = -1; timeout = 2000; initJ2534(500000, library); LOGGER.info("J2534/ISO15765 connection initialized"); } + @Override + public void open(byte[] start, byte[] stop) { + checkNotNull(start, "start"); + checkNotNull(stop, "stop"); + this.stopRequest = stop; + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Start Diagnostics Request ---> %s", + asHex(start))); + api.writeMsg(channelId, start, timeout, TxFlags.ISO15765_FRAME_PAD); + final byte[] response = api.readMsg(channelId, 1, timeout); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Start Diagnostics Response <--- %s", + asHex(response))); + } + // Send request and wait for response with known length @Override public void send(byte[] request, byte[] response, PollingState pollState) { @@ -57,7 +76,7 @@ public void send(byte[] request, byte[] response, PollingState pollState) { checkNotNull(response, "response"); checkNotNull(pollState, "pollState"); pollState.setFastPoll(false); - pollState.setCurrentState(0); + pollState.setCurrentState(PollingState.State.STATE_0); api.writeMsg(channelId, request, timeout, TxFlags.ISO15765_FRAME_PAD); final byte[] readMsg = api.readMsg(channelId, 1, timeout); System.arraycopy(readMsg, 0, response, 0, readMsg.length) ; @@ -73,12 +92,23 @@ public byte[] send(byte[] request) { @Override public void clearLine() { - // LOGGER.debug("J2534/ISO15765 clearing buffers"); + // if (LOGGER.isDebugEnabled()) + // LOGGER.debug("J2534/ISO15765 clearing buffers"); // api.clearBuffers(channelId); } @Override public void close() { + if (stopRequest != null) { // OBD has no open or close procedure + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Stop Diagnostics Request ---> %s", + asHex(stopRequest))); + api.writeMsg(channelId, stopRequest, timeout, TxFlags.ISO15765_FRAME_PAD); + final byte[] response = api.readMsg(channelId, 1, timeout); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Stop Diagnostics Response <--- %s", + asHex(response))); + } stopFcFilter(); disconnectChannel(); closeDevice(); @@ -94,27 +124,23 @@ private void initJ2534(int baudRate, String library) { final byte[] mask = { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; - byte[] pattern = { - (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe8}; - byte[] flowCntrl = { - (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe0}; - if (SettingsManager.getSettings().getDestinationId() == 0x18) { - pattern = new byte[] { - (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe9}; - flowCntrl = new byte[] { - (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe1}; - } + final byte[] pattern = + SettingsManager.getSettings().getDestinationTarget().getAddress(); + final byte[] flowCntrl = + SettingsManager.getSettings().getDestinationTarget().getTester(); msgId = api.startFlowCntrlFilter( channelId, mask, pattern, flowCntrl, TxFlags.ISO15765_FRAME_PAD); - LOGGER.debug(String.format( + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( "J2534/ISO15765 success: deviceId:%d, channelId:%d, msgId:%d", deviceId, channelId, msgId)); } catch (Exception e) { - LOGGER.debug(String.format( + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( "J2534/ISO15765 exception: deviceId:%d, channelId:%d, msgId:%d", deviceId, channelId, msgId)); close(); @@ -124,7 +150,6 @@ private void initJ2534(int baudRate, String library) { } private void version(int deviceId) { - if (!LOGGER.isDebugEnabled()) return; final Version version = api.readVersion(deviceId); LOGGER.info("J2534 Version => firmware: " + version.firmware + ", dll: " + version.dll + ", api: " + version.api); @@ -141,9 +166,11 @@ private void setConfig(int channelId) { } private void stopFcFilter() { + if (msgId == -1) return; try { api.stopMsgFilter(channelId, msgId); - LOGGER.debug("J2534/ISO15765 stopped message filter:" + msgId); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("J2534/ISO15765 stopped message filter:" + msgId); } catch (Exception e) { LOGGER.warn("J2534/ISO15765 Error stopping msg filter: " + e.getMessage()); @@ -151,9 +178,11 @@ private void stopFcFilter() { } private void disconnectChannel() { + if (deviceId == -1) return; try { api.disconnect(channelId); - LOGGER.debug("J2534/ISO15765 disconnected channel:" + channelId); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("J2534/ISO15765 disconnected channel:" + channelId); } catch (Exception e) { LOGGER.warn("J2534/ISO15765 Error disconnecting channel: " + e.getMessage()); @@ -162,10 +191,15 @@ private void disconnectChannel() { private void closeDevice() { try { - api.close(deviceId); - LOGGER.info("J2534/ISO15765 closed connection to device:" + deviceId); + if (deviceId != -1) { + api.close(deviceId); + LOGGER.info("J2534/ISO15765 closed connection to device:" + deviceId); + } } catch (Exception e) { LOGGER.warn("J2534/ISO15765 Error closing device: " + e.getMessage()); } + finally { + deviceId = -1; + } } } diff --git a/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO9141.java b/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO9141.java index 5bc43afde..283687344 100644 --- a/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO9141.java +++ b/src/main/java/com/romraider/io/j2534/api/J2534ConnectionISO9141.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,33 +46,41 @@ public final class J2534ConnectionISO9141 implements ConnectionManager { public J2534ConnectionISO9141(ConnectionProperties connectionProperties, String library) { checkNotNull(connectionProperties, "connectionProperties"); - timeout = (long)connectionProperties.getConnectTimeout(); - initJ2534(connectionProperties.getBaudRate(), library); + deviceId = -1; + msgId = -1; + timeout = connectionProperties.getConnectTimeout(); + initJ2534(connectionProperties, library); LOGGER.info("J2534/ISO9141 connection initialised"); } + @Override + public void open(byte[] start, byte[] stop) { + } + // Send request and wait for response with known length + @Override public void send(byte[] request, byte[] response, PollingState pollState) { checkNotNull(request, "request"); checkNotNull(response, "response"); checkNotNull(pollState, "pollState"); - if (pollState.getCurrentState() == 0 && pollState.getLastState() == 1) { + if (pollState.getCurrentState() == PollingState.State.STATE_0 && + pollState.getLastState() == PollingState.State.STATE_1) { clearLine(); } - if (pollState.getCurrentState() == 0) { + if (pollState.getCurrentState() == PollingState.State.STATE_0) { api.writeMsg(channelId, request, timeout, TxFlags.NO_FLAGS); } api.readMsg(channelId, response, timeout); - if (pollState.getCurrentState() == 1){ + if (pollState.getCurrentState() == PollingState.State.STATE_1){ if ( response[0] == (byte) 0x80 && response[1] == (byte) 0xF0 && (response[2] == (byte) 0x10 || response[2] == (byte) 0x18) && response[3] == (response.length - 5) && response[response.length - 1] == calculateChecksum(response)) { - + lastResponse = new byte[response.length]; arraycopy(response, 0, lastResponse, 0, response.length); } @@ -85,51 +93,60 @@ public void send(byte[] request, byte[] response, PollingState pollState) { } // Send request and wait specified time for response with unknown length + @Override public byte[] send(byte[] request) { checkNotNull(request, "request"); api.writeMsg(channelId, request, timeout, TxFlags.NO_FLAGS); return api.readMsg(channelId, 1, timeout); } + @Override public void clearLine() { - LOGGER.debug("J2534/ISO9141 sending line break"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("J2534/ISO9141 sending line break"); api.writeMsg( - channelId, - new byte[] {0,0,0,0,0,0,0,0,0,0}, - 100L, + channelId, + new byte[20], + 100L, TxFlags.NO_FLAGS); boolean empty = false; do { byte[] badBytes = api.readMsg(channelId, 100L); if (badBytes.length > 0) { - LOGGER.debug("J2534/ISO9141 clearing line (stale data): " + asHex(badBytes)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("J2534/ISO9141 clearing line (stale data): " + asHex(badBytes)); empty = false; } else { empty = true; } - } while (!empty ); + } while (!empty ); } + @Override public void close() { stopMsgFilter(); disconnectChannel(); closeDevice(); } - private void initJ2534(int baudRate, String library) { + private void initJ2534(ConnectionProperties connectionProperties, String library) { api = new J2534Impl(Protocol.ISO9141, library); deviceId = api.open(); try { version(deviceId); - channelId = api.connect(deviceId, Flag.ISO9141_NO_CHECKSUM.getValue(), baudRate); - setConfig(channelId); + channelId = api.connect( + deviceId, Flag.ISO9141_NO_CHECKSUM.getValue(), + connectionProperties.getBaudRate()); + setConfig(channelId, connectionProperties); msgId = api.startPassMsgFilter(channelId, (byte) 0x00, (byte) 0x00); - LOGGER.debug(String.format( + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( "J2534/ISO9141 success: deviceId:%d, channelId:%d, msgId:%d", deviceId, channelId, msgId)); } catch (Exception e) { - LOGGER.debug(String.format( + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( "J2534/ISO9141 exception: deviceId:%d, channelId:%d, msgId:%d", deviceId, channelId, msgId)); close(); @@ -138,32 +155,45 @@ private void initJ2534(int baudRate, String library) { } private void version(int deviceId) { - if (!LOGGER.isDebugEnabled()) return; final Version version = api.readVersion(deviceId); LOGGER.info("J2534 Version => firmware: " + version.firmware + ", dll: " + version.dll + ", api: " + version.api); } - private void setConfig(int channelId) { - final ConfigItem p1Max = new ConfigItem(Config.P1_MAX.getValue(), 2); - final ConfigItem p3Min = new ConfigItem(Config.P3_MIN.getValue(), 0); + private void setConfig(int channelId, ConnectionProperties connectionProperties) { + final ConfigItem p1Max = new ConfigItem(Config.P1_MAX.getValue(), 1); + final ConfigItem p3Min = new ConfigItem(Config.P3_MIN.getValue(), 1); final ConfigItem p4Min = new ConfigItem(Config.P4_MIN.getValue(), 0); final ConfigItem loopback = new ConfigItem(Config.LOOPBACK.getValue(), 1); - api.setConfig(channelId, p1Max, p3Min, p4Min, loopback); + final ConfigItem dataBits = new ConfigItem( + Config.DATA_BITS.getValue(), + (connectionProperties.getDataBits() == 8 ? 0 : 1)); + final ConfigItem parity = new ConfigItem( + Config.PARITY.getValue(), + connectionProperties.getParity()); + api.setConfig(channelId, p1Max, p3Min, p4Min, loopback, dataBits, parity); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("J2534/ISO9141 set connection properties: bits=" + + connectionProperties.getDataBits() + ", parity=" + + connectionProperties.getParity()); } private void stopMsgFilter() { + if (msgId == -1) return; try { api.stopMsgFilter(channelId, msgId); - LOGGER.debug("J2534/ISO9141 stopped message filter:" + msgId); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("J2534/ISO9141 stopped message filter:" + msgId); } catch (Exception e) { LOGGER.warn("J2534/ISO9141 Error stopping msg filter: " + e.getMessage()); } } private void disconnectChannel() { + if (deviceId == -1) return; try { api.disconnect(channelId); - LOGGER.debug("J2534/ISO9141 disconnected channel:" + channelId); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("J2534/ISO9141 disconnected channel:" + channelId); } catch (Exception e) { LOGGER.warn("J2534/ISO9141 Error disconnecting channel: " + e.getMessage()); } @@ -171,10 +201,15 @@ private void disconnectChannel() { private void closeDevice() { try { - api.close(deviceId); - LOGGER.info("J2534/ISO9141 closed connection to device:" + deviceId); + if (deviceId != -1) { + api.close(deviceId); + LOGGER.info("J2534/ISO9141 closed connection to device:" + deviceId); + } } catch (Exception e) { LOGGER.warn("J2534/ISO9141 Error closing device: " + e.getMessage()); } + finally { + deviceId = -1; + } } } diff --git a/src/main/java/com/romraider/io/j2534/api/J2534DllLocator.java b/src/main/java/com/romraider/io/j2534/api/J2534DllLocator.java deleted file mode 100644 index f328cd298..000000000 --- a/src/main/java/com/romraider/io/j2534/api/J2534DllLocator.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.io.j2534.api; - -import static com.sun.jna.platform.win32.WinError.ERROR_FILE_NOT_FOUND; -import static com.sun.jna.platform.win32.WinError.ERROR_SUCCESS; -import static com.sun.jna.platform.win32.WinReg.HKEY_LOCAL_MACHINE; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.log4j.Logger; - -import com.romraider.util.ParamChecker; -import com.sun.jna.Native; -import com.sun.jna.platform.win32.Advapi32; -import com.sun.jna.platform.win32.WinBase.FILETIME; -import com.sun.jna.platform.win32.WinReg.HKEY; -import com.sun.jna.platform.win32.WinReg.HKEYByReference; -import com.sun.jna.ptr.IntByReference; - -/** - * Discover all the J2534 device installations on the local computer from - * keys and value settings in the Windows registry. Return a List of - * J2534Library instances. - * @see J2534Library - */ -public class J2534DllLocator { - private static final Logger LOGGER = Logger.getLogger(J2534DllLocator.class); - private static final String FUNCTIONLIBRARY = "FunctionLibrary"; - private static final int KEY_READ = 0x20019; - private static final int ERROR_NO_MORE_ITEMS = 0x103; - private static Advapi32 advapi32 = Advapi32.INSTANCE; - - public static Set listLibraries(String protocol) throws Exception { - Set libraries = new HashSet(); - HKEY hklm = HKEY_LOCAL_MACHINE; - String passThru = "SOFTWARE\\PassThruSupport.04.04"; - HKEYByReference passThruHandle = getHandle(hklm, passThru); - - List vendors = getKeys(passThruHandle.getValue()); - for (String vendor : vendors) { - HKEYByReference vendorKey = - getHandle(passThruHandle.getValue(), vendor); - int supported = getDWord(vendorKey.getValue(), protocol); - if (supported == 0 ) continue; - String library = getSZ(vendorKey.getValue(), FUNCTIONLIBRARY); - LOGGER.debug(String.format("Found J2534 Vendor:%s | Library:%s", - vendor, library)); - if (ParamChecker.isNullOrEmpty(library)) continue; - libraries.add(new J2534Library(vendor, library)); - advapi32.RegCloseKey(vendorKey.getValue()); - } - advapi32.RegCloseKey(passThruHandle.getValue()); - return libraries; - } - - private static HKEYByReference getHandle(HKEY hKey, String lpSubKey) - throws Exception { - - HKEYByReference phkResult = new HKEYByReference(); - int ret = advapi32.RegOpenKeyEx( - hKey, - lpSubKey, - 0, - KEY_READ, - phkResult); - - if(ret != ERROR_SUCCESS) { - handleError("RegOpenKeyEx", ret); - } - return phkResult; - } - - private static int reverse(byte[] bytes, int size) { - ByteBuffer b = ByteBuffer.wrap(bytes, 0, size); - return b.order(ByteOrder.LITTLE_ENDIAN).getInt(); - } - - private static void handleError(String operation, int status) - throws Exception { - - String errString = String.format("%s error [%d]%n", - operation, status); - throw new Exception(errString); - } - - private static List getKeys(HKEY hkey) - throws Exception { - - int dwIndex = 0; - List vendors = new ArrayList(); - int ret = 0; - do { - char[] lpName = new char[255]; - IntByReference lpcName = new IntByReference(-1); - IntByReference lpReserved = null; - char[] lpClass = new char[255]; - IntByReference lpcClass = new IntByReference(-1); - FILETIME lpftLastWriteTime = new FILETIME(); - ret = advapi32.RegEnumKeyEx( - hkey, - dwIndex, - lpName, - lpcName, - lpReserved, - lpClass, - lpcClass, - lpftLastWriteTime); - - switch (ret) { - case ERROR_SUCCESS: - dwIndex++; - vendors.add(Native.toString(lpName)); - break; - case ERROR_NO_MORE_ITEMS: - break; - default: - handleError("RegEnumKeyEx", ret); - } - } while(ret == ERROR_SUCCESS); - return vendors; - } - - private static int getDWord(HKEY hkey, String valueName) - throws Exception { - - IntByReference lpType = new IntByReference(-1); - byte[] lpData = new byte[16]; - IntByReference lpcbData = new IntByReference(-1); - int ret = advapi32.RegQueryValueEx( - hkey, - valueName, - 0, - lpType, - lpData, - lpcbData); - - int dword = -1; - switch (ret) { - case ERROR_SUCCESS: - dword = reverse(lpData, lpcbData.getValue()); - break; - case ERROR_FILE_NOT_FOUND: - dword = 0; - break; - default: - String errString = String.format("DWORD_RegQueryValueEx(%s)", - valueName); - handleError(errString, ret); - } - return dword; - } - - private static String getSZ(HKEY hkey, String valueName) - throws Exception { - - IntByReference lpType = new IntByReference(-1); - char[] lpData = new char[1024]; - IntByReference lpcbData = new IntByReference(-1); - int ret = advapi32.RegQueryValueEx( - hkey, - valueName, - 0, - lpType, - lpData, - lpcbData); - - String szValue = null; - switch (ret) { - case ERROR_SUCCESS: - szValue = Native.toString(lpData); - break; - case ERROR_FILE_NOT_FOUND: - break; - default: - String errString = String.format("SZ_RegQueryValueEx(%s)", - valueName); - handleError(errString, ret); - } - return szValue; - } -} diff --git a/src/main/java/com/romraider/io/j2534/api/J2534Impl.java b/src/main/java/com/romraider/io/j2534/api/J2534Impl.java index b5ca3b10c..b98fb173b 100644 --- a/src/main/java/com/romraider/io/j2534/api/J2534Impl.java +++ b/src/main/java/com/romraider/io/j2534/api/J2534Impl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,11 +32,11 @@ import org.apache.log4j.Logger; import com.romraider.io.j2534.api.J2534_v0404.PASSTHRU_MSG; +import com.romraider.io.j2534.api.J2534_v0404.SBYTE_ARRAY; import com.romraider.io.j2534.api.J2534_v0404.SCONFIG; import com.romraider.io.j2534.api.J2534_v0404.SCONFIG.ByReference; import com.romraider.io.j2534.api.J2534_v0404.SCONFIG_LIST; import com.romraider.util.HexUtil; -import com.romraider.util.ThreadUtil; import com.sun.jna.Native; import com.sun.jna.NativeLong; import com.sun.jna.ptr.NativeLongByReference; @@ -50,6 +50,7 @@ public final class J2534Impl implements J2534 { private boolean loopback; private static J2534_v0404 lib; + /** * Enum class representing the J2534-1 protocols with methods to * translate the mnemonic and numerical values. @@ -57,14 +58,14 @@ public final class J2534Impl implements J2534 { public enum Protocol { J1850VPW (0x01), J1850PWM (0x02), - ISO9141 (0x03), + ISO9141 (0x03), ISO14230 (0x04), - CAN (0x05), + CAN (0x05), ISO15765 (0x06), - SCI_A_ENGINE (0x07), // OP2.0: Not supported - SCI_A_TRANS (0x08), // OP2.0: Not supported + SCI_A_ENGINE (0x07), // OP2.0: Not supported + SCI_A_TRANS (0x08), // OP2.0: Not supported SCI_B_ENGINE (0x09), // OP2.0: Not supported - SCI_B_TRANS (0x0A), // OP2.0: Not supported + SCI_B_TRANS (0x0A), // OP2.0: Not supported UNDEFINED (0xFFFFFFFF); // Returned when no match is found for get() private static final Map lookup @@ -74,13 +75,13 @@ public enum Protocol { for(Protocol s : EnumSet.allOf(Protocol.class)) lookup.put(s.getValue(), s); } - + private int value; - + private Protocol(int value) { this.value = value; } - + /** * @return the numeric value associated with the Protocol * mnemonic string. @@ -88,7 +89,7 @@ private Protocol(int value) { public int getValue() { return value; } - + /** * @param value - numeric value to be translated. * @return the Protocol mnemonic mapped to the numeric @@ -107,7 +108,7 @@ public static Protocol get(int value) { * translate the mnemonic and numerical values. */ public enum Flag { - ISO9141_NO_CHECKSUM (0x0200), + ISO9141_NO_CHECKSUM (0x0200), UNDEFINED (0xFFFFFFFF); // Returned when no match is found for get() private static final Map lookup @@ -117,13 +118,13 @@ public enum Flag { for(Flag s : EnumSet.allOf(Flag.class)) lookup.put(s.getValue(), s); } - + private int value; - + private Flag(int value) { this.value = value; } - + /** * @return the numeric value associated with the Flag * mnemonic string. @@ -131,7 +132,7 @@ private Flag(int value) { public int getValue() { return value; } - + /** * @param value - numeric value to be translated. * @return the Flag mnemonic mapped to the numeric @@ -150,36 +151,36 @@ public static Flag get(int value) { * translate the mnemonic and numerical values. */ public enum Extension { - CAN_CH1 (0x00009000), + CAN_CH1 (0x00009000), J1850VPW_CH1 (0x00009080), J1850PWM_CH1 (0x00009160), - ISO9141_CH1 (0x00009240), - ISO9141_CH2 (0x00009241), - ISO9141_CH3 (0x00009242), - ISO9141_K (0x00009240), - ISO9141_L (0x00009241), // OP2.0: ISO9141 communications over the L line + ISO9141_CH1 (0x00009240), + ISO9141_CH2 (0x00009241), + ISO9141_CH3 (0x00009242), + ISO9141_K (0x00009240), + ISO9141_L (0x00009241), // OP2.0: ISO9141 communications over the L line ISO9141_INNO (0x00009242), // OP2.0: RS-232 receive-only via the 2.5mm jack ISO14230_CH1 (0x00009320), ISO14230_CH2 (0x00009321), - ISO14230_K (0x00009320), - ISO14230_L (0x00009321), // OP2.0: ISO14230 communications over the L line + ISO14230_K (0x00009320), + ISO14230_L (0x00009321), // OP2.0: ISO14230 communications over the L line ISO15765_CH1 (0x00009400), - UNDEFINED (0xFFFFFFFF); // Returned when no match is found for get() - + UNDEFINED (0xFFFFFFFF); // Returned when no match is found for get() + private static final Map lookup = new HashMap(); - + static { for(Extension s : EnumSet.allOf(Extension.class)) lookup.put(s.getValue(), s); } - + private int value; - + private Extension(int value) { this.value = value; } - + /** * @return the numeric value associated with the Extension * mnemonic string. @@ -187,7 +188,7 @@ private Extension(int value) { public int getValue() { return value; } - + /** * @param value - numeric value to be translated. * @return the Extension mnemonic mapped to the numeric @@ -206,11 +207,11 @@ public static Extension get(int value) { * translate the mnemonic and numerical values. */ public enum Filter { - PASS_FILTER (0x01), + PASS_FILTER (0x01), BLOCK_FILTER (0x02), - FLOW_CONTROL_FILTER (0x03), + FLOW_CONTROL_FILTER (0x03), UNDEFINED (0xFFFFFFFF); // Returned when no match is found for get() - + private static final Map lookup = new HashMap(); @@ -218,13 +219,13 @@ public enum Filter { for(Filter s : EnumSet.allOf(Filter.class)) lookup.put(s.getValue(), s); } - + private int value; - + private Filter(int value) { this.value = value; } - + /** * @return the numeric value associated with the Filter * mnemonic string. @@ -232,7 +233,7 @@ private Filter(int value) { public int getValue() { return value; } - + /** * @param value - numeric value to be translated. * @return the Filter mnemonic mapped to the numeric @@ -268,21 +269,21 @@ public enum IOCtl { READ_PROG_VOLTAGE (0x0E), UNDEFINED (0xFFFFFFFF); // Returned when no match is found for get() - + private static final Map lookup = new HashMap(); - + static { for(IOCtl s : EnumSet.allOf(IOCtl.class)) lookup.put(s.getValue(), s); } - + private int value; - + private IOCtl(int value) { this.value = value; } - + /** * @return the numeric value associated with the IOCtl * mnemonic string. @@ -290,7 +291,7 @@ private IOCtl(int value) { public int getValue() { return value; } - + /** * @param value - numeric value to be translated. * @return the IOCtl mnemonic mapped to the numeric @@ -310,57 +311,57 @@ public static IOCtl get(int value) { */ public enum Config { DATA_RATE (0x01), - LOOPBACK (0x03), - NODE_ADDRESS (0x04), // OP2.0: Not yet supported - NETWORK_LINE (0x05), // OP2.0: Not yet supported - P1_MIN (0x06), // J2534 says this may not be changed - P1_MAX (0x07), - P2_MIN (0x08), // J2534 says this may not be changed - P2_MAX (0x09), // J2534 says this may not be changed - P3_MIN (0x0A), - P3_MAX (0x0B), // J2534 says this may not be changed - P4_MIN (0x0C), - P4_MAX (0x0D), // J2534 says this may not be changed - W0 (0x19), - W1 (0x0E), - W2 (0x0F), - W3 (0x10), - W4 (0x11), - W5 (0x12), + LOOPBACK (0x03), + NODE_ADDRESS (0x04), // OP2.0: Not yet supported + NETWORK_LINE (0x05), // OP2.0: Not yet supported + P1_MIN (0x06), // J2534 says this may not be changed + P1_MAX (0x07), + P2_MIN (0x08), // J2534 says this may not be changed + P2_MAX (0x09), // J2534 says this may not be changed + P3_MIN (0x0A), + P3_MAX (0x0B), // J2534 says this may not be changed + P4_MIN (0x0C), + P4_MAX (0x0D), // J2534 says this may not be changed + W0 (0x19), + W1 (0x0E), + W2 (0x0F), + W3 (0x10), + W4 (0x11), + W5 (0x12), TIDLE (0x13), TINIL (0x14), - TWUP (0x15), - PARITY (0x16), - BIT_SAMPLE_POINT(0x17), // OP2.0: Not yet supported - SYNC_JUMP_WIDTH (0x18), // OP2.0: Not yet supported - T1_MAX (0x1A), - T2_MAX (0x1B), - T3_MAX (0x24), - T4_MAX (0x1C), - T5_MAX (0x1D), - ISO15765_BS (0x1E), - ISO15765_STMIN (0x1F), + TWUP (0x15), + PARITY (0x16), + BIT_SAMPLE_POINT (0x17), // OP2.0: Not yet supported + SYNC_JUMP_WIDTH (0x18), // OP2.0: Not yet supported + T1_MAX (0x1A), + T2_MAX (0x1B), + T3_MAX (0x24), + T4_MAX (0x1C), + T5_MAX (0x1D), + ISO15765_BS (0x1E), + ISO15765_STMIN (0x1F), DATA_BITS (0x20), FIVE_BAUD_MOD (0x21), BS_TX (0x22), - STMIN_TX (0x23), - ISO15765_WFT_MAX(0x25), + STMIN_TX (0x23), + ISO15765_WFT_MAX (0x25), UNDEFINED (0xFFFFFFFF); // Returned when no match is found for get() - + private static final Map lookup = new HashMap(); - + static { for(Config s : EnumSet.allOf(Config.class)) lookup.put(s.getValue(), s); } - + private int value; - + private Config(int value) { this.value = value; } - + /** * @return the numeric value associated with the Config * mnemonic string. @@ -368,7 +369,7 @@ private Config(int value) { public int getValue() { return value; } - + /** * @param value - numeric value to be translated. * @return the Config mnemonic mapped to the numeric @@ -387,52 +388,52 @@ public static Config get(int value) { * translate the mnemonic and numerical values. */ public enum Status { - NOERROR (0x00), + NOERROR (0x00), ERR_NOT_SUPPORTED (0x01), - ERR_INVALID_CHANNEL_ID (0x02), - ERR_INVALID_PROTOCOL_ID (0x03), - ERR_NULL_PARAMETER (0x04), - ERR_INVALID_IOCTL_VALUE (0x05), + ERR_INVALID_CHANNEL_ID (0x02), + ERR_INVALID_PROTOCOL_ID (0x03), + ERR_NULL_PARAMETER (0x04), + ERR_INVALID_IOCTL_VALUE (0x05), ERR_INVALID_FLAGS (0x06), - ERR_FAILED (0x07), - ERR_DEVICE_NOT_CONNECTED (0x08), - ERR_TIMEOUT (0x09), - ERR_INVALID_MSG (0x0A), - ERR_INVALID_TIME_INTERVAL(0x0B), - ERR_EXCEEDED_LIMIT (0x0C), - ERR_INVALID_MSG_ID (0x0D), + ERR_FAILED (0x07), + ERR_DEVICE_NOT_CONNECTED (0x08), + ERR_TIMEOUT (0x09), + ERR_INVALID_MSG (0x0A), + ERR_INVALID_TIME_INTERVAL (0x0B), + ERR_EXCEEDED_LIMIT (0x0C), + ERR_INVALID_MSG_ID (0x0D), ERR_DEVICE_IN_USE (0x0E), - ERR_INVALID_IOCTL_ID (0x0F), - ERR_BUFFER_EMPTY (0x10), - ERR_BUFFER_FULL (0x11), - ERR_BUFFER_OVERFLOW (0x12), - ERR_PIN_INVALID (0x13), - ERR_CHANNEL_IN_USE (0x14), - ERR_MSG_PROTOCOL_ID (0x15), + ERR_INVALID_IOCTL_ID (0x0F), + ERR_BUFFER_EMPTY (0x10), + ERR_BUFFER_FULL (0x11), + ERR_BUFFER_OVERFLOW (0x12), + ERR_PIN_INVALID (0x13), + ERR_CHANNEL_IN_USE (0x14), + ERR_MSG_PROTOCOL_ID (0x15), ERR_INVALID_FILTER_ID (0x16), - ERR_NO_FLOW_CONTROL (0x17), - ERR_NOT_UNIQUE (0x18), - ERR_INVALID_BAUDRATE (0x19), + ERR_NO_FLOW_CONTROL (0x17), + ERR_NOT_UNIQUE (0x18), + ERR_INVALID_BAUDRATE (0x19), ERR_INVALID_DEVICE_ID (0x1A), - ERR_INVALID_DEVICE_ID_OP2(0x20), // OP2.0 Tactrix specific - ERR_OEM_VOLTAGE_TOO_LOW (0x78), // OP2.0 Tactrix specific - ERR_OEM_VOLTAGE_TOO_HIGH (0x77), // OP2.0 Tactrix specific + ERR_INVALID_DEVICE_ID_OP2 (0x20), // OP2.0 Tactrix specific + ERR_OEM_VOLTAGE_TOO_LOW (0x78), // OP2.0 Tactrix specific + ERR_OEM_VOLTAGE_TOO_HIGH (0x77), // OP2.0 Tactrix specific UNDEFINED (0xFFFFFFFF); // Returned when no match is found for get() - + private static final Map lookup = new HashMap(); - + static { for(Status s : EnumSet.allOf(Status.class)) lookup.put(s.getValue(), s); } - + private int value; - + private Status(int value) { this.value = value; } - + /** * @return the numeric value associated with the Status * mnemonic string. @@ -440,7 +441,7 @@ private Status(int value) { public int getValue() { return value; } - + /** * @param value - numeric value to be translated. * @return the Status mnemonic mapped to the numeric @@ -469,21 +470,21 @@ public enum RxStatus { ISO15765_ADDR_TYPE (0x00000080), CAN_29BIT_ID (0x00000100), UNDEFINED (0xFFFFFFFF); // Returned when no match is found for get() - + private static final Map lookup = new HashMap(); - + static { for(RxStatus s : EnumSet.allOf(RxStatus.class)) lookup.put(s.getValue(), s); } - + private int value; - + private RxStatus(int value) { this.value = value; } - + /** * @return the numeric value associated with the RxStatus * mnemonic string. @@ -491,7 +492,7 @@ private RxStatus(int value) { public int getValue() { return value; } - + /** * @param value - numeric value to be translated. * @return the RxStatus mnemonic mapped to the numeric @@ -518,21 +519,21 @@ public enum TxFlags { SCI_MODE (0x00400000), SCI_TX_VOLTAGE (0x00800000), UNDEFINED (0xFFFFFFFF); // Returned when no match is found for get() - + private static final Map lookup = new HashMap(); - + static { for(TxFlags s : EnumSet.allOf(TxFlags.class)) lookup.put(s.getValue(), s); } - + private int value; - + private TxFlags(int value) { this.value = value; } - + /** * @return the numeric value associated with the TxFlags * mnemonic string. @@ -540,7 +541,7 @@ private TxFlags(int value) { public int getValue() { return value; } - + /** * @param value - numeric value to be translated. * @return the TxFlags mnemonic mapped to the numeric @@ -554,16 +555,6 @@ public static TxFlags get(int value) { } } - /** - * Constructor declaration - * @param protocolID - numeric ID specified by J2534-1 - * @exception J2534Exception on various non-zero return status - * @deprecated - */ - public J2534Impl(int protocolID) { - this.protocolID = new NativeLong(protocolID); - } - /** * Constructor declaration * @param protocol - Protocol enum specified by J2534-1 @@ -572,13 +563,19 @@ public J2534Impl(int protocolID) { */ public J2534Impl(Protocol protocol, String library) { this.protocolID = new NativeLong(protocol.getValue()); - lib = new J2534_v0404(library); + try { + lib = new J2534_v0404(library); + } + catch (Throwable t) { + throw new J2534Exception(t.getMessage(), t); + } } /** * Establish a connection and initialize the PassThru device. * @return DeviceID of PassThru device */ + @Override public int open() { NativeLongByReference pDeviceID = new NativeLongByReference(); NativeLong ret = lib.PassThruOpen(null, pDeviceID); @@ -594,6 +591,7 @@ public int open() { * @return an instance of Version * @see Version */ + @Override public Version readVersion(int deviceId) { ByteBuffer pFirmwareVersion = ByteBuffer.allocate(80); ByteBuffer pDllVersion = ByteBuffer.allocate(80); @@ -620,6 +618,7 @@ public Version readVersion(int deviceId) { * @param baud - vehicle network communication rate * @return a handle to the open communications channel */ + @Override public int connect(int deviceId, int flags, int baud) { NativeLongByReference pChannelID = new NativeLongByReference(); NativeLong ret = lib.PassThruConnect( @@ -640,6 +639,7 @@ public int connect(int deviceId, int flags, int baud) { * @param items - values of multiple parameters can be set * in an array of ConfigItem */ + @Override public void setConfig(int channelId, ConfigItem... items) { if (items.length == 0) return; SCONFIG[] sConfigs = sConfigs(items); @@ -664,6 +664,7 @@ public void setConfig(int channelId, ConfigItem... items) { * @return an array of ConfigItem * @see ConfigItem */ + @Override public ConfigItem[] getConfig(int channelId, int... parameters) { if (parameters.length == 0) return new ConfigItem[0]; SCONFIG[] sConfigs = sConfigs(parameters); @@ -690,6 +691,7 @@ public ConfigItem[] getConfig(int channelId, int... parameters) { * @param pattern - a message pattern to compare with the receive messages * @return the message filter ID to be used to later stop the filter */ + @Override public int startPassMsgFilter(int channelId, byte mask, byte pattern) { PASSTHRU_MSG maskMsg = passThruMessage(mask); PASSTHRU_MSG patternMsg = passThruMessage(pattern); @@ -709,6 +711,7 @@ public int startPassMsgFilter(int channelId, byte mask, byte pattern) { * @param pattern - a message pattern to compare with the receive messages * @return the message filter ID to be used to later stop the filter */ + @Override public int startPassMsgFilter(int channelId, byte[] mask, byte[] pattern) { PASSTHRU_MSG maskMsg = passThruMessage(mask); PASSTHRU_MSG patternMsg = passThruMessage(pattern); @@ -719,6 +722,27 @@ public int startPassMsgFilter(int channelId, byte[] mask, byte[] pattern) { return rc; } + /** + * Setup network protocol filter(s) to selectively restrict or limit + * messages received. Then purge the PassThru device's receive buffer. + * @param channelId - handle to the open communications channel + * @param mask - used to isolate the receive message + * header section(s) of interest to pass + * @param pattern - a message pattern to compare with the receive messages + * @param flag - TX Flag to apply to PassThruMessage + * @return the message filter ID to be used to later stop the filter + */ + @Override + public int startPassMsgFilter(int channelId, byte[] mask, byte[] pattern, TxFlags flag) { + PASSTHRU_MSG maskMsg = passThruMessage(flag, mask); + PASSTHRU_MSG patternMsg = passThruMessage(flag, pattern); + + int filterType = Filter.PASS_FILTER.getValue(); + int rc = setMsgFilter(channelId, filterType, + maskMsg, patternMsg, null); + return rc; + } + /** * Setup network protocol filter(s) to selectively restrict or limit * messages received. Then purge the PassThru device's receive buffer. @@ -728,6 +752,7 @@ public int startPassMsgFilter(int channelId, byte[] mask, byte[] pattern) { * @param pattern - a message pattern to compare with the receive messages * @return the message filter ID to be used to later stop the filter */ + @Override public int startBlockMsgFilter(int channelId, byte[] mask, byte[] pattern) { PASSTHRU_MSG maskMsg = passThruMessage(mask); PASSTHRU_MSG patternMsg = passThruMessage(pattern); @@ -738,6 +763,27 @@ public int startBlockMsgFilter(int channelId, byte[] mask, byte[] pattern) { return rc; } + /** + * Setup network protocol filter(s) to selectively restrict or limit + * messages received. Then purge the PassThru device's receive buffer. + * @param channelId - handle to the open communications channel + * @param mask - used to isolate the receive message + * header section(s) of interest to block + * @param pattern - a message pattern to compare with the receive messages + * @param flag - TX Flag to apply to PassThruMessage + * @return the message filter ID to be used to later stop the filter + */ + @Override + public int startBlockMsgFilter(int channelId, byte[] mask, byte[] pattern, TxFlags flag) { + PASSTHRU_MSG maskMsg = passThruMessage(flag, mask); + PASSTHRU_MSG patternMsg = passThruMessage(flag, pattern); + + int filterType = Filter.BLOCK_FILTER.getValue(); + int rc = setMsgFilter(channelId, filterType, + maskMsg, patternMsg, null); + return rc; + } + /** * Setup network protocol filter(s) to selectively restrict or limit * messages received. Then purge the PassThru device's receive buffer. @@ -745,8 +791,11 @@ public int startBlockMsgFilter(int channelId, byte[] mask, byte[] pattern) { * @param mask - used to isolate the receive message * header section(s) of interest to pass * @param pattern - a message pattern to compare with the receive messages + * @param flowCntrl - FlowControl message transmitted by the PassThru device + * @param flag - TX Flag to apply to PassThruMessage * @return the message filter ID to be used to later stop the filter */ + @Override public int startFlowCntrlFilter(int channelId, byte[] mask, byte[] pattern, byte[] flowCntrl, TxFlags flag) { PASSTHRU_MSG maskMsg = passThruMessage(flag, mask); @@ -760,28 +809,62 @@ public int startFlowCntrlFilter(int channelId, byte[] mask, } /** - * This function performs an ISO14230 fast initialization sequence. + * This function performs an ISO9141 five baud initialization sequence. * @param channelId - handle to the open communications channel * @param input - start message to be transmitted to the vehicle network * @return response - response upon a successful initialization */ + @Override + public byte[] fiveBaudInit(int channelId, byte[] input) { + SBYTE_ARRAY inMsg = sByteMessage(input); + final byte[] out = new byte[2]; + SBYTE_ARRAY outMsg = sByteMessage(out); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Ioctl inMsg: " + inMsg.toString()); + NativeLong ret = lib.PassThruIoctl( + new NativeLong(channelId), + new NativeLong(IOCtl.FIVE_BAUD_INIT.value), + inMsg.getPointer(), + outMsg.getPointer() + ); + if (ret.intValue() != Status.NOERROR.getValue()) handleError( + "PassThruIoctl FIVE_BAUD_INIT", ret.intValue()); + outMsg.read(); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Ioctl outMsg: " + outMsg.toString()); + byte[] response = new byte[outMsg.numOfBytes.intValue()]; + arraycopy(outMsg.bytePtr, 0, response, 0, outMsg.numOfBytes.intValue()); + clearBuffers(channelId); + return response; + } + + /** + * This function performs an ISO14230 fast initialization sequence. + * @param channelId - handle to the open communications channel + * @param input - start message to be transmitted to the vehicle network + * @return response - response upon a successful initialization + */ + @Override public byte[] fastInit(int channelId, byte[] input) { PASSTHRU_MSG inMsg = passThruMessage(input); PASSTHRU_MSG outMsg = passThruMessage(); - LOGGER.trace("Ioctl inMsg: " + toString(inMsg)); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Ioctl inMsg: " + toString(inMsg)); NativeLong ret = lib.PassThruIoctl( new NativeLong(channelId), new NativeLong(IOCtl.FAST_INIT.value), inMsg.getPointer(), outMsg.getPointer() ); - if (ret.intValue() != Status.NOERROR.getValue()) handleError( - "PassThruIoctl", ret.intValue()); - outMsg.read(); - LOGGER.trace("Ioctl outMsg: " + toString(outMsg)); + if (ret.intValue() != Status.NOERROR.getValue()) handleError( + "PassThruIoctl FAST_INIT", ret.intValue()); + outMsg.read(); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Ioctl outMsg: " + toString(outMsg)); byte[] response = new byte[outMsg.dataSize.intValue()]; arraycopy(outMsg.data, 0, response, 0, outMsg.dataSize.intValue()); - return response; + clearBuffers(channelId); + return response; } /** @@ -789,6 +872,7 @@ public byte[] fastInit(int channelId, byte[] input) { * @param deviceId - handle to the PassThru device * @return battery voltage in VDC */ + @Override public double getVbattery(int deviceId) { NativeLongByReference vBatt = new NativeLongByReference(); NativeLong ret = lib.PassThruIoctl( @@ -797,9 +881,10 @@ public double getVbattery(int deviceId) { null, vBatt.getPointer() ); - if (ret.intValue() != Status.NOERROR.getValue()) handleError( - "PassThruIoctl", ret.intValue()); - LOGGER.trace("Ioctl result: " + vBatt.getValue().longValue()); + if (ret.intValue() != Status.NOERROR.getValue()) handleError( + "PassThruIoctl", ret.intValue()); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Ioctl result: " + vBatt.getValue().longValue()); double response = vBatt.getValue().doubleValue() / 1000; return response; } @@ -808,11 +893,14 @@ public double getVbattery(int deviceId) { * Send a message through the existing communication channel to the vehicle. * @param channelId - handle to the open communications channel * @param data - data bytes to be transmitted to the vehicle network - * @param timeout - maximum time (in milliseconds) for write completion + * @param timeout - maximum time (in milliseconds) for write completion + * @param flag - TX Flag to apply to PassThruMessage */ + @Override public void writeMsg(int channelId, byte[] data, long timeout, TxFlags flag) { PASSTHRU_MSG msg = passThruMessage(flag, data); - LOGGER.trace("Write Msg: " + toString(msg)); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Write Msg: " + toString(msg)); NativeLongByReference numMsg = new NativeLongByReference(); numMsg.setValue(new NativeLong(1)); NativeLong ret = lib.PassThruWriteMsgs( @@ -826,37 +914,75 @@ public void writeMsg(int channelId, byte[] data, long timeout, TxFlags flag) { } /** - * Retrieve a message through the existing communication channel from the vehicle. + * Retrieve a fixed size message within timeout through the existing + * communication channel from the vehicle. * @param channelId - handle to the open communications channel * @param response - data array to be populated with the vehicle network message - * @param timeout - maximum time (in milliseconds) for read completion + * @param timeout - maximum time (in milliseconds) for read completion + * @throws J2534Exception */ + @Override public void readMsg(int channelId, byte[] response, long timeout) { int index = 0; - long end = currentTimeMillis() + timeout; + long start = currentTimeMillis(); + long end = start + timeout; + long current = start; + int len = 0; do { - PASSTHRU_MSG msg = doReadMsg(channelId); - LOGGER.trace("Read Msg: " + toString(msg)); + if (currentTimeMillis() >= end) { + String errString = String.format( + "readMsg error: timeout expired waiting for %d more bytes", + response.length - index); + throw new J2534Exception(errString); + } + PASSTHRU_MSG msg = doReadMsg(channelId, timeout); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Read B Msg: " + toString(msg)); if (!isResponse(msg)) continue; - arraycopy(msg.data, 0, response, index, msg.dataSize.intValue()); - index += msg.dataSize.intValue(); - } while (currentTimeMillis() <= end && index < response.length - 1); + // if we get a large msg back, only read what will fit in the response buffer + len = 0; + if (msg.dataSize.intValue() <= (response.length - index)) { + len = msg.dataSize.intValue(); + } + else if (msg.dataSize.intValue() == (response.length - index)) { + len = response.length; + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format( + "readMsg: only read %d of %d bytes from response message", + len, msg.dataSize.intValue())); + } + else if (msg.dataSize.intValue() > (response.length - index)) { + len = response.length - index; + LOGGER.trace(String.format( + "readMsg: only read %d of %d bytes from response message", + len, msg.dataSize.intValue())); + } + arraycopy(msg.data, 0, response, index, len); + index += len; + current = currentTimeMillis(); + } while ((current <= end) && (index < response.length)); + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format( + "readMsg: read %d of %d bytes in %d msecs", + index, response.length, (current - start))); } /** - * Retrieve a message through the existing communication channel from the vehicle. + * Retrieve messages until timeout through the existing communication channel from the vehicle. * @param channelId - handle to the open communications channel - * @param maxWait - maximum time (in milliseconds) for read completion - * @return bytes read from the vehicle network + * @param maxWait - maximum time (in milliseconds) for read completion + * @return bytes read from the vehicle network */ + @Override public byte[] readMsg(int channelId, long maxWait) { List responses = new ArrayList(); long end = currentTimeMillis() + maxWait; do { - PASSTHRU_MSG msg = doReadMsg(channelId); - LOGGER.trace("Read Msg: " + toString(msg)); - if (isResponse(msg)) responses.add(data(msg)); - ThreadUtil.sleep(2); + PASSTHRU_MSG msg = doReadMsg(channelId, maxWait); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Read W Msg: " + toString(msg)); + if (isResponse(msg)) + responses.add(data(msg)); } while (currentTimeMillis() <= end); return concat(responses); } @@ -866,10 +992,11 @@ public byte[] readMsg(int channelId, long maxWait) { * channel from the vehicle. If the number of messages can not be read before the * timeout expires, throw an exception. * @param channelId - handle to the open communications channel - * @param numMsg - number of valid messages to retrieve - * @return bytes read from the vehicle network - * @throws J2534Exception + * @param numMsg - number of valid messages to retrieve + * @return bytes read from the vehicle network + * @throws J2534Exception */ + @Override public byte[] readMsg(int channelId, int numMsg, long timeout) { if (loopback) { numMsg++; @@ -883,13 +1010,16 @@ public byte[] readMsg(int channelId, int numMsg, long timeout) { numMsg); throw new J2534Exception(errString); } - PASSTHRU_MSG msg = doReadMsg(channelId); - LOGGER.trace("Read Msg: " + toString(msg)); - if (isResponse(msg)) { - responses.add(data(msg)); - numMsg--; + PASSTHRU_MSG[] msgs = doReadMsg(channelId, numMsg, timeout); // num of msgs to read + for (PASSTHRU_MSG msg : msgs) { + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Read # Msg: " + toString(msg)); + if (isResponse(msg)) { + responses.add(data(msg)); + numMsg--; + } + if (numMsg == 0) break; } - ThreadUtil.sleep(2); } while (numMsg != 0); return concat(responses); } @@ -899,6 +1029,7 @@ public byte[] readMsg(int channelId, int numMsg, long timeout) { * @param channelId - handle to the open communications channel * @param msgId - ID of the filter to stop */ + @Override public void stopMsgFilter(int channelId, int msgId) { NativeLong ret = lib.PassThruStopMsgFilter( new NativeLong(channelId), @@ -912,6 +1043,7 @@ public void stopMsgFilter(int channelId, int msgId) { * Clear the buffers on the communications channel. * @param channelId - handle to the open communications channel */ + @Override public void clearBuffers(int channelId) { NativeLong ret = lib.PassThruIoctl( new NativeLong(channelId), @@ -936,6 +1068,7 @@ public void clearBuffers(int channelId) { * Disconnect a previously opened communications channel. * @param channelId - handle to the open communications channel */ + @Override public void disconnect(int channelId) { NativeLong ret = lib.PassThruDisconnect(new NativeLong(channelId)); if (ret.intValue() != Status.NOERROR.getValue()) handleError( @@ -946,6 +1079,7 @@ public void disconnect(int channelId) { * Close the PassThru device by ID. * @param deviceId of PassThru device */ + @Override public void close(int deviceId) { NativeLong ret = lib.PassThruClose(new NativeLong(deviceId)); if (ret.intValue() != Status.NOERROR.getValue()) handleError( @@ -986,28 +1120,28 @@ private boolean isResponse(PASSTHRU_MSG msg) { switch (RxStatus.get(msg.rxStatus.intValue())) { case RX_INDICATION: return true; - + case TX_LOOPBACK: return loopback; case START_OF_MESSAGE: return false; - + case RX_BREAK: return false; - - case TX_INDICATION: + + case TX_INDICATION: return false; - case TX_DONE_LOOPBACK: + case TX_DONE_LOOPBACK: return false; case ISO15765_PADDING_ERROR: return false; - + case ISO15765_ADDR_TYPE: return false; - + case CAN_29BIT_ID: return false; @@ -1018,7 +1152,7 @@ private boolean isResponse(PASSTHRU_MSG msg) { return false; } - private PASSTHRU_MSG doReadMsg(int channelId) { + private PASSTHRU_MSG doReadMsg(int channelId, long timeout) { PASSTHRU_MSG msg = passThruMessage(); NativeLongByReference pNumMsgs = new NativeLongByReference(); pNumMsgs.setValue(new NativeLong(1)); @@ -1026,7 +1160,7 @@ private PASSTHRU_MSG doReadMsg(int channelId) { new NativeLong(channelId), msg.getPointer(), pNumMsgs, - new NativeLong(50) + new NativeLong(timeout) ); if (status.intValue() != Status.NOERROR.getValue() && status.intValue() != Status.ERR_TIMEOUT.getValue() && @@ -1036,6 +1170,30 @@ private PASSTHRU_MSG doReadMsg(int channelId) { return msg; } + private PASSTHRU_MSG[] doReadMsg(int channelId, int nm, long timeout) { + PASSTHRU_MSG[] msgs = + (PASSTHRU_MSG[]) new PASSTHRU_MSG.ByReference().toArray(nm); + NativeLongByReference pNumMsgs = new NativeLongByReference(); + pNumMsgs.setValue(new NativeLong(nm)); + NativeLong status = lib.PassThruReadMsgs( + new NativeLong(channelId), + msgs[0].getPointer(), + pNumMsgs, + new NativeLong(timeout) + ); + if (status.intValue() != Status.NOERROR.getValue() && + status.intValue() != Status.ERR_TIMEOUT.getValue() && + status.intValue() != Status.ERR_BUFFER_EMPTY.getValue()) + handleError("PassThruReadMsgs", status.intValue()); + int cnt = pNumMsgs.getValue().intValue(); + if (cnt > nm && LOGGER.isTraceEnabled()) + LOGGER.trace(cnt - nm + " msgs dropped"); + for (int i = 0; i < cnt ; i++) { + msgs[i].read(); + } + return msgs; + } + private ConfigItem[] configItems(SCONFIG_LIST sConfigs) { SCONFIG.ByReference[] configs = (ByReference[]) sConfigs.configPtr.toArray( @@ -1062,10 +1220,6 @@ private SCONFIG[] sConfigs(ConfigItem... items) { } } } -// for (SCONFIG sc : sConfigs) { -// sc.write(); -// System.out.printf("%s%n", sc); -// } return sConfigs; } @@ -1084,10 +1238,17 @@ private SCONFIG_LIST sConfigList(SCONFIG[] sConfigs) { list.numOfParams = new NativeLong(sConfigs.length); list.configPtr = (SCONFIG.ByReference) sConfigs[0]; list.write(); -// System.out.printf("list:%n%s%n", list); return list; } + private SBYTE_ARRAY sByteMessage(byte... data) { + SBYTE_ARRAY msg = new SBYTE_ARRAY(); + msg.numOfBytes = new NativeLong(data.length); + arraycopy(data, 0, msg.bytePtr, 0, data.length); + msg.write(); + return msg; + } + private PASSTHRU_MSG passThruMessage(byte... data) { PASSTHRU_MSG msg = passThruMessage(); msg.dataSize = new NativeLong(data.length); diff --git a/src/main/java/com/romraider/io/j2534/api/J2534Library.java b/src/main/java/com/romraider/io/j2534/api/J2534Library.java index cf24087dc..9d0b26ee8 100644 --- a/src/main/java/com/romraider/io/j2534/api/J2534Library.java +++ b/src/main/java/com/romraider/io/j2534/api/J2534Library.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,9 +21,10 @@ /** * Each class instance holds the Vendor and Library details for a J2534 - * installed device. These are discovered on the local computer from - * keys and value settings in the Windows registry. - * @see J2534DllLocator + * installed device. On Windows these are discovered on the local computer + * from keys and value settings in the Windows registry. + * On Linux, from a static list. + * @see J2534LibraryLocator */ public class J2534Library { private String vendor; @@ -32,7 +33,7 @@ public class J2534Library { /** * Create a new instance of a J2534 library detail. * @param vendor - J2534 vendor string - * @param library - J2534 library path + * @param library - J2534 library path */ public J2534Library(String vendor, String library) { this.vendor = vendor; diff --git a/src/main/java/com/romraider/io/j2534/api/J2534LibraryLocator.java b/src/main/java/com/romraider/io/j2534/api/J2534LibraryLocator.java new file mode 100644 index 000000000..c85d0baed --- /dev/null +++ b/src/main/java/com/romraider/io/j2534/api/J2534LibraryLocator.java @@ -0,0 +1,333 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.j2534.api; + +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import static com.romraider.util.ParamChecker.isNullOrEmpty; +import static com.romraider.util.Platform.WINDOWS; +import static com.romraider.util.Platform.isPlatform; +import static com.sun.jna.platform.win32.WinError.ERROR_FILE_NOT_FOUND; +import static com.sun.jna.platform.win32.WinError.ERROR_SUCCESS; +import static com.sun.jna.platform.win32.WinReg.HKEY_LOCAL_MACHINE; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Properties; +import java.util.Set; + +import org.apache.log4j.Logger; + +import com.romraider.util.ParamChecker; +import com.sun.jna.Native; +import com.sun.jna.platform.win32.Advapi32; +import com.sun.jna.platform.win32.WinBase.FILETIME; +import com.sun.jna.platform.win32.WinReg.HKEY; +import com.sun.jna.platform.win32.WinReg.HKEYByReference; +import com.sun.jna.ptr.IntByReference; + +/** + * Discover all the J2534 device installations on the local computer from + * keys and value settings in the Windows registry. + * On Linux, from a static list. + * Return a List of J2534Library instances. + * @see J2534Library + */ +public class J2534LibraryLocator { + private static final Logger LOGGER = Logger.getLogger(J2534LibraryLocator.class); + private static final String FUNCTIONLIBRARY = "FunctionLibrary"; + private static final int KEY_READ = 0x20019; + private static final int ERROR_NO_MORE_ITEMS = 0x103; + private static final Set libraries = new HashSet(); + private static List WIN_LIBRARIES = new ArrayList(); + private static List LINUX_LIBRARIES = new ArrayList(); + private static String j2534Protocol = ""; + + public static Set getLibraries(final String protocol) { + checkNotNullOrEmpty(protocol, "protocol"); + if (WIN_LIBRARIES.isEmpty() && LINUX_LIBRARIES.isEmpty()) { + loadProperties(); + } + + if (isNullOrEmpty(j2534Protocol)) { + j2534Protocol = protocol; + } + if (!j2534Protocol.equalsIgnoreCase(protocol)) { + libraries.clear(); + } + if (libraries.isEmpty()) { + File libFile = null; + if (isPlatform(WINDOWS)) { + try { + listLibraries(j2534Protocol); + } + catch (Exception e) { + LOGGER.info("No J2534 Registry libraries found that support protocol " + + j2534Protocol); + } + + if (!WIN_LIBRARIES.isEmpty()) { + for (String lib : WIN_LIBRARIES) { + if (lib.contains("\\") || lib.contains("/")) { + libFile = new File(lib); + } + else { + libFile = new File(System.getProperty("java.library.path"), lib); + } + if (libFile.exists()) { + libraries.add(new J2534Library( + "Windows J2534 OP2 WinUSB", + libFile.getAbsolutePath())); + } + else { + LOGGER.info("Windows Openport 2.0 library not found at: " + + libFile.getAbsolutePath()); + } + } + } + } + else { + if (!LINUX_LIBRARIES.isEmpty()) { + for (String lib : LINUX_LIBRARIES) { + if (lib.contains("/")) { + libFile = new File(lib); + } + else { + libFile = new File(System.getProperty("java.library.path"), lib); + } + if (libFile.exists()) { + libraries.add(new J2534Library( + "Linux J2534 OP2", + libFile.getAbsolutePath())); + } + else { + LOGGER.info("Linux Openport 2.0 library not found at: " + + libFile.getAbsolutePath()); + } + } + } + } + } + return libraries; + } + + private static void listLibraries(final String protocol) throws Exception { + final Advapi32 advapi32 = Advapi32.INSTANCE; + final HKEY hklm = HKEY_LOCAL_MACHINE; + final String passThru = "SOFTWARE\\PassThruSupport.04.04"; + final HKEYByReference passThruHandle = getHandle(advapi32, hklm, passThru); + + if(passThruHandle != null) { + List vendors = getKeys(advapi32, passThruHandle.getValue()); + for (String vendor : vendors) { + final HKEYByReference vendorKey = + getHandle(advapi32, passThruHandle.getValue(), vendor); + final int supported = getDWord(advapi32, vendorKey.getValue(), protocol); + if (supported == 0 ) continue; + final String library = getSZ(advapi32, vendorKey.getValue(), FUNCTIONLIBRARY); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Found J2534 Vendor:%s | Library:%s", + vendor, library)); + if (ParamChecker.isNullOrEmpty(library)) continue; + libraries.add(new J2534Library(vendor, library)); + advapi32.RegCloseKey(vendorKey.getValue()); + } + advapi32.RegCloseKey(passThruHandle.getValue()); + } + } + + private static HKEYByReference getHandle( + final Advapi32 advapi32, + final HKEY hKey, String lpSubKey) { + + HKEYByReference phkResult = new HKEYByReference(); + int ret = advapi32.RegOpenKeyEx( + hKey, + lpSubKey, + 0, + KEY_READ, + phkResult); + + if(ret != ERROR_SUCCESS) { + return null; + } + return phkResult; + } + + private static int reverse(final byte[] bytes, final int size) { + ByteBuffer b = ByteBuffer.wrap(bytes, 0, size); + return b.order(ByteOrder.LITTLE_ENDIAN).getInt(); + } + + private static void handleError(final String operation, + final int status) + throws Exception { + + String errString = String.format("%s error [%d]%n", + operation, status); + throw new Exception(errString); + } + + private static List getKeys( + final Advapi32 advapi32, + final HKEY hkey) + throws Exception { + + int dwIndex = 0; + List vendors = new ArrayList(); + int ret = 0; + do { + char[] lpName = new char[255]; + IntByReference lpcName = new IntByReference(-1); + IntByReference lpReserved = null; + char[] lpClass = new char[255]; + IntByReference lpcClass = new IntByReference(-1); + FILETIME lpftLastWriteTime = new FILETIME(); + ret = advapi32.RegEnumKeyEx( + hkey, + dwIndex, + lpName, + lpcName, + lpReserved, + lpClass, + lpcClass, + lpftLastWriteTime); + + switch (ret) { + case ERROR_SUCCESS: + dwIndex++; + vendors.add(Native.toString(lpName)); + break; + case ERROR_NO_MORE_ITEMS: + break; + default: + handleError("RegEnumKeyEx", ret); + } + } while(ret == ERROR_SUCCESS); + return vendors; + } + + private static int getDWord( + final Advapi32 advapi32, + final HKEY hkey, final String valueName) + throws Exception { + + IntByReference lpType = new IntByReference(-1); + byte[] lpData = new byte[16]; + IntByReference lpcbData = new IntByReference(-1); + int ret = advapi32.RegQueryValueEx( + hkey, + valueName, + 0, + lpType, + lpData, + lpcbData); + + int dword = -1; + switch (ret) { + case ERROR_SUCCESS: + dword = reverse(lpData, lpcbData.getValue()); + break; + case ERROR_FILE_NOT_FOUND: + dword = 0; + break; + default: + String errString = String.format("DWORD_RegQueryValueEx(%s)", + valueName); + handleError(errString, ret); + } + return dword; + } + + private static String getSZ( + final Advapi32 advapi32, + final HKEY hkey, final String valueName) + throws Exception { + + final IntByReference lpType = new IntByReference(-1); + final char[] lpData = new char[1024]; + final IntByReference lpcbData = new IntByReference(-1); + final int ret = advapi32.RegQueryValueEx( + hkey, + valueName, + 0, + lpType, + lpData, + lpcbData); + + String szValue = null; + switch (ret) { + case ERROR_SUCCESS: + szValue = Native.toString(lpData); + break; + case ERROR_FILE_NOT_FOUND: + break; + default: + final String errString = String.format("SZ_RegQueryValueEx(%s)", + valueName); + handleError(errString, ret); + } + return szValue; + } + + /** + * Load J2534 library names from a user customized properties file. + * The file will populate the library lists if it is present. + * Library names in the file should be separated by the ; character + * @exception FileNotFoundException if the directory or file is not present + * @exception IOException if there's some kind of IO error + */ + private static void loadProperties() { + final Properties libraries = new Properties(); + FileInputStream propFile; + try { + propFile = new FileInputStream("./customize/j2534Libraries.properties"); + libraries.load(propFile); + final String win_names = libraries.getProperty("windows"); + if (!isNullOrEmpty(win_names)) { + final String[] names = win_names.split(";", 0); + for (String name : names) { + if (isNullOrEmpty(name)) continue; + WIN_LIBRARIES.add(name.trim()); + } + } + final String linux_names = libraries.getProperty("linux"); + if (!isNullOrEmpty(linux_names)) { + final String[] names = linux_names.split(";", 0); + for (String name : names) { + if (isNullOrEmpty(name)) continue; + LINUX_LIBRARIES.add(name.trim()); + } + } + propFile.close(); + LOGGER.info("J2534 Library names loaded from file: ./customize/j2534Libraries.properties"); + } catch (FileNotFoundException e) { + LOGGER.error("j2534Libraries.properties file: " + e.getLocalizedMessage()); + } catch (IOException e) { + LOGGER.error("j2534Libraries.properties IOException: " + e.getLocalizedMessage()); + } + } +} diff --git a/src/main/java/com/romraider/io/j2534/api/J2534_v0404.java b/src/main/java/com/romraider/io/j2534/api/J2534_v0404.java index 5b40341e0..ac9c62154 100644 --- a/src/main/java/com/romraider/io/j2534/api/J2534_v0404.java +++ b/src/main/java/com/romraider/io/j2534/api/J2534_v0404.java @@ -113,7 +113,6 @@ public static class SCONFIG extends Structure { public NativeLong parameter; public NativeLong value; public SCONFIG() { - super(); initFieldOrder(); } protected void initFieldOrder() { @@ -133,7 +132,6 @@ public static class SCONFIG_LIST extends Structure { public NativeLong numOfParams; public SCONFIG.ByReference configPtr; public SCONFIG_LIST() { - super(); initFieldOrder(); } protected void initFieldOrder() { diff --git a/src/main/java/com/romraider/io/j2534/api/TestJ2534.java b/src/main/java/com/romraider/io/j2534/api/TestJ2534.java index 49e17451f..15b776acc 100644 --- a/src/main/java/com/romraider/io/j2534/api/TestJ2534.java +++ b/src/main/java/com/romraider/io/j2534/api/TestJ2534.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +22,9 @@ import static com.romraider.util.HexUtil.asHex; import static com.romraider.util.LogManager.initDebugLogging; +import java.util.ArrayList; +import java.util.List; + import com.romraider.io.j2534.api.J2534Impl.Config; import com.romraider.io.j2534.api.J2534Impl.Flag; import com.romraider.io.j2534.api.J2534Impl.Protocol; @@ -32,30 +35,99 @@ * an active ECU using the ISO9141 protocol. */ public class TestJ2534 { - private static final J2534 api = new J2534Impl(Protocol.ISO9141, "op20pt32"); + private static String protocol; // Dev to choice SSM or DS2 on cmdline for testing + private static J2534 api; public TestJ2534() { - int deviceId = api.open(); + int deviceId = -1; try { + deviceId = api.open(); version(deviceId); - int channelId = api.connect( - deviceId, Flag.ISO9141_NO_CHECKSUM.getValue(), 4800); + int channelId = -1; + if (protocol.equalsIgnoreCase("ssm")) { + channelId = api.connect( + deviceId, Flag.ISO9141_NO_CHECKSUM.getValue(), 4800); + } + else if (protocol.equalsIgnoreCase("ds2")) { + channelId = api.connect( + deviceId, Flag.ISO9141_NO_CHECKSUM.getValue(), 9600); + } try { setConfig(channelId); getConfig(channelId); - + int msgId = api.startPassMsgFilter(channelId, (byte) 0x00, (byte) 0x00); try { + List msgs = new ArrayList(); + byte[] ecuInit = null; + if (protocol.equalsIgnoreCase("ssm")) { + ecuInit = new byte[]{ + (byte) 0x80, (byte) 0x10, (byte) 0xF0, + (byte) 0x01, (byte) 0xBF, (byte) 0x40}; + msgs.add(ecuInit); + } + else if (protocol.equalsIgnoreCase("ds2")) { + ecuInit = new byte[]{ + (byte) 0x12, (byte) 0x04, (byte) 0x00, + (byte) 0x16}; + byte[] engine = new byte[]{ + (byte) 0x12, (byte) 0x05, (byte) 0x0B, + (byte) 0x03, (byte) 0x1F}; + byte[] swtch = new byte[]{ + (byte) 0x12, (byte) 0x05, (byte) 0x0B, + (byte) 0x04, (byte) 0x18}; + byte[] lambda = new byte[]{ + (byte) 0x12, (byte) 0x05, (byte) 0x0B, + (byte) 0x91, (byte) 0x8D}; + byte[] adapt = new byte[]{ + (byte) 0x12, (byte) 0x05, (byte) 0x0B, + (byte) 0x92, (byte) 0x8E}; + byte[] corr = new byte[]{ + (byte) 0x12, (byte) 0x05, (byte) 0x0B, + (byte) 0x93, (byte) 0x8F}; + byte[] cat = new byte[]{ + (byte) 0x12, (byte) 0x05, (byte) 0x0B, + (byte) 0x94, (byte) 0x88}; + byte[] status = new byte[]{ + (byte) 0x12, (byte) 0x05, (byte) 0x0B, + (byte) 0x95, (byte) 0x89}; + byte[] close = new byte[]{ + (byte) 0x12, (byte) 0x05, (byte) 0x0B, + (byte) 0xFF, (byte) 0xE3}; + byte[] _0C = new byte[]{ + (byte) 0x12, (byte) 0x04, (byte) 0x0C, + (byte) 0x1A}; + byte[] _0D = new byte[]{ + (byte) 0x12, (byte) 0x04, (byte) 0x0D, + (byte) 0x1B}; + byte[] _25 = new byte[]{ + (byte) 0x12, (byte) 0x04, (byte) 0x25, + (byte) 0x33}; + byte[] _53 = new byte[]{ + (byte) 0x12, (byte) 0x04, (byte) 0x53, + (byte) 0x45}; + msgs.add(ecuInit); + msgs.add(engine); + msgs.add(swtch); + msgs.add(lambda); + msgs.add(adapt); + msgs.add(corr); + msgs.add(cat); + msgs.add(status); + msgs.add(close); + msgs.add(_0C); + msgs.add(_0D); + msgs.add(_25); + msgs.add(_53); + } - byte[] ecuInit = { - (byte) 0x80, (byte) 0x10, (byte) 0xF0, - (byte) 0x01, (byte) 0xBF, (byte) 0x40}; - - api.writeMsg(channelId, ecuInit, 55L, TxFlags.NO_FLAGS); - System.out.println("Request = " + asHex(ecuInit)); + for (byte[] msg : msgs) { + api.writeMsg(channelId, msg, 55L, TxFlags.NO_FLAGS); + System.out.println("Request = " + asHex(msg)); - byte[] response = api.readMsg(channelId, 1, 2000L); - System.out.println("Response = " + asHex(response)); + byte[] response = api.readMsg(channelId, 500L); + System.out.println("Response = " + asHex(response)); + } } finally { api.stopMsgFilter(channelId, msgId); @@ -64,7 +136,8 @@ public TestJ2534() { api.disconnect(channelId); } } finally { - api.close(deviceId); + if (api != null) + api.close(deviceId); } } @@ -79,7 +152,17 @@ private static void setConfig(int channelId) { ConfigItem p3Min = new ConfigItem(Config.P3_MIN.getValue(), 0); ConfigItem p4Min = new ConfigItem(Config.P4_MIN.getValue(), 0); ConfigItem loopback = new ConfigItem(Config.LOOPBACK.getValue(), 1); - api.setConfig(channelId, p1Max, p3Min, p4Min, loopback); + ConfigItem parity = null; + ConfigItem databits = null; + if (protocol.equalsIgnoreCase("ssm")) { + parity = new ConfigItem(Config.PARITY.getValue(), 0); + databits = new ConfigItem(Config.DATA_BITS.getValue(), 8); + } + else if (protocol.equalsIgnoreCase("ds2")) { + parity = new ConfigItem(Config.PARITY.getValue(), 2); + databits = new ConfigItem(Config.DATA_BITS.getValue(), 8); + } + api.setConfig(channelId, p1Max, p3Min, p4Min, parity, databits, loopback); } private static void getConfig(int channelId) { @@ -88,7 +171,10 @@ private static void getConfig(int channelId) { Config.LOOPBACK.getValue(), Config.P1_MAX.getValue(), Config.P3_MIN.getValue(), - Config.P4_MIN.getValue()); + Config.P4_MIN.getValue(), + Config.P4_MIN.getValue(), + Config.DATA_BITS.getValue(), + Config.LOOPBACK.getValue()); int i = 1; for (ConfigItem item : configs) { System.out.printf("Config item %d: Parameter: %d, value:%d%n", @@ -97,8 +183,17 @@ private static void getConfig(int channelId) { } } - public static void main(String args[]){ + public final static void main(String args[]) throws InterruptedException{ initDebugLogging(); + if (args.length < 2) { + System.out.printf("Provide \"library_name\" and \"protocol\" cmdline args."); + return; + } + else { + protocol = args[1].toLowerCase(); // SSM or DS2 + api = new J2534Impl( //op20pt32 MONGI432 /usr/local/lib/j2534.so + Protocol.ISO9141, args[0]); + } TestJ2534 a = new TestJ2534(); } } diff --git a/src/main/java/com/romraider/io/j2534/api/TestJ2534Can.java b/src/main/java/com/romraider/io/j2534/api/TestJ2534Can.java new file mode 100644 index 000000000..9d4a6cc9e --- /dev/null +++ b/src/main/java/com/romraider/io/j2534/api/TestJ2534Can.java @@ -0,0 +1,125 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.j2534.api; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; + +import com.romraider.io.j2534.api.J2534Impl.Protocol; +import com.romraider.io.j2534.api.J2534Impl.TxFlags; +import com.romraider.util.HexUtil; +import com.romraider.util.LogManager; + +/** + * This class is used to exercise the J2534 API against a real J2534 device and + * an active ECU using the ISO11898 (CAN bus) protocol. + */ +public final class TestJ2534Can { + private static final Logger LOGGER = Logger.getLogger(TestJ2534Can.class); + private static J2534 api ; + private static final StringBuilder sb = new StringBuilder(); + + + public TestJ2534Can() throws InterruptedException { + LOGGER.setLevel(Level.DEBUG); + final int deviceId = api.open(); + sb.delete(0, sb.capacity()); + try { + version(deviceId); + final int channelId = api.connect(deviceId, 0, 500000); + + final double vBatt = api.getVbattery(deviceId); + sb.append(String.format( + "J2534 Interface Pin 16: %sVDC%n", vBatt)); + + // accept everything + final byte[] mask1 = { + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}; + final byte[] match1 = { + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}; + // accept 0x0180 and 0x0182 + final byte[] mask2 = { + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xfd}; + final byte[] match2 = { + (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x80}; + // accept 0x01f9 + final byte[] mask3 = { + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; + final byte[] match3 = { + (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0xf9}; + +// final int msgId = api.startPassMsgFilter( +// channelId, mask1, match1, TxFlags.ISO15765_FRAME_PAD); + final int msgId1 = api.startPassMsgFilter( + channelId, mask2, match2, TxFlags.ISO15765_FRAME_PAD); + final int msgId2 = api.startPassMsgFilter( + channelId, mask3, match3, TxFlags.ISO15765_FRAME_PAD); + + try { + byte[] response = null; + for (int i = 0; i < 10; i++) { + response = api.readMsg(channelId, 1, 1000L); + LOGGER.info("Response = " + + HexUtil.asHex(response)); + } + } + catch (Exception e) { + LOGGER.error(e); + } + finally { + //api.stopMsgFilter(channelId, msgId); + api.stopMsgFilter(channelId, msgId1); + api.stopMsgFilter(channelId, msgId2); + api.clearBuffers(channelId); + api.disconnect(channelId); + } + } finally { + api.close(deviceId); + } + } + + private final static void version(final int deviceId) { + final Version version = api.readVersion(deviceId); + sb.append(String.format( + "J2534 Firmware:[%s], DLL:[%s], API:[%s]%n", + version.firmware, version.dll, version.api)); + } + + @Override + public final String toString() { + return sb.toString(); + } + + public final static void main(String args[]) throws InterruptedException{ + LogManager.initDebugLogging(); + if (args.length < 1) { + System.out.printf("Provide \"library_name\" cmdline arg."); + return; + } + else { + //op20pt32, MONGI432, /usr/local/lib/j2534.so, System.getProperty("java.library.path")\\windows\\j2534.dll + api = new J2534Impl( + Protocol.CAN, args[0]); + } + + final TestJ2534Can test1 = new TestJ2534Can(); + System.out.print(test1.toString()); + } +} diff --git a/src/main/java/com/romraider/io/j2534/api/TestJ2534IsoTp.java b/src/main/java/com/romraider/io/j2534/api/TestJ2534IsoTp.java index 8262934df..73dc4662c 100644 --- a/src/main/java/com/romraider/io/j2534/api/TestJ2534IsoTp.java +++ b/src/main/java/com/romraider/io/j2534/api/TestJ2534IsoTp.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2018 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -346,12 +346,12 @@ private final static byte[] buildRequest( public final static void main(String args[]) throws InterruptedException{ LogManager.initDebugLogging(); - if (args.length == 0) { //op20pt32 MONGI432 - api = new J2534Impl( - Protocol.ISO15765, "op20pt32"); + if (args.length < 1) { + System.out.printf("Provide \"library_name\" cmdline arg."); + return; } else { - api = new J2534Impl( + api = new J2534Impl( //op20pt32 MONGI432 /usr/local/lib/j2534.so Protocol.ISO15765, args[0]); } diff --git a/src/main/java/com/romraider/io/j2534/api/TestJ2534NCS.java b/src/main/java/com/romraider/io/j2534/api/TestJ2534NCS.java new file mode 100644 index 000000000..4bcd8e31b --- /dev/null +++ b/src/main/java/com/romraider/io/j2534/api/TestJ2534NCS.java @@ -0,0 +1,1233 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.j2534.api; + +import static com.romraider.util.ByteUtil.asUnsignedInt; +import static com.romraider.util.HexUtil.asHex; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.List; + +import com.romraider.io.j2534.api.J2534Impl.Config; +import com.romraider.io.j2534.api.J2534Impl.Protocol; +import com.romraider.io.j2534.api.J2534Impl.TxFlags; +import com.romraider.logger.ecu.exception.InvalidResponseException; +import com.romraider.maps.checksum.NcsCoDec; +import com.romraider.util.HexUtil; +import com.romraider.util.LogManager; + +/** + * This class is used to exercise the J2534 API against a real J2534 device and + * an active ECU using the ISO15765-2 protocol. + * Using command line options the ECU can be read and written. + */ +public final class TestJ2534NCS { + private static J2534 api ; + private static final int LOOPBACK = 0; + private static final byte[] mask1 = { + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; + private static final byte[] match1 = { + (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe8}; + private static final byte[] tester = { + (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe0}; + private static final byte ECU_NRC = (byte) 0x7F; + private static final byte READ_MODE9_RESPONSE = (byte) 0x49; + private static final byte READ_MODE9_COMMAND = (byte) 0x09; + private static final byte[] READ_MODE9_PIDS = {(byte) 0x00, + (byte) 0x02, (byte) 0x04, (byte) 0x06, (byte) 0x08}; + private static final byte READ_MODE3_RESPONSE = (byte) 0x43; + private static final byte READ_MODE3_COMMAND = (byte) 0x03; + private static final byte READ_MODE21_COMMAND = (byte) 0x21; + private static final byte READ_MODE22_COMMAND = (byte) 0x22; + private static final byte ECU_INIT_COMMAND = (byte) 0x10; + private static final StringBuilder sb = new StringBuilder(); + private static String calid = ""; + + + public TestJ2534NCS(String[] args) throws InterruptedException { + final int deviceId = api.open(); + sb.delete(0, sb.capacity()); + String report = ""; + try { + version(deviceId); + final int channelId = api.connect(deviceId, 0, 500000); + + final double vBatt = api.getVbattery(deviceId); + report = String.format("J2534 Interface Pin 16: %sVDC%n", vBatt); + System.out.print(report); + sb.append(report); + + final int msgId = api.startFlowCntrlFilter( + channelId, mask1, match1, tester, TxFlags.ISO15765_FRAME_PAD); + + try { + setConfig(channelId); + getConfig(channelId); + report = String.format("%n--- Vehicle Information ---%n"); + System.out.print(report); + sb.append(report); + + for (byte pid : READ_MODE9_PIDS) { + final byte[] mode9 = buildRequest( + READ_MODE9_COMMAND, // mode + new byte[]{pid}, // pid + true, // pid valid + tester); // source + api.writeMsg(channelId, + mode9, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + + final byte[] response; + response = api.readMsg(channelId, 1, 1000L); + handleResponse(response); + } + final byte[] mode3 = buildRequest( + READ_MODE3_COMMAND, // mode + new byte[]{0}, // pid + false, // pid valid + tester); // source + api.writeMsg(channelId, + mode3, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + + byte[] response; + response = api.readMsg(channelId, 1, 1000L); + handleResponse(response); + + // UDS 22 1101 - this will fail + final byte[] mode22xx = buildRequest( + (byte) 0x22, // mode + new byte[]{ + (byte) 0x11, //CID high byte VDC + (byte) 0x03,//CID low byte VDC +// (byte) 0x11, //CID high byte ECT +// (byte) 0x01, //CID low byte ECU + }, + true, // pid valid + tester); // source + System.out.println("UDS 22 1103 BattVDC request = " + + HexUtil.asHex(mode22xx)); + api.writeMsg(channelId, + mode22xx, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("UDS 22 1103 BattVDC response = " + + HexUtil.asHex(response)); + +// NCS init + final byte[] init = buildRequest( + ECU_INIT_COMMAND, // mode + new byte[]{(byte) 0xC0},// pid + true, // pid valid + tester); // source + System.out.println("Init request = " + + HexUtil.asHex(init)); + api.writeMsg(channelId, + init, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("Init response = " + + HexUtil.asHex(response)); + + // UDS 22 1101 - try again + System.out.println("UDS 22 1103 BattVDC request = " + + HexUtil.asHex(mode22xx)); + api.writeMsg(channelId, + mode22xx, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("UDS 22 1103 BattVDC response = " + + HexUtil.asHex(response)); + + // NCS ident + final byte[] id = buildRequest( + READ_MODE21_COMMAND, // mode + new byte[]{(byte) 0x10},// pid + true, // pid valid + tester); // source + System.out.println("Ident request = " + + HexUtil.asHex(id)); + api.writeMsg(channelId, + id, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("Ident response = " + + HexUtil.asHex(response)); + + // UDS 21 01 + final byte[] mode2101 = buildRequest( + READ_MODE21_COMMAND, // mode + new byte[]{(byte) 0x01},// pid + true, // pid valid + tester); // source + System.out.println("UDS 21 01 request = " + + HexUtil.asHex(mode2101)); + api.writeMsg(channelId, + mode2101, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("UDS 21 01 response = " + + HexUtil.asHex(response)); + + // NCS Query PID support + final byte[] supportedPidsPid = { + (byte) 0x00, (byte) 0x20, (byte) 0x40, (byte) 0x60, + (byte) 0x80, (byte) 0xA0, (byte) 0xC0, (byte) 0xE0}; + boolean test_grp = true; + for (byte pid : supportedPidsPid) { + if (test_grp) { + final byte[] mode21 = buildRequest( + READ_MODE21_COMMAND, // mode + new byte[]{pid}, // pid + true, // pid valid + tester); // source + System.out.println("UDS 21 request = " + + HexUtil.asHex(mode21)); + api.writeMsg(channelId, + mode21, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("UDS 21 response = " + + HexUtil.asHex(response)); + // Check lsb to see if next PID group is supported + if ((response[response.length-1] & 0x01) == 0) { + test_grp = false; + } + } + } + final byte[] highBytes = { + (byte) 0x11, (byte) 0x12, (byte) 0x13, (byte) 0x14, + (byte) 0x15, (byte) 0x16}; + for (byte hb : highBytes) { + test_grp = true; + for (byte pid : supportedPidsPid) { + if (test_grp) { + final byte[] mode22 = buildRequest( + READ_MODE22_COMMAND, // mode + new byte[]{hb, pid}, // pid + true, // pid valid + tester); // source + System.out.println("UDS 22 request = " + + HexUtil.asHex(mode22)); + api.writeMsg(channelId, + mode22, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("UDS 22 response = " + + HexUtil.asHex(response)); + // Check lsb to see if next PID group is supported + if ((response[response.length-1] & 0x01) == 0) { + test_grp = false; + } + } + } + } + + // UDS 2C E0 + final byte[] mode2Cxx = buildRequest( + (byte) 0x2c, // mode + new byte[]{(byte) 0xE0, +// (byte) 0x01, //definitionMode +// (byte) 0x01, //positionIn +// (byte) 0x01, //size +// (byte) 0x01, +// (byte) 0x01, + + (byte) 0x02, //definitionMode + (byte) 0x01, //positionIn doesn't see to matter + (byte) 0x01, //size + (byte) 0x11, //CID high byte ECT + (byte) 0x01, //CID low byte ECU + (byte) 0x01, //positionInRecord doesn't see to matter + (byte) 0x02, //definitionMode + (byte) 0x02, //positionIn doesn't see to matter + (byte) 0x01, //size + (byte) 0x11, //CID high byte VDC + (byte) 0x03, //CID low byte VDC + (byte) 0x01, //positionInRecord doesn't see to matter + (byte) 0x02, //definitionMode + (byte) 0x03, //positionIn doesn't see to matter + (byte) 0x02, //size + (byte) 0x12, //CID high byte RPM + (byte) 0x01, //CID low byte RPM + (byte) 0x01, //positionInRecord doesn't see to matter + (byte) 0x02, //definitionMode + (byte) 0x04, //positionIn doesn't see to matter + (byte) 0x02, //size + (byte) 0x12, //CID high byte TPS1 + (byte) 0x0F, //CID low byte TPS1 + (byte) 0x01, //positionInRecord doesn't see to matter + (byte) 0x02, //definitionMode + (byte) 0x05, //positionIn doesn't see to matter + (byte) 0x02, //size + (byte) 0x12, //CID high byte TPS2 + (byte) 0x10, //CID low byte TPS2 + (byte) 0x01, //positionInRecord doesn't see to matter + +// (byte) 0x03, //definitionMode +// (byte) 0x01, //positionIn +// (byte) 0x01, //size +// (byte) 0xff, //RAM high byte +// (byte) 0xff, //RAM high byte +// (byte) 0x12, //RAM mid byte +// (byte) 0x34, //RAM low byte +// (byte) 0x03, //definitionMode +// (byte) 0x02, //positionIn +// (byte) 0x01, //size +// (byte) 0xff, //RAM high byte +// (byte) 0xff, //RAM high byte +// (byte) 0xab, //RAM mid byte +// (byte) 0xcd, //RAM low byte + }, + true, // pid valid + tester); // source + System.out.println("UDS 2C request = " + + HexUtil.asHex(mode2Cxx)); + api.writeMsg(channelId, + mode2Cxx, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("UDS 2C response = " + + HexUtil.asHex(response)); + + final byte[] _21e0 = buildRequest( + (byte) 0x21, // mode + new byte[]{(byte) 0xe0}, + true, // pid valid + tester); // source + System.out.println("UDS 21 request = " + + HexUtil.asHex(_21e0)); + api.writeMsg(channelId, + _21e0, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("UDS 21 reponse = " + + HexUtil.asHex(response)); + + FileOutputStream stream = null; + try { + if (args.length == 3 || args.length == 4) { + byte[] uds3483_d = new byte[0x30]; + final byte[] _10fb = buildRequest( + ECU_INIT_COMMAND, // mode + new byte[]{(byte) 0xfb},// pid + true, // pid valid + tester); // source + System.out.println("Init request = " + + HexUtil.asHex(_10fb)); + api.writeMsg(channelId, + _10fb, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("Init response = " + + HexUtil.asHex(response)); + + final byte[] _2110 = buildRequest( + READ_MODE21_COMMAND, // mode + new byte[]{(byte) 0x10},// pid + true, // pid valid + tester); // source + System.out.println("ID request = " + + HexUtil.asHex(_2110)); + api.writeMsg(channelId, + _2110, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("ID response = " + + HexUtil.asHex(response)); + + final byte[] _2181 = buildRequest( + READ_MODE21_COMMAND, // mode + new byte[]{(byte) 0x81},// pid + true, // pid valid + tester); // source + System.out.println("VIN request = " + + HexUtil.asHex(_2181)); + api.writeMsg(channelId, + _2181, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("VIN response = " + + HexUtil.asHex(response)); + + final byte[] _2180 = buildRequest( + READ_MODE21_COMMAND, // mode + new byte[]{(byte) 0x80},// pid + true, // pid valid + tester); // source + System.out.println("UDS 2180 request = " + + HexUtil.asHex(_2180)); + api.writeMsg(channelId, + _2180, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("UDS 2180 response = " + + HexUtil.asHex(response)); + + final byte[] _21f0 = buildRequest( + READ_MODE21_COMMAND, // mode + new byte[]{(byte) 0xf0},// pid + true, // pid valid + tester); // source + System.out.println("Prod Num request long = " + + HexUtil.asHex(_21f0)); + api.writeMsg(channelId, + _21f0, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("Prod Num response long = " + + HexUtil.asHex(response)); + + final byte[] _21fe = buildRequest( + READ_MODE21_COMMAND, // mode + new byte[]{(byte) 0xfe},// pid + true, // pid valid + tester); // source + System.out.println("Prod Num request = " + + HexUtil.asHex(_21fe)); + api.writeMsg(channelId, + _21fe, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("Prod Num response = " + + HexUtil.asHex(response)); + if (response[4] != 0x7f) { + int j = 6; + while (response[j] != 0 && j < response.length) { j++; } + if (j == response.length) { j--; } + System.arraycopy(response, 6, uds3483_d, 0, j - 6); + } + + final byte[] _21ff = buildRequest( + READ_MODE21_COMMAND, // mode + new byte[]{(byte) 0xff},// pid + true, // pid valid + tester); // source + System.out.println("HW Num request = " + + HexUtil.asHex(_21ff)); + api.writeMsg(channelId, + _21ff, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + System.out.println("HW Num response = " + + HexUtil.asHex(response)); + if (response[4] != 0x7f) { + System.arraycopy(response, 10, uds3483_d, 28, 10); + } + // Read from start address for length bytes + if (args[1].equalsIgnoreCase("r")) { + long start; + int size; + if (args[2].startsWith("0x")) { + start = Long.valueOf(args[2].substring(2), 16); + } + else { + start = Long.parseLong(args[2]); + } + if (args[3].startsWith("0x")) { + size = Integer.valueOf(args[3].substring(2), 16); + } + else { + size = Integer.parseInt(args[3]); + } + + final String filename = String.format("%s\\%s_read.bin", + System.getProperty("user.home"), calid); + System.out.println(String.format( + "Writing file: %s%nRead start: 0x%X, length: %s", + filename, start, size)); + stream = new FileOutputStream(filename); + final long end = start + size; + long i = start; + final int frame_len = 0x3F; + int len = 0x3F; + while (i < end) { + if ((i + frame_len) > end) { + len = size % frame_len; + } + final byte[] frame = new byte[6]; + final byte[] addr = ByteBuffer.allocate(8).putLong(i).array(); + System.arraycopy(addr, 4, frame, 0, 4); // copy last 4 (integer) bytes + frame[5] = (byte) len; + final byte[] _2300 = buildRequest( + (byte) 0x23, + frame, + true, + tester); + System.out.println(String.format("Reading addr: 0x%06X, len: %d", i, len)); + api.writeMsg(channelId, + _2300, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + final byte[] out = new byte[response.length-5]; + System.arraycopy(response, 5, out, 0, out.length); + stream.write(out); + i+=frame_len; + } + } + // Program ECU with or test given binary file + if (args[1].equals("P") || args[1].equalsIgnoreCase("t")) { + boolean test = false; + if (args[1].equalsIgnoreCase("t")) { + test = true; + System.out.println("Test programming without actually doing it"); + } + final File binFile = new File(args[2]); + if ((binFile.length() % 4) > 0) { + System.out.println(String.format( + "Error: file length %d is not a multiple of 4 bytes", binFile.length())); + return; + } + final NcsCoDec codec = new NcsCoDec(); + final int size = 0x80; + int scode = 0; + int idx = 0x8200; + try { + List inChunks = readFile(binFile, size); + final int filesize = inChunks.size() * size; + System.out.println("file: " + binFile.getName()); + System.out.println(String.format( + "file size: %d, chunk size: %d, chunks: %d, chunks length: %d", + binFile.length(), size, inChunks.size(), filesize)); + if (binFile.length() != filesize) { + System.out.println("Error: file and chunked file are not equal byte length"); + return; + } + if ((binFile.length() == 524288) || (binFile.length() == 1048576) || (binFile.length() == 1310720) + || (binFile.length() == 1572864) || (binFile.length() == 2097152)) { + scode = inChunks.get(191).getInt(96); // 191*size+96=24544 (0x5FE0) + } + if (scode == 0) { + System.out.println("Error: scode not found in file"); + return; + } + System.out.println(String.format("using scode from file: %08X", scode)); + if (test) System.out.println("input starting at 0x8200:"); + // remove the chunks that we won't be flashing + final int skip = idx / size; + for (int i = 0; i < skip; i++) { + inChunks.remove(0); + } + List encChunks = new ArrayList(); + for (ByteBuffer chunk : inChunks) { + if (test) System.out.println(String.format("0x%06X : %s", + idx, HexUtil.asHex(chunk.array()))); + encChunks.add(codec.nisEncode(chunk, scode)); + idx += size; + } + if (test) System.out.println("encoded output:"); + idx = 0x8200; + List prgChunks = new ArrayList(); + for (byte[] chunk : encChunks) { + //System.out.println(HexUtil.asHex(chunk)); + final ByteBuffer crcChunk = ByteBuffer.allocate(134).order(ByteOrder.BIG_ENDIAN); + crcChunk.putInt(1, idx); + crcChunk.putShort(0, (short) 0x3482); + crcChunk.put(5, (byte) size); + crcChunk.position(6); + crcChunk.put(chunk); + //System.out.println(HexUtil.asHex(crcChunk.array())); + final short crc = codec.calcCrc(crcChunk.array()); + //System.out.println(String.format("CRC:%04x", crc)); + final short invert = (short) ~crc; + //System.out.println(String.format("~CRC:%04x", invert)); + final short flip = (short) (((invert << 8) | ((invert & 0xffff) >>> 8)) & 0xffff); + //System.out.println(String.format("Flip:%04x", flip)); + final ByteBuffer finalChunk = ByteBuffer.allocate(136).order(ByteOrder.BIG_ENDIAN); + finalChunk.put(crcChunk.array()); + finalChunk.putShort(flip); + if (test) System.out.println(String.format("%04X : %s", + codec.calcCrc(finalChunk.array()), + HexUtil.asHex(finalChunk.array()))); + prgChunks.add(finalChunk.array()); + idx += size; + } + + // Start programming + try { + uds1085(channelId); + uds2781(channelId); + uds2782(channelId); + if (!test) { + uds3181(channelId); + for (byte[] chunk : prgChunks) { + uds34(channelId, chunk); + } + uds3182(channelId); + } + else { + System.out.println("If not a Test, programming messages would appear here ..."); + } + //String uds3483_t = "3132333435014106043954524B454D564E32000000000080010203040544414243444E4F4445780000010110115CFFFF"; + //String uds3483_t = "30303030303041060431434D43375150443430310000000000000000005230303030434F4E332B0619022000005CAD04"; // CRC = 312C + String uds3483_t = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; // !~CRC = B9BC + uds3483_d = HexUtil.asBytes(uds3483_t); + final ByteBuffer uds3483_bb = ByteBuffer.allocate(uds3483_d.length + 6).order(ByteOrder.BIG_ENDIAN); + uds3483_bb.putShort((short) 0x3483); + uds3483_bb.putInt(0x00000030); + uds3483_bb.put(uds3483_d); + //System.out.println(HexUtil.asHex(uds3483_bb.array())); + short crc = codec.calcCrc(uds3483_bb.array()); + short invert = (short) ~crc; + short flip = (short) (((invert << 8) | ((invert & 0xffff) >>> 8)) & 0xffff); + final ByteBuffer uds3483_data = ByteBuffer.allocate(uds3483_bb.capacity() + 2).order(ByteOrder.BIG_ENDIAN); + uds3483_data.put(uds3483_bb.array()); + uds3483_data.putShort(flip); + if (test) System.out.println(String.format("UDS 3483 data: %s", + HexUtil.asHex(uds3483_data.array()))); + if (!test) uds3483(channelId, uds3483_data.array()); + } catch (Exception e) { + e.printStackTrace(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + if (stream != null) stream.close(); + } + uds1081(channelId); + } + catch (Exception e) { + System.out.println(e); + sb.append(e); + } + finally { + api.stopMsgFilter(channelId, msgId); +// api.stopMsgFilter(channelId, msgId1); +// api.stopMsgFilter(channelId, msgId2); + api.disconnect(channelId); + } + } finally { + api.close(deviceId); + } + } + +// public final String toString() { +// return sb.toString(); +// } + + private final void handleResponse(byte[] response) { + String report = ""; + //validateResponse(response); + final int responseLen = response.length; + if (response[4] == READ_MODE9_RESPONSE) { + final byte[] data = new byte[responseLen - 7]; + System.arraycopy(response, 7, data, 0, data.length); + if (response[5] == 0x00) { + final byte[] rsp = new byte[responseLen - 6]; + System.arraycopy(response, 6, rsp, 0, data.length); + report = String.format(String.format( + "Mode 9 PIDs: %s%n", HexUtil.asHex(rsp))); + System.out.print(report); + sb.append(report); + } + if (response[5] == 0x02) { + report = String.format(String.format( + "VIN: %s%n", new String(data))); + System.out.print(report); + sb.append(report); + } + if (response[5] == 0x04) { + int i; + for (i = 0; i < data.length && data[i] != 0; i++) { } + final String str = new String(data, 0, i); + report = String.format(String.format( + "CAL ID: %s%n", str)); + System.out.print(report); + sb.append(report); + calid = str; + } + if (response[5] == 0x06) { + report = String.format(String.format( + "CVN: %s%n", HexUtil.asHex(data))); + System.out.print(report); + sb.append(report); + } + if (response[5] == 0x08) { + report = String.format("PID_8: %s%n", HexUtil.asHex(data)); + System.out.print(report); + sb.append(report); + } + if (response[5] == 0x0A) { + int i; + for (i = 0; i < data.length && data[i] != 0; i++) { } + final String str = new String(data, 0, i); + report = String.format(String.format( + "Module: %s%n", str)); + System.out.print(report); + sb.append(report); + } + } + if (response[4] == READ_MODE3_RESPONSE) { + if (response[5] > 0x00) { + final byte[] data = new byte[responseLen - 6]; + System.arraycopy(response, 6, data, 0, data.length); + int i; + int j = 1; + final byte[] codeHex = new byte[2]; + for (i = 0; i < data.length; i = i + 2) { + System.arraycopy(data, i, codeHex, 0, 2); + final byte module = (byte) ((codeHex[0] & 0xC0) >> 6); + String moduleTxt = null; + switch (module) { + case 0: + moduleTxt = "P"; + break; + case 1: + moduleTxt = "C"; + break; + case 2: + moduleTxt = "B"; + break; + case 3: + moduleTxt = "U"; + break; + } + + final byte dtcB1 = (byte) ((codeHex[0] & 0x30) >> 4); + final byte dtcB2 = (byte) (codeHex[0] & 0x0F); + final byte dtcB3 = (byte) ((codeHex[1] & 0xF0) >> 4); + final byte dtcB4 = (byte) (codeHex[1] & 0x0F); + + report = String.format(String.format( + "DTC %d: %s%s%s%s%s%n", + j, + moduleTxt, + Character.forDigit(dtcB1, 16), + Character.forDigit(dtcB2, 16), + Character.forDigit(dtcB3, 16), + Character.forDigit(dtcB4, 16))); + System.out.print(report); + sb.append(report); + j++; + } + } + } + } + + private final void version(final int deviceId) { + final Version version = api.readVersion(deviceId); + String report = String.format( + "J2534 Firmware:[%s], DLL:[%s], API:[%s]%n", + version.firmware, version.dll, version.api); + System.out.print(report); + sb.append(report); + } + + private final void setConfig(int channelId) { + final ConfigItem loopback = new ConfigItem(Config.LOOPBACK.getValue(), LOOPBACK); + final ConfigItem bs = new ConfigItem(Config.ISO15765_BS.getValue(), 0); + final ConfigItem stMin = new ConfigItem(Config.ISO15765_STMIN.getValue(), 0); + final ConfigItem bs_tx = new ConfigItem(Config.BS_TX.getValue(), 0xffff); + final ConfigItem st_tx = new ConfigItem(Config.STMIN_TX.getValue(), 0xffff); + final ConfigItem wMax = new ConfigItem(Config.ISO15765_WFT_MAX.getValue(), 0); + api.setConfig(channelId, loopback, bs, stMin, bs_tx, st_tx, wMax); + } + + private final void getConfig(int channelId) { + final ConfigItem[] configs = api.getConfig( + channelId, + Config.LOOPBACK.getValue(), + Config.ISO15765_BS.getValue(), + Config.ISO15765_STMIN.getValue(), + Config.BS_TX.getValue(), + Config.STMIN_TX.getValue(), + Config.ISO15765_WFT_MAX.getValue() + ); + int i = 1; + String report = ""; + for (ConfigItem item : configs) { + report = String.format( + "J2534 Config item %d: Parameter: %s, value:%d%n", + i, Config.get(item.parameter), item.value); + System.out.print(report); + sb.append(report); + i++; + } + } + + private final void validateResponse(byte[] response) { + assertEquals(match1, response, "Invalid ECU id"); + if (response.length == 7 && response[4] == 0x7f) { + assertNrc(ECU_NRC, response[4], response[5], response[6], "Command: "); + } + //assertOneOf(new byte[]{ECU_INIT_RESPONSE, READ_MODE3_RESPONSE, READ_MODE9_RESPONSE}, response[4], "Invalid response code"); + } + + private final void assertNrc(byte expected, byte actual, byte command, byte code, String msg) { + if (actual == expected) { + String ec = " unsupported"; + switch(code) { + case 0x10: + ec = " generalReject"; + break; + case 0x11: + ec = " serviceNotSupported"; + break; + case 0x12: + ec = " subFunctionNotSupported-invalidFormat"; + break; + case 0x13: + ec = " invalid format or length"; + break; + case 0x21: + ec = " busy-RepeatRequest"; + break; + case 0x22: + ec = " conditionsNotCorrect or requestSequenceError"; + break; + case 0x23: + ec = " routineNotComplete"; + break; + case 0x31: + ec = " requestOutOfRange"; + break; + case 0x33: + ec = " securityAccessDenied"; + break; + case 0x35: + ec = " invalidKey"; + break; + case 0x36: + ec = " exceedNumberOfAttempts"; + break; + case 0x37: + ec = " requiredTimeDelayNotExpired"; + break; + case 0x40: + ec = " downloadNotAccepted"; + break; + case 0x41: + ec = " improperDownloadType"; + break; + case 0x42: + ec = " can'tDownloadToSpecifiedAddress"; + break; + case 0x43: + ec = " can'tDownloadNumberOfBytesRequested"; + break; + case 0x50: + ec = " uploadNotAccepted"; + break; + case 0x51: + ec = " improperUploadType"; + break; + case 0x52: + ec = " can'tUploadFromSpecifiedAddress"; + break; + case 0x53: + ec = " can'tUploadNumberOfBytesRequested"; + break; + case 0x71: + ec = " transferSuspended"; + break; + case 0x72: + ec = " transferAborted"; + break; + case 0x74: + ec = " illegalAddressInBlockTransfer"; + break; + case 0x75: + ec = " illegalByteCountInBlockTransfer"; + break; + case 0x76: + ec = " illegalBlockTransferType"; + break; + case 0x77: + ec = " blockTransferDataChecksumError"; + break; + case 0x78: + ec = " reqCorrectlyRcvd-RspPending (requestCorrectlyReceived-ResponsePending)"; + break; + case 0x79: + ec = " incorrectByteCountDuringBlockTransfer"; + break; + } + if (code > 0x7f) { + ec = " manufacturerSpecificCode"; + } + throw new InvalidResponseException( + msg + asHex(new byte[]{command}) + ec); + } + } + + private final void assertEquals(byte[] expected, byte[] actual, String msg) { + final byte[] idBytes = new byte[4]; + System.arraycopy(actual, 0, idBytes, 0, 4); + final int idExpected = asUnsignedInt(expected); + final int idActual = asUnsignedInt(idBytes); + if (idActual != idExpected) { + throw new InvalidResponseException( + msg + ". Expected: " + asHex(expected) + + ". Actual: " + asHex(idBytes) + "."); + } + } + + private final void assertOneOf(byte[] validOptions, byte actual, String msg) { + for (byte option : validOptions) { + if (option == actual) { + return; + } + } + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < validOptions.length; i++) { + if (i > 0) { + builder.append(", "); + } + builder.append(asHex(new byte[]{validOptions[i]})); + } + throw new InvalidResponseException(msg + ". Expected one of [" + builder.toString() + "]. Actual: " + asHex(new byte[]{actual}) + "."); + } + + private final byte[] buildRequest( + byte mode, + byte[] pid, + boolean pidValid, + byte[] address) { + + final ByteArrayOutputStream bb = new ByteArrayOutputStream(6); + try { + bb.write(address); + bb.write(mode); + if (pidValid) { + bb.write(pid); + } + } catch (IOException e) { + e.printStackTrace(); + } + return bb.toByteArray(); + } + + + private final byte[] buildBareRequest( + byte[] data, + byte[] address) { + + final ByteArrayOutputStream bb = new ByteArrayOutputStream(6); + try { + bb.write(address); + bb.write(data); + } catch (IOException e) { + e.printStackTrace(); + } + return bb.toByteArray(); + } + + private final void uds1081(int channelId) { + final byte[] _1081 = buildRequest( + (byte) 0x10, + new byte[]{(byte) 0x81}, + true, + tester); + System.out.println("Ending session: " + + HexUtil.asHex(_1081)); + api.writeMsg(channelId, + _1081, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + final byte[] response = api.readMsg(channelId, 1, 1000L); + validateResponse(response); + System.out.println("End session ACK: " + + HexUtil.asHex(response)); + } + + private final void uds1085(int channelId) { + final byte[] _1085 = buildRequest( + (byte) 0x10, + new byte[]{(byte) 0x85}, + true, + tester); + System.out.println("Starting programming session: " + + HexUtil.asHex(_1085)); + api.writeMsg(channelId, + _1085, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + final byte[] response = api.readMsg(channelId, 1, 1000L); + validateResponse(response); + System.out.println("Programming session ACK: " + + HexUtil.asHex(response)); + } + + private final void uds2781(int channelId) { + final byte[] _2781 = buildRequest( + (byte) 0x27, + new byte[]{(byte) 0x81}, + true, + tester); + System.out.println("Requesting security access: " + + HexUtil.asHex(_2781)); + api.writeMsg(channelId, + _2781, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + final byte[] response = api.readMsg(channelId, 1, 1000L); + validateResponse(response); + System.out.println("Security access seed: " + + HexUtil.asHex(response)); + } + + private final void uds2782(int channelId) { + final byte[] _2782 = buildRequest( + (byte) 0x27, + new byte[]{(byte) 0x82,(byte) 0x11,(byte) 0x22,(byte) 0x33,(byte) 0x44},// pid + true, + tester); + System.out.println("Sending security access key: " + + HexUtil.asHex(_2782)); + api.writeMsg(channelId, + _2782, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + final byte[] response = api.readMsg(channelId, 1, 1000L); + validateResponse(response); + System.out.println("Security access granted: " + + HexUtil.asHex(response)); + } + + private final void uds3181(int channelId) { + byte[] _3181 = buildRequest( + (byte) 0x31, + new byte[]{(byte) 0x81,(byte) 0x82,(byte) 0xf0,(byte) 0x5a}, + true, + tester); + System.out.println("Requesting download service: " + + HexUtil.asHex(_3181)); + api.writeMsg(channelId, + _3181, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + byte[] response = api.readMsg(channelId, 1, 1000L); + validateResponse(response); + System.out.println("Preparing ECU for download: " + + HexUtil.asHex(response)); + + // wait for "ready" response + while (response[response.length-1] == 1) { + _3181 = buildRequest( + (byte) 0x31, + new byte[]{(byte) 0x81,(byte) 0x01}, + true, + tester); + //System.out.println("UDS 31 request = " + + // HexUtil.asHex(_3181)); + api.writeMsg(channelId, + _3181, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + validateResponse(response); + System.out.print("."); + try { + Thread.sleep(400); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + System.out.println("."); + System.out.println("ECU ready for download: " + + HexUtil.asHex(response)); + } + + private final void uds3182(int channelId) { + byte[] _3182 = buildRequest( + (byte) 0x31, + new byte[]{(byte) 0x82,(byte) 0x00}, + true, + tester); + System.out.println("Closing download service: " + + HexUtil.asHex(_3182)); + api.writeMsg(channelId, + _3182, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + byte[] response = api.readMsg(channelId, 1, 1000L); + validateResponse(response); + if (response[response.length-1] == 1) { + System.out.println("Download service closed: " + + HexUtil.asHex(response)); + } + else { + throw new InvalidResponseException("Download secrive close failed"); + } + + System.out.println("Verifying download:"); + // wait for "ready" response + while (response[response.length-1] == 1) { + _3182 = buildRequest( + (byte) 0x31, + new byte[]{(byte) 0x82,(byte) 0x01}, + true, + tester); + //System.out.println("UDS 31 request = " + + // HexUtil.asHex(_3181)); + api.writeMsg(channelId, + _3182, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + response = api.readMsg(channelId, 1, 1000L); + validateResponse(response); + System.out.print("."); + try { + Thread.sleep(400); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + System.out.println("."); + System.out.println("Verification response: " + + HexUtil.asHex(response)); + if (response[response.length-1] == 2) { + System.out.println("Verification successful!"); + } + else { + throw new InvalidResponseException("Verification of download data failed"); + } + } + + private final void uds34(int channelId, byte[] data) { + final byte[] _34 = buildBareRequest( + data, + tester); + System.out.print(String.format("%d: writing address 0x%02X%02X%02X : ", + System.currentTimeMillis(), data[2], data[3], data[4])); + api.writeMsg(channelId, + _34, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + final byte[] response = api.readMsg(channelId, 1, 1000L); + validateResponse(response); + if (response[response.length-1] == 2) { + System.out.println("ok"); + } + else { + System.out.println("NAK : " + + HexUtil.asHex(response)); + throw new InvalidResponseException("Programming failed at last address block"); + } + } + + private final void uds3483(int channelId, byte[] data) { + final byte[] _3483 = buildBareRequest( + data, + tester); + System.out.println("Finalizing ECU: " + + HexUtil.asHex(_3483)); + api.writeMsg(channelId, + _3483, + 1000L, + TxFlags.ISO15765_FRAME_PAD); + final byte[] response = api.readMsg(channelId, 1, 1000L); + System.out.println("Finalizing ECU response: " + + HexUtil.asHex(response)); + validateResponse(response); + if (response[response.length-1] == 2) { + System.out.println("Complete! "); + } + } + + /** + * For the given inputFile, read data into chunks of size bytes + * and return a List of read chunks + */ + public final List readFile(File inputFile, int size) throws IOException { + final List chunkList = new ArrayList(); + final FileInputStream fis = new FileInputStream(inputFile); + try { + final byte[] buf = new byte[size]; + int readBytes = 0; + int bytesRead = 0; + while ((readBytes = fis.read(buf)) != -1) { + bytesRead += readBytes; + final ByteBuffer chunk = ByteBuffer.allocate(size).order(ByteOrder.BIG_ENDIAN).put(buf); + chunkList.add(chunk); + } + if ((bytesRead % size) != 0) { + System.out.println("WARNING: less than a chunck size of data left over : " + (bytesRead % size)); + } + } finally { + fis.close(); + } + return chunkList; + } + + public final static void main(String[] args) throws InterruptedException{ + LogManager.initDebugLogging(); + if (args.length < 1) { + System.out.printf("Provide \"J2534_library_name\" cmdline arg."); + return; + } + else { + /** + * Argument options: + * arg0: J2534 library [required] - op20pt32 | MONGI432 | /usr/local/lib/j2534.so + * arg1: Command [optional] - one of: r | P | t + * Command arguments: + * r = read from address for length bytes: + * example, read from start for 128kB: + * r 0 0x2000 + * (start and length can be provided in decimal or hexadecimal) + * P = program ECU from given ROM image file: + * example: + * P + * (the file must be the exact size of the ROM in bytes) + * t = test programming ECU from given ROM image file: + * example: + * t + * (the file must be the exact size of the ROM in bytes) + */ + api = new J2534Impl( + Protocol.ISO15765, args[0]); + } + new TestJ2534NCS(args); + } +} diff --git a/src/main/java/com/romraider/io/j2534/api/TestJ2534OBD.java b/src/main/java/com/romraider/io/j2534/api/TestJ2534OBD.java index a8691cc99..a78793f36 100644 --- a/src/main/java/com/romraider/io/j2534/api/TestJ2534OBD.java +++ b/src/main/java/com/romraider/io/j2534/api/TestJ2534OBD.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2018 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,8 +30,7 @@ * an active ECU using the ISO14230 protocol. */ public final class TestJ2534OBD { - private static final J2534 api = new J2534Impl( - Protocol.ISO14230, "op20pt32"); //op20pt32 MONGI432 + private static J2534 api; private static final int LOOPBACK = 0; public TestJ2534OBD() throws InterruptedException { @@ -171,6 +170,14 @@ private static void getConfig(int channelId) { public static void main(String args[]) throws InterruptedException{ LogManager.initDebugLogging(); + if (args.length < 1) { + System.out.printf("Provide \"library_name\" cmdline arg."); + return; + } + else { + api = new J2534Impl( //op20pt32 MONGI432 /usr/local/lib/j2534.so + Protocol.ISO14230, args[0]); + } TestJ2534OBD test1 = new TestJ2534OBD(); } } diff --git a/src/main/java/com/romraider/io/protocol/Protocol.java b/src/main/java/com/romraider/io/protocol/Protocol.java index 038e99570..c4d493666 100644 --- a/src/main/java/com/romraider/io/protocol/Protocol.java +++ b/src/main/java/com/romraider/io/protocol/Protocol.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,18 +22,19 @@ import com.romraider.io.connection.ConnectionProperties; import com.romraider.logger.ecu.comms.manager.PollingState; import com.romraider.logger.ecu.comms.query.EcuInit; +import com.romraider.logger.ecu.definition.Module; public interface Protocol { - byte[] constructEcuInitRequest(byte id); + byte[] constructEcuInitRequest(Module module); - byte[] constructWriteMemoryRequest(byte id, byte[] address, byte[] values); + byte[] constructWriteMemoryRequest(Module module, byte[] address, byte[] values); - byte[] constructWriteAddressRequest(byte id, byte[] address, byte value); + byte[] constructWriteAddressRequest(Module module, byte[] address, byte value); - byte[] constructReadMemoryRequest(byte id, byte[] address, int numBytes); + byte[] constructReadMemoryRequest(Module module, byte[] address, int numBytes); - byte[] constructReadAddressRequest(byte id, byte[][] addresses); + byte[] constructReadAddressRequest(Module module, byte[][] addresses); byte[] preprocessResponse(byte[] request, byte[] response, PollingState pollState); @@ -43,7 +44,7 @@ public interface Protocol { EcuInit parseEcuInitResponse(byte[] processedResponse); - byte[] constructEcuResetRequest(byte id); + byte[] constructEcuResetRequest(Module module, int resetCode); void checkValidEcuResetResponse(byte[] processedResponse); diff --git a/src/main/java/com/romraider/io/protocol/ProtocolDS2.java b/src/main/java/com/romraider/io/protocol/ProtocolDS2.java new file mode 100644 index 000000000..62cd15638 --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ProtocolDS2.java @@ -0,0 +1,37 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol; + +import com.romraider.logger.ecu.definition.Module; + +public interface ProtocolDS2 extends Protocol { + + byte[] constructReadProcedureRequest(Module module, byte[][] addresses); + + byte[] constructReadGroupRequest(Module module, byte[][] addresses); + + byte[] constructReadMemoryRequest( + Module module, byte[][] convertToByteAddresses, int length); + + byte[] constructSetAddressRequest( + Module module, byte[][] convertToByteAddresses); + + void validateSetAddressResponse(byte[] response); +} diff --git a/src/main/java/com/romraider/io/protocol/ProtocolNCS.java b/src/main/java/com/romraider/io/protocol/ProtocolNCS.java new file mode 100644 index 000000000..09f2082e8 --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ProtocolNCS.java @@ -0,0 +1,52 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol; + +import java.util.Map; + +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.definition.Module; + + +public interface ProtocolNCS extends Protocol { + + byte[] constructEcuFastInitRequest(Module module); + + byte[] constructReadSidPidRequest(Module module, byte sid, byte[][] pid); + + byte[] constructLoadAddressRequest(Map queryMap); + + void validateLoadAddressResponse(byte[] response); + + byte[] checkValidSidPidResponse(byte[] response); + + byte[] constructReadAddressRequest(Module module, byte[][] bs, + PollingState pollState); + + byte[] constructEcuIdRequest(Module module); + + byte[] constructEcuStopRequest(Module module); + + byte[] constructStartDiagRequest(Module module); + + byte[] constructElevatedDiagRequest(Module module); + + byte[] constructReadMemoryRequest(Module module, byte[][] address, int numBytes); +} diff --git a/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2ChecksumCalculator.java b/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2ChecksumCalculator.java new file mode 100644 index 000000000..6d0119104 --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2ChecksumCalculator.java @@ -0,0 +1,36 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2014 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ds2.iso9141; + + +public final class DS2ChecksumCalculator { + + private DS2ChecksumCalculator() { + throw new UnsupportedOperationException(); + } + + public static byte calculateChecksum(byte[] bytes) { + byte cs = 0; + for (int i = 0; i < (bytes.length - 1); i++) { + cs ^= bytes[i]; + } + return cs; + } +} diff --git a/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2LoggerProtocol.java b/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2LoggerProtocol.java new file mode 100644 index 000000000..2d76ea8ac --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2LoggerProtocol.java @@ -0,0 +1,360 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ds2.iso9141; + +import static com.romraider.io.protocol.ds2.iso9141.DS2Protocol.RESPONSE_NON_DATA_BYTES; +import static com.romraider.io.protocol.ds2.iso9141.DS2ResponseProcessor.extractResponseData; +import static com.romraider.io.protocol.ds2.iso9141.DS2ResponseProcessor.filterRequestFromResponse; +import static com.romraider.util.ByteUtil.asUnsignedInt; +import static com.romraider.util.HexUtil.asBytes; +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import static java.lang.System.arraycopy; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import com.romraider.io.protocol.Protocol; +import com.romraider.io.protocol.ProtocolDS2; +import com.romraider.logger.ecu.comms.io.protocol.LoggerProtocolDS2; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.query.EcuInit; +import com.romraider.logger.ecu.comms.query.EcuInitCallback; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryData; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.Module; + +public final class DS2LoggerProtocol implements LoggerProtocolDS2 { + private final ProtocolDS2 protocol = new DS2Protocol(); + + @Override + public byte[] constructEcuInitRequest(Module module) { + return protocol.constructEcuInitRequest(module); + } + + @Override + public byte[] constructEcuResetRequest(Module module, int resetCode) { + return protocol.constructEcuResetRequest(module, resetCode); + } + + @Override + public byte[] constructReadAddressRequest( + Module module, Collection queries) { + + return protocol.constructReadAddressRequest( + module, new byte[][]{}); + } + + @Override + public byte[] constructReadProcedureRequest( + Module module, Collection queries) { + + Collection filteredQueries = filterDuplicates(queries); + return protocol.constructReadProcedureRequest( + module, convertToByteAddresses(filteredQueries)); + } + + @Override + public byte[] constructReadGroupRequest( + Module module, String group) { + + return protocol.constructReadGroupRequest( + module, new byte[][]{asBytes(group)}); + } + + @Override + public byte[] constructReadMemoryRequest( + Module module, Collection queries) { + + Collection filteredQueries = filterDuplicates(queries); + return protocol.constructReadMemoryRequest( + module, convertToByteAddresses(filteredQueries), getDataLength(filteredQueries)); + } + + @Override + public byte[] constructReadMemoryRange( + Module module, Collection queries, int length) { + + return protocol.constructReadMemoryRequest( + module, convertToByteAddresses(queries), length); + } + + /** + * Convert address for the list of queries into the hex format the + * ECU expects. + **/ + @Override + public byte[] constructSetAddressRequest(Module module, + Collection queries) { + Collection filteredQueries = filterDuplicates(queries); + return protocol.constructSetAddressRequest( + module, convertListToByteAddresses(filteredQueries)); + } + + /** + * An Address set response is a 4 byte ACK sequence + **/ + @Override + public byte[] constructSetAddressResponse(int requestSize) { + return new byte[requestSize + RESPONSE_NON_DATA_BYTES]; + } + + @Override + public byte[] constructReadAddressResponse(Collection queries, + PollingState pollState) { + return null; + } + + @Override + public byte[] constructReadAddressResponse( + Collection queries, int requestSize) { + + checkNotNullOrEmpty(queries, "queries"); + Collection filteredQueries = filterDuplicates(queries); + int responseBytes = requestSize + RESPONSE_NON_DATA_BYTES; + for (EcuQuery ecuQuery : filteredQueries) { + responseBytes += EcuQueryData.getDataLength(ecuQuery); + } + return new byte[responseBytes]; + } + + @Override + public byte[] constructReadMemoryRangeResponse(int requestSize, int length) { + + return new byte[requestSize + RESPONSE_NON_DATA_BYTES + length]; + } + + @Override + public byte[] constructReadGroupResponse( + Collection queries, int requestSize) { + + checkNotNullOrEmpty(queries, "queries"); + int size = 0; + for (EcuQuery ecuQuery : queries) { + size = ((EcuData) ecuQuery.getLoggerData()).getGroupSize(); + break; + } + return new byte[requestSize + RESPONSE_NON_DATA_BYTES + size]; + } + + @Override + public byte[] preprocessResponse(byte[] request, byte[] response, PollingState pollState) { + return filterRequestFromResponse(request, response, pollState); + } + + @Override + public void processEcuInitResponse(EcuInitCallback callback, byte[] response) { + checkNotNull(callback, "callback"); + checkNotNullOrEmpty(response, "response"); + protocol.checkValidEcuInitResponse(response); + EcuInit ecuInit = protocol.parseEcuInitResponse(response); + callback.callback(ecuInit); + } + + @Override + public void processEcuResetResponse(byte[] response) { + checkNotNullOrEmpty(response, "response"); + protocol.checkValidEcuResetResponse(response); + } + + /** + * Processes the response bytes and set individual response on corresponding + * query objects. + * If EcuData has a group size value greater than 0 then the response is + * the result of a group read and the address is the index into the response + * array. + **/ + @Override + public void processReadAddressResponse(Collection queries, byte[] response, PollingState pollState) { + checkNotNullOrEmpty(queries, "queries"); + checkNotNullOrEmpty(response, "response"); + byte[] responseData = extractResponseData(response); + Collection filteredQueries = filterDuplicates(queries); + Map addressResults = new HashMap(); + + int srcPos = 0; + for (EcuQuery filteredQuery : filteredQueries) { + byte[] bytes = new byte[EcuQueryData.getDataLength(filteredQuery)]; + if (((EcuData) filteredQuery.getLoggerData()).getGroupSize() > 0) { + srcPos = filteredQuery.getBytes()[0]; + } + arraycopy(responseData, srcPos, bytes, 0, bytes.length); + addressResults.put(filteredQuery.getHex(), bytes); + srcPos = 0; + } + for (EcuQuery query : queries) { + query.setResponse(addressResults.get(query.getHex())); + } + } + + /** + * Processes the response bytes and set individual response on corresponding + * query objects. + * The response data is based on the lowest EcuData address and the length + * is the result of the difference between the highest and lowest address. + * The index into the response array is based in the lowest address. + **/ + public void processReadMemoryRangeResponse( + Collection queries, byte[] response) { + + checkNotNullOrEmpty(queries, "queries"); + checkNotNullOrEmpty(response, "response"); + final byte[] responseData = extractResponseData(response); + final Collection filteredQueries = filterDuplicates(queries); + final Map addressResults = new HashMap(); + + int lowestAddress = Integer.MAX_VALUE; + for (EcuQuery filteredQuery : filteredQueries) { + final int address = Integer.parseInt(filteredQuery.getHex(), 16); + if (address < lowestAddress) { + lowestAddress = address; + } + } + + int srcPos = 0; + for (EcuQuery filteredQuery : filteredQueries) { + final byte[] bytes = new byte[EcuQueryData.getDataLength(filteredQuery)]; + srcPos = Integer.parseInt(filteredQuery.getHex(), 16) - lowestAddress; + arraycopy(responseData, srcPos, bytes, 0, bytes.length); + addressResults.put(filteredQuery.getHex(), bytes); + } + + for (EcuQuery query : queries) { + query.setResponse(addressResults.get(query.getHex())); + } + } + + @Override + public void processReadAddressResponses(Collection queries, + byte[] response, PollingState pollState) { + checkNotNullOrEmpty(queries, "queries"); + checkNotNullOrEmpty(response, "response"); + final byte[] responseData = extractResponseData(response); + final Collection filteredQueries = filterDuplicates(queries); + final Map addressResults = new HashMap(); + int i = 0; + for (EcuQuery filteredQuery : filteredQueries) { + final int dataLength = EcuQueryData.getDataLength(filteredQuery); + final byte[] data = new byte[dataLength]; + arraycopy(responseData, i, data, 0, dataLength); + addressResults.put(filteredQuery.getHex(), data); + i += dataLength; + } + for (EcuQuery query : queries) { + query.setResponse(addressResults.get(query.getHex())); + } + } + + /** + * Validate response headers, length and checksum + **/ + @Override + public void validateSetAddressResponse(byte[] response) { + checkNotNullOrEmpty(response, "response"); + protocol.validateSetAddressResponse(response); + } + + @Override + public Protocol getProtocol() { + return protocol; + } + + @Override + public byte[] constructWriteAddressRequest( + Module module, byte[] writeAddress, byte value) { + + return protocol.constructWriteAddressRequest(module, writeAddress, value); + } + + @Override + public void processWriteResponse(byte[] data, byte[] response) { + checkNotNullOrEmpty(data, "data"); + checkNotNullOrEmpty(response, "response"); + protocol.checkValidWriteResponse(data, response); + } + + private Collection filterDuplicates(Collection queries) { + Collection filteredQueries = new ArrayList(); + for (EcuQuery query : queries) { + if (!filteredQueries.contains(query)) { + filteredQueries.add(query); + } + } + return filteredQueries; + } + + private byte[][] convertToByteAddresses(Collection queries) { + int byteCount = 0; + int addressSize = 0; + for (EcuQuery query : queries) { + byteCount += query.getAddresses().length; + addressSize = query.getBytes().length; + } + final byte[][] addresses = new byte[byteCount][addressSize]; + int i = 0; + for (EcuQuery query : queries) { + final int addrLength = query.getBytes().length; + final byte[] bytes = query.getBytes(); + for (int j = 0; j < bytes.length / addrLength; j++) { + arraycopy(bytes, j * addrLength, addresses[i++], 0, addrLength); + } + } + return addresses; + } + + private byte[][] convertListToByteAddresses(Collection queries) { + /* + * Address format is five bytes. First byte is data type + * (byte, word, procedure) followed by the four byte address. + */ + final byte[][] addresses = new byte[queries.size()][5]; + int i = 0; + for (EcuQuery query : queries) { + final int addrLength = query.getBytes().length; + final byte[] bytes = query.getBytes(); + for (int j = 0; j < bytes.length / addrLength; j++) { + arraycopy(bytes, j * addrLength, addresses[i], 1, addrLength); + } + // Update the first byte to the appropriate data type + // 0 = byte, 1 = word and 2 = procedure + // procedure + if (asUnsignedInt(bytes) < 0x1C) { + addresses[i][0] = 2; + } + // word or byte + else { + addresses[i][0] = (byte) (EcuQueryData.getDataLength(query) - 1); + } + i++; + } + return addresses; + } + + private int getDataLength(Collection queries) { + int dataLength = 0; + for (EcuQuery query : queries) { + dataLength += EcuQueryData.getDataLength(query); + } + return dataLength; + } +} diff --git a/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2Protocol.java b/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2Protocol.java new file mode 100644 index 000000000..b2e546fba --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2Protocol.java @@ -0,0 +1,256 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ds2.iso9141; + +import static com.romraider.io.protocol.ds2.iso9141.DS2ChecksumCalculator.calculateChecksum; +import static com.romraider.util.ByteUtil.asByte; +import static com.romraider.util.HexUtil.asHex; +import static com.romraider.util.ParamChecker.checkGreaterThanZero; +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.ByteBuffer; + +import com.romraider.io.connection.ConnectionProperties; +import com.romraider.io.protocol.ProtocolDS2; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.query.DS2EcuInit; +import com.romraider.logger.ecu.comms.query.EcuInit; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.exception.UnsupportedProtocolException; + +public final class DS2Protocol implements ProtocolDS2 { + private static final byte[] READ_MEMORY_COMMAND = new byte[]{0x06, 0x00}; + private static final byte[] READ_PROCEDURE_COMMAND = new byte[]{0x0B, 0x02}; + private static final byte[] ECU_INIT_COMMAND = new byte[]{0x00}; + private static final byte[] ECU_RESET_COMMAND = new byte[]{0x43}; + private static final byte[] SET_ADDRESS_COMMAND = new byte[]{0x0B, 0x01}; + private static final byte[] READ_ADDRESS_COMMAND = new byte[]{0x0B, 0x00}; + public static final byte VALID_RESPONSE = (byte) 0xA0; + public static final int RESPONSE_NON_DATA_BYTES = 4; + public static Module module; + private final ByteArrayOutputStream bb = new ByteArrayOutputStream(255); + + @Override + public byte[] constructEcuInitRequest(Module module) { + checkNotNull(module, "module"); + DS2Protocol.module = module; + // 0x12 0x04 0x00 0x16 + return buildRequest(ECU_INIT_COMMAND, new byte[0], new byte[0]); + } + + @Override + public byte[] constructWriteMemoryRequest( + Module module, byte[] address, byte[] values) { + + return buildRequest(new byte[0], new byte[0], values); + } + + @Override + public byte[] constructWriteAddressRequest( + Module module, byte[] address, byte value) { + + throw new UnsupportedProtocolException( + "Write Address command is not supported by DS2 for address: " + + asHex(address)); + } + + @Override + public byte[] constructReadMemoryRequest( + Module module, byte[] address, int numBytes) { + + return constructReadMemoryRequest( + module, new byte[][]{address}, numBytes); + } + + @Override + public byte[] constructReadMemoryRequest( + Module module, byte[][] address, int numBytes) { + checkNotNull(module, "module"); + checkNotNullOrEmpty(address, "address"); + checkGreaterThanZero(numBytes, "numBytes"); + // 0x12 0x09 0x06 + return buildRequest( + READ_MEMORY_COMMAND, new byte[]{asByte(numBytes)}, address); + } + + @Override + public byte[] constructReadAddressRequest( + Module module, byte[][] addresses) { + checkNotNull(module, "module"); + // 0x12 0x05 0x0B 0x00 + return buildRequest( + READ_ADDRESS_COMMAND, new byte[0], new byte[]{0}); + } + + @Override + public byte[] constructReadProcedureRequest( + Module module, byte[][] addresses) { + checkNotNull(module, "module"); + checkNotNullOrEmpty(addresses, "addresses"); + // 0x12 data_length group subgroup [procedure] checksum + return buildRequest(READ_PROCEDURE_COMMAND, new byte[0], addresses); + } + + public byte[] constructReadGroupRequest( + Module module, byte[][] addresses) { + checkNotNull(module, "module"); + checkNotNullOrEmpty(addresses, "addresses"); + // 0x12 data_length group subgroup checksum + return buildRequest(new byte[0], new byte[0], addresses); + } + + @Override + public byte[] constructSetAddressRequest(Module module, + byte[][] addresses) { + checkNotNull(module, "module"); + checkNotNullOrEmpty(addresses, "address"); + return buildRequest(SET_ADDRESS_COMMAND, new byte[0], addresses); + } + + @Override + public byte[] preprocessResponse(byte[] request, byte[] response, PollingState pollState) { + return DS2ResponseProcessor.filterRequestFromResponse(request, response, pollState); + } + + @Override + public byte[] parseResponseData(byte[] processedResponse) { + checkNotNullOrEmpty(processedResponse, "processedResponse"); + return DS2ResponseProcessor.extractResponseData(processedResponse); + } + + @Override + public void checkValidEcuInitResponse(byte[] processedResponse) { + // 12 2e a0 31343337383036 3131303133303231323239363030303031313538353236303030393632313432353634 9c + checkNotNullOrEmpty(processedResponse, "processedResponse"); + DS2ResponseProcessor.validateResponse(processedResponse); + } + + @Override + public void validateSetAddressResponse(byte[] processedResponse) { + // Valid response is an ACK: 12 04 A0 B6 + checkNotNullOrEmpty(processedResponse, "processedResponse"); + DS2ResponseProcessor.validateResponse(processedResponse); + } + + @Override + public EcuInit parseEcuInitResponse(byte[] processedResponse) { + return new DS2EcuInit(parseResponseData(processedResponse)); + } + + @Override + public final byte[] constructEcuResetRequest(Module module, int resetCode) { + // 0x12 data_length cmd byte1 byte2 checksum + checkNotNull(module, "module"); + final byte[] resetBytes = ByteBuffer.allocate(4).putInt(resetCode).array(); + final byte[] reset = new byte[2]; + System.arraycopy(resetBytes, 2, reset, 0, 2); + return buildRequest(ECU_RESET_COMMAND, new byte[0], reset); + } + + @Override + public void checkValidEcuResetResponse(byte[] processedResponse) { + // 80 F0 10 02 F8 40 BA + checkNotNullOrEmpty(processedResponse, "processedResponse"); + DS2ResponseProcessor.validateResponse(processedResponse); + } + + @Override + public void checkValidWriteResponse(byte[] data, byte[] processedResponse) { + } + + @Override + public ConnectionProperties getDefaultConnectionProperties() { + return new ConnectionProperties() { + + public int getBaudRate() { + return 9600; + } + + public void setBaudRate(int b) { + + } + + public int getDataBits() { + return 8; + } + + public int getStopBits() { + return 1; + } + + public int getParity() { + return 2; + } + + public int getConnectTimeout() { + return 2000; + } + + public int getSendTimeout() { + return 55; + } + }; + } + + private final byte[] buildRequest( + byte[] command, byte[] readLen, byte[]... content) { + + byte[] request = new byte[0]; + try { + int length = 3; + length += command.length; + length += readLen.length; + bb.reset(); + bb.write(module.getAddress()); + bb.write((byte) length); + bb.write(command); + if (command == SET_ADDRESS_COMMAND) { + length++; + bb.write(content.length); // number of parameters + } + for (byte[] tmp : content) { // address payload + if (command == READ_PROCEDURE_COMMAND + && tmp.length == 3) {// legacy ADC def 0x0B020E support + length++; + bb.write((byte) 0x00); + } + else if (command == READ_ADDRESS_COMMAND) { + break; // no content + } + length += tmp.length; + bb.write(tmp); + } + if (readLen.length > 0) { // readMemory, # of bytes to reads + bb.write(readLen); + } + bb.write((byte) 0x00); // chksum placeholder + request = bb.toByteArray(); + request[1] = (byte) length; // update length value + final byte cs = calculateChecksum(request); + request[request.length - 1] = cs; + } catch (IOException e) { + e.printStackTrace(); + } + return request; + } +} diff --git a/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2ResponseProcessor.java b/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2ResponseProcessor.java new file mode 100644 index 000000000..17ee46415 --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ds2/iso9141/DS2ResponseProcessor.java @@ -0,0 +1,87 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ds2.iso9141; + +import static com.romraider.io.protocol.ds2.iso9141.DS2ChecksumCalculator.calculateChecksum; +import static com.romraider.io.protocol.ds2.iso9141.DS2Protocol.RESPONSE_NON_DATA_BYTES; +import static com.romraider.io.protocol.ds2.iso9141.DS2Protocol.VALID_RESPONSE; +import static com.romraider.io.protocol.ds2.iso9141.DS2Protocol.module; +import static com.romraider.util.ByteUtil.asByte; +import static com.romraider.util.HexUtil.asHex; +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; + +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.exception.InvalidResponseException; + +public final class DS2ResponseProcessor { + + private DS2ResponseProcessor() { + throw new UnsupportedOperationException(); + } + + public static byte[] filterRequestFromResponse(byte[] request, byte[] response, PollingState pollState) { + checkNotNull(request, "request"); + checkNotNullOrEmpty(response, "response"); + checkNotNull(pollState, "pollState"); + byte[] filteredResponse = new byte[0]; + if (pollState.getCurrentState() == PollingState.State.STATE_0) { + filteredResponse = new byte[response.length - request.length]; + System.arraycopy(response, request.length, filteredResponse, 0, filteredResponse.length); + } + if (pollState.getCurrentState() == PollingState.State.STATE_1) { + filteredResponse = new byte[response.length]; + System.arraycopy(response, 0, filteredResponse, 0, filteredResponse.length); + } + return filteredResponse; + } + + public static void validateResponse(byte[] response) { + int i = 0; + assertTrue(response.length >= RESPONSE_NON_DATA_BYTES, "Invalid response length"); + assertEquals(module.getAddress()[0], response[i++], "Invalid " + module.getName() + " id"); + assertEquals(asByte(response.length), response[i++], "Invalid response packet length"); + assertEquals(VALID_RESPONSE, response[i], "Request not supported"); + assertEquals(calculateChecksum(response), response[response.length - 1], "Invalid checksum"); + } + + public static byte[] extractResponseData(byte[] response) { + checkNotNullOrEmpty(response, "response"); + // 12 a0 + validateResponse(response); + byte[] data = new byte[response.length - RESPONSE_NON_DATA_BYTES]; + System.arraycopy(response, (RESPONSE_NON_DATA_BYTES - 1), data, 0, data.length); + return data; + } + + + private static void assertTrue(boolean condition, String msg) { + if (!condition) { + throw new InvalidResponseException(msg); + } + } + + + private static void assertEquals(byte expected, byte actual, String msg) { + if (actual != expected) { + throw new InvalidResponseException(msg + ". Expected: " + asHex(new byte[]{expected}) + ". Actual: " + asHex(new byte[]{actual}) + "."); + } + } +} diff --git a/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSChecksumCalculator.java b/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSChecksumCalculator.java new file mode 100644 index 000000000..07f0b6dda --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSChecksumCalculator.java @@ -0,0 +1,39 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2018 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ncs.iso14230; + +import static com.romraider.util.ByteUtil.asByte; +import static com.romraider.util.ByteUtil.asInt; + +public final class NCSChecksumCalculator { + + private NCSChecksumCalculator() { + throw new UnsupportedOperationException(); + } + + public static byte calculateChecksum(byte[] bytes) { + int total = 0; + for (int i = 0; i < (bytes.length - 1); i++) { + byte b = bytes[i]; + total += asInt(b); + } + return asByte(total & 0xFF); + } +} diff --git a/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSLoggerProtocol.java b/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSLoggerProtocol.java new file mode 100644 index 000000000..5a4693e6d --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSLoggerProtocol.java @@ -0,0 +1,248 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ncs.iso14230; + +import static com.romraider.io.protocol.ncs.iso14230.NCSResponseProcessor.extractResponseData; +import static com.romraider.io.protocol.ncs.iso14230.NCSResponseProcessor.filterRequestFromResponse; +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import static java.lang.System.arraycopy; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import com.romraider.io.protocol.Protocol; +import com.romraider.io.protocol.ProtocolNCS; +import com.romraider.logger.ecu.comms.io.protocol.LoggerProtocolNCS; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.query.EcuInit; +import com.romraider.logger.ecu.comms.query.EcuInitCallback; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryData; +import com.romraider.logger.ecu.definition.Module; + +public final class NCSLoggerProtocol implements LoggerProtocolNCS { + private final ProtocolNCS protocol = new NCSProtocol(); + + @Override + public byte[] constructEcuFastInitRequest(Module module) { + return protocol.constructEcuFastInitRequest(module); + } + + @Override + public byte[] constructStartDiagRequest(Module module) { + return protocol.constructStartDiagRequest(module); + } + + @Override + public byte[] constructElevatedDiagRequest(Module module) { + return protocol.constructElevatedDiagRequest(module); + } + + @Override + public byte[] constructEcuStopRequest(Module module) { + return protocol.constructEcuStopRequest(module); + } + + @Override + public byte[] constructEcuInitRequest(Module module) { + return protocol.constructEcuInitRequest(module); + } + + @Override + public byte[] constructEcuIdRequest(Module module) { + return protocol.constructEcuIdRequest(module); + } + + @Override + public byte[] constructEcuResetRequest(Module module, int resetCode) { + return protocol.constructEcuResetRequest(module, resetCode); + } + + @Override + public byte[] constructReadAddressRequest(Module module, + Collection queries) { + return protocol.constructReadAddressRequest( + module, new byte[0][0]); + } + + @Override + public byte[] constructReadAddressRequest( + Module module, Collection queries, PollingState pollState) { + return protocol.constructReadAddressRequest( + module, new byte[0][0], pollState); + } + + @Override + public byte[] constructReadSidPidRequest(Module module, byte sid, byte[] pid) { + final byte[][] request = new byte[1][pid.length]; + arraycopy(pid, 0, request[0], 0, pid.length); + return protocol.constructReadSidPidRequest(module, sid, request); + } + + @Override + public byte[] constructLoadAddressRequest(Collection queries) { + Collection filteredQueries = filterDuplicates(queries); + return protocol.constructLoadAddressRequest( + convertToByteAddresses(filteredQueries)); + } + + @Override + public byte[] constructReadMemoryRequest(Module module, + Collection queries, int length) { + return null; + } + + @Override + public byte[] constructReadMemoryResponse(int requestSize, int length) { + return null; + } + + @Override + public void validateLoadAddressResponse(byte[] response) { + protocol.validateLoadAddressResponse(response); + } + + @Override + public byte[] constructReadAddressResponse( + Collection queries, PollingState pollState) { + + checkNotNullOrEmpty(queries, "queries"); + // length + // one byte - Response sid + // one byte - option + // variable bytes of data defined for pid + // checksum + Collection filteredQueries = filterDuplicates(queries); + int numAddresses = 0; + for (EcuQuery ecuQuery : filteredQueries) { + numAddresses += EcuQueryData.getDataLength(ecuQuery); + } + return new byte[(numAddresses + 4)]; + } + + @Override + public byte[] preprocessResponse( + byte[] request, byte[] response, PollingState pollState) { + + return filterRequestFromResponse(request, response, pollState); + } + + @Override + public void processEcuInitResponse(EcuInitCallback callback, byte[] response) { + checkNotNull(callback, "callback"); + checkNotNullOrEmpty(response, "response"); + EcuInit ecuInit = protocol.parseEcuInitResponse(response); + callback.callback(ecuInit); + } + + @Override + public byte[] processEcuIdResponse(byte[] response) { + checkNotNullOrEmpty(response, "response"); + return protocol.parseResponseData(response); + } + + @Override + public byte[] processReadSidPidResponse(byte[] response) { + checkNotNullOrEmpty(response, "response"); + return protocol.checkValidSidPidResponse(response); + } + + @Override + public void processEcuResetResponse(byte[] response) { + checkNotNullOrEmpty(response, "response"); + protocol.checkValidEcuResetResponse(response); + } + + // processes the response bytes and sets individual responses on corresponding query objects + @Override + public void processReadAddressResponses( + Collection queries, byte[] response, PollingState pollState) { + + checkNotNullOrEmpty(queries, "queries"); + checkNotNullOrEmpty(response, "response"); + final byte[] responseData = extractResponseData(response); + final Collection filteredQueries = filterDuplicates(queries); + final Map addressResults = new HashMap(); + int i = 0; + for (EcuQuery filteredQuery : filteredQueries) { + final int dataLength = EcuQueryData.getDataLength(filteredQuery); + final byte[] data = new byte[dataLength]; + arraycopy(responseData, i, data, 0, dataLength); + addressResults.put(filteredQuery.getHex(), data); + i += dataLength; + } + for (EcuQuery query : queries) { + query.setResponse(addressResults.get(query.getHex())); + } + } + + @Override + public void processReadMemoryResponses(Collection queries, byte[] response) { + } + + @Override + public Protocol getProtocol() { + return protocol; + } + + @Override + public byte[] constructWriteAddressRequest( + Module module, byte[] writeAddress, byte value) { + + return protocol.constructWriteAddressRequest(module, writeAddress, value); + } + + @Override + public void processWriteResponse(byte[] data, byte[] response) { + checkNotNullOrEmpty(data, "data"); + checkNotNullOrEmpty(response, "response"); + protocol.checkValidWriteResponse(data, response); + } + + @Override + public Collection filterDuplicates(Collection queries) { + Collection filteredQueries = new ArrayList(); + for (EcuQuery query : queries) { + if (!filteredQueries.contains(query)) { + filteredQueries.add(query); + } + } + return filteredQueries; + } + + private Map convertToByteAddresses(Collection queries) { + final Map queryMap = new LinkedHashMap(); + for (EcuQuery query : queries) { + byte[] bytes = query.getBytes(); + int addrCount = query.getAddresses().length; + int addrLen = bytes.length / addrCount; + for (int j = 0; j < addrCount; j++) { + final byte[] addr = new byte[addrLen]; + arraycopy(bytes, j * addrLen, addr, 0, addr.length); + queryMap.put(addr, 1); + } + } + return queryMap; + } +} diff --git a/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSProtocol.java b/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSProtocol.java new file mode 100644 index 000000000..f1a89e183 --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSProtocol.java @@ -0,0 +1,464 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ncs.iso14230; + +import static com.romraider.io.protocol.ncs.iso14230.NCSChecksumCalculator.calculateChecksum; +import static com.romraider.util.HexUtil.asHex; +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Map; + +import com.romraider.io.connection.ConnectionProperties; +import com.romraider.io.connection.KwpConnectionProperties; +import com.romraider.io.protocol.ProtocolNCS; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.query.EcuInit; +import com.romraider.logger.ecu.comms.query.NCSEcuInit; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.exception.InvalidResponseException; +import com.romraider.logger.ecu.exception.UnsupportedProtocolException; + +public final class NCSProtocol implements ProtocolNCS { + private final ByteArrayOutputStream bb = new ByteArrayOutputStream(255); + public static final byte PHY_ADDR = (byte) 0x80; + public static final byte READ_MEMORY_PADDING = (byte) 0x00; + public static final byte READ_MEMORY_COMMAND = (byte) 0xA0; + public static final byte READ_MEMORY_RESPONSE = (byte) 0xE0; + public static final byte LOAD_ADDRESS_COMMAND = (byte) 0xAC; + public static final byte LOAD_ADDRESS_RESPONSE = (byte) 0xEC; + public static final byte READ_LOAD_COMMAND = (byte) 0x21; + public static final byte READ_LOAD_RESPONSE = (byte) 0x61; + public static final byte WRITE_MEMORY_COMMAND = (byte) 0xB0; + public static final byte WRITE_MEMORY_RESPONSE = (byte) 0xF0; + public static final byte WRITE_ADDRESS_COMMAND = (byte) 0xB8; + public static final byte WRITE_ADDRESS_RESPONSE = (byte) 0xF8; + public static final byte FASTINIT_COMMAND = (byte) 0x81; + public static final byte FASTINIT_RESPONSE = (byte) 0xC1; + public static final byte STOP_COMMAND = (byte) 0x82; + public static final byte STOP_RESPONSE = (byte) 0xC2; + public static final byte ECU_ID_SID = (byte) 0x1A; + public static final byte OPTION_81 = (byte) 0x81; + public static final byte FIELD_TYPE_01 = (byte) 0x01; + public static final byte FIELD_TYPE_02 = (byte) 0x02; + public static final byte FIELD_TYPE_83 = (byte) 0x83; + public static final byte SID_21 = (byte) 0x21; + public static final byte SID_22 = (byte) 0x22; + public static final byte ECU_ID_SID_RESPONSE = (byte) 0x5A; + public static final byte READ_SID_GRP_RESPONSE = (byte) 0x62; + public static final byte ECU_RESET_COMMAND = (byte) 0x04; + public static final byte ECU_RESET_RESPONSE = (byte) 0x44; + public static final byte NCS_NRC = (byte) 0x7F; + public static final int RESPONSE_NON_DATA_BYTES = 3; + public static final int ADDRESS_SIZE = 3; + public static Module module; + + @Override + public byte[] constructEcuFastInitRequest(Module module) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + final byte[] request = buildRequest( + FASTINIT_COMMAND, false, new byte[]{}); + return request; + } + + @Override + public byte[] constructEcuStopRequest(Module module) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + final byte[] request = buildRequest( + STOP_COMMAND, false, new byte[]{}); + return request; + } + + // not implemented + @Override + public byte[] constructStartDiagRequest(Module module) { + return null; + } + + // not implemented + @Override + public byte[] constructElevatedDiagRequest(Module module) { + return null; + } + + // not implemented + @Override + public byte[] constructEcuInitRequest(Module module) { + return null; + } + + @Override + public byte[] constructEcuIdRequest(Module module) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + // len SID opt chk + // 0x02 0x1A 0x81 0x9D + final byte[] request = buildRequest( + ECU_ID_SID, true, new byte[]{OPTION_81}); + return request; + } + + @Override + public byte[] constructReadSidPidRequest(Module module, byte sid, byte[][] pid) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + final byte[] request = buildSidPidRequest(sid, true, pid); + return request; + } + + @Override + //TODO: not yet implemented + public byte[] constructWriteMemoryRequest( + Module module, byte[] address, byte[] values) { + + throw new UnsupportedProtocolException( + "Write memory command is not supported on for address: " + + asHex(address)); + } + + @Override + //TODO: not yet implemented + public byte[] constructWriteAddressRequest( + Module module, byte[] address, byte value) { + + throw new UnsupportedProtocolException( + "Write Address command is not supported on for address: " + + asHex(address)); + } + + @Override + //TODO: not yet implemented + public byte[] constructReadMemoryRequest( + Module module, byte[] address, int numBytes) { + + throw new UnsupportedProtocolException( + "Read memory command is not supported on for address: " + + asHex(address)); + } + + @Override + //TODO: not yet implemented + public byte[] constructReadMemoryRequest(Module module, byte[][] address, + int numBytes) { + + throw new UnsupportedProtocolException( + "Read memory command is not supported on for address: " + + asHex(address[0])); + } + + @Override + public byte[] constructLoadAddressRequest(Map queries) { + checkNotNullOrEmpty(queries, "queries"); + // short header - false, length encoded into lower 5 bits of first byte + // 0x8Len 0x10 0xFC 0xac 0x81 fld_typ address1 [[fld_typ address2] ... [fld_typ addressN]] checksum + // short header - true + // Len 0xac 0x81 fld_typ address1 [[fld_typ address2] ... [fld_typ addressN]] checksum + byte [][] addresses = new byte[queries.size()][]; + int i = 0; + for (byte [] query : queries.keySet()) { + addresses[i++] = query; + } + return buildLoadAddrRequest(true, addresses); + } + + @Override + public byte[] constructReadAddressRequest(Module module, byte[][] addresses) { + // read previously loaded addresses + // len 0x21 0x81 0x04 0x01 checksum + return buildRequest( + READ_LOAD_COMMAND, true, new byte[]{(byte) 0x81, (byte) 0x04, (byte) 0x01}); + } + + @Override + public byte[] constructReadAddressRequest(Module module, byte[][] bs, + PollingState pollState) { + byte opt_byte3; + if (pollState.isFastPoll()) { + // continuously read response of previously loaded addresses + // len 0x21 0x81 0x06 0x01 checksum + opt_byte3 = (byte) 0x06; + } + else { + // read one response of previously loaded addresses + // len 0x21 0x81 0x04 0x01 checksum + opt_byte3 = (byte) 0x04; + } + return buildRequest( + READ_LOAD_COMMAND, true, new byte[]{(byte) 0x81, opt_byte3, (byte) 0x01}); + } + + @Override + public byte[] preprocessResponse( + byte[] request, byte[] response, PollingState pollState) { + return NCSResponseProcessor.filterRequestFromResponse( + request, response, pollState); + } + + @Override + public byte[] parseResponseData(byte[] processedResponse) { + checkNotNullOrEmpty(processedResponse, "processedResponse"); + return NCSResponseProcessor.extractResponseData(processedResponse); + } + + @Override + public void checkValidEcuInitResponse(byte[] processedResponse) { + checkNotNullOrEmpty(processedResponse, "processedResponse"); + NCSResponseProcessor.validateResponse(processedResponse); + } + + @Override + public EcuInit parseEcuInitResponse(byte[] processedResponse) { + checkNotNullOrEmpty(processedResponse, "processedResponse"); + return new NCSEcuInit(processedResponse); + } + + @Override + public void validateLoadAddressResponse(byte[] response) { + checkNotNullOrEmpty(response, "addressLoadResponse"); + NCSResponseProcessor.validateResponse(response); + } + + @Override + //TODO: not yet implemented + // maybe use: Service $11 - Module reset + public byte[] constructEcuResetRequest(Module module, int resetCode) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + return buildRequest((byte) 0, false, new byte[]{ECU_RESET_COMMAND}); + } + + @Override + public byte[] checkValidSidPidResponse(byte[] response) { + checkNotNullOrEmpty(response, "SidPidResponse"); + return NCSResponseProcessor.extractResponseData(response); + } + + @Override + //TODO: not yet implemented + public void checkValidEcuResetResponse(byte[] processedResponse) { + checkNotNullOrEmpty(processedResponse, "processedResponse"); + byte responseType = processedResponse[4]; + if (responseType != ECU_RESET_RESPONSE) { + throw new InvalidResponseException( + "Unexpected OBD Reset response: " + + asHex(processedResponse)); + } + } + + @Override + public void checkValidWriteResponse(byte[] data, byte[] processedResponse) { + } + + @Override + public ConnectionProperties getDefaultConnectionProperties() { + return new KwpConnectionProperties() { + + @Override + public int getBaudRate() { + return 10400; + } + + @Override + public void setBaudRate(int b) { + + } + + @Override + public int getDataBits() { + return 8; + } + + @Override + public int getStopBits() { + return 1; + } + + @Override + public int getParity() { + return 0; + } + + @Override + public int getConnectTimeout() { + return 2000; + } + + @Override + public int getSendTimeout() { + return 255; + } + + + @Override + public int getP1Max() { + return 0; + } + + @Override + public int getP3Min() { + return 5; + } + + @Override + public int getP4Min() { + return 0; + } + }; + } + + private final byte[] buildRequest(byte command, boolean shortHeader, + byte[]... content) { + + int length = 1; + for (byte[] tmp : content) { + length += tmp.length; + } + byte[] request = new byte[0]; + try { + bb.reset(); + if (shortHeader) { + bb.write(length); + } + else { + bb.write(PHY_ADDR + length); + bb.write(module.getAddress()); + bb.write(module.getTester()); + } + bb.write(command); + for (byte[] tmp : content) { + bb.write(tmp); + } + bb.write((byte) 0x00); + request = bb.toByteArray(); + final byte cs = calculateChecksum(request); + request[request.length - 1] = cs; + } + catch (IOException e) { + e.printStackTrace(); + } + return request; + } + + private final byte[] buildSidPidRequest(byte command, boolean shortHeader, + byte[]... content) { + + int length = 3; + for (byte[] tmp : content) { + length += tmp.length; + } + byte[] request = new byte[0]; + try { + bb.reset(); + if (shortHeader) { + bb.write(length); + } + else { + bb.write(PHY_ADDR + length); + bb.write(module.getAddress()); + bb.write(module.getTester()); + } + bb.write(command); + for (byte[] tmp : content) { + bb.write(tmp); + } + bb.write((byte) 0x04); + bb.write((byte) 0x01); + bb.write((byte) 0x00); + request = bb.toByteArray(); + final byte cs = calculateChecksum(request); + request[request.length - 1] = cs; + } + catch (IOException e) { + e.printStackTrace(); + } + return request; + } + + private final byte[] buildLoadAddrRequest(boolean shortHeader, + byte[]... content) { + + int length = 2; + byte[] request = new byte[0]; + try { + bb.reset(); + if (shortHeader) { + bb.write(length); + } + else { + bb.write(PHY_ADDR); + bb.write(module.getAddress()); + bb.write(module.getTester()); + } + bb.write(LOAD_ADDRESS_COMMAND); + bb.write(OPTION_81); + for (byte[] tmp : content) { + if (tmp[0] == SID_21) { + bb.write(FIELD_TYPE_01); + bb.write(tmp, 1, tmp.length - 1); + continue; + } + if (tmp[0] == SID_22) { + bb.write(FIELD_TYPE_02); + bb.write(tmp, 1, tmp.length - 1); + continue; + } + if (tmp.length == 3 && (tmp[0] & 0x80) == 0x80) { + bb.write(FIELD_TYPE_83); + bb.write((byte) 0xFF); + bb.write(tmp, 0, 3); + } + else { //assume a short length ROM address + bb.write(FIELD_TYPE_83); + bb.write((byte) 0x00); + switch (tmp.length) { + case 1: + bb.write((byte) 0x00); + bb.write((byte) 0x00); + break; + case 2: + bb.write((byte) 0x00); + break; + case 3: + break; + } + bb.write(tmp); + } + } + bb.write(0); // reserve last byte for checksum + request = bb.toByteArray(); + if (shortHeader) { + request[0] = (byte)(request.length - 2); + } + else { + request[0] = (byte)(PHY_ADDR + request.length - 4); + } + final byte cs = calculateChecksum(request); + request[request.length - 1] = cs; + } + catch (IOException e) { + e.printStackTrace(); + } + return request; + } +} diff --git a/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSResponseProcessor.java b/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSResponseProcessor.java new file mode 100644 index 000000000..3d64e91a8 --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ncs/iso14230/NCSResponseProcessor.java @@ -0,0 +1,150 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ncs.iso14230; + +import static com.romraider.io.protocol.ncs.iso14230.NCSChecksumCalculator.calculateChecksum; +import static com.romraider.io.protocol.ncs.iso14230.NCSProtocol.ECU_ID_SID_RESPONSE; +import static com.romraider.io.protocol.ncs.iso14230.NCSProtocol.LOAD_ADDRESS_RESPONSE; +import static com.romraider.io.protocol.ncs.iso14230.NCSProtocol.NCS_NRC; +import static com.romraider.io.protocol.ncs.iso14230.NCSProtocol.READ_LOAD_RESPONSE; +import static com.romraider.io.protocol.ncs.iso14230.NCSProtocol.READ_SID_GRP_RESPONSE; +import static com.romraider.io.protocol.ncs.iso14230.NCSProtocol.RESPONSE_NON_DATA_BYTES; +import static com.romraider.util.HexUtil.asHex; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; + +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.exception.InvalidResponseException; + +public final class NCSResponseProcessor { + + private NCSResponseProcessor() { + throw new UnsupportedOperationException(); + } + + public final static byte[] filterRequestFromResponse( + byte[] request, byte[] response, PollingState pollState) { + checkNotNullOrEmpty(response, "response"); + // If J2534 device Loopback is off, the request is filtered out by J2534 device + // and only the response is present + return response; + } + + public final static void validateResponse(byte[] response) { + checkNotNullOrEmpty(response, "response"); + assertTrue(response.length > RESPONSE_NON_DATA_BYTES, + "Invalid response length"); + validateChecksum(response); + if (response[1] == NCS_NRC) { + assertNrc((byte) (response[2] + 0x40), response[1], response[2], response[3], + "Request type not supported"); + } + if ((response[0] & (byte)0x80) == (byte)0x80) { // long header + assertOneOf(new byte[]{ECU_ID_SID_RESPONSE, LOAD_ADDRESS_RESPONSE, + READ_LOAD_RESPONSE, READ_SID_GRP_RESPONSE}, + response[3], "Invalid response code"); + } + else { // short header + assertOneOf(new byte[]{ECU_ID_SID_RESPONSE, LOAD_ADDRESS_RESPONSE, + READ_LOAD_RESPONSE, READ_SID_GRP_RESPONSE}, + response[1], "Invalid response code"); + } + } + + public final static byte[] extractResponseData(byte[] response) { + checkNotNullOrEmpty(response, "response"); + // len response_sid option response_data1 ... [response_dataN] CS + validateResponse(response); + byte[] data = new byte[]{}; + // Strip headers and CS returning only the payload + if (response[1] == ECU_ID_SID_RESPONSE) { + data = new byte[response.length - RESPONSE_NON_DATA_BYTES]; + System.arraycopy(response, RESPONSE_NON_DATA_BYTES-1, data, 0, data.length); + } + if (response[1] == READ_LOAD_RESPONSE) { + data = new byte[response.length - 4]; + System.arraycopy(response, RESPONSE_NON_DATA_BYTES, data, 0, data.length); + } + if (response[1] == READ_SID_GRP_RESPONSE) { + data = new byte[response.length - 5]; + System.arraycopy(response, RESPONSE_NON_DATA_BYTES+1, data, 0, data.length); + } + return data; + } + + private final static void validateChecksum(byte[] response) { + final byte calc_chk = calculateChecksum(response); + final byte pkt_cs = response[response.length - 1]; + assertTrue(calc_chk == pkt_cs, String.format( + "Response checksum match failure. Expected: %s, Actual: %s", + asHex(calc_chk), asHex(pkt_cs))); + } + + private final static void assertTrue(boolean condition, String msg) { + if (!condition) { + throw new InvalidResponseException(msg); + } + } + + private final static void assertNrc( + byte expected, byte actual, byte command, byte code, String msg) { + + if (actual == expected) { + String ec = "unsupported."; + if (code == 0x10) { + ec = "general reject no specific reason."; + } + if (code == 0x12) { + ec = "request sub-function is not supported or invalid format."; + } + if (code == 0x13) { + ec = "invalid format or length."; + } + if (code == 0x21) { + ec = "busy, repeat request."; + } + if (code == 0x22) { + ec = "conditions not correct or request sequence error."; + } + throw new InvalidResponseException(String.format( + "%s. Command: %s, %s", + msg, asHex(command), ec)); + } + } + + private final static void assertOneOf( + byte[] validOptions, byte actual, String msg) { + + for (byte option : validOptions) { + if (option == actual) { + return; + } + } + final StringBuilder builder = new StringBuilder(); + for (int i = 0; i < validOptions.length; i++) { + if (i > 0) { + builder.append(", "); + } + builder.append(asHex(validOptions[i])); + } + throw new InvalidResponseException(String.format( + "%s. Expected one of [%s]. Actual: %s.", + msg, builder.toString(), asHex(actual))); + } +} diff --git a/src/main/java/com/romraider/io/protocol/ncs/iso15765/NCSLoggerProtocol.java b/src/main/java/com/romraider/io/protocol/ncs/iso15765/NCSLoggerProtocol.java new file mode 100644 index 000000000..9d5657648 --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ncs/iso15765/NCSLoggerProtocol.java @@ -0,0 +1,305 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ncs.iso15765; + +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.RESPONSE_NON_DATA_BYTES; +import static com.romraider.io.protocol.ncs.iso15765.NCSResponseProcessor.extractResponseData; +import static com.romraider.io.protocol.ncs.iso15765.NCSResponseProcessor.filterRequestFromResponse; +import static com.romraider.util.HexUtil.hexToInt; +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import static java.lang.System.arraycopy; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import com.romraider.io.protocol.Protocol; +import com.romraider.io.protocol.ProtocolNCS; +import com.romraider.logger.ecu.comms.io.protocol.LoggerProtocolNCS; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.query.EcuInit; +import com.romraider.logger.ecu.comms.query.EcuInitCallback; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryData; +import com.romraider.logger.ecu.definition.Module; + +public final class NCSLoggerProtocol implements LoggerProtocolNCS { + private final ProtocolNCS protocol = new NCSProtocol(); + + @Override + public byte[] constructEcuFastInitRequest(Module module) { + return protocol.constructEcuFastInitRequest(module); + } + + @Override + public byte[] constructStartDiagRequest(Module module) { + return protocol.constructStartDiagRequest(module); + } + + @Override + public byte[] constructElevatedDiagRequest(Module module) { + return protocol.constructElevatedDiagRequest(module); + } + + @Override + public byte[] constructEcuInitRequest(Module module) { + return protocol.constructEcuInitRequest(module); + } + + @Override + public byte[] constructEcuStopRequest(Module module) { + return protocol.constructEcuStopRequest(module); + } + + @Override + public byte[] constructEcuIdRequest(Module module) { + return protocol.constructEcuIdRequest(module); + } + + @Override + public byte[] constructEcuResetRequest(Module module, int resetCode) { + return protocol.constructEcuResetRequest(module, resetCode); + } + + @Override + public byte[] constructReadAddressRequest(Module module, + Collection queries) { + return protocol.constructReadAddressRequest( + module, convertToByteAddresses(queries)); + } + + @Override + public byte[] constructReadAddressRequest( + Module module, Collection queries, PollingState pollState) { + return protocol.constructReadAddressRequest( + module, new byte[0][0], pollState); + } + + @Override + public byte[] constructReadSidPidRequest(Module module, byte sid, byte[] pid) { + final byte[][] request = new byte[1][pid.length]; + arraycopy(pid, 0, request[0], 0, pid.length); + return protocol.constructReadSidPidRequest(module, sid, request); + } + + @Override + public byte[] constructLoadAddressRequest(Collection queries) { + Collection filteredQueries = filterDuplicates(queries); + // convert to address and data length + return protocol.constructLoadAddressRequest( + convertToByteAddressAndLen(filteredQueries)); + } + + @Override + public byte[] constructReadMemoryRequest(Module module, + Collection queries, int length) { + + return protocol.constructReadMemoryRequest( + module, convertToByteAddresses(queries), length); + } + + @Override + public byte[] constructReadMemoryResponse(int requestSize, int length) { + return new byte[RESPONSE_NON_DATA_BYTES + requestSize + length]; + } + + @Override + public void validateLoadAddressResponse(byte[] response) { + protocol.validateLoadAddressResponse(response); + } + + @Override + public byte[] constructReadAddressResponse( + Collection queries, PollingState pollState) { + + checkNotNullOrEmpty(queries, "queries"); + int numBytes = 7; + if (pollState.isFastPoll()) { + numBytes = 6; + } + // CAN addr + // one byte - Response sid + // one byte - Response pid + // one byte - option + // variable bytes of data defined for pid + Collection filteredQueries = filterDuplicates(queries); + for (EcuQuery ecuQuery : filteredQueries) { + //numBytes += ecuQuery.getBytes().length; + numBytes += EcuQueryData.getDataLength(ecuQuery); + } + return new byte[(numBytes)]; + } + + @Override + public byte[] preprocessResponse( + byte[] request, byte[] response, PollingState pollState) { + + return filterRequestFromResponse(request, response, pollState); + } + + @Override + public void processEcuInitResponse(EcuInitCallback callback, byte[] response) { + checkNotNull(callback, "callback"); + checkNotNullOrEmpty(response, "response"); + EcuInit ecuInit = protocol.parseEcuInitResponse(response); + callback.callback(ecuInit); + } + + @Override + public byte[] processEcuIdResponse(byte[] response) { + checkNotNullOrEmpty(response, "response"); + return protocol.parseResponseData(response); + } + + @Override + public byte[] processReadSidPidResponse(byte[] response) { + checkNotNullOrEmpty(response, "response"); + return protocol.checkValidSidPidResponse(response); + } + + @Override + public void processEcuResetResponse(byte[] response) { + checkNotNullOrEmpty(response, "response"); + protocol.checkValidEcuResetResponse(response); + } + + // processes the response bytes and sets individual responses on corresponding query objects + @Override + public void processReadAddressResponses( + Collection queries, byte[] response, PollingState pollState) { + + checkNotNullOrEmpty(queries, "queries"); + checkNotNullOrEmpty(response, "response"); + final byte[] responseData = extractResponseData(response); + final Collection filteredQueries = filterDuplicates(queries); + final Map addressResults = new HashMap(); + int i = 0; + for (EcuQuery filteredQuery : filteredQueries) { + final int dataLength = EcuQueryData.getDataLength(filteredQuery); + final byte[] data = new byte[dataLength]; + arraycopy(responseData, i, data, 0, dataLength); + addressResults.put(filteredQuery.getHex(), data); + i += dataLength; + } + for (EcuQuery query : queries) { + query.setResponse(addressResults.get(query.getHex())); + } + } + + /** + * Processes the response bytes and set individual response on corresponding + * query objects. + * The response data is based on the lowest EcuData address and the length + * is the result of the difference between the highest and lowest address. + * The index into the response array is based in the lowest address. + **/ + public void processReadMemoryResponses( + Collection queries, byte[] response) { + + checkNotNullOrEmpty(queries, "queries"); + checkNotNullOrEmpty(response, "response"); + final byte[] responseData = extractResponseData(response); + final Collection filteredQueries = filterDuplicates(queries); + final Map addressResults = new HashMap(); + + int lowestAddress = Integer.MAX_VALUE; + for (EcuQuery filteredQuery : filteredQueries) { + final int address = hexToInt(filteredQuery.getAddresses()[0]); + if (address < lowestAddress) { + lowestAddress = address; + } + } + + int srcPos = 0; + for (EcuQuery filteredQuery : filteredQueries) { + int dataTypeLength = EcuQueryData.getDataLength(filteredQuery); + final byte[] bytes = new byte[dataTypeLength]; + final int address = hexToInt(filteredQuery.getAddresses()[0]); + srcPos = address - lowestAddress; + arraycopy(responseData, srcPos, bytes, 0, bytes.length); + addressResults.put(filteredQuery.getHex(), bytes); + } + + for (EcuQuery query : queries) { + query.setResponse(addressResults.get(query.getHex())); + } + } + + @Override + public Protocol getProtocol() { + return protocol; + } + + @Override + public byte[] constructWriteAddressRequest( + Module module, byte[] writeAddress, byte value) { + + return protocol.constructWriteAddressRequest(module, writeAddress, value); + } + + @Override + public void processWriteResponse(byte[] data, byte[] response) { + checkNotNullOrEmpty(data, "data"); + checkNotNullOrEmpty(response, "response"); + protocol.checkValidWriteResponse(data, response); + } + + @Override + public Collection filterDuplicates(Collection queries) { + Collection filteredQueries = new ArrayList(); + for (EcuQuery query : queries) { + if (!filteredQueries.contains(query)) { + filteredQueries.add(query); + } + } + return filteredQueries; + } + + private byte[][] convertToByteAddresses(Collection queries) { + int byteCount = 0; + for (EcuQuery query : queries) { + byteCount += query.getAddresses().length; + } + byte[][] addresses = new byte[byteCount][]; + int i = 0; + for (EcuQuery query : queries) { + byte[] bytes = query.getBytes(); + int addrCount = query.getAddresses().length; + int addrLen = bytes.length / addrCount; + for (int j = 0; j < addrCount; j++) { + final byte[] addr = new byte[addrLen]; + arraycopy(bytes, j * addrLen, addr, 0, addr.length); + addresses[i++] = addr; + } + } + return addresses; + } + + private Map convertToByteAddressAndLen(Collection queries) { + final Map queryMap = new LinkedHashMap(); + for (EcuQuery query : queries) { + queryMap.put(query.getBytes(), EcuQueryData.getDataLength(query)); + } + return queryMap; + } +} diff --git a/src/main/java/com/romraider/io/protocol/ncs/iso15765/NCSProtocol.java b/src/main/java/com/romraider/io/protocol/ncs/iso15765/NCSProtocol.java new file mode 100644 index 000000000..8f4cf426b --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ncs/iso15765/NCSProtocol.java @@ -0,0 +1,388 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ncs.iso15765; + +import static com.romraider.util.HexUtil.asHex; +import static com.romraider.util.ParamChecker.checkGreaterThanZero; +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Map; + +import com.romraider.io.connection.ConnectionProperties; +import com.romraider.io.connection.KwpConnectionProperties; +import com.romraider.io.protocol.ProtocolNCS; +import com.romraider.io.protocol.ncs.iso15765.NCSResponseProcessor; +import com.romraider.io.protocol.ncs.iso15765.NCSProtocol; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.query.EcuInit; +import com.romraider.logger.ecu.comms.query.NCSEcuInit; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.exception.InvalidResponseException; +import com.romraider.logger.ecu.exception.UnsupportedProtocolException; + +public final class NCSProtocol implements ProtocolNCS { + private final ByteArrayOutputStream bb = new ByteArrayOutputStream(255); + public static final byte READ_MEMORY_PADDING = (byte) 0x00; + public static final byte READ_MEMORY_COMMAND = (byte) 0x23; + public static final byte READ_MEMORY_RESPONSE = (byte) 0x63; + public static final byte LOAD_ADDRESS_COMMAND = (byte) 0x2C; + public static final byte DDLOCID = (byte) 0xE0; + public static final byte LOAD_ADDRESS_RESPONSE = (byte) 0x6C; + public static final byte READ_LOAD_COMMAND = (byte) 0x21; + public static final byte READ_LOAD_RESPONSE = (byte) 0x61; + public static final byte ECU_INIT_COMMAND = (byte) 0x10; + public static final byte ECU_INIT_RESPONSE = (byte) 0x50; + public static final byte ECU_ID_SID = (byte) 0x21; + public static final byte ECU_ID_CMD = (byte) 0x10; + public static final byte FIELD_TYPE_01 = (byte) 0x01; + public static final byte FIELD_TYPE_02 = (byte) 0x02; + public static final byte FIELD_TYPE_03 = (byte) 0x03; + public static final byte SID_21 = (byte) 0x21; + public static final byte SID_22 = (byte) 0x22; + public static final byte ECU_ID_SID_RESPONSE = (byte) 0x50; + public static final byte READ_SID_21_RESPONSE = (byte) 0x61; + public static final byte READ_SID_GRP_RESPONSE = (byte) 0x62; + public static final byte ECU_RESET_COMMAND = (byte) 0x04; + public static final byte ECU_RESET_RESPONSE = (byte) 0x44; + public static final byte NCS_NRC = (byte) 0x7F; + public static final int RESPONSE_NON_DATA_BYTES = 4; + public static final int ADDRESS_SIZE = 4; + public static Module module; + + // not implemented + @Override + public byte[] constructEcuFastInitRequest(Module module) { + return null; + } + + @Override + public byte[] constructEcuStopRequest(Module module) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + // 000007E01081 + final byte[] request = buildRequest( + ECU_INIT_COMMAND, false, new byte[]{(byte) 0x81}); + return request; + } + + @Override + public byte[] constructEcuInitRequest(Module module) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + // 000007E010C0 + final byte[] request = buildRequest( + ECU_INIT_COMMAND, false, new byte[]{(byte) 0xC0}); + return request; + } + + @Override + public byte[] constructStartDiagRequest(Module module) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + // 000007E010C0 + final byte[] request = buildRequest( + ECU_INIT_COMMAND, false, new byte[]{(byte) 0xC0}); + return request; + } + + @Override + public byte[] constructElevatedDiagRequest(Module module) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + // 000007E010FB + final byte[] request = buildRequest( + ECU_INIT_COMMAND, false, new byte[]{(byte) 0xFB}); + return request; + } + + @Override + public byte[] constructEcuIdRequest(Module module) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + // 000007E02110 + final byte[] request = buildRequest( + ECU_ID_SID, false, new byte[]{ECU_ID_CMD}); + return request; + } + + @Override + public byte[] constructReadSidPidRequest(Module module, byte sid, byte[][] pid) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + final byte[] request = buildRequest(sid, false, pid); + return request; + } + + @Override + //TODO: not yet implemented + public byte[] constructWriteMemoryRequest( + Module module, byte[] address, byte[] values) { + + throw new UnsupportedProtocolException( + "Write memory command is not supported on for address: " + + asHex(address)); + } + + @Override + public byte[] constructWriteAddressRequest( + Module module, byte[] address, byte value) { + + throw new UnsupportedProtocolException( + "Write Address command is not supported on for address: " + + asHex(address)); + } + + @Override + public byte[] constructReadMemoryRequest(Module module, byte[] address, + int numBytes) { + NCSProtocol.module = module; + // 000007E023 4-byte_address 2-byte_numBytes + final byte[] frame = new byte[6]; + if (address.length == 3 && (address[0] & 0x80) == 0x80) { + // expand a 6-byte RAM address to 8-bytes + frame[0] = (byte) 0xFF; + } + System.arraycopy(address, 0, frame, 4-address.length, address.length); + frame[5] = (byte) numBytes; + return buildRequest(READ_MEMORY_COMMAND, false, frame, new byte[]{}); + } + + @Override + public byte[] constructReadMemoryRequest( + Module module, byte[][] address, int numBytes) { + checkNotNull(module, "module"); + checkNotNullOrEmpty(address, "address"); + checkGreaterThanZero(numBytes, "numBytes"); + return constructReadMemoryRequest(module, address[0], + numBytes); + } + + @Override + public byte[] constructLoadAddressRequest(Map queryMap) { + checkNotNullOrEmpty(queryMap, "queryMap"); + // ID 0x2C 0xE0 DEFMODE ... DEFMODE ... DEFMODE ... + return buildLoadAddrRequest(queryMap); + } + + @Override + public byte[] constructReadAddressRequest(Module module, byte[][] addresses) { + // read addresses + // addr sid pid + return buildSidPidRequest(addresses); + } + + @Override + public byte[] constructReadAddressRequest(Module module, byte[][] bs, + PollingState pollState) { + return buildRequest( + READ_LOAD_COMMAND, false, new byte[]{(byte) 0xE0}); + } + + @Override + public byte[] preprocessResponse( + byte[] request, byte[] response, PollingState pollState) { + return NCSResponseProcessor.filterRequestFromResponse( + request, response, pollState); + } + + @Override + public byte[] parseResponseData(byte[] processedResponse) { + checkNotNullOrEmpty(processedResponse, "processedResponse"); + return NCSResponseProcessor.extractResponseData(processedResponse); + } + + @Override + public void checkValidEcuInitResponse(byte[] processedResponse) { + checkNotNullOrEmpty(processedResponse, "processedResponse"); + NCSResponseProcessor.validateResponse(processedResponse); + } + + @Override + public EcuInit parseEcuInitResponse(byte[] processedResponse) { + checkNotNullOrEmpty(processedResponse, "processedResponse"); + //final byte[] ecuInitBytes = parseResponseData(processedResponse); + return new NCSEcuInit(processedResponse); + } + + @Override + public void validateLoadAddressResponse(byte[] response) { + checkNotNullOrEmpty(response, "addressLoadResponse"); + NCSResponseProcessor.validateResponse(response); + } + + @Override + //TODO: not yet implemented + // maybe use: Service $11 with 0x80 - module reset + public byte[] constructEcuResetRequest(Module module, int resetCode) { + checkNotNull(module, "module"); + NCSProtocol.module = module; + return buildRequest((byte) 0, false, new byte[]{ECU_RESET_COMMAND}); + } + + @Override + public byte[] checkValidSidPidResponse(byte[] response) { + checkNotNullOrEmpty(response, "SidPidResponse"); + return NCSResponseProcessor.extractResponseData(response); + } + + @Override + //TODO: not yet implemented + public void checkValidEcuResetResponse(byte[] processedResponse) { + checkNotNullOrEmpty(processedResponse, "processedResponse"); + byte responseType = processedResponse[4]; + if (responseType != ECU_RESET_RESPONSE) { + throw new InvalidResponseException( + "Unexpected OBD Reset response: " + + asHex(processedResponse)); + } + } + + @Override + public void checkValidWriteResponse(byte[] data, byte[] processedResponse) { + } + + @Override + public ConnectionProperties getDefaultConnectionProperties() { + return new KwpConnectionProperties() { + + @Override + public int getBaudRate() { + return 500000; + } + + @Override + public void setBaudRate(int b) { + + } + + @Override + public int getDataBits() { + return 8; + } + + @Override + public int getStopBits() { + return 1; + } + + @Override + public int getParity() { + return 0; + } + + @Override + public int getConnectTimeout() { + return 2000; + } + + @Override + public int getSendTimeout() { + return 255; + } + + @Override + public int getP1Max() { + return 0; + } + + @Override + public int getP3Min() { + return 5; + } + + @Override + public int getP4Min() { + return 0; + } + }; + } + + private byte[] buildRequest( + byte command, + boolean padContent, + byte[]... content) { + + bb.reset(); + try { + bb.write(module.getTester()); + bb.write(command); + if (padContent) { + bb.write(READ_MEMORY_PADDING); + } + for (byte[] tmp : content) { + bb.write(tmp); + } + } catch (IOException e) { + e.printStackTrace(); + } + return bb.toByteArray(); + } + + private final byte[] buildSidPidRequest(byte[]... content) { + + bb.reset(); + try { + bb.write(module.getTester()); + for (byte[] tmp : content) { + bb.write(tmp); + } + } catch (IOException e) { + e.printStackTrace(); + } + return bb.toByteArray(); + } + + private final byte[] buildLoadAddrRequest(Map queryMap) { + + int PIDYDLID = 1; + byte[] request = new byte[0]; + try { + bb.reset(); + bb.write(module.getTester()); + bb.write(LOAD_ADDRESS_COMMAND); + bb.write(DDLOCID); + for (byte[] tmp : queryMap.keySet()) { + if (tmp[0] == SID_22) { + bb.write(FIELD_TYPE_02); //definitionMode + bb.write(PIDYDLID++); //positionIn + bb.write(queryMap.get(tmp)); //size + bb.write(tmp, 1, tmp.length - 1);//CID + bb.write(1); //positionInRecord + continue; + } + else if (tmp.length == 3 && (tmp[0] & 0x80) == 0x80) { + bb.write(FIELD_TYPE_03); //definitionMode + bb.write(PIDYDLID++); //positionIn + bb.write(queryMap.get(tmp));//size (could be 1, 2 or 4) + bb.write((byte) 0xFF); //RAM addr high byte + bb.write(tmp, 0, 3); //3-byte RAM addr + } + } + request = bb.toByteArray(); + } + catch (IOException e) { + e.printStackTrace(); + } + return request; + } +} diff --git a/src/main/java/com/romraider/io/protocol/ncs/iso15765/NCSResponseProcessor.java b/src/main/java/com/romraider/io/protocol/ncs/iso15765/NCSResponseProcessor.java new file mode 100644 index 000000000..35aab550d --- /dev/null +++ b/src/main/java/com/romraider/io/protocol/ncs/iso15765/NCSResponseProcessor.java @@ -0,0 +1,159 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.io.protocol.ncs.iso15765; + +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.module; +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.ECU_INIT_RESPONSE; +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.ECU_ID_SID_RESPONSE; +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.READ_SID_21_RESPONSE; +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.NCS_NRC; +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.READ_SID_GRP_RESPONSE; +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.READ_MEMORY_RESPONSE; +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.RESPONSE_NON_DATA_BYTES; +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.LOAD_ADDRESS_RESPONSE; +import static com.romraider.io.protocol.ncs.iso15765.NCSProtocol.READ_LOAD_RESPONSE; +import static com.romraider.util.ByteUtil.asUnsignedInt; +import static com.romraider.util.HexUtil.asHex; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; + +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.exception.InvalidResponseException; + +public final class NCSResponseProcessor { + + private NCSResponseProcessor() { + throw new UnsupportedOperationException(); + } + + public final static byte[] filterRequestFromResponse( + byte[] request, byte[] response, PollingState pollState) { + checkNotNullOrEmpty(response, "response"); + // If J2534 device Loopback is off, the request is filtered out by J2534 device + // and only the response is present + return response; + } + + public static void validateResponse(byte[] response) { + assertTrue(response.length > RESPONSE_NON_DATA_BYTES, "Invalid response length"); + assertEquals(module.getAddress(), response, "Invalid " + + module.getName() + " id"); + if (response[4] == NCS_NRC) { + assertNrc(NCS_NRC, response[4], response[5], response[6], "Request type not supported"); + } + assertOneOf(new byte[]{ECU_INIT_RESPONSE, ECU_ID_SID_RESPONSE, + READ_SID_21_RESPONSE, READ_SID_GRP_RESPONSE, + READ_MEMORY_RESPONSE, LOAD_ADDRESS_RESPONSE, + READ_LOAD_RESPONSE}, response[4], "Invalid response code"); + } + + public static byte[] extractResponseData(byte[] response) { + checkNotNullOrEmpty(response, "response"); + // 0x00 0x00 0x07 0xe0 response_command response_data + validateResponse(response); + int nonDataLength = 0; + byte[] data = new byte[]{}; + if (response[4] == ECU_ID_SID_RESPONSE) { + nonDataLength = RESPONSE_NON_DATA_BYTES; + } + else if (response[4] == READ_SID_21_RESPONSE) { + nonDataLength = RESPONSE_NON_DATA_BYTES + 2; + } + else if (response[4] == READ_SID_GRP_RESPONSE) { + nonDataLength = RESPONSE_NON_DATA_BYTES + 3; + } + else if (response[4] == READ_MEMORY_RESPONSE) { + nonDataLength = RESPONSE_NON_DATA_BYTES + 1; + } + else if (response[4] == LOAD_ADDRESS_RESPONSE) { + nonDataLength = RESPONSE_NON_DATA_BYTES + 2; + } + else if (response[4] == READ_LOAD_RESPONSE) { + nonDataLength = RESPONSE_NON_DATA_BYTES + 2; + } + data = new byte[response.length - nonDataLength]; + System.arraycopy(response, nonDataLength, data, 0, data.length); + return data; + } + + private final static void assertTrue(boolean condition, String msg) { + if (!condition) { + throw new InvalidResponseException(msg); + } + } + + private final static void assertNrc( + byte expected, byte actual, byte command, byte code, String msg) { + + if (actual == expected) { + String ec = "unsupported."; + if (code == 0x10) { + ec = "general reject no specific reason."; + } + if (code == 0x11) { + ec = "mode not supported."; + } + if (code == 0x12) { + ec = "request sub-function is not supported or invalid format."; + } + if (code == 0x13) { + ec = "invalid format or length."; + } + if (code == 0x21) { + ec = "busy, repeat request."; + } + if (code == 0x22) { + ec = "conditions not correct or request sequence error."; + } + throw new InvalidResponseException(String.format( + "%s. Command: %s, %s", + msg, asHex(command), ec)); + } + } + + private static void assertEquals(byte[] expected, byte[] actual, String msg) { + final byte[] idBytes = new byte[4]; + System.arraycopy(actual, 0, idBytes, 0, 4); + final int idExpected = asUnsignedInt(expected); + final int idActual = asUnsignedInt(idBytes); + if (idActual != idExpected) { + throw new InvalidResponseException(msg + ". Expected: " + asHex(expected) + ". Actual: " + asHex(idBytes) + "."); + } + } + + private final static void assertOneOf( + byte[] validOptions, byte actual, String msg) { + + for (byte option : validOptions) { + if (option == actual) { + return; + } + } + final StringBuilder builder = new StringBuilder(); + for (int i = 0; i < validOptions.length; i++) { + if (i > 0) { + builder.append(", "); + } + builder.append(asHex(validOptions[i])); + } + throw new InvalidResponseException(String.format( + "%s. Expected one of [%s]. Actual: %s.", + msg, builder.toString(), asHex(actual))); + } +} diff --git a/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDLoggerProtocol.java b/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDLoggerProtocol.java index aea77276d..61745cc70 100644 --- a/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDLoggerProtocol.java +++ b/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDLoggerProtocol.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,34 +38,36 @@ import com.romraider.logger.ecu.comms.query.EcuInit; import com.romraider.logger.ecu.comms.query.EcuInitCallback; import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryData; +import com.romraider.logger.ecu.definition.Module; public final class OBDLoggerProtocol implements LoggerProtocolOBD { private final Protocol protocol = new OBDProtocol(); @Override - public byte[] constructEcuInitRequest(byte id) { - return protocol.constructEcuInitRequest(id); + public byte[] constructEcuInitRequest(Module module) { + return protocol.constructEcuInitRequest(module); } @Override - public byte[] constructEcuResetRequest(byte id) { - return protocol.constructEcuResetRequest(id); + public byte[] constructEcuResetRequest(Module module, int resetCode) { + return protocol.constructEcuResetRequest(module, resetCode); } @Override public byte[] constructReadAddressRequest( - byte id, Collection queries) { + Module module, Collection queries) { Collection filteredQueries = filterDuplicates(queries); return protocol.constructReadAddressRequest( - id, convertToByteAddresses(filteredQueries)); + module, convertToByteAddresses(filteredQueries)); } @Override - public byte[] constructReadPidRequest(byte id, byte[] pid) { + public byte[] constructReadPidRequest(Module module, byte[] pid) { final byte[][] request = new byte[1][pid.length]; arraycopy(pid, 0, request[0], 0, pid.length); - return protocol.constructReadAddressRequest(id, request); + return protocol.constructReadAddressRequest(module, request); } @Override @@ -81,7 +83,7 @@ public byte[] constructReadAddressResponse( int numAddresses = 0; for (EcuQuery ecuQuery : filteredQueries) { numAddresses += ecuQuery.getBytes().length; - numAddresses += getDataLength(ecuQuery); + numAddresses += EcuQueryData.getDataLength(ecuQuery); } return new byte[(numAddresses + RESPONSE_NON_DATA_BYTES)]; } @@ -121,7 +123,7 @@ public void processReadAddressResponses( int i = 0; for (EcuQuery filteredQuery : filteredQueries) { final int addrLength = filteredQuery.getBytes().length; - final int dataLength = getDataLength(filteredQuery); + final int dataLength = EcuQueryData.getDataLength(filteredQuery); final byte[] addr = new byte[addrLength]; final byte[] data = new byte[dataLength]; arraycopy(responseData, i, addr, 0, addrLength); @@ -141,9 +143,9 @@ public Protocol getProtocol() { @Override public byte[] constructWriteAddressRequest( - byte id, byte[] writeAddress, byte value) { + Module module, byte[] writeAddress, byte value) { - return protocol.constructWriteAddressRequest(id, writeAddress, value); + return protocol.constructWriteAddressRequest(module, writeAddress, value); } @Override @@ -181,18 +183,4 @@ private byte[][] convertToByteAddresses(Collection queries) { } return addresses; } - - private int getDataLength(EcuQuery ecuQuery) { - int dataLength = 1; - final String dataType = - ecuQuery.getLoggerData().getSelectedConvertor().getDataType().toLowerCase(); - if (dataType.contains("int16")) { - dataLength = 2; - } - else if (dataType.contains("int32") || - dataType.contains("float")) { - dataLength = 4; - } - return dataLength; - } } diff --git a/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDProtocol.java b/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDProtocol.java index d318ac8c3..e33573b4c 100644 --- a/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDProtocol.java +++ b/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDProtocol.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,40 +19,27 @@ package com.romraider.io.protocol.obd.iso15765; -import static com.romraider.util.HexUtil.asBytes; import static com.romraider.util.HexUtil.asHex; -import static com.romraider.util.ParamChecker.checkGreaterThanZero; +import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; -import static java.lang.System.arraycopy; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; import java.util.Map; -import com.romraider.Settings; import com.romraider.io.connection.ConnectionProperties; import com.romraider.io.protocol.Protocol; import com.romraider.logger.ecu.comms.manager.PollingState; import com.romraider.logger.ecu.comms.query.EcuInit; import com.romraider.logger.ecu.comms.query.SSMEcuInit; import com.romraider.logger.ecu.definition.EcuDefinition; +import com.romraider.logger.ecu.definition.Module; import com.romraider.logger.ecu.exception.InvalidResponseException; import com.romraider.logger.ecu.exception.UnsupportedProtocolException; import com.romraider.util.SettingsManager; public final class OBDProtocol implements Protocol { - private static final byte[] ECU_TESTER = - new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe0}; - private static final byte[] TCU_TESTER = - new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe1}; - private static byte[] ECU_CALID = - new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe8}; - private static final byte[] TCU_CALID = - new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe9}; private final ByteArrayOutputStream bb = new ByteArrayOutputStream(255); - private static byte[] TESTER = ECU_TESTER; - public static byte[] ECU_ID = ECU_CALID; public static final byte OBD_INIT_COMMAND = (byte) 0x01; public static final byte OBD_INIT_RESPONSE = (byte) 0x41; public static final byte OBD_INFO_COMMAND = (byte) 0x09; @@ -61,11 +48,12 @@ public final class OBDProtocol implements Protocol { public static final byte OBD_RESET_RESPONSE = (byte) 0x44; public static final byte OBD_NRC = (byte) 0x7F; public static final int RESPONSE_NON_DATA_BYTES = 5; - + public static Module module; + @Override - public byte[] constructEcuInitRequest(byte id) { - checkGreaterThanZero(id, "ECU_ID"); - setIDs(id); + public byte[] constructEcuInitRequest(Module module) { + checkNotNull(module, "module"); + OBDProtocol.module = module; final byte[] request = buildRequest( OBD_INFO_COMMAND, true, new byte[]{4}); return request; @@ -73,36 +61,36 @@ public byte[] constructEcuInitRequest(byte id) { @Override public byte[] constructWriteMemoryRequest( - byte id, byte[] address, byte[] values) { + Module module, byte[] address, byte[] values) { throw new UnsupportedProtocolException( - "Write memory command is not supported on OBD for address: " + + "Write memory command is not supported on OBD for address: " + asHex(address)); } @Override public byte[] constructWriteAddressRequest( - byte id, byte[] address, byte value) { + Module module, byte[] address, byte value) { throw new UnsupportedProtocolException( - "Write Address command is not supported on OBD for address: " + + "Write Address command is not supported on OBD for address: " + asHex(address)); } @Override public byte[] constructReadMemoryRequest( - byte id, byte[] address, int numBytes) { + Module module, byte[] address, int numBytes) { throw new UnsupportedProtocolException( - "Read memory command is not supported on OBD for address: " + + "Read memory command is not supported on OBD for address: " + asHex(address)); } @Override - public byte[] constructReadAddressRequest(byte id, byte[][] addresses) { - checkGreaterThanZero(id, "ECU_ID"); + public byte[] constructReadAddressRequest(Module module, byte[][] addresses) { + checkNotNull(module, "module"); checkNotNullOrEmpty(addresses, "addresses"); - setIDs(id); + OBDProtocol.module = module; return buildRequest(OBD_INIT_COMMAND, true, addresses); } @@ -123,45 +111,42 @@ public byte[] parseResponseData(byte[] processedResponse) { public void checkValidEcuInitResponse(byte[] processedResponse) { checkNotNullOrEmpty(processedResponse, "processedResponse"); OBDResponseProcessor.validateResponse(processedResponse); - // four byte - CAN ID - // one byte - Response mode - // one byte - Response pid - // null terminated CAL ID string - // 000007E8 49 ..... - byte responseType = processedResponse[4]; - if (responseType != OBD_INFO_RESPONSE) { - throw new InvalidResponseException( - "Unexpected ECU Info response type: " + - asHex(new byte[]{responseType})); - } } @Override public EcuInit parseEcuInitResponse(byte[] processedResponse) { checkNotNullOrEmpty(processedResponse, "processedResponse"); final byte[] ecuInitBytes = parseResponseData(processedResponse); - final byte[] calIdBytes = Arrays.copyOf(ecuInitBytes, 8); + // get CAL ID as reported by OBD + byte[] calIdBytes = Arrays.copyOf(ecuInitBytes, 8); + int j = 0; + // try to find the string termination character 0x00 in the calIdBytes + while (j < calIdBytes.length && calIdBytes[j] != 0) { j++; } + // if the CAL ID string is less than 8 bytes shorten the byte array + calIdBytes = Arrays.copyOf(calIdBytes, j); + // CAL ID as a string final String calIdStr = new String(calIdBytes); - final Settings settings = SettingsManager.getSettings(); + // make a default EcuInit using the CAL ID + EcuInit ssmEcuInit = new SSMEcuInit(ecuInitBytes, calIdStr); final Map defMap = - settings.getLoggerEcuDefinitionMap(); - byte[] ecuIdBytes = new byte[] {0,0,0,0,0}; - // convert CALID to ECUID based on defined ECU defs + SettingsManager.getSettings().getLoggerEcuDefinitionMap(); + // try to x-ref the CAL ID to ECU ID based on the loaded ECU defs for (EcuDefinition ecuDef : defMap.values()) { if (ecuDef.getCalId().equals(calIdStr)) { - ecuIdBytes = asBytes(ecuDef.getEcuId()); + // found a match so make a new EcuInit with the proper ECU ID + ssmEcuInit = new SSMEcuInit(ecuInitBytes, ecuDef.getEcuId()); break; } } - arraycopy(ecuIdBytes, 0, ecuInitBytes, 3, 5); - return new SSMEcuInit(ecuInitBytes); + return ssmEcuInit; } @Override - public byte[] constructEcuResetRequest(byte id) { - checkGreaterThanZero(id, "ECU_ID"); + public byte[] constructEcuResetRequest(Module module, int resetCode) { + checkNotNull(module, "module"); + OBDProtocol.module = module; // 000007E0 04 return buildRequest((byte) 0, false, new byte[]{OBD_RESET_COMMAND}); } @@ -173,7 +158,7 @@ public void checkValidEcuResetResponse(byte[] processedResponse) { byte responseType = processedResponse[4]; if (responseType != OBD_RESET_RESPONSE) { throw new InvalidResponseException( - "Unexpected OBD Reset response: " + + "Unexpected OBD Reset response: " + asHex(processedResponse)); } } @@ -186,30 +171,37 @@ public void checkValidWriteResponse(byte[] data, byte[] processedResponse) { public ConnectionProperties getDefaultConnectionProperties() { return new ConnectionProperties() { + @Override public int getBaudRate() { return 500000; } + @Override public void setBaudRate(int b) { } + @Override public int getDataBits() { return 8; } + @Override public int getStopBits() { return 1; } + @Override public int getParity() { return 0; } + @Override public int getConnectTimeout() { return 2000; } + @Override public int getSendTimeout() { return 55; } @@ -217,13 +209,13 @@ public int getSendTimeout() { } private byte[] buildRequest( - byte command, - boolean addCommand, + byte command, + boolean addCommand, byte[]... content) { bb.reset(); try { - bb.write(TESTER); + bb.write(module.getTester()); if (addCommand) { bb.write(command); } @@ -235,13 +227,4 @@ private byte[] buildRequest( } return bb.toByteArray(); } - - private void setIDs(byte id) { - ECU_ID = ECU_CALID; - TESTER = ECU_TESTER; - if (id == 0x18) { - ECU_ID = TCU_CALID; - TESTER = TCU_TESTER; - } - } } diff --git a/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDResponseProcessor.java b/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDResponseProcessor.java index 5580219c5..94840a17a 100644 --- a/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDResponseProcessor.java +++ b/src/main/java/com/romraider/io/protocol/obd/iso15765/OBDResponseProcessor.java @@ -19,12 +19,12 @@ package com.romraider.io.protocol.obd.iso15765; -import static com.romraider.io.protocol.obd.iso15765.OBDProtocol.ECU_ID; import static com.romraider.io.protocol.obd.iso15765.OBDProtocol.OBD_INFO_RESPONSE; import static com.romraider.io.protocol.obd.iso15765.OBDProtocol.OBD_INIT_RESPONSE; import static com.romraider.io.protocol.obd.iso15765.OBDProtocol.OBD_NRC; import static com.romraider.io.protocol.obd.iso15765.OBDProtocol.OBD_RESET_RESPONSE; import static com.romraider.io.protocol.obd.iso15765.OBDProtocol.RESPONSE_NON_DATA_BYTES; +import static com.romraider.io.protocol.obd.iso15765.OBDProtocol.module; import static com.romraider.util.ByteUtil.asUnsignedInt; import static com.romraider.util.HexUtil.asHex; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; @@ -51,7 +51,8 @@ public final static void validateResponse(byte[] response) { checkNotNullOrEmpty(response, "response"); assertTrue(response.length > RESPONSE_NON_DATA_BYTES, "Invalid response length"); - assertEquals(ECU_ID, response, "Invalid ECU id"); + assertEquals(module.getAddress(), response, "Invalid " + + module.getName() + " id"); if (response[4] == OBD_NRC) { assertNrc(OBD_NRC, response[4], response[5], response[6], "Request type not supported"); diff --git a/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMLoggerProtocol.java b/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMLoggerProtocol.java index 39b6fa825..c00bc27ee 100644 --- a/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMLoggerProtocol.java +++ b/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMLoggerProtocol.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,21 +39,22 @@ import com.romraider.logger.ecu.comms.query.EcuInit; import com.romraider.logger.ecu.comms.query.EcuInitCallback; import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.definition.Module; public final class SSMLoggerProtocol implements LoggerProtocol { private final Protocol protocol = new SSMProtocol(); - public byte[] constructEcuInitRequest(byte id) { - return protocol.constructEcuInitRequest(id); + public byte[] constructEcuInitRequest(Module module) { + return protocol.constructEcuInitRequest(module); } - public byte[] constructEcuResetRequest(byte id) { - return protocol.constructEcuResetRequest(id); + public byte[] constructEcuResetRequest(Module module, int resetCode) { + return protocol.constructEcuResetRequest(module, resetCode); } - public byte[] constructReadAddressRequest(byte id, Collection queries) { + public byte[] constructReadAddressRequest(Module module, Collection queries) { Collection filteredQueries = filterDuplicates(queries); - return protocol.constructReadAddressRequest(id, convertToByteAddresses(filteredQueries)); + return protocol.constructReadAddressRequest(module, convertToByteAddresses(filteredQueries)); } public byte[] constructReadAddressResponse(Collection queries, PollingState pollState) { @@ -108,9 +109,9 @@ public Protocol getProtocol() { } public byte[] constructWriteAddressRequest( - byte id, byte[] writeAddress, byte value) { + Module module, byte[] writeAddress, byte value) { - return protocol.constructWriteAddressRequest(id, writeAddress, value); + return protocol.constructWriteAddressRequest(module, writeAddress, value); } public void processWriteResponse(byte[] data, byte[] response) { diff --git a/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMProtocol.java b/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMProtocol.java index 977bbaffc..5d273b377 100644 --- a/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMProtocol.java +++ b/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMProtocol.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,36 +19,26 @@ package com.romraider.io.protocol.ssm.iso15765; +import static com.romraider.util.HexUtil.asHex; +import static com.romraider.util.ParamChecker.checkGreaterThanZero; +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; + import java.io.ByteArrayOutputStream; import java.io.IOException; + import com.romraider.io.connection.ConnectionProperties; import com.romraider.io.protocol.Protocol; - import com.romraider.logger.ecu.comms.manager.PollingState; import com.romraider.logger.ecu.comms.query.EcuInit; import com.romraider.logger.ecu.comms.query.SSMEcuInit; +import com.romraider.logger.ecu.definition.Module; import com.romraider.logger.ecu.exception.InvalidResponseException; import com.romraider.logger.ecu.exception.UnsupportedProtocolException; -import static com.romraider.util.HexUtil.asHex; -import static com.romraider.util.ParamChecker.checkGreaterThanZero; -import static com.romraider.util.ParamChecker.checkNotNull; -import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; - public final class SSMProtocol implements Protocol { - private static final byte[] ECU_TESTER = - new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe0}; - private static final byte[] TCU_TESTER = - new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe1}; - private static byte[] ECU_CALID = - new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe8}; - private static final byte[] TCU_CALID = - new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xe9}; private static final byte[] resetAddress = new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x60}; - private final ByteArrayOutputStream bb = new ByteArrayOutputStream(255); - private static byte[] TESTER = ECU_TESTER; - public static byte[] ECU_ID = ECU_CALID; public static final byte READ_MEMORY_PADDING = (byte) 0x00; public static final byte READ_MEMORY_COMMAND = (byte) 0xA0; public static final byte READ_MEMORY_RESPONSE = (byte) 0xE0; @@ -64,20 +54,22 @@ public final class SSMProtocol implements Protocol { public static final int ADDRESS_SIZE = 3; public static final int DATA_SIZE = 1; public static final int RESPONSE_NON_DATA_BYTES = 5; + public static Module module; + private final ByteArrayOutputStream bb = new ByteArrayOutputStream(255); - public byte[] constructEcuInitRequest(byte id) { - checkGreaterThanZero(id, "ECU_ID"); - setIDs(id); + public byte[] constructEcuInitRequest(Module module) { + checkNotNull(module, "module"); + SSMProtocol.module = module; // 000007E0 AA return buildRequest(ECU_INIT_COMMAND, false, new byte[0]); } public byte[] constructWriteMemoryRequest( - byte id, byte[] address, byte[] values) { - checkGreaterThanZero(id, "ECU_ID"); + Module module, byte[] address, byte[] values) { + checkNotNull(module, "module"); checkNotNullOrEmpty(address, "address"); checkNotNullOrEmpty(values, "values"); - setIDs(id); + SSMProtocol.module = module; // 000007E0 B0 from_address value1 value2 ... valueN throw new UnsupportedProtocolException( "Write memory command is not supported on CAN for address: " + @@ -85,33 +77,33 @@ public byte[] constructWriteMemoryRequest( } public byte[] constructWriteAddressRequest( - byte id, byte[] address, byte value) { + Module module, byte[] address, byte value) { - checkGreaterThanZero(id, "ECU_ID"); + checkNotNull(module, "module"); checkNotNullOrEmpty(address, "address"); checkNotNull(value, "value"); - setIDs(id); + SSMProtocol.module = module; // 000007E0 B8 address value return buildRequest( WRITE_ADDRESS_COMMAND, false, address, new byte[]{value}); } public byte[] constructReadMemoryRequest( - byte id, byte[] address, int numBytes) { - checkGreaterThanZero(id, "ECU_ID"); + Module module, byte[] address, int numBytes) { + checkNotNull(module, "module"); checkNotNullOrEmpty(address, "address"); checkGreaterThanZero(numBytes, "numBytes"); - setIDs(id); + SSMProtocol.module = module; // 000007E0 A0 padding from_address num_bytes-1 throw new UnsupportedProtocolException( "Read memory command is not supported on CAN for address: " + asHex(address)); } - public byte[] constructReadAddressRequest(byte id, byte[][] addresses) { - checkGreaterThanZero(id, "ECU_ID"); + public byte[] constructReadAddressRequest(Module module, byte[][] addresses) { + checkNotNull(module, "module"); checkNotNullOrEmpty(addresses, "addresses"); - setIDs(id); + SSMProtocol.module = module; // 000007E0 A8 padding [address1] [address2] ... [addressN] return buildRequest(READ_ADDRESS_COMMAND, true, addresses); } @@ -137,7 +129,7 @@ public void checkValidEcuInitResponse(byte[] processedResponse) { byte responseType = processedResponse[4]; if (responseType != ECU_INIT_RESPONSE) { throw new InvalidResponseException( - "Unexpected ECU Init response type: " + + "Unexpected " + module.getName() + " Init response type: " + asHex(new byte[]{responseType})); } } @@ -146,10 +138,9 @@ public EcuInit parseEcuInitResponse(byte[] processedResponse) { return new SSMEcuInit(parseResponseData(processedResponse)); } - public byte[] constructEcuResetRequest(byte id) { - checkGreaterThanZero(id, "ECU_ID"); + public byte[] constructEcuResetRequest(Module module, int resetCode) { // 000007E0 B8 000060 40 - return constructWriteAddressRequest(id, resetAddress, (byte) 0x40); + return constructWriteAddressRequest(module, resetAddress, (byte) resetCode); } public void checkValidEcuResetResponse(byte[] processedResponse) { @@ -159,7 +150,7 @@ public void checkValidEcuResetResponse(byte[] processedResponse) { if (responseType != WRITE_ADDRESS_RESPONSE || processedResponse[5] != (byte) 0x40) { throw new InvalidResponseException( - "Unexpected ECU Reset response: " + + "Unexpected " + module.getName() + " Reset response: " + asHex(processedResponse)); } } @@ -172,7 +163,7 @@ public void checkValidWriteResponse(byte[] data, byte[] processedResponse) { if (responseType != WRITE_ADDRESS_RESPONSE || processedResponse[5] != (byte) data[0]) { throw new InvalidResponseException( - "Unexpected ECU Write response: " + + "Unexpected " + module.getName() + " Write response: " + asHex(processedResponse)); } } @@ -217,7 +208,7 @@ private byte[] buildRequest( bb.reset(); try { - bb.write(TESTER); + bb.write(module.getTester()); bb.write(command); if (padContent) { bb.write(READ_MEMORY_PADDING); @@ -230,13 +221,4 @@ private byte[] buildRequest( } return bb.toByteArray(); } - - private void setIDs(byte id) { - ECU_ID = ECU_CALID; - TESTER = ECU_TESTER; - if (id == 0x18) { - ECU_ID = TCU_CALID; - TESTER = TCU_TESTER; - } - } } diff --git a/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMResponseProcessor.java b/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMResponseProcessor.java index cf8db008c..2007abff8 100644 --- a/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMResponseProcessor.java +++ b/src/main/java/com/romraider/io/protocol/ssm/iso15765/SSMResponseProcessor.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,21 +19,21 @@ package com.romraider.io.protocol.ssm.iso15765; -import static com.romraider.io.protocol.ssm.iso15765.SSMProtocol.ECU_ID; +import static com.romraider.io.protocol.ssm.iso15765.SSMProtocol.module; import static com.romraider.io.protocol.ssm.iso15765.SSMProtocol.ECU_INIT_RESPONSE; +import static com.romraider.io.protocol.ssm.iso15765.SSMProtocol.ECU_NRC; import static com.romraider.io.protocol.ssm.iso15765.SSMProtocol.READ_ADDRESS_RESPONSE; import static com.romraider.io.protocol.ssm.iso15765.SSMProtocol.READ_MEMORY_RESPONSE; import static com.romraider.io.protocol.ssm.iso15765.SSMProtocol.RESPONSE_NON_DATA_BYTES; import static com.romraider.io.protocol.ssm.iso15765.SSMProtocol.WRITE_ADDRESS_RESPONSE; import static com.romraider.io.protocol.ssm.iso15765.SSMProtocol.WRITE_MEMORY_RESPONSE; -import static com.romraider.io.protocol.ssm.iso15765.SSMProtocol.ECU_NRC; - -import com.romraider.logger.ecu.comms.manager.PollingState; -import com.romraider.logger.ecu.exception.InvalidResponseException; import static com.romraider.util.ByteUtil.asUnsignedInt; import static com.romraider.util.HexUtil.asHex; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.exception.InvalidResponseException; + public final class SSMResponseProcessor { private SSMResponseProcessor() { @@ -47,7 +47,8 @@ public static byte[] filterRequestFromResponse(byte[] request, byte[] response, public static void validateResponse(byte[] response) { assertTrue(response.length > RESPONSE_NON_DATA_BYTES, "Invalid response length"); - assertEquals(ECU_ID, response, "Invalid ECU id"); + assertEquals(module.getAddress(), response, "Invalid " + + module.getName() + " id"); if (response[4] == ECU_NRC) { assertNrc(ECU_NRC, response[4], response[5], response[6],"Request type not supported"); } diff --git a/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMLoggerProtocol.java b/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMLoggerProtocol.java index 800d7ea3d..2d6af1bc6 100644 --- a/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMLoggerProtocol.java +++ b/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMLoggerProtocol.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,41 +19,43 @@ package com.romraider.io.protocol.ssm.iso9141; -import com.romraider.io.protocol.Protocol; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.ADDRESS_SIZE; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.DATA_SIZE; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.REQUEST_NON_DATA_BYTES; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.RESPONSE_NON_DATA_BYTES; import static com.romraider.io.protocol.ssm.iso9141.SSMResponseProcessor.extractResponseData; import static com.romraider.io.protocol.ssm.iso9141.SSMResponseProcessor.filterRequestFromResponse; - -import com.romraider.logger.ecu.comms.io.protocol.LoggerProtocol; -import com.romraider.logger.ecu.comms.manager.PollingState; -import com.romraider.logger.ecu.comms.query.EcuInit; -import com.romraider.logger.ecu.comms.query.EcuInitCallback; -import com.romraider.logger.ecu.comms.query.EcuQuery; import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; import static java.lang.System.arraycopy; + import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import com.romraider.io.protocol.Protocol; +import com.romraider.logger.ecu.comms.io.protocol.LoggerProtocol; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.query.EcuInit; +import com.romraider.logger.ecu.comms.query.EcuInitCallback; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.definition.Module; + public final class SSMLoggerProtocol implements LoggerProtocol { private final Protocol protocol = new SSMProtocol(); - public byte[] constructEcuInitRequest(byte id) { - return protocol.constructEcuInitRequest(id); + public byte[] constructEcuInitRequest(Module module) { + return protocol.constructEcuInitRequest(module); } - public byte[] constructEcuResetRequest(byte id) { - return protocol.constructEcuResetRequest(id); + public byte[] constructEcuResetRequest(Module module, int resetCode) { + return protocol.constructEcuResetRequest(module, resetCode); } - public byte[] constructReadAddressRequest(byte id, Collection queries) { + public byte[] constructReadAddressRequest(Module module, Collection queries) { Collection filteredQueries = filterDuplicates(queries); - return protocol.constructReadAddressRequest(id, convertToByteAddresses(filteredQueries)); + return protocol.constructReadAddressRequest(module, convertToByteAddresses(filteredQueries)); } public byte[] constructReadAddressResponse(Collection queries, PollingState pollState) { @@ -66,9 +68,9 @@ public byte[] constructReadAddressResponse(Collection queries, Polling numAddresses += (ecuQuery.getBytes().length / ADDRESS_SIZE); } switch (pollState.getCurrentState()) { - case 0: + case STATE_0: return new byte[(numAddresses * DATA_SIZE + RESPONSE_NON_DATA_BYTES) + (numAddresses * ADDRESS_SIZE + REQUEST_NON_DATA_BYTES)]; - case 1: + case STATE_1: return new byte[(numAddresses * DATA_SIZE + RESPONSE_NON_DATA_BYTES)]; default: throw new UnsupportedOperationException("Poll mode not supported:" + pollState.getCurrentState()); @@ -116,9 +118,9 @@ public Protocol getProtocol() { } public byte[] constructWriteAddressRequest( - byte id, byte[] writeAddress, byte value) { + Module module, byte[] writeAddress, byte value) { - return protocol.constructWriteAddressRequest(id, writeAddress, value); + return protocol.constructWriteAddressRequest(module, writeAddress, value); } public void processWriteResponse(byte[] data, byte[] response) { diff --git a/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMProtocol.java b/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMProtocol.java index 589c3a91a..4e310eac4 100644 --- a/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMProtocol.java +++ b/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMProtocol.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ import com.romraider.logger.ecu.comms.manager.PollingStateImpl; import com.romraider.logger.ecu.comms.query.EcuInit; import com.romraider.logger.ecu.comms.query.SSMEcuInit; +import com.romraider.logger.ecu.definition.Module; import com.romraider.logger.ecu.exception.InvalidResponseException; import static com.romraider.util.ByteUtil.asByte; import static com.romraider.util.HexUtil.asHex; @@ -40,8 +41,6 @@ public final class SSMProtocol implements Protocol { public static final byte HEADER = (byte) 0x80; - public static byte ECU_ID = (byte) 0x10; - public static final byte DIAGNOSTIC_TOOL_ID = (byte) 0xF0; public static final byte READ_ADDRESS_ONCE = (byte) 0x00; public static final byte READ_ADDRESS_CONTINUOUS = (byte) 0x01; public static final byte READ_MEMORY_PADDING = (byte) 0x00; @@ -59,49 +58,50 @@ public final class SSMProtocol implements Protocol { public static final int DATA_SIZE = 1; public static final int RESPONSE_NON_DATA_BYTES = 6; public static final int REQUEST_NON_DATA_BYTES = 7; + public static Module module; private final PollingState pollState = new PollingStateImpl(); private final ByteArrayOutputStream bb = new ByteArrayOutputStream(255); - public byte[] constructEcuInitRequest(byte id) { - checkGreaterThanZero(id, "ECU_ID"); - SSMProtocol.ECU_ID = id; + public byte[] constructEcuInitRequest(Module module) { + checkNotNull(module, "module"); + SSMProtocol.module = module; // 0x80 0x10 0xF0 0x01 0xBF 0x40 return buildRequest(ECU_INIT_COMMAND, false, new byte[0]); } - public byte[] constructWriteMemoryRequest(byte id, byte[] address, byte[] values) { - checkGreaterThanZero(id, "ECU_ID"); + public byte[] constructWriteMemoryRequest(Module module, byte[] address, byte[] values) { + checkNotNull(module, "module"); checkNotNullOrEmpty(address, "address"); checkNotNullOrEmpty(values, "values"); - SSMProtocol.ECU_ID = id; + SSMProtocol.module = module; // 0x80 0x10 0xF0 data_length 0xB0 from_address value1 value2 ... valueN checksum return buildRequest(WRITE_MEMORY_COMMAND, false, address, values); } public byte[] constructWriteAddressRequest( - byte id, byte[] address, byte value) { + Module module, byte[] address, byte value) { - checkGreaterThanZero(id, "ECU_ID"); + checkNotNull(module, "module"); checkNotNullOrEmpty(address, "address"); checkNotNull(value, "value"); - SSMProtocol.ECU_ID = id; + SSMProtocol.module = module; // 0x80 0x10 0xF0 data_length 0xB8 from_address value checksum return buildRequest(WRITE_ADDRESS_COMMAND, false, address, new byte[]{value}); } - public byte[] constructReadMemoryRequest(byte id, byte[] address, int numBytes) { - checkGreaterThanZero(id, "ECU_ID"); + public byte[] constructReadMemoryRequest(Module module, byte[] address, int numBytes) { + checkNotNull(module, "module"); checkNotNullOrEmpty(address, "address"); checkGreaterThanZero(numBytes, "numBytes"); - SSMProtocol.ECU_ID = id; + SSMProtocol.module = module; // 0x80 0x10 0xF0 data_length 0xA0 padding from_address num_bytes-1 checksum return buildRequest(READ_MEMORY_COMMAND, true, address, new byte[]{asByte(numBytes - 1)}); } - public byte[] constructReadAddressRequest(byte id, byte[][] addresses) { - checkGreaterThanZero(id, "ECU_ID"); + public byte[] constructReadAddressRequest(Module module, byte[][] addresses) { + checkNotNull(module, "module"); checkNotNullOrEmpty(addresses, "addresses"); - SSMProtocol.ECU_ID = id; + SSMProtocol.module = module; // 0x80 0x10 0xF0 data_length 0xA8 padding address1 address2 ... addressN checksum return buildRequest(READ_ADDRESS_COMMAND, true, addresses); } @@ -122,7 +122,8 @@ public void checkValidEcuInitResponse(byte[] processedResponse) { SSMResponseProcessor.validateResponse(processedResponse); byte responseType = processedResponse[4]; if (responseType != ECU_INIT_RESPONSE) { - throw new InvalidResponseException("Unexpected ECU Init response type: " + asHex(new byte[]{responseType})); + throw new InvalidResponseException("Unexpected " + module.getName() + + " Init response type: " + asHex(new byte[]{responseType})); } } @@ -130,13 +131,11 @@ public EcuInit parseEcuInitResponse(byte[] processedResponse) { return new SSMEcuInit(parseResponseData(processedResponse)); } - public final byte[] constructEcuResetRequest(byte id) { + public final byte[] constructEcuResetRequest(Module module, int resetCode) { // 80 10 F0 05 B8 00 00 60 40 DD - checkGreaterThanZero(id, "ECU_ID"); final byte[] resetAddress = new byte[]{ (byte) 0x00, (byte) 0x00, (byte) 0x60}; - final byte reset = 0x40; - return constructWriteAddressRequest(id, resetAddress, reset); + return constructWriteAddressRequest(module, resetAddress, (byte) resetCode); } public void checkValidEcuResetResponse(byte[] processedResponse) { @@ -145,7 +144,8 @@ public void checkValidEcuResetResponse(byte[] processedResponse) { SSMResponseProcessor.validateResponse(processedResponse); byte responseType = processedResponse[4]; if (responseType != WRITE_ADDRESS_RESPONSE || processedResponse[5] != (byte) 0x40) { - throw new InvalidResponseException("Unexpected ECU Reset response: " + asHex(processedResponse)); + throw new InvalidResponseException("Unexpected " + module.getName() + + " Reset response: " + asHex(processedResponse)); } } @@ -157,7 +157,7 @@ public void checkValidWriteResponse(byte[] data, byte[] processedResponse) { if (responseType != WRITE_ADDRESS_RESPONSE || processedResponse[5] != (byte) data[0]) { throw new InvalidResponseException( - "Unexpected ECU Write response: " + + "Unexpected " + module.getName() + " Write response: " + asHex(processedResponse)); } } @@ -202,27 +202,29 @@ private final byte[] buildRequest(byte command, boolean padContent, for (byte[] tmp : content) { length += tmp.length; } - bb.reset(); - bb.write(HEADER); - bb.write(ECU_ID); - bb.write(DIAGNOSTIC_TOOL_ID); - bb.write(Integer.valueOf(length + (padContent ? 2 : 1)).byteValue()); - bb.write(command); - if (padContent) { - bb.write((pollState.isFastPoll() ? - READ_ADDRESS_CONTINUOUS : READ_ADDRESS_ONCE)); - } - for (byte[] tmp : content) { - try { + byte[] request = new byte[0]; + try { + bb.reset(); + bb.write(HEADER); + bb.write(module.getAddress()); + bb.write(module.getTester()); + bb.write(Integer.valueOf(length + (padContent ? 2 : 1)).byteValue()); + bb.write(command); + if (padContent) { + bb.write((pollState.isFastPoll() ? + READ_ADDRESS_CONTINUOUS : READ_ADDRESS_ONCE)); + } + for (byte[] tmp : content) { bb.write(tmp); - } catch (IOException e) { - e.printStackTrace(); } + bb.write((byte) 0x00); + request = bb.toByteArray(); + final byte cs = calculateChecksum(request); + request[request.length - 1] = cs; + } + catch (IOException e) { + e.printStackTrace(); } - bb.write((byte) 0x00); - final byte[] request = bb.toByteArray(); - final byte cs = calculateChecksum(request); - request[request.length - 1] = cs; return request; } } diff --git a/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMResponseProcessor.java b/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMResponseProcessor.java index 1f8a6f77a..d507e6da9 100644 --- a/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMResponseProcessor.java +++ b/src/main/java/com/romraider/io/protocol/ssm/iso9141/SSMResponseProcessor.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2014 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,8 +20,6 @@ package com.romraider.io.protocol.ssm.iso9141; import static com.romraider.io.protocol.ssm.iso9141.SSMChecksumCalculator.calculateChecksum; -import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.DIAGNOSTIC_TOOL_ID; -import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.ECU_ID; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.ECU_INIT_RESPONSE; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.HEADER; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.READ_ADDRESS_COMMAND; @@ -30,14 +28,15 @@ import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.RESPONSE_NON_DATA_BYTES; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.WRITE_ADDRESS_RESPONSE; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.WRITE_MEMORY_RESPONSE; - -import com.romraider.logger.ecu.comms.manager.PollingState; -import com.romraider.logger.ecu.exception.InvalidResponseException; +import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.module; import static com.romraider.util.ByteUtil.asByte; import static com.romraider.util.HexUtil.asHex; import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.exception.InvalidResponseException; + public final class SSMResponseProcessor { private SSMResponseProcessor() { @@ -49,11 +48,11 @@ public static byte[] filterRequestFromResponse(byte[] request, byte[] response, checkNotNullOrEmpty(response, "response"); checkNotNull(pollState, "pollState"); byte[] filteredResponse = new byte[0]; - if (request[4] != READ_ADDRESS_COMMAND || pollState.getCurrentState() == 0){ + if (request[4] != READ_ADDRESS_COMMAND || pollState.getCurrentState() == PollingState.State.STATE_0) { filteredResponse = new byte[response.length - request.length]; System.arraycopy(response, request.length, filteredResponse, 0, filteredResponse.length); } - if (request[4] == READ_ADDRESS_COMMAND && pollState.getCurrentState() == 1){ + if (request[4] == READ_ADDRESS_COMMAND && pollState.getCurrentState() == PollingState.State.STATE_1) { filteredResponse = new byte[response.length]; System.arraycopy(response, 0, filteredResponse, 0, filteredResponse.length); } @@ -64,8 +63,9 @@ public static void validateResponse(byte[] response) { int i = 0; assertTrue(response.length > RESPONSE_NON_DATA_BYTES, "Invalid response length"); assertEquals(HEADER, response[i++], "Invalid header"); - assertEquals(DIAGNOSTIC_TOOL_ID, response[i++], "Invalid diagnostic tool id"); - assertEquals(ECU_ID, response[i++], "Invalid ECU id"); + assertEquals(module.getTester()[0], response[i++], "Invalid diagnostic tool id"); + assertEquals(module.getAddress()[0], response[i++], + "Invalid " + module.getName() + " id"); assertEquals(asByte(response.length - RESPONSE_NON_DATA_BYTES + 1), response[i++], "Invalid response data length"); assertOneOf(new byte[]{ECU_INIT_RESPONSE, READ_ADDRESS_RESPONSE, READ_MEMORY_RESPONSE, WRITE_ADDRESS_RESPONSE, WRITE_MEMORY_RESPONSE}, response[i], "Invalid response code"); assertEquals(calculateChecksum(response), response[response.length - 1], "Invalid checksum"); diff --git a/src/main/java/com/romraider/io/serial/connection/SerialConnectionImpl.java b/src/main/java/com/romraider/io/serial/connection/SerialConnectionImpl.java index 4b8456f46..592e7b0f8 100644 --- a/src/main/java/com/romraider/io/serial/connection/SerialConnectionImpl.java +++ b/src/main/java/com/romraider/io/serial/connection/SerialConnectionImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,35 +19,32 @@ package com.romraider.io.serial.connection; -import com.romraider.io.connection.ConnectionProperties; -import com.romraider.logger.ecu.exception.NotConnectedException; -import com.romraider.logger.ecu.exception.PortNotFoundException; -import com.romraider.logger.ecu.exception.SerialCommunicationException; -import com.romraider.logger.ecu.exception.UnsupportedPortTypeException; +import static com.fazecast.jSerialComm.SerialPort.FLOW_CONTROL_DISABLED; +import static com.fazecast.jSerialComm.SerialPort.TIMEOUT_READ_SEMI_BLOCKING; import static com.romraider.util.HexUtil.asHex; import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; import static com.romraider.util.ThreadUtil.sleep; -import gnu.io.CommPortIdentifier; -import static gnu.io.CommPortIdentifier.PORT_SERIAL; -import static gnu.io.CommPortIdentifier.getPortIdentifier; -import gnu.io.NoSuchPortException; -import gnu.io.PortInUseException; -import gnu.io.SerialPort; -import static gnu.io.SerialPort.FLOWCONTROL_NONE; import static java.lang.System.currentTimeMillis; -import gnu.io.UnsupportedCommOperationException; -import org.apache.log4j.Logger; import static org.apache.log4j.Logger.getLogger; + import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -public final class SerialConnectionImpl implements SerialConnection { +import org.apache.log4j.Logger; + +import com.fazecast.jSerialComm.SerialPort; +import com.fazecast.jSerialComm.SerialPortInvalidPortException; +import com.romraider.io.connection.ConnectionProperties; +import com.romraider.logger.ecu.exception.ConfigurationException; +import com.romraider.logger.ecu.exception.NotConnectedException; +import com.romraider.logger.ecu.exception.SerialCommunicationException; + +public class SerialConnectionImpl implements SerialConnection { private static final Logger LOGGER = getLogger(SerialConnectionImpl.class); - private static final String RXTX_READ_LINE_HACK = "Underlying input stream returned zero bytes"; private final SerialPort serialPort; private final BufferedOutputStream os; private final BufferedInputStream is; @@ -68,72 +65,76 @@ public SerialConnectionImpl(String portName, ConnectionProperties connectionProp } } + @Override public void write(byte[] bytes) { try { os.write(bytes, 0, bytes.length); os.flush(); } catch (IOException e) { - throw new SerialCommunicationException(e); + throw new SerialCommunicationException("Write bytes: " + e); } } + @Override public int available() { try { return is.available(); } catch (IOException e) { - throw new SerialCommunicationException(e); + throw new SerialCommunicationException("Available: " + e); } } + @Override public int read() { try { waitForBytes(1); return is.read(); } catch (IOException e) { - throw new SerialCommunicationException(e); + throw new SerialCommunicationException("Read: " + e); } } + @Override public void read(byte[] bytes) { try { waitForBytes(bytes.length); is.read(bytes, 0, bytes.length); } catch (IOException e) { - throw new SerialCommunicationException(e); + throw new SerialCommunicationException("Read bytes: " + e); } } + @Override public String readLine() { try { waitForBytes(1); return reader.readLine(); } catch (IOException e) { - /* - This is a dodgy hack to workaround RXTX seemingly not respecting the request - to disable to the receive timeout. ie. gnu.io.SerialPort.disableReceiveTimeout() - */ - if (RXTX_READ_LINE_HACK.equalsIgnoreCase(e.getMessage())) return null; - throw new SerialCommunicationException(e); + throw new SerialCommunicationException("Read line: " + e); } } + @Override public byte[] readAvailable() { byte[] response = new byte[available()]; read(response); return response; } + @Override public void readStaleData() { if (available() <= 0) return; final long end = currentTimeMillis() + 100L; do { byte[] staleBytes = readAvailable(); - LOGGER.debug("Stale data read: " + asHex(staleBytes)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Stale data read: " + asHex(staleBytes)); sleep(2); } while ( (available() > 0) && (currentTimeMillis() <= end)); } + @Override public void close() { if (os != null) { try { @@ -159,66 +160,57 @@ public void close() { } } if (serialPort != null) { - try { - serialPort.close(); - } catch (Exception e) { - LOGGER.error("Error closing serial port", e); - } + if (!serialPort.closePort()) + LOGGER.error("Error closing serial port: " + serialPort.getSystemPortName()); } LOGGER.info("Connection closed."); } public void sendBreak(int duration) { - try { - serialPort.sendBreak(duration); - } catch (Exception e) { - throw new SerialCommunicationException(e); - } + if (!serialPort.setBreak()) + throw new SerialCommunicationException("Send Break"); + sleep((long)duration); + if (!serialPort.clearBreak()) + throw new SerialCommunicationException("Clear Break"); } private SerialPort connect(String portName, ConnectionProperties connectionProperties) { - CommPortIdentifier portIdentifier = resolvePortIdentifier(portName); - SerialPort serialPort = openPort(portIdentifier, connectionProperties.getConnectTimeout()); - initSerialPort(serialPort, connectionProperties.getBaudRate(), connectionProperties.getDataBits(), connectionProperties.getStopBits(), - connectionProperties.getParity()); + final SerialPort serialPort = openPort(portName); + serialPort.openPort(); + configSerialPort(serialPort, + connectionProperties.getBaudRate(), connectionProperties.getDataBits(), + connectionProperties.getStopBits(), connectionProperties.getParity()); LOGGER.info("Connected to: " + portName); return serialPort; } - private SerialPort openPort(CommPortIdentifier portIdentifier, int connectTimeout) { - checkIsSerialPort(portIdentifier); + private SerialPort openPort(String portName) { + SerialPort serialPort; try { - return (SerialPort) portIdentifier.open(this.getClass().getName(), connectTimeout); - } catch (PortInUseException e) { - throw new SerialCommunicationException("Port is currently in use: " + portIdentifier.getName()); + serialPort = SerialPort.getCommPort(portName); + if (!serialPort.openPort()) + throw new SerialCommunicationException("Failed to open port: " + portName); + } catch (SerialPortInvalidPortException e) { + throw new SerialCommunicationException("Port is unavailable: " + portName); } + return serialPort; } - private void checkIsSerialPort(CommPortIdentifier portIdentifier) { - if (portIdentifier.getPortType() != PORT_SERIAL) { - throw new UnsupportedPortTypeException("Port type " + portIdentifier.getPortType() + " not supported - must be serial."); - } - } - - private void initSerialPort(SerialPort serialPort, int baudrate, int dataBits, int stopBits, int parity) { + private void configSerialPort(SerialPort serialPort, int baudrate, int dataBits, int stopBits, int parity) { try { - serialPort.setFlowControlMode(FLOWCONTROL_NONE); - serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); - serialPort.disableReceiveTimeout(); - serialPort.setRTS(false); - } catch (UnsupportedCommOperationException e) { + if(!serialPort.setFlowControl(FLOW_CONTROL_DISABLED)) + throw new ConfigurationException("Flow control"); + if (!serialPort.setComPortParameters(baudrate, dataBits, stopBits, parity)) + throw new ConfigurationException("Connection properties"); + if (!serialPort.setComPortTimeouts(TIMEOUT_READ_SEMI_BLOCKING, 0, 0)) + throw new ConfigurationException("Timeout values"); + if (!serialPort.clearRTS()) + throw new ConfigurationException("RTS value"); + } catch (ConfigurationException e) { throw new UnsupportedOperationException(e); } } - private CommPortIdentifier resolvePortIdentifier(String portName) { - try { - return getPortIdentifier(portName); - } catch (NoSuchPortException e) { - throw new PortNotFoundException("Unable to resolve port: " + portName); - } - } - private void waitForBytes(int numBytes) { while (available() < numBytes) sleep(2L); } diff --git a/src/main/java/com/romraider/io/serial/connection/SerialConnectionManager.java b/src/main/java/com/romraider/io/serial/connection/SerialConnectionManager.java index 67381cb52..f933e3762 100644 --- a/src/main/java/com/romraider/io/serial/connection/SerialConnectionManager.java +++ b/src/main/java/com/romraider/io/serial/connection/SerialConnectionManager.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,6 +53,10 @@ public SerialConnectionManager(String portName, ConnectionProperties connectionP //connection = new TestSerialConnection2(portName, connectionProperties); } + @Override + public void open(byte[] start, byte[] stop) { + } + // Send request and wait for response with known length @Override public void send(byte[] request, byte[] response, PollingState pollState) { @@ -60,11 +64,12 @@ public void send(byte[] request, byte[] response, PollingState pollState) { checkNotNull(response, "response"); checkNotNull(pollState, "pollState"); - if (pollState.getCurrentState() == 0 && pollState.getLastState() == 1) { + if (pollState.getCurrentState() == PollingState.State.STATE_0 && + pollState.getLastState() == PollingState.State.STATE_1) { clearLine(); } - if (pollState.getCurrentState() == 0) { + if (pollState.getCurrentState() == PollingState.State.STATE_0) { connection.readStaleData(); connection.write(request); } @@ -73,14 +78,15 @@ public void send(byte[] request, byte[] response, PollingState pollState) { readTimeout -= 1; if (readTimeout <= 0) { byte[] badBytes = connection.readAvailable(); - LOGGER.debug("SSM Bad read response (read timeout): " + asHex(badBytes)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Serial Bad Read response (read timeout): " + asHex(badBytes)); return; // this will reinitialize the connection } } readTimeout = timeout; connection.read(response); - if (pollState.getCurrentState() == 1){ + if (pollState.getCurrentState() == PollingState.State.STATE_1){ if ( response[0] == (byte) 0x80 && response[1] == (byte) 0xF0 && (response[2] == (byte) 0x10 || response[2] == (byte) 0x18) @@ -91,7 +97,7 @@ public void send(byte[] request, byte[] response, PollingState pollState) { arraycopy(response, 0, lastResponse, 0, response.length); } else{ - LOGGER.error("SSM Bad Data response: " + asHex(response)); + LOGGER.error("Serial Bad Data response: " + asHex(response)); arraycopy(lastResponse, 0, response, 0, response.length); pollState.setNewQuery(true); } @@ -102,7 +108,11 @@ public void send(byte[] request, byte[] response, PollingState pollState) { @Override public byte[] send(byte[] bytes) { checkNotNull(bytes, "bytes"); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Reading stale data"); connection.readStaleData(); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Writing bytes"); connection.write(bytes); int available = 0; boolean keepLooking = true; @@ -120,16 +130,18 @@ public byte[] send(byte[] bytes) { @Override public void clearLine() { - LOGGER.debug("SSM sending line break"); - connection.sendBreak( 1 / - (connectionProperties.getBaudRate() * + int duration = (10000 / connectionProperties.getBaudRate()) * (connectionProperties.getDataBits() + - connectionProperties.getStopBits() + - connectionProperties.getParity() + 1))); + connectionProperties.getStopBits() + + connectionProperties.getParity() + 1); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Serial sending line break of duration: " + duration + " msec"); + connection.sendBreak(duration); do { sleep(2); byte[] badBytes = connection.readAvailable(); - LOGGER.debug("SSM clearing line (stale data): " + asHex(badBytes)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Serial clearing line (stale data): " + asHex(badBytes)); sleep(10); } while (connection.available() > 0 ); } diff --git a/src/main/java/com/romraider/io/serial/connection/TestSerialConnection.java b/src/main/java/com/romraider/io/serial/connection/TestSerialConnection.java index 332c78e4e..19451b70d 100644 --- a/src/main/java/com/romraider/io/serial/connection/TestSerialConnection.java +++ b/src/main/java/com/romraider/io/serial/connection/TestSerialConnection.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2014 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,13 +19,9 @@ package com.romraider.io.serial.connection; -import com.romraider.io.connection.ConnectionProperties; - import static com.romraider.io.protocol.ssm.iso9141.SSMChecksumCalculator.calculateChecksum; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.ADDRESS_SIZE; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.DATA_SIZE; -import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.DIAGNOSTIC_TOOL_ID; -import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.ECU_ID; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.ECU_INIT_COMMAND; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.HEADER; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.READ_ADDRESS_COMMAND; @@ -36,8 +32,7 @@ import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.RESPONSE_NON_DATA_BYTES; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.WRITE_MEMORY_COMMAND; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.WRITE_MEMORY_RESPONSE; - -import com.romraider.logger.ecu.exception.SerialCommunicationException; +import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.module; import static com.romraider.util.ByteUtil.asInt; import static com.romraider.util.HexUtil.asBytes; import static com.romraider.util.HexUtil.asHex; @@ -45,10 +40,15 @@ import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; import static com.romraider.util.ThreadUtil.sleep; import static java.lang.System.currentTimeMillis; -import org.apache.log4j.Logger; import static org.apache.log4j.Logger.getLogger; + import java.util.Random; +import org.apache.log4j.Logger; + +import com.romraider.io.connection.ConnectionProperties; +import com.romraider.logger.ecu.exception.SerialCommunicationException; + final class TestSerialConnection implements SerialConnection { private static final Logger LOGGER = getLogger(TestSerialConnection.class); private static final Random RANDOM = new Random(currentTimeMillis()); @@ -74,10 +74,10 @@ public void write(byte[] bytes) { public int available() { if (isEcuInitRequest()) { String init = ""; - if (ECU_ID == 0x10){ + if (module.getName().equalsIgnoreCase("ECU")){ init = ECU_INIT_RESPONSE; } - if (ECU_ID == 0x18){ + if (module.getName().equalsIgnoreCase("TCU")){ init = ECU_INIT_RESPONSE_TCU; } return asBytes(init).length; @@ -94,10 +94,10 @@ public int available() { public void read(byte[] bytes) { if (isEcuInitRequest()) { - if (ECU_ID == 0x10){ + if (module.getName().equalsIgnoreCase("ECU")){ System.arraycopy(asBytes(ECU_INIT_RESPONSE), 0, bytes, 0, bytes.length); } - if (ECU_ID == 0x18){ + if (module.getName().equalsIgnoreCase("TCU")){ System.arraycopy(asBytes(ECU_INIT_RESPONSE_TCU), 0, bytes, 0, bytes.length); } } else if (isIamRequest()) { @@ -111,8 +111,8 @@ public void read(byte[] bytes) { int i = 0; byte[] response = new byte[RESPONSE_NON_DATA_BYTES + calculateNumResponseDataBytes()]; response[i++] = HEADER; - response[i++] = DIAGNOSTIC_TOOL_ID; - response[i++] = ECU_ID; + response[i++] = module.getTester()[0]; + response[i++] = module.getAddress()[0]; response[i++] = (byte) (1 + responseData.length); response[i++] = READ_ADDRESS_RESPONSE; System.arraycopy(responseData, 0, response, i, responseData.length); @@ -124,8 +124,8 @@ public void read(byte[] bytes) { int i = 0; byte[] response = new byte[RESPONSE_NON_DATA_BYTES + responseData.length]; response[i++] = HEADER; - response[i++] = DIAGNOSTIC_TOOL_ID; - response[i++] = ECU_ID; + response[i++] = module.getTester()[0]; + response[i++] = module.getAddress()[0]; response[i++] = (byte) (1 + responseData.length); response[i++] = READ_MEMORY_RESPONSE; System.arraycopy(responseData, 0, response, i, responseData.length); @@ -137,8 +137,8 @@ public void read(byte[] bytes) { byte[] response = new byte[RESPONSE_NON_DATA_BYTES + numDataBytes]; int i = 0; response[i++] = HEADER; - response[i++] = DIAGNOSTIC_TOOL_ID; - response[i++] = ECU_ID; + response[i++] = module.getTester()[0]; + response[i++] = module.getAddress()[0]; response[i++] = (byte) (numDataBytes + 1); response[i++] = WRITE_MEMORY_RESPONSE; System.arraycopy(request, 8, response, i, numDataBytes); diff --git a/src/main/java/com/romraider/io/serial/connection/TestSerialConnection2.java b/src/main/java/com/romraider/io/serial/connection/TestSerialConnection2.java index eacc1bb71..92aac9617 100644 --- a/src/main/java/com/romraider/io/serial/connection/TestSerialConnection2.java +++ b/src/main/java/com/romraider/io/serial/connection/TestSerialConnection2.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,13 +19,9 @@ package com.romraider.io.serial.connection; -import com.romraider.io.connection.ConnectionProperties; - import static com.romraider.io.protocol.ssm.iso9141.SSMChecksumCalculator.calculateChecksum; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.ADDRESS_SIZE; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.DATA_SIZE; -import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.DIAGNOSTIC_TOOL_ID; -import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.ECU_ID; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.ECU_INIT_COMMAND; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.HEADER; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.READ_ADDRESS_COMMAND; @@ -36,10 +32,7 @@ import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.RESPONSE_NON_DATA_BYTES; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.WRITE_MEMORY_COMMAND; import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.WRITE_MEMORY_RESPONSE; - -import com.romraider.logger.ecu.comms.manager.PollingState; -import com.romraider.logger.ecu.comms.manager.PollingStateImpl; -import com.romraider.logger.ecu.exception.SerialCommunicationException; +import static com.romraider.io.protocol.ssm.iso9141.SSMProtocol.module; import static com.romraider.util.ByteUtil.asInt; import static com.romraider.util.HexUtil.asBytes; import static com.romraider.util.HexUtil.asHex; @@ -47,10 +40,17 @@ import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; import static com.romraider.util.ThreadUtil.sleep; import static java.lang.System.currentTimeMillis; -import org.apache.log4j.Logger; import static org.apache.log4j.Logger.getLogger; + import java.util.Random; +import org.apache.log4j.Logger; + +import com.romraider.io.connection.ConnectionProperties; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.manager.PollingStateImpl; +import com.romraider.logger.ecu.exception.SerialCommunicationException; + final class TestSerialConnection2 implements SerialConnection { private static final Logger LOGGER = getLogger(TestSerialConnection2.class); private static final Random RANDOM = new Random(currentTimeMillis()); @@ -73,6 +73,8 @@ final class TestSerialConnection2 implements SerialConnection { private byte[] request = new byte[0]; private byte[] readResponse = new byte[0]; private byte[] result = new byte[1]; + private boolean close = false; + private int index = 0; // private int index; @@ -88,14 +90,18 @@ public void write(byte[] bytes) { } public int available() { + if (close) return 0; if (pollState.isLastQuery() && !pollState.isNewQuery() && - pollState.getCurrentState() == 0 && pollState.getLastState() == 1) return 0; + pollState.getCurrentState() == PollingState.State.STATE_0 && + pollState.getLastState() == PollingState.State.STATE_1) { + return 0; + } if (isEcuInitRequest()) { String init = ""; - if (ECU_ID == 0x10){ + if (module.getName().equalsIgnoreCase("ECU")){ init = ECU_INIT_RESPONSE; } - if (ECU_ID == 0x18){ + if (module.getName().equalsIgnoreCase("TCU")){ init = ECU_INIT_RESPONSE_TCU; } return asBytes(init).length; @@ -111,18 +117,35 @@ public int available() { } public void read(byte[] bytes) { - long sleepTime = 200L; + long sleepTime = 500L; // if (readResponse.length == 0) { if (isEcuInitRequest()) { - if (ECU_ID == 0x10){ + if (module.getName().equalsIgnoreCase("ECU")){ System.arraycopy(asBytes(ECU_INIT_RESPONSE), 0, bytes, 0, bytes.length); } - if (ECU_ID == 0x18){ + if (module.getName().equalsIgnoreCase("TCU")){ System.arraycopy(asBytes(ECU_INIT_RESPONSE_TCU), 0, bytes, 0, bytes.length); } } else if (isIamRequest()) { byte[] response = asBytes("0x80F01006E83F600000000D"); System.arraycopy(response, 0, bytes, request.length, response.length); + } else if (isFBKCRequest()) { + byte[] response = new byte[7]; + switch (index) { + case 0: + response = asBytes("0x80F01002E844AE"); + index = 1; + break; + case 1: + response = asBytes("0x80F01002E860CA"); + index = 2; + break; + case 2: + response = asBytes("0x80F01002E880EA"); + index = 0; + break; + } + System.arraycopy(response, 0, bytes, request.length, response.length); } else if (isEngineLoadRequest()) { byte[] response = asBytes("0x80F01006E83EC74A760033"); System.arraycopy(response, 0, bytes, request.length, response.length); @@ -131,18 +154,18 @@ public void read(byte[] bytes) { int i = 0; byte[] response = new byte[RESPONSE_NON_DATA_BYTES + calculateNumResponseDataBytes()]; response[i++] = HEADER; - response[i++] = DIAGNOSTIC_TOOL_ID; - response[i++] = ECU_ID; + response[i++] = module.getTester()[0]; + response[i++] = module.getAddress()[0]; response[i++] = (byte) (1 + responseData.length); response[i++] = READ_ADDRESS_RESPONSE; System.arraycopy(responseData, 0, response, i, responseData.length); response[i += responseData.length] = calculateChecksum(response); - if (pollState.getCurrentState() == 0) { + if (pollState.getCurrentState() == PollingState.State.STATE_0) { readResponse = new byte[request.length + response.length]; System.arraycopy(request, 0, readResponse, 0, request.length); System.arraycopy(response, 0, readResponse, request.length, response.length); } - if (pollState.getCurrentState() == 1) { + if (pollState.getCurrentState() == PollingState.State.STATE_1) { readResponse = new byte[response.length]; System.arraycopy(response, 0, readResponse, 0, response.length); sleepTime = 20L; @@ -154,8 +177,8 @@ public void read(byte[] bytes) { int i = 0; byte[] response = new byte[RESPONSE_NON_DATA_BYTES + responseData.length]; response[i++] = HEADER; - response[i++] = DIAGNOSTIC_TOOL_ID; - response[i++] = ECU_ID; + response[i++] = module.getTester()[0]; + response[i++] = module.getAddress()[0]; response[i++] = (byte) (1 + responseData.length); response[i++] = READ_MEMORY_RESPONSE; System.arraycopy(responseData, 0, response, i, responseData.length); @@ -167,8 +190,8 @@ public void read(byte[] bytes) { byte[] response = new byte[RESPONSE_NON_DATA_BYTES + numDataBytes]; int i = 0; response[i++] = HEADER; - response[i++] = DIAGNOSTIC_TOOL_ID; - response[i++] = ECU_ID; + response[i++] = module.getTester()[0]; + response[i++] = module.getAddress()[0]; response[i++] = (byte) (numDataBytes + 1); response[i++] = WRITE_MEMORY_RESPONSE; System.arraycopy(request, 8, response, i, numDataBytes); @@ -194,6 +217,7 @@ public void read(byte[] bytes) { public byte[] readAvailable() { byte[] response = new byte[available()]; + if (response.length == 0) return new byte[]{0}; read(response); return response; } @@ -215,6 +239,7 @@ public int read() { } public void sendBreak(int duration) { + close = true; } private int calculateNumResponseDataBytes() { @@ -226,6 +251,11 @@ private boolean isIamRequest() { return hex.startsWith("8010F011A8") && hex.contains("FF8228FF8229FF822AFF822B"); } + private boolean isFBKCRequest() { + String hex = asHex(request); + return hex.startsWith("8010F005A8") && hex.contains("FF6ADD73"); + } + private boolean isEngineLoadRequest() { String hex = asHex(request); return hex.startsWith("8010F011A8") && hex.contains("FFA6FCFFA6FDFFA6FEFFA6FF"); @@ -240,6 +270,7 @@ private byte[] generateResponseData(int dataLength) { } private boolean isEcuInitRequest() { + close = false; byte command = ECU_INIT_COMMAND; return isCommand(command); } @@ -265,8 +296,8 @@ private void genNewRandomResponseData() { int i = 0; byte[] response = new byte[RESPONSE_NON_DATA_BYTES + calculateNumResponseDataBytes()]; response[i++] = HEADER; - response[i++] = DIAGNOSTIC_TOOL_ID; - response[i++] = ECU_ID; + response[i++] = module.getTester()[0]; + response[i++] = module.getAddress()[0]; response[i++] = (byte) (1 + responseData.length); response[i++] = READ_ADDRESS_RESPONSE; System.arraycopy(responseData, 0, response, i, responseData.length); diff --git a/src/main/java/com/romraider/io/serial/port/SerialPortDiscoverer.java b/src/main/java/com/romraider/io/serial/port/SerialPortDiscoverer.java index c249a2825..940fb7b0d 100644 --- a/src/main/java/com/romraider/io/serial/port/SerialPortDiscoverer.java +++ b/src/main/java/com/romraider/io/serial/port/SerialPortDiscoverer.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,11 +19,11 @@ package com.romraider.io.serial.port; -import gnu.io.CommPortIdentifier; +import com.fazecast.jSerialComm.*; import java.util.List; public interface SerialPortDiscoverer { - List listPorts(); + List listPorts(); } diff --git a/src/main/java/com/romraider/io/serial/port/SerialPortDiscovererImpl.java b/src/main/java/com/romraider/io/serial/port/SerialPortDiscovererImpl.java index 99f0594e4..a5a3b93a8 100644 --- a/src/main/java/com/romraider/io/serial/port/SerialPortDiscovererImpl.java +++ b/src/main/java/com/romraider/io/serial/port/SerialPortDiscovererImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,24 +19,33 @@ package com.romraider.io.serial.port; -import gnu.io.CommPortIdentifier; -import static gnu.io.CommPortIdentifier.PORT_SERIAL; -import static gnu.io.CommPortIdentifier.getPortIdentifiers; +import static org.apache.log4j.Logger.getLogger; + import java.util.ArrayList; -import java.util.Enumeration; import java.util.List; +import org.apache.log4j.Logger; + +import com.fazecast.jSerialComm.SerialPort; + public final class SerialPortDiscovererImpl implements SerialPortDiscoverer { - @SuppressWarnings({"unchecked"}) - public List listPorts() { - List serialPortIdentifiers = new ArrayList(); - Enumeration portEnum = getPortIdentifiers(); - while (portEnum.hasMoreElements()) { - CommPortIdentifier portIdentifier = portEnum.nextElement(); - if (portIdentifier.getPortType() == PORT_SERIAL) { - serialPortIdentifiers.add(portIdentifier); - } + private static final Logger LOGGER = getLogger(SerialPortDiscovererImpl.class); + + public List listPorts() { + final List serialPortIdentifiers = new ArrayList(); + + try { + for (final SerialPort port : SerialPort.getCommPorts()) { + serialPortIdentifiers.add(port); + } + } + catch(NoClassDefFoundError e) { + LOGGER.error("Could not load jSerialComm library!"); + } + catch(UnsatisfiedLinkError e) { + LOGGER.error("Could not load jSerialComm library!"); } + return serialPortIdentifiers; } } diff --git a/src/main/java/com/romraider/io/serial/port/SerialPortRefresher.java b/src/main/java/com/romraider/io/serial/port/SerialPortRefresher.java index 085fddae5..4d597c7a6 100644 --- a/src/main/java/com/romraider/io/serial/port/SerialPortRefresher.java +++ b/src/main/java/com/romraider/io/serial/port/SerialPortRefresher.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,14 +21,16 @@ import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ThreadUtil.sleep; -import gnu.io.CommPortIdentifier; -import org.apache.log4j.Logger; - import static org.apache.log4j.Logger.getLogger; + import java.util.List; import java.util.Set; import java.util.TreeSet; +import org.apache.log4j.Logger; + +import com.fazecast.jSerialComm.SerialPort; + public final class SerialPortRefresher implements Runnable { private static final Logger LOGGER = getLogger(SerialPortRefresher.class); private static final long PORT_REFRESH_INTERVAL = 15000L; @@ -45,6 +47,8 @@ public SerialPortRefresher(SerialPortRefreshListener listener, String defaultLog } public void run() { + Thread.currentThread().setName("Serial Port Refresher"); + refreshPortList(); started = true; while (true) { @@ -75,10 +79,10 @@ private void refreshPortList() { } private Set listSerialPorts() { - List portIdentifiers = serialPortDiscoverer.listPorts(); - Set portNames = new TreeSet(); - for (CommPortIdentifier portIdentifier : portIdentifiers) { - String portName = portIdentifier.getName(); + final List portIdentifiers = serialPortDiscoverer.listPorts(); + final Set portNames = new TreeSet(); + for (final SerialPort portIdentifier : portIdentifiers) { + final String portName = portIdentifier.getSystemPortName(); if (!portNames.contains(portName)) { portNames.add(portName); } diff --git a/src/main/java/com/romraider/logger/car/util/Constants.java b/src/main/java/com/romraider/logger/car/util/Constants.java index 577286c39..b92246892 100644 --- a/src/main/java/com/romraider/logger/car/util/Constants.java +++ b/src/main/java/com/romraider/logger/car/util/Constants.java @@ -19,22 +19,12 @@ package com.romraider.logger.car.util; -public enum Constants { - IMPERIAL ("imperial"), - IMPERIAL_UNIT ("mph"), - METRIC ("metric"), - METRIC_UNIT ("km/h"), - KPH_2_MPH ("1.609344"), - TQ_CONSTANT_I ("5252.113122"), - TQ_CONSTANT_M ("9549.296748"); - - private final String value; - - Constants (String value) { - this.value = value; - } - - public String value(){ - return value; - } +public class Constants { + static String IMPERIAL = "imperial"; + static String METRIC = "metric"; + static String METRIC_UNIT = "km/h"; + static String IMPERIAL_UNIT = "mph"; + static double KPH_2_MPH = 1.609344; + static double TQ_CONSTANT_I = 5252.113122; + static double TQ_CONSTANT_M = 9549.296748; } diff --git a/src/main/java/com/romraider/logger/car/util/SpeedCalculator.java b/src/main/java/com/romraider/logger/car/util/SpeedCalculator.java index 06441e557..8101ce171 100644 --- a/src/main/java/com/romraider/logger/car/util/SpeedCalculator.java +++ b/src/main/java/com/romraider/logger/car/util/SpeedCalculator.java @@ -24,20 +24,18 @@ import static com.romraider.logger.car.util.Constants.METRIC_UNIT; public class SpeedCalculator { - private static final double K2M = Double.parseDouble(KPH_2_MPH.value()); - public static double calculateMph(double rpm, double ratio) { return (rpm / ratio); } public static double calculateKph(double rpm, double ratio) { - return calculateMph(rpm, ratio) * K2M; + return calculateMph(rpm, ratio) * KPH_2_MPH; } public static double calculateRpm(double vs, double ratio, String units) { double rpm = 0; - if (units.equalsIgnoreCase(IMPERIAL_UNIT.value())) rpm = (vs * ratio); - if (units.equalsIgnoreCase(METRIC_UNIT.value())) rpm = (vs * ratio / K2M); + if (units.equalsIgnoreCase(IMPERIAL_UNIT)) rpm = (vs * ratio); + if (units.equalsIgnoreCase(METRIC_UNIT)) rpm = (vs * ratio / KPH_2_MPH); return rpm; } diff --git a/src/main/java/com/romraider/logger/car/util/TorqueCalculator.java b/src/main/java/com/romraider/logger/car/util/TorqueCalculator.java index 8a4fcd8cb..c3927e635 100644 --- a/src/main/java/com/romraider/logger/car/util/TorqueCalculator.java +++ b/src/main/java/com/romraider/logger/car/util/TorqueCalculator.java @@ -28,11 +28,11 @@ public class TorqueCalculator { public static double calculateTorque(double rpm, double hp, String units) { double tq = 0; - if (units.equalsIgnoreCase(IMPERIAL.value())) { - tq = hp / rpm * Double.parseDouble(TQ_CONSTANT_I.value()); + if (units.equalsIgnoreCase(IMPERIAL)) { + tq = hp / rpm * TQ_CONSTANT_I; } - if (units.equalsIgnoreCase(METRIC.value())) { - tq = hp / rpm * Double.parseDouble(TQ_CONSTANT_M.value()); + if (units.equalsIgnoreCase(METRIC)) { + tq = hp / rpm * TQ_CONSTANT_M; } return tq; } diff --git a/src/main/java/com/romraider/logger/ecu/EcuLogger.java b/src/main/java/com/romraider/logger/ecu/EcuLogger.java index 9a1aad0c4..64d605285 100644 --- a/src/main/java/com/romraider/logger/ecu/EcuLogger.java +++ b/src/main/java/com/romraider/logger/ecu/EcuLogger.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,6 +58,7 @@ import static javax.swing.SwingConstants.RIGHT; import static javax.swing.SwingConstants.VERTICAL; import static javax.swing.SwingUtilities.invokeLater; +import com.romraider.swing.menubar.RadioButtonMenuItem; import java.awt.BorderLayout; import java.awt.Component; @@ -75,10 +76,13 @@ import java.beans.PropertyChangeEvent; import java.io.File; import java.net.URL; +import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.ResourceBundle; import java.util.Vector; import javax.swing.AbstractAction; @@ -102,20 +106,24 @@ import javax.swing.JTextField; import javax.swing.JToggleButton; import javax.swing.JWindow; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import javax.swing.table.TableColumn; import org.apache.log4j.Level; import org.apache.log4j.Logger; import com.romraider.Settings; +import com.romraider.Version; import com.romraider.editor.ecu.ECUEditor; +import com.romraider.editor.ecu.ECUEditorManager; import com.romraider.io.serial.port.SerialPortRefresher; import com.romraider.logger.ecu.comms.controller.LoggerController; import com.romraider.logger.ecu.comms.controller.LoggerControllerImpl; import com.romraider.logger.ecu.comms.globaladjust.GlobalAdjustManager; -import com.romraider.logger.ecu.comms.globaladjust.GlobalAdjustManagerImpl; +import com.romraider.logger.ecu.comms.globaladjust.SSMGlobalAdjustManager; import com.romraider.logger.ecu.comms.learning.LearningTableValues; -import com.romraider.logger.ecu.comms.learning.LearningTableValuesImpl; +import com.romraider.logger.ecu.comms.learning.LearningTableValuesFactory; import com.romraider.logger.ecu.comms.query.EcuInit; import com.romraider.logger.ecu.comms.query.EcuInitCallback; import com.romraider.logger.ecu.comms.readcodes.ReadCodesManager; @@ -131,6 +139,8 @@ import com.romraider.logger.ecu.definition.ExternalData; import com.romraider.logger.ecu.definition.ExternalDataImpl; import com.romraider.logger.ecu.definition.LoggerData; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.definition.Transport; import com.romraider.logger.ecu.exception.ConfigurationException; import com.romraider.logger.ecu.exception.PortNotFoundException; import com.romraider.logger.ecu.profile.UserProfile; @@ -139,6 +149,7 @@ import com.romraider.logger.ecu.profile.UserProfileItemImpl; import com.romraider.logger.ecu.profile.UserProfileLoader; import com.romraider.logger.ecu.profile.UserProfileLoaderImpl; +import com.romraider.logger.ecu.ui.CustomButtonGroup; import com.romraider.logger.ecu.ui.DataRegistrationBroker; import com.romraider.logger.ecu.ui.DataRegistrationBrokerImpl; import com.romraider.logger.ecu.ui.EcuDataComparator; @@ -148,6 +159,7 @@ import com.romraider.logger.ecu.ui.handler.DataUpdateHandlerManager; import com.romraider.logger.ecu.ui.handler.DataUpdateHandlerManagerImpl; import com.romraider.logger.ecu.ui.handler.dash.DashboardUpdateHandler; +import com.romraider.logger.ecu.ui.handler.dataflow.DataflowSimulationHandler; import com.romraider.logger.ecu.ui.handler.dyno.DynoUpdateHandler; import com.romraider.logger.ecu.ui.handler.file.FileLoggerControllerSwitchHandler; import com.romraider.logger.ecu.ui.handler.file.FileLoggerControllerSwitchMonitorImpl; @@ -181,8 +193,10 @@ import com.romraider.swing.AbstractFrame; import com.romraider.swing.SetFont; import com.romraider.util.FormatFilename; -import com.romraider.util.JREChecker; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; + + import com.romraider.util.ThreadUtil; /* @@ -199,30 +213,29 @@ public final class EcuLogger extends AbstractFrame implements MessageListener { private static final long serialVersionUID = 7145423251696282784L; private static final Logger LOGGER = Logger.getLogger(EcuLogger.class); - private static final String ECU_LOGGER_TITLE = PRODUCT_NAME + " v" + VERSION + " | ECU/TCU Logger"; + protected static final ResourceBundle rb = new ResourceUtil().getBundle( + EcuLogger.class.getName()); + private static final String ECU_LOGGER_TITLE = PRODUCT_NAME + " v" + VERSION + " | " + rb.getString("TITLE"); private static final String LOGGER_FULLSCREEN_ARG = "-logger.fullscreen"; - private static final URL ICON_PATH = Settings.class.getClass().getResource("/graphics/romraider-ico.gif"); + private static final String LOGGER_TOUCH_ARG = "-logger.touch"; + private static final URL ICON_PATH = Settings.class.getResource("/graphics/romraider-ico.gif"); private static final String HEADING_PARAMETERS = "Parameters"; private static final String HEADING_SWITCHES = "Switches"; private static final String HEADING_EXTERNAL = "External"; private static final String CAL_ID_LABEL = "CAL ID"; - private static final String FILE_NAME_EXTENTION = "Right-click to select or type text to add to the saved logfile name."; - private static final String ECU_TEXT = "Engine Control Unit Polling. Uncheck both ECU & TCU for Externals logging only"; - private static final String TCU_TEXT = "Transmission Control Unit Polling. Un-check both ECU & TCU for Externals logging only"; + private static final String FILE_NAME_EXTENTION = rb.getString("FILENAMEEXTENTION"); private static final String[] LOG_FILE_TEXT = {"1st PT","2nd PT","3rd PT", // PT = Part Throttle "4th PT","5th PT","6th PT", "1st WOT","2nd WOT","3rd WOT", "4th WOT","5th WOT","6th WOT", - "cruising"}; - private static final String TOGGLE_LIST_TT_TEXT = "Hides the parameter list and saves the state on exit (F11)"; - private static final String UNSELECT_ALL_TT_TEXT = "Un-select all selected parameters/switches on all tabs! (F9)"; - private static final byte ECU_ID = (byte) 0x10; - private static final byte TCU_ID = (byte) 0x18; + "cruising"}; + private static final String TOGGLE_LIST_TT_TEXT = rb.getString("TTTEXTF11"); + private static final String UNSELECT_ALL_TT_TEXT = rb.getString("TTTEXTF9"); private static final String LOG_TO_FILE_FK = "F1"; private static final String LOG_TO_FILE_ICON = "/graphics/logger_log_to_file.png"; - private static final String LOG_TO_FILE_START = "Start file log"; - private static final String LOG_TO_FILE_STOP = "Stop file log"; - private static final String LOG_TO_FILE_TT_TEXT = "Start/stop file logging (F1)"; + private static final String LOG_TO_FILE_START = rb.getString("STARTFILELOG"); + private static final String LOG_TO_FILE_STOP = rb.getString("STOPFILELOG"); + private static final String LOG_TO_FILE_TT_TEXT = rb.getString("TTTEXTF1"); private static String target = "ECU"; private static String loadResult = ""; private String defVersion; @@ -276,32 +289,59 @@ public final class EcuLogger extends AbstractFrame implements MessageListener { private List ecuParams; private SerialPortRefresher refresher; private JWindow startStatus; - private final JLabel startText = new JLabel(" Initializing Logger..."); + private final JLabel startText = new JLabel(rb.getString("INITIALIZELOGGER")); private final String HOME = System.getProperty("user.home"); private StatusIndicator statusIndicator; private List dtcodes = new ArrayList(); + private Map>> protocolList = + new HashMap>>(); + private Map componentList = new HashMap(); + private static boolean touchEnabled = false; + private final JPanel moduleSelectPanel = new JPanel(new FlowLayout()); - public EcuLogger() { - super(ECU_LOGGER_TITLE); - construct(); + private static EcuLogger instance; + + public static EcuLogger getEcuLoggerWithoutCreation() { + return instance; } - public EcuLogger(ECUEditor ecuEditor) { + public static EcuLogger getEcuLogger(ECUEditor ecuEditor) { + if (instance != null ) return instance; + else { + instance = new EcuLogger(ecuEditor); + return instance; + } + } + + private EcuLogger(ECUEditor ecuEditor) { super(ECU_LOGGER_TITLE); this.ecuEditor = ecuEditor; construct(); } + public void setEcuEditor(ECUEditor ecuEditor) { + this.ecuEditor = ecuEditor; + + mafTab = new MafTabImpl(mafTabBroker, ecuEditor); + injectorTab = new InjectorTabImpl(injectorTabBroker, ecuEditor); + dynoTab = new DynoTabImpl(dynoTabBroker, ecuEditor); + + injectorUpdateHandler.setInjectorTab(injectorTab); + mafUpdateHandler.setMafTab(mafTab); + dynoUpdateHandler.setDynoTab(dynoTab); + } + private void construct() { - // 64-bit won't work with the native libs (e.g. serial rxtx) but won't - // fail until we actually try to use them since the logger requires - // these libraries, this is a hard error here - if (!JREChecker.is32bit()) { - showMessageDialog(null, - "Incompatible JRE detected.\n" + - PRODUCT_NAME + - " ECU Logger requires a 32-bit JRE.\nLogger will now exit.", - "JRE Incompatibility Error", + /** + * Bitness of supporting libraries must match the bitness of RomRaider + * and the running JRE. Notify and exit if mixed bitness is detected. + */ + if (!System.getProperty("sun.arch.data.model").equals(Version.BUILD_ARCH)) { + showMessageDialog(null, + MessageFormat.format( + rb.getString("INCOMPJRE"), + PRODUCT_NAME, Version.BUILD_ARCH), + rb.getString("INCOMPJREERR"), ERROR_MESSAGE); // this will generate a NullPointerException because we never got // things started @@ -317,43 +357,42 @@ private void construct() { JProgressBar progressBar = startbar(); bootstrap(); progressBar.setValue(20); - startText.setText(" Loading ECU Defs..."); + startText.setText(rb.getString("LOADINGDEFS")); loadEcuDefs(); progressBar.setValue(40); - startText.setText(" Loading Plugins..."); + startText.setText(rb.getString("LOADINGPLUG")); progressBar.setIndeterminate(true); loadLoggerPlugins(); progressBar.setIndeterminate(false); progressBar.setValue(60); - startText.setText(" Loading ECU Parameters..."); + startText.setText(rb.getString("LOADINGPARAMS")); loadLoggerParams(); progressBar.setValue(80); - startText.setText(" Starting Logger..."); + startText.setText(rb.getString("STARTINGLOGGER")); initControllerListeners(); initUserInterface(); progressBar.setValue(100); initDataUpdateHandlers(); startPortRefresherThread(); - if (!isLogging()) startLogging(); startStatus.dispose(); } else { bootstrap(); - ecuEditor.statusPanel.update("Loading ECU Defs...", 20); + ecuEditor.getStatusPanel().update(rb.getString("LOADINGDEFS"), 20); loadEcuDefs(); - ecuEditor.statusPanel.update("Loading Plugins...", 40); + ecuEditor.getStatusPanel().update(rb.getString("LOADINGPLUG"), 40); loadLoggerPlugins(); - ecuEditor.statusPanel.update("Loading ECU Parameters...", 60); + ecuEditor.getStatusPanel().update(rb.getString("LOADINGPARAMS"), 60); loadLoggerParams(); - ecuEditor.statusPanel.update("Starting Logger...", 80); + ecuEditor.getStatusPanel().update(rb.getString("STARTINGLOGGER"), 80); initControllerListeners(); initUserInterface(); - ecuEditor.statusPanel.update("Complete...", 100); + ecuEditor.getStatusPanel().update(rb.getString("COMPLETE"), 100); initDataUpdateHandlers(); startPortRefresherThread(); - if (!isLogging()) startLogging(); - ecuEditor.statusPanel.update("Ready...",0); + ecuEditor.getStatusPanel().update(rb.getString("READY"),0); } + this.toFront(); } private void bootstrap() { @@ -400,25 +439,29 @@ private String getCarString(String ecuId) { graphPanel = new JPanel(new BorderLayout(2, 2)); graphUpdateHandler = new GraphUpdateHandler(graphPanel); dashboardPanel = new JPanel(new BetterFlowLayout(FlowLayout.CENTER, 3, 3)); - dashboardUpdateHandler = new DashboardUpdateHandler(dashboardPanel); + dashboardUpdateHandler = new DashboardUpdateHandler(dashboardPanel, getSettings().getLoggerSelectedGaugeIndex()); mafUpdateHandler = new MafUpdateHandler(); injectorUpdateHandler = new InjectorUpdateHandler(); dynoUpdateHandler = new DynoUpdateHandler(); controller = new LoggerControllerImpl(ecuInitCallback, this, liveDataUpdateHandler, graphUpdateHandler, dashboardUpdateHandler, mafUpdateHandler, injectorUpdateHandler, - dynoUpdateHandler, fileUpdateHandler, TableUpdateHandler.getInstance()); + dynoUpdateHandler, fileUpdateHandler, TableUpdateHandler.getInstance(), DataflowSimulationHandler.getInstance()); + mafHandlerManager = new DataUpdateHandlerManagerImpl(); mafTabBroker = new DataRegistrationBrokerImpl(controller, mafHandlerManager); mafTab = new MafTabImpl(mafTabBroker, ecuEditor); mafUpdateHandler.setMafTab(mafTab); + injectorHandlerManager = new DataUpdateHandlerManagerImpl(); injectorTabBroker = new DataRegistrationBrokerImpl(controller, injectorHandlerManager); injectorTab = new InjectorTabImpl(injectorTabBroker, ecuEditor); injectorUpdateHandler.setInjectorTab(injectorTab); + dynoHandlerManager = new DataUpdateHandlerManagerImpl(); dynoTabBroker = new DataRegistrationBrokerImpl(controller, dynoHandlerManager); dynoTab = new DynoTabImpl(dynoTabBroker, ecuEditor); dynoUpdateHandler.setDynoTab(dynoTab); + resetManager = new ResetManagerImpl(this); messageLabel = new JLabel(ECU_LOGGER_TITLE); calIdLabel = new JLabel(buildEcuInfoLabelText(CAL_ID_LABEL, null)); @@ -473,7 +516,7 @@ private void doWait(SerialPortRefresher refresher) { long start = currentTimeMillis(); while (!refresher.isStarted()) { checkSerialPortRefresherTimeout(start); - sleep(100); + sleep(5); } } @@ -527,7 +570,11 @@ private void loadEcuDefs() { private void loadLoggerConfig() { String loggerConfigFilePath = getSettings().getLoggerDefinitionFilePath(); - if (isNullOrEmpty(loggerConfigFilePath)) showMissingConfigDialog(); + if (isNullOrEmpty(loggerConfigFilePath)) + { + showMissingConfigDialog(); + getSettings().setLogExternalsOnly(true); + } else { try { EcuDataLoader dataLoader = new EcuDataLoaderImpl(); @@ -538,8 +585,23 @@ private void loadLoggerConfig() { loadEcuParams(ecuParams); loadEcuSwitches(dataLoader.getEcuSwitches()); dtcodes = dataLoader.getEcuCodes(); + protocolList = dataLoader.getProtocols(); + buildModuleSelectPanel(); final EcuSwitch fileLogCntrlSw = dataLoader.getFileLoggingControllerSwitch(); - if (fileLogCntrlSw != null && target.equals("ECU")) initFileLoggingController(fileLogCntrlSw); + final RadioButtonMenuItem flc = (RadioButtonMenuItem) componentList.get("fileLoggingControl"); + if (fileLogCntrlSw != null && target.equals("ECU")) { + initFileLoggingController(fileLogCntrlSw); + if (flc != null) { + flc.setEnabled(true); + flc.setSelected(getSettings().isFileLoggingControllerSwitchActive()); + } + } + else { + if (flc != null) { + flc.setSelected(false); + flc.setEnabled(false); + } + } getSettings().setLoggerConnectionProperties(dataLoader.getConnectionProperties()); if (dataLoader.getDefVersion() == null) { defVersion = "na"; @@ -549,7 +611,7 @@ private void loadLoggerConfig() { } loadResult = String.format( - "%sloaded protocol %s: %d parameters, %d switches from def version %s.", + "%sloaded protocol %s: %d parameters, %d switches from def version %s. ", loadResult, getSettings().getLoggerProtocol(), ecuParams.size(), @@ -558,7 +620,7 @@ private void loadLoggerConfig() { LOGGER.info(loadResult); } catch (ConfigurationException cfe) { reportError(cfe); - showMissingConfigDialog(); + showErrorConfigDialog(cfe); } catch (Exception e) { reportError(e); @@ -566,17 +628,35 @@ private void loadLoggerConfig() { } } + private void showErrorConfigDialog(Exception e) { + Object[] options = {"OK"}; + showOptionDialog(this, + rb.getString("LOGGERDEFERROR") + e.getMessage(), + rb.getString("LOGGERCONFIG"), + DEFAULT_OPTION, + ERROR_MESSAGE, + null, + options, + options[0]); + } + private void showMissingConfigDialog() { - Object[] options = {"Yes", "No"}; + Object[] options = {rb.getString("YES"), rb.getString("NO")}; int answer = showOptionDialog(this, - "Logger definition not configured.\nGo online to download the latest definition file?", - "Configuration", DEFAULT_OPTION, WARNING_MESSAGE, null, options, options[0]); + rb.getString("LOGGERDEFNOTCFG"), + rb.getString("LOGGERCONFIG"), + DEFAULT_OPTION, + WARNING_MESSAGE, + null, + options, + options[0]); if (answer == 0) { BrowserControl.displayURL(LOGGER_DEFS_URL); } else { showMessageDialog(this, - "The Logger definition file needs to be configured before connecting to the ECU.\nMenu: Settings > Logger Definition Location...", - "Configuration", INFORMATION_MESSAGE); + rb.getString("CFGEDFSMENU"), + rb.getString("LOGGERCONFIG"), + INFORMATION_MESSAGE); reportError("Logger definition file not found"); } } @@ -610,7 +690,9 @@ public boolean loadUserProfile(String profileFilePath) { final File profileFile = new File(path); if (profileFile.exists()) { reportMessageInTitleBar( - "Profile: " + FormatFilename.getShortName(profileFile)); + MessageFormat.format( + rb.getString("PROFILENAME"), + FormatFilename.getShortName(profileFile))); } return true; } @@ -643,21 +725,21 @@ public void handleSwitch(double switchValue) { private boolean applyUserProfile(UserProfile profile) { if (profile != null) { - final String profileProto = + final String profileProto = profile.getProtocol() == null ? "SSM" : profile.getProtocol(); if (!profileProto.equalsIgnoreCase(getSettings().getLoggerProtocol())) { - - Object[] options = {"Load", "Cancel"}; - final String message = String.format( - "This profile was created for logging protocol %s.%n" + - "Some parameters may not be selected by this profile if%n" + - "you load it. Change protocols in the Settings menu%n" + - "then reload this profile.", - profileProto); + Object[] options = {rb.getString("LOAD"), rb.getString("CANCEL")}; int answer = showOptionDialog(this, - message, - "Protocol Mismatch", DEFAULT_OPTION, WARNING_MESSAGE, null, options, options[1]); + MessageFormat.format( + rb.getString("PROFILEWRONGPROTO"), + profileProto), + rb.getString("PROTOCOLMISMATCH"), + DEFAULT_OPTION, + WARNING_MESSAGE, + null, + options, + options[1]); if (answer == 1) { final String cancelMsg = "Profile load canceled by user"; LOGGER.info(cancelMsg); @@ -778,7 +860,10 @@ private List getExternalData(List externalData externalDatas.add(new ExternalDataImpl(item, dataSource)); } } catch (Exception e) { - reportError("Error loading plugin: " + dataSource.getName() + " v" + dataSource.getVersion(), e); + reportError(MessageFormat.format( + rb.getString("LOADPLUGINERR"), + dataSource.getName(), + dataSource.getVersion()), e); } } return externalDatas; @@ -878,49 +963,111 @@ private void initDataUpdateHandlers() { } private JComponent buildTabbedPane() { - addSplitPaneTab( - "Data", - buildSplitPane( - buildParamListPane( - dataTabParamListTableModel, - dataTabSwitchListTableModel, - dataTabExternalListTableModel), - buildDataTab()), - buildUnselectAllButton(), - buildLtvButton()); - addSplitPaneTab( - "Graph", - buildSplitPane( - buildParamListPane( - graphTabParamListTableModel, - graphTabSwitchListTableModel, - graphTabExternalListTableModel), - buildGraphTab()), - buildUnselectAllButton(), - buildLtvButton()); - addSplitPaneTab( - "Dashboard", - buildSplitPane( - buildParamListPane( - dashboardTabParamListTableModel, - dashboardTabSwitchListTableModel, - dashboardTabExternalListTableModel), - buildDashboardTab()), - buildUnselectAllButton(), - buildLtvButton(), - buildToggleGaugeStyleButton()); - tabbedPane.add("MAF", mafTab.getPanel()); - tabbedPane.add("Injector", injectorTab.getPanel()); - tabbedPane.add("Dyno", dynoTab.getPanel()); + if (touchEnabled == false) + { + addSplitPaneTab( + "Data", + buildSplitPane( + buildParamListPane( + dataTabParamListTableModel, + dataTabSwitchListTableModel, + dataTabExternalListTableModel), + buildDataTab()), + buildUnselectAllButton(), + buildLtvButton()); + addSplitPaneTab( + "Graph", + buildSplitPane( + buildParamListPane( + graphTabParamListTableModel, + graphTabSwitchListTableModel, + graphTabExternalListTableModel), + buildGraphTab()), + buildUnselectAllButton(), + buildLtvButton()); + addSplitPaneTab( + "Dashboard", + buildSplitPane( + buildParamListPane( + dashboardTabParamListTableModel, + dashboardTabSwitchListTableModel, + dashboardTabExternalListTableModel), + buildDashboardTab()), + buildUnselectAllButton(), + buildLtvButton(), + buildToggleGaugeStyleButton()); + tabbedPane.add("MAF", mafTab.getPanel()); + tabbedPane.add("Injector", injectorTab.getPanel()); + tabbedPane.add("Dyno", dynoTab.getPanel()); + } + else + { + addSplitPaneTab( + "" + "Data" + "", + buildSplitPane( + buildParamListPane( + dataTabParamListTableModel, + dataTabSwitchListTableModel, + dataTabExternalListTableModel), + buildDataTab()), + buildUnselectAllButton(), + buildLtvButton()); + addSplitPaneTab( + "" + "Graph" + "", + buildSplitPane( + buildParamListPane( + graphTabParamListTableModel, + graphTabSwitchListTableModel, + graphTabExternalListTableModel), + buildGraphTab()), + buildUnselectAllButton(), + buildLtvButton()); + addSplitPaneTab( + "" + "Dashboard" + "", + buildSplitPane( + buildParamListPane( + dashboardTabParamListTableModel, + dashboardTabSwitchListTableModel, + dashboardTabExternalListTableModel), + buildDashboardTab()), + buildUnselectAllButton(), + buildLtvButton(), + buildToggleGaugeStyleButton()); + tabbedPane.add("" + "MAF"+ "", mafTab.getPanel()); + tabbedPane.add("" + "Injector"+ "", injectorTab.getPanel()); + tabbedPane.add("" + "Dyno" + "", dynoTab.getPanel()); + } + + //Check for definitions only when we open the dyno tab + tabbedPane.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + if(tabbedPane.getSelectedComponent() == dynoTab.getPanel()) + { + ((DynoTabImpl)dynoTab).getDynoControlPanel().checkDynoDefs(); + } + } + }); + return tabbedPane; } private JButton buildToggleGaugeStyleButton() { final JButton button = new JButton(); SetFont.plain(button); - VerticalTextIcon textIcon = new VerticalTextIcon(button, "Gauge Style", ROTATE_LEFT); + VerticalTextIcon textIcon = new VerticalTextIcon( + button, + rb.getString("BTNGAUGESTYLE"), + ROTATE_LEFT); button.setIcon(textIcon); - button.setPreferredSize(new Dimension(25, 80)); + if (touchEnabled == false) + { + button.setPreferredSize(new Dimension(25, 80)); + } + else + { + button.setPreferredSize(new Dimension(56, 80)); + } button.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(getKeyStroke("F12"), "toggleGaugeStyle"); button.getActionMap().put("toggleGaugeStyle", new AbstractAction() { private static final long serialVersionUID = 6913964758354638587L; @@ -957,10 +1104,20 @@ private JButton buildUnselectAllButton() { final JButton button = new JButton(); SetFont.plain(button); button.setBackground(YELLOW); - VerticalTextIcon textIcon = new VerticalTextIcon(button, "Un-select ALL", ROTATE_LEFT); + VerticalTextIcon textIcon = new VerticalTextIcon( + button, + rb.getString("BTNUNSELECTALL"), + ROTATE_LEFT); button.setToolTipText(UNSELECT_ALL_TT_TEXT); button.setIcon(textIcon); - button.setPreferredSize(new Dimension(25, 85)); + if (touchEnabled == false) + { + button.setPreferredSize(new Dimension(25, 85)); + } + else + { + button.setPreferredSize(new Dimension(56, 85)); + } button.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(getKeyStroke("F9"), "un-selectAll"); button.getActionMap().put("un-selectAll", new AbstractAction() { private static final long serialVersionUID = 4913964758354638588L; @@ -1001,9 +1158,19 @@ private JButton buildLtvButton() { final JButton button = new JButton(); SetFont.plain(button); VerticalTextIcon textIcon = - new VerticalTextIcon(button, "LTV (F6)", ROTATE_LEFT); + new VerticalTextIcon( + button, + "LTV (F6)", + ROTATE_LEFT); button.setIcon(textIcon); - button.setPreferredSize(new Dimension(25, 60)); + if (touchEnabled == false) + { + button.setPreferredSize(new Dimension(25, 60)); + } + else + { + button.setPreferredSize(new Dimension(56, 60)); + } button.addActionListener(new LearningTableValuesAction(this)); return button; } @@ -1013,9 +1180,19 @@ private void addSplitPaneTab(String name, final JSplitPane splitPane, JComponent SetFont.plain(toggleListButton); toggleListButton.setToolTipText(TOGGLE_LIST_TT_TEXT); toggleListButton.setSelected(true); - VerticalTextIcon textIcon = new VerticalTextIcon(toggleListButton, "Parameter List", ROTATE_LEFT); + VerticalTextIcon textIcon = new VerticalTextIcon( + toggleListButton, + rb.getString("BTNPARAMLIST"), + ROTATE_LEFT); toggleListButton.setIcon(textIcon); - toggleListButton.setPreferredSize(new Dimension(25, 95)); + if (touchEnabled == false) + { + toggleListButton.setPreferredSize(new Dimension(25, 95)); + } + else + { + toggleListButton.setPreferredSize(new Dimension(56, 95)); + } toggleListButton.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(getKeyStroke("F11"), "toggleHideParams"); toggleListButton.getActionMap().put("toggleHideParams", new AbstractAction() { private static final long serialVersionUID = -276854997788647306L; @@ -1050,7 +1227,14 @@ public void actionPerformed(ActionEvent e) { } JPanel tabControlPanel = new JPanel(new BetterFlowLayout(FlowLayout.CENTER, 1, 1)); - tabControlPanel.setPreferredSize(new Dimension(25, 25)); + if (touchEnabled == false) + { + tabControlPanel.setPreferredSize(new Dimension(25, 25)); + } + else + { + tabControlPanel.setPreferredSize(new Dimension(56, 25)); + } tabControlPanel.add(toggleListButton); for (JComponent control : extraControls) tabControlPanel.add(control); @@ -1066,16 +1250,35 @@ private JComponent buildParamListPane(ParameterListTableModel paramListTableMode JScrollPane externalList = new JScrollPane(buildParamListTable(externalListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); JScrollPane switchList = new JScrollPane(buildParamListTable(switchListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); JTabbedPane tabs = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT); - tabs.addTab(HEADING_PARAMETERS, paramList); - tabs.addTab(HEADING_SWITCHES, switchList); - tabs.addTab("External Sensors", externalList); + + if (touchEnabled == false) + { + tabs.addTab(HEADING_PARAMETERS, paramList); + tabs.addTab(HEADING_SWITCHES, switchList); + tabs.addTab("External Sensors", externalList); + } + else + { + tabs.addTab("" + HEADING_PARAMETERS + "", paramList); + tabs.addTab("" + HEADING_SWITCHES + "", switchList); + tabs.addTab("External Sensors", externalList); + } return tabs; } private JTable buildParamListTable(ParameterListTableModel tableModel) { JTable paramListTable = new ParameterListTable(tableModel); - changeColumnWidth(paramListTable, 0, 20, 55, 55); - changeColumnWidth(paramListTable, 2, 50, 250, 130); + + if( touchEnabled == false) + { + changeColumnWidth(paramListTable, 0, 20, 55, 55); + changeColumnWidth(paramListTable, 2, 50, 250, 130); + } + else + { + changeColumnWidth(paramListTable, 0, 20, 75, 75); + changeColumnWidth(paramListTable, 2, 50, 75, 75); + } return paramListTable; } @@ -1139,7 +1342,15 @@ private String buildEcuInfoLabelText(String label, String value) { private JSplitPane buildSplitPane(JComponent leftComponent, JComponent rightComponent) { splitPane = new JSplitPane(HORIZONTAL_SPLIT, leftComponent, rightComponent); splitPane.setDividerSize(5); - splitPane.setDividerLocation((int) getSettings().getDividerLocation()); + + if (touchEnabled == false) + { + splitPane.setDividerLocation((int) getSettings().getDividerLocation()); + } + else + { + splitPane.setDividerLocation((int) getSettings().getDividerLocation()+200); + } splitPane.addPropertyChangeListener(this); return splitPane; } @@ -1150,6 +1361,12 @@ private JMenuBar buildMenubar() { private JPanel buildControlToolbar() { JPanel controlPanel = new JPanel(new BorderLayout()); + + if (touchEnabled == true) + { + portsComboBox.setPreferredSize(new Dimension(100,50)); + } + controlPanel.add(buildPortsComboBox(), WEST); //TODO: Finish log playback stuff... // controlPanel.add(buildPlaybackControls(), CENTER); @@ -1179,8 +1396,12 @@ public void run() { } private Component buildFileNameExtention() { - JLabel fileNameLabel = new JLabel("Logfile Text"); + JLabel fileNameLabel = new JLabel(rb.getString("LOGFILETEXT")); final JTextField fileNameExtention = new JTextField("",8); + if (touchEnabled == true) + { + fileNameExtention.setPreferredSize(new Dimension(200, 50)); + } fileNameExtention.setToolTipText(FILE_NAME_EXTENTION); fileNameExtention.addFocusListener(new FocusListener() { @Override @@ -1194,7 +1415,9 @@ public void focusLost(FocusEvent arg0) { }); JPopupMenu fileNamePopup = new JPopupMenu(); - JMenuItem ecuIdItem = new JMenuItem("Use Current " + target + " ID"); + JMenuItem ecuIdItem = new JMenuItem(MessageFormat.format( + rb.getString("TARGETID"), target)); + componentList.put("ecuIdItem", ecuIdItem); ecuIdItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -1205,8 +1428,8 @@ public void actionPerformed(ActionEvent e) { fileNamePopup.add(ecuIdItem); for (final String item : LOG_FILE_TEXT) { ecuIdItem = new JMenuItem(item); - if (item.endsWith("PT")) ecuIdItem.setToolTipText("Part Throttle"); - if (item.endsWith("WOT")) ecuIdItem.setToolTipText("Wide Open Throttle"); + if (item.endsWith("PT")) ecuIdItem.setToolTipText(rb.getString("PT")); + if (item.endsWith("WOT")) ecuIdItem.setToolTipText(rb.getString("WOT")); ecuIdItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -1216,7 +1439,7 @@ public void actionPerformed(ActionEvent e) { }); fileNamePopup.add(ecuIdItem); } - ecuIdItem = new JMenuItem("Clear Logfile Text"); + ecuIdItem = new JMenuItem(rb.getString("CLT")); ecuIdItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -1238,6 +1461,10 @@ private final Component buildLogToFileButton() { LOG_TO_FILE_START, new ImageIcon(getClass().getResource(LOG_TO_FILE_ICON))); SetFont.plain(logToFileButton); + if (touchEnabled == true) + { + logToFileButton.setPreferredSize(new Dimension(200, 50)); + } logToFileButton.setToolTipText(LOG_TO_FILE_TT_TEXT); logToFileButton.setBackground(GREEN); logToFileButton.setOpaque(true); @@ -1280,60 +1507,24 @@ public void actionPerformed(ActionEvent actionEvent) { } }); JPanel comboBoxPanel = new JPanel(new FlowLayout()); - comboBoxPanel.add(new JLabel("COM Port:")); + comboBoxPanel.add(new JLabel(rb.getString("COMPORT"))); comboBoxPanel.add(portsComboBox); - final JCheckBox ecuCheckBox = new JCheckBox("ECU"); - final JCheckBox tcuCheckBox = new JCheckBox("TCU"); - ecuCheckBox.setToolTipText(ECU_TEXT); - tcuCheckBox.setToolTipText(TCU_TEXT); - ecuCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent actionEvent) { - stopLogging(); - tcuCheckBox.setSelected(false); - if (ecuCheckBox.isSelected()) { - getSettings().setLogExternalsOnly(false); - setTargetEcu(); - } - else { - getSettings().setLogExternalsOnly(true); - } - startLogging(); - } - }); - tcuCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent actionEvent) { - stopLogging(); - ecuCheckBox.setSelected(false); - if (tcuCheckBox.isSelected()) { - getSettings().setLogExternalsOnly(false); - setTargetTcu(); - } - else { - getSettings().setLogExternalsOnly(true); - } - startLogging(); - } - }); - if (getSettings().getDestinationId() == 0x10) { - ecuCheckBox.setSelected(true); - tcuCheckBox.setSelected(false); - setTargetEcu(); - } - else { - tcuCheckBox.setSelected(true); - ecuCheckBox.setSelected(false); - setTargetTcu(); - } - - comboBoxPanel.add(ecuCheckBox); - comboBoxPanel.add(tcuCheckBox); + comboBoxPanel.add(moduleSelectPanel); JButton reconnectButton = new JButton(new ImageIcon( getClass().getResource("/graphics/logger_restart.png"))); - reconnectButton.setPreferredSize(new Dimension(25, 25)); - reconnectButton.setToolTipText("Reconnect to " + target); + componentList.put("reconnectButton", reconnectButton); + if (touchEnabled == false) + { + reconnectButton.setPreferredSize(new Dimension(25, 25)); + } + else + { + reconnectButton.setPreferredSize(new Dimension(75, 50)); + } + reconnectButton.setToolTipText(MessageFormat.format( + rb.getString("TTTEXTRECON"), + target)); reconnectButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -1346,8 +1537,19 @@ public void actionPerformed(ActionEvent actionEvent) { }); comboBoxPanel.add(reconnectButton); JButton disconnectButton = new JButton(new ImageIcon( getClass().getResource("/graphics/logger_stop.png"))); - disconnectButton.setPreferredSize(new Dimension(25, 25)); - disconnectButton.setToolTipText("Disconnect from " + target); + componentList.put("disconnectButton", disconnectButton); + if (touchEnabled == false) + { + disconnectButton.setPreferredSize(new Dimension(25, 25)); + } + else + { + disconnectButton.setPreferredSize(new Dimension(75, 50)); + } + + disconnectButton.setToolTipText(MessageFormat.format( + rb.getString("TTTEXTDISCON"), + target)); disconnectButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -1366,24 +1568,147 @@ public void actionPerformed(ActionEvent actionEvent) { return comboBoxPanel; } - private void setTargetEcu() { - getSettings().setDestinationId(ECU_ID); - target = "ECU"; + private void buildModuleSelectPanel() { + moduleSelectPanel.removeAll(); + final CustomButtonGroup moduleGroup = new CustomButtonGroup(); + Collection moduleList = getModuleList(); + if(moduleList.size() == 0) { + getSettings().setLogExternalsOnly(true); + } + else { + for (Module module : moduleList) { + final JCheckBox cb = new JCheckBox(module.getName().toUpperCase()); + if (touchEnabled == true) + { + cb.setPreferredSize(new Dimension(75, 50)); + } + cb.setToolTipText(MessageFormat.format( + rb.getString("TTTEXTEXTERNALS"), + module.getDescription())); + if (getSettings().getTargetModule().equalsIgnoreCase(module.getName())) { + cb.setSelected(true); + setTarget(module.getName()); + } + + cb.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + stopLogging(); + final JCheckBox source = (JCheckBox) actionEvent.getSource(); + if (source.isSelected()) { + getSettings().setLogExternalsOnly(false); + setTarget(source.getText()); + } + else { + getSettings().setLogExternalsOnly(true); + } + startLogging(); + } + }); + + moduleGroup.add(cb); + moduleSelectPanel.add(cb); + moduleSelectPanel.validate(); + } + } + } + + private void setTarget(String name) { + target = name.toUpperCase(); + getSettings().setTargetModule(target); + for (Module module: getModuleList()) { + if (module.getName().equalsIgnoreCase(name)) { + getSettings().setDestinationTarget(module); + final RadioButtonMenuItem fp = + (RadioButtonMenuItem) componentList.get("fastPoll"); + if (fp != null) { + fp.setEnabled(module.getFastPoll()); + if(module.getFastPoll()) { + fp.setSelected(getSettings().isFastPoll()); + } + else { + fp.setSelected(false); + getSettings().setFastPoll(false); + } + } + } + } + + final String ecuId = ecuIdLabel.getText().split(": ")[1]; + ecuIdLabel.setText(buildEcuInfoLabelText(target + " ID", ecuId)); + + for (String key : componentList.keySet()) { + if (key.equals("ecuIdItem")) { + final JMenuItem menuItem = (JMenuItem) componentList.get(key); + menuItem.setText(replaceString(menuItem.getText(), target)); + } + if (key.equals("resetMenu")) { + final JMenuItem menuItem = (JMenuItem) componentList.get(key); + menuItem.setText(MessageFormat.format( + rb.getString("RESET"), + getSettings().getDestinationTarget().getDescription(), + getSettings().getDestinationTarget().getName().toUpperCase())); + } + if (key.equals("reconnectButton") || + key.equals("disconnectButton")) { + final JButton button = (JButton) componentList.get(key); + button.setToolTipText(replaceString(button.getToolTipText(), target)); + } + } + } + + private String replaceString(String inString, String newString) { + return inString.replaceAll("[A-Z]{3}", newString); } - private void setTargetTcu() { - getSettings().setDestinationId(TCU_ID); - target = "TCU"; + + private Transport getTransportById(String id) { + Transport loggerTransport = null; + Map> transportMap = getTransportMap(); + + for (Transport transport : transportMap.keySet()) { + if (transport.getId().equalsIgnoreCase(id)) + loggerTransport = transport; + } + + return loggerTransport; } - public String getTarget() { - return target; + public void updateElmSelectable() { + boolean value = getSettings().isObdProtocol(); + RadioButtonMenuItem c = (RadioButtonMenuItem)getComponentList().get("elmEnabled"); + c.setEnabled(value); + + if(!value) { + c.setSelected(false); + getSettings().setElm327Enabled(false); + } + } + + private Map> getTransportMap() { + return protocolList.get(getSettings().getLoggerProtocol()); + } + + private Collection getModuleList() { + return getTransportMap().get(getTransportById(getSettings().getTransportProtocol())); } public String getDefVersion() { return defVersion; } + public String getTarget() { + return target; + } + + public Map>> getProtocolList() { + return protocolList; + } + + public Map getComponentList() { + return componentList; + } + public void restartLogging() { stopLogging(); startLogging(); @@ -1398,7 +1723,16 @@ private StatusIndicator buildStatusIndicator() { private JComponent buildDataTab() { JPanel panel = new JPanel(new BorderLayout()); - JButton resetButton = new JButton("Reset Data"); + JButton resetButton; + + if (touchEnabled == false) + { + resetButton = new JButton(rb.getString("RESETDATA")); + } + else + { + resetButton = new JButton("Reset Data"); + } resetButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -1414,7 +1748,16 @@ public void actionPerformed(ActionEvent actionEvent) { private JComponent buildGraphTab() { JPanel panel = new JPanel(new BorderLayout()); - JButton resetButton = new JButton("Reset Data"); + JButton resetButton; + + if (touchEnabled == false) + { + resetButton = new JButton(rb.getString("RESETDATA")); + } + else + { + resetButton = new JButton("Reset Data"); + } resetButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -1430,7 +1773,16 @@ public void actionPerformed(ActionEvent actionEvent) { private JComponent buildDashboardTab() { JPanel panel = new JPanel(new BorderLayout()); - JButton resetButton = new JButton("Reset Data"); + JButton resetButton; + + if (touchEnabled == false) + { + resetButton = new JButton(rb.getString("RESETDATA")); + } + else + { + resetButton = new JButton("Reset Data"); + } resetButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -1505,8 +1857,8 @@ private void stopPlugins() { } } - public boolean resetEcu() { - return resetManager.resetEcu(); + public boolean resetEcu(int resetCode) { + return resetManager.resetEcu(resetCode); } public final boolean getDtcodesEmpty() { @@ -1534,7 +1886,7 @@ public final int readEcuCodes() { public final int ecuGlobalAdjustment() { final GlobalAdjustManager globalAdjustManager = - new GlobalAdjustManagerImpl( + new SSMGlobalAdjustManager( this, dataTabParamListTableModel); return globalAdjustManager.ecuGlobalAdjustments(); @@ -1545,10 +1897,12 @@ public final void readLearningTables() { getSettings().getLoggerEcuDefinitionMap(), ecuInit.getEcuId()); final LearningTableValues learningTablesManager = - new LearningTableValuesImpl( - this, - dataTabParamListTableModel, - ecuDef); + LearningTableValuesFactory.getManager( + getSettings().getLoggerProtocol()); + learningTablesManager.init( + this, + dataTabParamListTableModel, + ecuDef); learningTablesManager.execute(); } @@ -1573,10 +1927,19 @@ public void handleExit() { saveSettings(); backupCurrentProfile(); LOGGER.info("Logger shutdown successful"); + + if(ECUEditorManager.getECUEditorWithoutCreation() == null) { + System.exit(0); + } + else { + instance = null; + } } } private void saveSettings() { + dynoTab.saveSettings(); + getSettings().setLoggerSelectedGaugeIndex(dashboardUpdateHandler.styleIndex); getSettings().setLoggerPortDefault((String) portsComboBox.getSelectedItem()); getSettings().setLoggerWindowMaximized(getExtendedState() == MAXIMIZED_BOTH); getSettings().setLoggerWindowSize(getSize()); @@ -1593,7 +1956,8 @@ private void saveSettings() { getSettings().setLoggerPluginPorts(getPluginPorts(externalDataSources)); try { SettingsManager.save(getSettings()); - LOGGER.debug("Logger settings saved"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Logger settings saved"); } catch (Exception e) { LOGGER.warn("Error saving logger settings:", e); } @@ -1602,7 +1966,8 @@ private void saveSettings() { private void backupCurrentProfile() { try { saveProfileToFile(getCurrentProfile(), new File(HOME + BACKUP_PROFILE)); - LOGGER.debug("Backup profile saved"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Backup profile saved"); } catch (Exception e) { LOGGER.warn("Error backing up profile", e); } @@ -1662,7 +2027,8 @@ public void reportError(final String error) { invokeLater(new Runnable() { @Override public void run() { - messageLabel.setText("Error: " + error); + messageLabel.setText(MessageFormat.format( + rb.getString("ERROR"), error)); messageLabel.setForeground(RED); } }); @@ -1695,10 +2061,27 @@ public void setTitle(String title) { } } + public static boolean isTouchEnabled() + { + if( touchEnabled == true) + { + return true; + } + return false; + } + public void setRefreshMode(boolean refreshMode) { getSettings().setRefreshMode(refreshMode); refresher.setRefreshMode(refreshMode); } + + public void setAutoConnect(boolean connect) { + getSettings().setAutoConnectOnStartup(connect); + } + + public void setElmEnabled(Boolean value) { + getSettings().setElm327Enabled(value); + } private JProgressBar startbar() { startStatus = new JWindow(); @@ -1724,25 +2107,32 @@ private JProgressBar startbar() { //********************************************************************** - - public static void startLogger(int defaultCloseOperation, ECUEditor ecuEditor) { - EcuLogger ecuLogger = new EcuLogger(ecuEditor); - createAndShowGui(defaultCloseOperation, ecuLogger, false); - } - - public static void startLogger(int defaultCloseOperation, String... args) { - EcuLogger ecuLogger = new EcuLogger(); + public static void startLogger(int defaultCloseOperation, ECUEditor ecuEditor, String[] args) { + touchEnabled = setTouchEnabled(args); boolean fullscreen = containsFullScreenArg(args); + EcuLogger ecuLogger = getEcuLogger(ecuEditor); createAndShowGui(defaultCloseOperation, ecuLogger, fullscreen); + if (ecuLogger.getSettings().getAutoConnectOnStartup() && !ecuLogger.isLogging()) ecuLogger.startLogging(); } private static boolean containsFullScreenArg(String... args) { + if(args == null) return false; + for (String arg : args) { if (LOGGER_FULLSCREEN_ARG.equalsIgnoreCase(arg)) return true; } return false; } + private static boolean setTouchEnabled(String... args) { + if(args == null) return false; + + for (String arg : args) { + if (LOGGER_TOUCH_ARG.equalsIgnoreCase(arg)) return true; + } + return false; + } + private static void createAndShowGui(final int defaultCloseOperation, final EcuLogger ecuLogger, final boolean fullscreen) { invokeLater(new Runnable() { @Override @@ -1783,4 +2173,6 @@ private static void doCreateAndShowGui(int defaultCloseOperation, EcuLogger ecuL ecuLogger.setVisible(true); } } + + } diff --git a/src/main/java/com/romraider/logger/ecu/EcuLoggerExec.java b/src/main/java/com/romraider/logger/ecu/EcuLoggerExec.java index 5ff02764d..8282e269e 100644 --- a/src/main/java/com/romraider/logger/ecu/EcuLoggerExec.java +++ b/src/main/java/com/romraider/logger/ecu/EcuLoggerExec.java @@ -41,7 +41,7 @@ public static void main(String... args) { LookAndFeelManager.initLookAndFeel(); // start logger - EcuLogger.startLogger(EXIT_ON_CLOSE, args); + EcuLogger.startLogger(EXIT_ON_CLOSE, null, args); } } diff --git a/src/main/java/com/romraider/logger/ecu/comms/controller/LoggerControllerImpl.java b/src/main/java/com/romraider/logger/ecu/comms/controller/LoggerControllerImpl.java index 1ac78986a..640812e37 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/controller/LoggerControllerImpl.java +++ b/src/main/java/com/romraider/logger/ecu/comms/controller/LoggerControllerImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,21 +52,24 @@ public synchronized void addListener(StatusChangeListener listener) { @Override public void setFileLoggerSwitchMonitor(FileLoggerControllerSwitchMonitor monitor) { checkNotNull(monitor); - LOGGER.debug("Setting file logger switch monitor: [" + monitor.getEcuSwitch().getId() + "] " + monitor.getEcuSwitch().getName()); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Setting file logger switch monitor: [" + monitor.getEcuSwitch().getId() + "] " + monitor.getEcuSwitch().getName()); queryManager.setFileLoggerSwitchMonitor(monitor); } @Override public void addLogger(String callerId, LoggerData loggerData) { checkNotNull(loggerData); - LOGGER.debug("Adding logger: [" + loggerData.getId() + "] " + loggerData.getName()); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Adding logger: [" + loggerData.getId() + "] " + loggerData.getName()); queryManager.addQuery(callerId, loggerData); } @Override public void removeLogger(String callerId, LoggerData loggerData) { checkNotNull(loggerData, "ecuParam"); - LOGGER.debug("Removing logger: [" + loggerData.getId() + "] " + loggerData.getName()); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Removing logger: [" + loggerData.getId() + "] " + loggerData.getName()); queryManager.removeQuery(callerId, loggerData); } @@ -85,12 +88,14 @@ public synchronized void stop() { if (isStarted() && queryManager.getThread().isAlive()) { queryManager.stop(); try { - LOGGER.debug(String.format( + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( "%s - Stopping QueryManager: %s", this.getClass().getSimpleName(), queryManager.getThread().getName())); queryManager.getThread().interrupt(); - LOGGER.debug(String.format( + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( "%s - Waiting for QueryManager %s to terminate", this.getClass().getSimpleName(), queryManager.getThread().getName())); @@ -100,7 +105,8 @@ public synchronized void stop() { e.printStackTrace(); } finally { - LOGGER.debug(String.format( + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( "%s - QueryManager %s state: %s", this.getClass().getSimpleName(), queryManager.getThread().getName(), diff --git a/src/main/java/com/romraider/logger/ecu/comms/globaladjust/GlobalAdjustManagerImpl.java b/src/main/java/com/romraider/logger/ecu/comms/globaladjust/GlobalAdjustManagerImpl.java deleted file mode 100644 index c09c69c15..000000000 --- a/src/main/java/com/romraider/logger/ecu/comms/globaladjust/GlobalAdjustManagerImpl.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.logger.ecu.comms.globaladjust; - -import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection; -import static com.romraider.util.ParamChecker.checkNotNull; -import static com.romraider.util.ParamChecker.isNullOrEmpty; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - -import com.romraider.Settings; -import com.romraider.logger.ecu.EcuLogger; -import com.romraider.logger.ecu.comms.io.connection.LoggerConnection; -import com.romraider.logger.ecu.comms.manager.PollingStateImpl; -import com.romraider.logger.ecu.comms.query.EcuQuery; -import com.romraider.logger.ecu.comms.query.EcuQueryImpl; -import com.romraider.logger.ecu.definition.EcuData; -import com.romraider.logger.ecu.ui.MessageListener; -import com.romraider.logger.ecu.ui.paramlist.ParameterListTableModel; -import com.romraider.logger.ecu.ui.paramlist.ParameterRow; -import com.romraider.logger.ecu.ui.swing.tools.GlobalAdjustmentsPanel; - -public final class GlobalAdjustManagerImpl implements GlobalAdjustManager { - private static final Logger LOGGER = Logger.getLogger(GlobalAdjustManagerImpl.class); - private static final String ID_P239 = "P239"; - private static final String ID_P240 = "P240"; - private static final String ID_P241 = "P241"; - private final EcuLogger logger; - private final Settings settings; - private final MessageListener messageListener; - private final ParameterListTableModel parmeterList; - - public GlobalAdjustManagerImpl( - EcuLogger logger, - ParameterListTableModel dataTabParamListTableModel) { - - checkNotNull(logger); - this.logger = logger; - this.settings = logger.getSettings(); - this.messageListener = logger; - this.parmeterList = dataTabParamListTableModel; - } - - @Override - public final int ecuGlobalAdjustments() { - try { - LoggerConnection connection = getConnection( - settings.getLoggerProtocol(), settings.getLoggerPort(), - settings.getLoggerConnectionProperties()); - try { - messageListener.reportMessage("Retrieving current ECU global values..."); - final Collection queries = buildGlobalAdjustQueries(); - connection.sendAddressReads( - queries, - (byte) 0x10, - new PollingStateImpl()); - messageListener.reportMessage("Current ECU global values retrievied."); - final GlobalAdjustmentsPanel gap = - new GlobalAdjustmentsPanel(logger, queries); - gap.showGlobalAdjustPanel(); - final int[] results = gap.getResults(); - if (results == null) { - return -1; - } - else { - final Map writes = new HashMap(); - for (EcuQuery query : queries) { - if (query.getLoggerData().getId().equals(ID_P239)) { - final byte[] timing = - new byte[]{(byte) (results[0] & 0xff)}; - writes.put(query, timing); - } - if (query.getLoggerData().getId().equals(ID_P240)) { - final byte[] rpmOff = convertRpm(results[1]); - writes.put(query, rpmOff); - } - if (query.getLoggerData().getId().equals(ID_P241)) { - final byte[] rpmOn = convertRpm(results[2]); - writes.put(query, rpmOn); - } - } - connection.sendAddressWrites(writes, (byte) 0x10); - } - return 1; - } finally { - connection.close(); - } - } catch (Exception e) { - messageListener.reportMessage( - "Unable to retrieve current ECU timing value - check correct " + - "serial port \nhas been selected, cable is connected and ignition " + - "is on."); - LOGGER.error("Error retrieving current ECU global timing value", e); - return 0; - } - } - - private final Collection buildGlobalAdjustQueries() { - final Collection query = new ArrayList(); - final List parameterRows = parmeterList.getParameterRows(); - if (!isNullOrEmpty(parameterRows)) { - for (ParameterRow parameterRow : parameterRows) { - final String id = parameterRow.getLoggerData().getId(); - if (id.equals(ID_P239) || - id.equals(ID_P240) || - id.equals(ID_P241)) { - - query.add(buildEcuQuery(parameterRow)); - } - } - } - return query; - } - - private final EcuQuery buildEcuQuery(ParameterRow parameterRow) { - final EcuQuery ecuQuery = - new EcuQueryImpl((EcuData) parameterRow.getLoggerData()); - return ecuQuery; - } - - private final byte[] convertRpm(int result) { - final int rpmConverted = (result + 3200) / 25; - final byte[] rpmBytes = new byte[]{(byte) (rpmConverted & 0xff)}; - return rpmBytes; - } -} diff --git a/src/main/java/com/romraider/logger/ecu/comms/globaladjust/SSMGlobalAdjustManager.java b/src/main/java/com/romraider/logger/ecu/comms/globaladjust/SSMGlobalAdjustManager.java new file mode 100644 index 000000000..4349faf2e --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/globaladjust/SSMGlobalAdjustManager.java @@ -0,0 +1,151 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.globaladjust; + +import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection; +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.isNullOrEmpty; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; + +import org.apache.log4j.Logger; + +import com.romraider.Settings; +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.comms.io.connection.LoggerConnection; +import com.romraider.logger.ecu.comms.manager.PollingStateImpl; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryImpl; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.ui.MessageListener; +import com.romraider.logger.ecu.ui.paramlist.ParameterListTableModel; +import com.romraider.logger.ecu.ui.paramlist.ParameterRow; +import com.romraider.logger.ecu.ui.swing.tools.GlobalAdjustmentsPanel; +import com.romraider.util.ResourceUtil; + +public final class SSMGlobalAdjustManager implements GlobalAdjustManager { + private static final Logger LOGGER = Logger.getLogger(SSMGlobalAdjustManager.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + SSMGlobalAdjustManager.class.getName()); + private static final String ID_P239 = "P239"; + private static final String ID_P240 = "P240"; + private static final String ID_P241 = "P241"; + private final EcuLogger logger; + private final Settings settings; + private final MessageListener messageListener; + private final ParameterListTableModel parmeterList; + + public SSMGlobalAdjustManager( + EcuLogger logger, + ParameterListTableModel dataTabParamListTableModel) { + + checkNotNull(logger); + this.logger = logger; + this.settings = logger.getSettings(); + this.messageListener = logger; + this.parmeterList = dataTabParamListTableModel; + } + + @Override + public final int ecuGlobalAdjustments() { + try { + LoggerConnection connection = getConnection( + settings.getLoggerProtocol(), settings.getLoggerPort(), + settings.getLoggerConnectionProperties()); + try { + messageListener.reportMessage(rb.getString("GLOBALVALUES")); + final Collection queries = buildGlobalAdjustQueries(); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + messageListener.reportMessage(rb.getString("GLOBALDONE")); + final GlobalAdjustmentsPanel gap = + new GlobalAdjustmentsPanel(logger, queries); + gap.showGlobalAdjustPanel(); + final int[] results = gap.getResults(); + if (results == null) { + return -1; + } + else { + final Map writes = new HashMap(); + for (EcuQuery query : queries) { + if (query.getLoggerData().getId().equals(ID_P239)) { + final byte[] timing = + new byte[]{(byte) (results[0] & 0xff)}; + writes.put(query, timing); + } + if (query.getLoggerData().getId().equals(ID_P240)) { + final byte[] rpmOff = convertRpm(results[1]); + writes.put(query, rpmOff); + } + if (query.getLoggerData().getId().equals(ID_P241)) { + final byte[] rpmOn = convertRpm(results[2]); + writes.put(query, rpmOn); + } + } + connection.sendAddressWrites(writes, settings.getDestinationTarget()); + } + return 1; + } finally { + connection.close(); + } + } catch (Exception e) { + messageListener.reportMessage( + rb.getString("NOCONNECTION")); + LOGGER.error("Error retrieving current ECU global timing value", e); + return 0; + } + } + + private final Collection buildGlobalAdjustQueries() { + final Collection query = new ArrayList(); + final List parameterRows = parmeterList.getParameterRows(); + if (!isNullOrEmpty(parameterRows)) { + for (ParameterRow parameterRow : parameterRows) { + final String id = parameterRow.getLoggerData().getId(); + if (id.equals(ID_P239) || + id.equals(ID_P240) || + id.equals(ID_P241)) { + + query.add(buildEcuQuery(parameterRow)); + } + } + } + return query; + } + + private final EcuQuery buildEcuQuery(ParameterRow parameterRow) { + final EcuQuery ecuQuery = + new EcuQueryImpl((EcuData) parameterRow.getLoggerData()); + return ecuQuery; + } + + private final byte[] convertRpm(int result) { + final int rpmConverted = (result + 3200) / 25; + final byte[] rpmBytes = new byte[]{(byte) (rpmConverted & 0xff)}; + return rpmBytes; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/connection/DS2LoggerConnection.java b/src/main/java/com/romraider/logger/ecu/comms/io/connection/DS2LoggerConnection.java new file mode 100644 index 000000000..216e82df0 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/io/connection/DS2LoggerConnection.java @@ -0,0 +1,318 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2024 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.io.connection; + +import static com.romraider.util.HexUtil.asHex; +import static com.romraider.util.ParamChecker.checkNotNull; +import static org.apache.log4j.Logger.getLogger; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.ResourceBundle; + +import org.apache.log4j.Logger; + +import com.romraider.Settings; +import com.romraider.io.connection.ConnectionManager; +import com.romraider.io.protocol.ProtocolFactory; +import com.romraider.logger.ecu.comms.io.protocol.LoggerProtocolDS2; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.manager.PollingStateImpl; +import com.romraider.logger.ecu.comms.query.EcuInitCallback; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryRangeTest; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.exception.SerialCommunicationException; +import com.romraider.util.ResourceUtil; +import com.romraider.util.SettingsManager; + +public final class DS2LoggerConnection implements LoggerConnection { + private static final Logger LOGGER = getLogger(DS2LoggerConnection.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DS2LoggerConnection.class.getName()); + private final LoggerProtocolDS2 protocol; + private final ConnectionManager manager; + private final Settings settings = SettingsManager.getSettings(); + private int queryCount; + + public DS2LoggerConnection(ConnectionManager manager) { + checkNotNull(manager, "manager"); + this.manager = manager; + + this.protocol = (LoggerProtocolDS2) ProtocolFactory.getProtocol( + settings.getLoggerProtocol(), + settings.getTransportProtocol()); + } + + @Override + public void open(Module module) { + } + + @Override + public void ecuReset(Module module, int resetCode) { + byte[] request = protocol.constructEcuResetRequest(module, resetCode); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Reset Request ---> " + asHex(request)); + byte[] response = manager.send(request); + byte[] processedResponse = protocol.preprocessResponse(request, response, new PollingStateImpl()); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Reset Response <--- " + asHex(processedResponse)); + protocol.processEcuResetResponse(processedResponse); + } + + @Override + public void ecuInit(EcuInitCallback callback, Module module) { + byte[] request = protocol.constructEcuInitRequest(module); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Init Request ---> " + asHex(request)); + byte[] response = manager.send(request); + if (LOGGER.isTraceEnabled()) + LOGGER.trace(module + " Init Raw Response <--- " + asHex(response)); + byte[] processedResponse = protocol.preprocessResponse(request, response, new PollingStateImpl()); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Init Response <--- " + asHex(processedResponse)); + protocol.processEcuInitResponse(callback, processedResponse); + } + + @Override + public final void sendAddressReads( + Collection queries, + Module module, + PollingState pollState) { + + // Group the queries into common command groups + final Map> groupList = getGroupList(queries); + + // for each group populate the queries with results + for (String group : groupList.keySet().toArray(new String[0])) { + + final Collection querySet = groupList.get(group); + byte[] request = new byte[0]; + byte[] response = new byte[0]; + final String groupTest = group.toLowerCase(); + + // read from procedure [02 XX XX XX PN] PN - Procedure Number<28 (0x1C) + if (groupTest.startsWith("0x0b0x02")) { + for (EcuQuery query : querySet) { + final Collection queryList = new ArrayList(); + queryList.add(query); + request = protocol.constructReadProcedureRequest( + module, queryList); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Procedure request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + response = protocol.constructReadAddressResponse( + queryList, request.length); + protocol.processReadAddressResponse( + queryList, + sendRcv(module, request, response, pollState), + pollState); + } + } + // read data starting at address [00 SG HI LO NN] NN - number of bytes<249 + else if (groupTest.startsWith("0x060x00")) { + final EcuQueryRangeTest range = new EcuQueryRangeTest(querySet, 128); + final Collection newQuery = range.validate(); + int length = range.getLength(); + if (newQuery != null && length > 0) { + request = protocol.constructReadMemoryRange( + module, newQuery, length); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Range request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + response = protocol.constructReadMemoryRangeResponse( + request.length, length); + protocol.processReadMemoryRangeResponse( + querySet, + sendRcv(module, request, response, pollState)); + } + else { + for (EcuQuery query : querySet) { + final Collection queryList = new ArrayList(); + queryList.add(query); + request = protocol.constructReadMemoryRequest( + module, queryList); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Memory request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + response = protocol.constructReadAddressResponse( + queryList, request.length); + protocol.processReadAddressResponse( + queryList, + sendRcv(module, request, response, pollState), + pollState); + } + } + } + // Pre-defined Group parameter calls + // #03 Engine Parameters + // #04 Switch Parameters + // #91h Lambda Adaptations + // #92h Other Adaptations + // #93h Timing Correction/Fuel Compensation + else if (groupTest.startsWith("0x0b0x03") + || groupTest.startsWith("0x0b0x04") + || groupTest.startsWith("0x0b0x90") + || groupTest.startsWith("0x0b0x91") + || groupTest.startsWith("0x0b0x92") + || groupTest.startsWith("0x0b0x93") + || groupTest.startsWith("0x0b0x94") + || groupTest.startsWith("0x0b0x95")) { + + request = protocol.constructReadGroupRequest( + module, group); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Group request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + response = protocol.constructReadGroupResponse( + querySet, request.length); + protocol.processReadAddressResponse( + querySet, + sendRcv(module, request, response, pollState), + pollState); + } + // user selected parameter list + // [01 NN B4 B3 B2 B1 B0 ... B4n B3n B2n B1n B0n] NN<33h + else if (groupTest.startsWith("0x0b0x01")) { + // update address list if size or new query changes + if (querySet.size() != queryCount + || pollState.isNewQuery()) { + + // Set new address list + request = protocol.constructSetAddressRequest( + module, querySet); + // if too many parameters selected then notify user + if (request.length > 256) { + throw new SerialCommunicationException( + rb.getString("TOOLARGE")); + } + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Load address request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + pollState.setLastState(PollingState.State.STATE_0); + // Response to address list set is just an ACK + response = protocol.constructSetAddressResponse( + request.length); + protocol.validateSetAddressResponse( + sendRcv(module, request, response, pollState)); + queryCount = querySet.size(); + } + // Read set addresses + request = protocol.constructReadAddressRequest( + module, querySet); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Read addresses request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + pollState.setLastState(PollingState.State.STATE_0); + // Response to address list read is the parameter bytes + response = protocol.constructReadAddressResponse( + querySet, request.length); + protocol.processReadAddressResponses( + querySet, + sendRcv(module, request, response, pollState), + pollState); + } + } + } + + @Override + public void clearLine() { + clearQueryCount(); + manager.clearLine(); + } + + @Override + public void close() { + clearQueryCount(); + manager.close(); + } + + @Override + public final void sendAddressWrites( + Map writeQueries, Module module) { + + for (EcuQuery writeKey : writeQueries.keySet()) { + if (writeKey.getBytes().length == 3) { + final byte[] request = + protocol.constructWriteAddressRequest( + module, + writeKey.getBytes(), + writeQueries.get(writeKey)[0]); + + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Write Request ---> " + asHex(request)); + final byte[] response = manager.send(request); + byte[] processedResponse = + protocol.preprocessResponse( + request, + response, + new PollingStateImpl()); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Write Response <--- " + asHex(processedResponse)); + protocol.processWriteResponse( + writeQueries.get(writeKey), processedResponse); + } + } + } + + /** + * Return a map of groups each with a value of a list of queries having the same group + * @param queries + * @return Map(Group, Collection(EcuQuery)) + */ + private Map> getGroupList(Collection queries) { + final Map> groups = new HashMap>(); + String group; + String subGroup; + for (EcuQuery query : queries) { + group = ((EcuData) query.getLoggerData()).getGroup(); + subGroup = ((EcuData) query.getLoggerData()).getSubgroup(); + group = group + (subGroup == null ? "" : subGroup); + if (!groups.containsKey(group)) { + final Collection queryList = new ArrayList(); + queryList.add(query); + groups.put(group, queryList); + } + else { + groups.get(group).add(query); + } + } + return groups; + } + + private byte[] sendRcv(Module module, byte[] request, byte[] response, PollingState pollState) { + manager.send(request, response, pollState); + if (LOGGER.isTraceEnabled()) + LOGGER.trace(module + " Read Raw Response <--- " + asHex(response)); + final byte[] processedResponse = protocol.preprocessResponse( + request, response, pollState); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Mode:" + pollState.getCurrentState() + " " + + module + " Response <--- " + asHex(processedResponse)); + return processedResponse; + } + + public void clearQueryCount() { + queryCount = -1; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/connection/ELMOBDLoggerConnection.java b/src/main/java/com/romraider/logger/ecu/comms/io/connection/ELMOBDLoggerConnection.java new file mode 100644 index 000000000..ac7eab393 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/io/connection/ELMOBDLoggerConnection.java @@ -0,0 +1,187 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.io.connection; + +import static com.romraider.util.ParamChecker.checkNotNull; + +import static org.apache.log4j.Logger.getLogger; +import org.apache.log4j.Logger; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; + +import com.romraider.Settings; +import com.romraider.util.SettingsManager; +import com.romraider.io.elm327.ElmConnectionManager; +import com.romraider.io.elm327.ElmConnectionManager.ERROR_TYPE; +import com.romraider.io.protocol.ProtocolFactory; +import com.romraider.logger.ecu.comms.io.protocol.LoggerProtocolOBD; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.query.EcuInitCallback; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.exception.SerialCommunicationException; + +public final class ELMOBDLoggerConnection implements LoggerConnection { + private static final Logger LOGGER = getLogger(OBDLoggerConnection.class); + private final LoggerProtocolOBD protocol; + private final ElmConnectionManager manager; + private Collection obdQueries = new ArrayList(); + final Settings settings = SettingsManager.getSettings(); + + public ELMOBDLoggerConnection(ElmConnectionManager manager) { + checkNotNull(manager, "manager"); + this.manager = manager; + this.protocol = (LoggerProtocolOBD) ProtocolFactory.getProtocol("OBD", "iso15765"); + } + + @Override + public void open(Module module) { + } + + @Override + // TODO: + public void ecuReset(Module module, int resetCode) { + } + + + @Override + public void ecuInit(EcuInitCallback callback, Module module) { + String moduleStr = concatBytes(module.getAddress()); + String testerStr = concatBytes(module.getTester()); + + ERROR_TYPE result = manager.resetAndInit(settings.getTransportProtocol(), + moduleStr, testerStr); + + if(result == ERROR_TYPE.ELM_NOT_FOUND) { + throw new SerialCommunicationException("ELM327 was not found!"); + } + else if (result == ERROR_TYPE.ECU_NOT_FOUND) { + throw new SerialCommunicationException("ELM327 was found," + + " but no response from ECU!"); + } + else if(result == ERROR_TYPE.UNKNOWN_PROTOCOL) { + throw new SerialCommunicationException("Unknown ELM Protocol, check xml for" + + " available modes!"); + } + else if(result == ERROR_TYPE.ELM_REJECTED_REQUEST) { + throw new SerialCommunicationException("ELM rejected request!"); + } + + } + + private String concatBytes(final byte[] bytes) { + final StringBuilder sb = new StringBuilder(); + boolean foundData = false; + + for (byte b : bytes) { + if(b!= 0) foundData = true; + + if(foundData) + sb.append(String.format("%02X", b & 0xFF)); //Unsigned + } + + String finalS = sb.toString(); + if(finalS.startsWith("0")) finalS = finalS.replaceFirst("0", ""); + + return finalS; + } + + + @Override + //TODO: CAN supports requesting multiple PIDs at once + //This still has to be implemented + public final void sendAddressReads(Collection queries, Module module, + PollingState pollState) { + + final int obdQueryListLength = queries.size(); + for (int i = 0; i < obdQueryListLength; i++) { + + EcuQuery query = ((ArrayList) queries).get(i); + obdQueries.add(query); + + final byte[] request = protocol.constructReadAddressRequest(module, obdQueries); + String reqStr = String.format("%02X %02X", (int)request[4], (int)request[5]); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Request: " + reqStr); + String result = manager.sendAndWaitForChar(reqStr, 2500, ">"); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("ELM: " + result); + + if(result.contains("BUS INIT")) + { + LOGGER.warn("ELM 327 still initializing bus while querying!"); + continue; + } + else if(result.contains("STOPPED")) { + LOGGER.warn("ELM327 stopped trying to connect to the ECU!"); + continue; + } + else if(result.contains("NO DATA")) { + LOGGER.warn("ELM327 received no response from ECU!"); + continue; + } + + boolean found = false; + + String[] resultSplit = result.split("\r"); + + for(String s : resultSplit) { + String[] bytesSplit = s.split(" "); + + for(int j = 0; j < bytesSplit.length; j++) { + + if(bytesSplit[j].equals(String.format("%02X",(int)request[5]))) { + + byte[] response = new byte[bytesSplit.length - j - 1]; + + for(int k = 0; k < response.length; k++) { + response[k] = (byte) Integer.parseInt(bytesSplit[k + j + 1], 16); + } + + query.setResponse(response); + found = true; + break; + } + } + + if(found) break; + } + + obdQueries.clear(); + } + } + + @Override + public void clearLine() { + manager.clearLine(); + } + + @Override + public void close() { + manager.close(); + } + + @Override + public void sendAddressWrites(Map writeQueries, Module module) { + throw new UnsupportedOperationException(); + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/connection/LoggerConnection.java b/src/main/java/com/romraider/logger/ecu/comms/io/connection/LoggerConnection.java index 80539c2ef..1dade7dfa 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/io/connection/LoggerConnection.java +++ b/src/main/java/com/romraider/logger/ecu/comms/io/connection/LoggerConnection.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,19 +22,58 @@ import com.romraider.logger.ecu.comms.manager.PollingState; import com.romraider.logger.ecu.comms.query.EcuInitCallback; import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.definition.Module; + import java.util.Collection; import java.util.Map; public interface LoggerConnection { - void ecuReset(byte id); - void ecuInit(EcuInitCallback callback, byte id); + /** + * Use the open method when communications to a Module requires a + * StartCommunication sequence, such as Five Baud or Fast Init. + * @param module - the Module to open + */ + void open(Module module); + + /** + * Use this method to reset the module. + * @param module - the Module to reset + * @param resetCode - the reset procedure to activate + */ + void ecuReset(Module module, int resetCode); + + /** + * Use this method to get the identity the Module communicating with. + * @param callback - callback which will identify the Module + * @param module - the Module to identify + */ + void ecuInit(EcuInitCallback callback, Module module); + + /** + * Use this method to query the Module for the parameters included as queries. + * @param queries - the Collection of EcuQuery items + * @param module - the Module to query + * @param pollState - the PollingState to use + */ + void sendAddressReads(Collection queries, Module module, PollingState pollState); - void sendAddressReads(Collection queries, byte id, PollingState pollState); - + /** + * Use this method to clear the communications line of any erroneous data. + * It can be called before closing off communications to clear buffers + * of stale data, or when changing polling modes. + */ void clearLine(); + /** + * Use this method to close communications with the Module. + */ void close(); - void sendAddressWrites(Map writeQueries, byte id); + /** + * Use this method to write to a Module. + * @param writeQueries - a Map of EcuQuery items to write + * @param module - the Module to write to + */ + void sendAddressWrites(Map writeQueries, Module module); } diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/connection/LoggerConnectionFactory.java b/src/main/java/com/romraider/logger/ecu/comms/io/connection/LoggerConnectionFactory.java index cab72116f..8beebdbb5 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/io/connection/LoggerConnectionFactory.java +++ b/src/main/java/com/romraider/logger/ecu/comms/io/connection/LoggerConnectionFactory.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,34 +22,39 @@ import com.romraider.io.connection.ConnectionManager; import static com.romraider.io.connection.ConnectionManagerFactory.getManager; import com.romraider.io.connection.ConnectionProperties; +import com.romraider.io.elm327.ElmConnectionManager; import com.romraider.logger.ecu.exception.UnsupportedProtocolException; public final class LoggerConnectionFactory { - private LoggerConnectionFactory() { - } + private LoggerConnectionFactory() {} public static LoggerConnection getConnection( - String protocolName, - String portName, - ConnectionProperties connectionProperties) { - ConnectionManager manager = getManager(portName, connectionProperties); + final String protocolName, + final String portName, + final ConnectionProperties connectionProperties) { + + final ConnectionManager manager = getManager(portName, connectionProperties); return instantiateConnection(protocolName, manager); } private static LoggerConnection instantiateConnection( - String protocolName, - ConnectionManager manager) { + final String protocolName, + final ConnectionManager manager) { - try { - Class cls = Class.forName( - LoggerConnectionFactory.class.getPackage().getName() + - "." + protocolName + "LoggerConnection"); - return (LoggerConnection) cls.getConstructor( - ConnectionManager.class).newInstance(manager); - } catch (Exception e) { - manager.close(); - throw new UnsupportedProtocolException( - protocolName, e); - } + if (manager.getClass() == ElmConnectionManager.class && + protocolName.equals("OBD")) { + return new ELMOBDLoggerConnection((ElmConnectionManager)manager); + } + else { + try { + Class cls = Class.forName(LoggerConnectionFactory. + class.getPackage().getName() + "." + protocolName + "LoggerConnection"); + return (LoggerConnection) cls.getConstructor( + ConnectionManager.class).newInstance(manager); + } catch (Exception e) { + manager.close(); + throw new UnsupportedProtocolException(protocolName, e); + } + } } } diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/connection/NCSLoggerConnection.java b/src/main/java/com/romraider/logger/ecu/comms/io/connection/NCSLoggerConnection.java new file mode 100644 index 000000000..df63d9d1f --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/io/connection/NCSLoggerConnection.java @@ -0,0 +1,561 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.io.connection; + +import static com.romraider.util.HexUtil.asHex; +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ThreadUtil.sleep; +import static org.apache.log4j.Logger.getLogger; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.ResourceBundle; + +import org.apache.log4j.Logger; + +import com.romraider.Settings; +import com.romraider.util.ResourceUtil; +import com.romraider.util.SettingsManager; +import com.romraider.io.connection.ConnectionManager; +import com.romraider.io.protocol.ProtocolFactory; +import com.romraider.logger.ecu.comms.io.protocol.LoggerProtocolNCS; +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.manager.PollingStateImpl; +import com.romraider.logger.ecu.comms.query.EcuInitCallback; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryData; +import com.romraider.logger.ecu.comms.query.EcuQueryRangeTest; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.exception.SerialCommunicationException; + +public final class NCSLoggerConnection implements LoggerConnection { + private static final Logger LOGGER = getLogger(NCSLoggerConnection.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + NCSLoggerConnection.class.getName()); + private final LoggerProtocolNCS protocol; + private final ConnectionManager manager; + private int queryCount; + private final Settings settings = SettingsManager.getSettings(); + private final Collection scQuery = new ArrayList(); + private final Collection ramQuery = new ArrayList(); + private boolean commsStarted; + private boolean elevatedDiag; + + + public NCSLoggerConnection(ConnectionManager manager) { + checkNotNull(manager, "manager"); + this.manager = manager; + this.protocol = (LoggerProtocolNCS) ProtocolFactory.getProtocol( + settings.getLoggerProtocol(), + settings.getTransportProtocol()); + commsStarted = false; + elevatedDiag = false; + } + + @Override + //TODO: not yet implemented + public void ecuReset(Module module, int resetCode) { + byte[] request = protocol.constructEcuResetRequest(module, resetCode); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Reset Request ---> %s", + module, asHex(request))); + byte[] response = manager.send(request); + byte[] processedResponse = protocol.preprocessResponse( + request, response, new PollingStateImpl()); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Reset Response <--- %s", + module, asHex(processedResponse))); + protocol.processEcuResetResponse(processedResponse); + } + + @Override + // Build an init string similar to the SSM version so the logger definition + // can reference supported parameters using ecubyte/bit attributes. + public void ecuInit(EcuInitCallback callback, Module module) { + // ConnectionManger must have completed a fastInit to start comms + if (!commsStarted) open(module); + final byte[] initResponse = new byte[422]; + byte[] request; + byte[] response; + request = protocol.constructEcuIdRequest(module); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s ID Request ---> %s", + module, asHex(request))); + response = manager.send(request); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s ID Raw Response <--- %s", + module, asHex(response))); + response = protocol.processEcuIdResponse(response); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s ID Processed Response <--- %s", + module, asHex(response))); + System.arraycopy(response, 0, initResponse, 2, response.length); + sleep(55L); + + final byte[] supportedPidsPid = { + (byte) 0x00, (byte) 0x20, (byte) 0x40, (byte) 0x60, + (byte) 0x80, (byte) 0xA0, (byte) 0xC0, (byte) 0xE0}; + int i = 8; + byte sid = (byte) 0x21; + boolean test_grp = true; + for (byte pid : supportedPidsPid) { + if (test_grp) { + request = protocol.constructReadSidPidRequest( + module, sid, new byte[]{pid}); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID Group %02X Request ---> %s", + module, sid, pid, asHex(request))); + response = manager.send(request); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID Group %02X Raw Response <--- %s", + module, sid ,pid, asHex(response))); + // Validate response + response = protocol.processReadSidPidResponse(response); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID Group %02X Processed Response <--- %s", + module, sid ,pid, asHex(response))); + System.arraycopy(response, 0, initResponse, i, 4); + // Check lsb to see if next PID group is supported + if ((response[response.length-1] & 0x01) == 0) { + test_grp = false; + } + } + i = i + 4; + } + sid = (byte) 0x22; + final byte[] highBytes = { + (byte) 0x11, (byte) 0x12, (byte) 0x13, + (byte) 0x15}; + for (byte hb : highBytes) { + if (hb == (byte) 0x13) { // Supported Switch PIDs + test_grp = true; + for (byte pid : supportedPidsPid) { + if (test_grp) { + request = protocol.constructReadSidPidRequest( + module, sid, new byte[]{hb, pid}); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID Group %02X%02X Request ---> %s", + module, sid, hb, pid, asHex(request))); + response = manager.send(request); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID Group %02X%02X Raw Response <--- %s", + module, sid, hb, pid, asHex(response))); + // Validate response + response = protocol.processReadSidPidResponse(response); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID Group %02X%02X Processed Response <--- %s", + module, sid, hb, pid, asHex(response))); + // Check lsb to see if next PID group is supported + if ((response[response.length-1] & 0x01) == 0) { + test_grp = false; + } + final short[] supported = new short[2]; + for (int j = 0; j < 2; j++) { + supported[j] = (short) ((short)(response[j*2] << 8) + (response[j*2+1] & 0x00FF)); + } + for (int k = 0; k < supported.length; k++) { + // ex: 7FFC2000 + for (int shift = 15; shift > -1; shift--) { + if (((1 << shift) & supported[k]) > 0) { + byte cid = (byte) ((16 - shift) + (k * 16)); + request = protocol.constructReadSidPidRequest( + module, sid, new byte[]{hb, cid}); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID %02X%02X Request ---> %s", + module, sid, hb, cid, asHex(request))); + response = manager.send(request); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID %02X%02X Raw Response <--- %s", + module, sid ,hb, cid, asHex(response))); + // Validate response + response = protocol.processReadSidPidResponse(response); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID Group %02X%02X Processed Response <--- %s", + module, sid, hb, pid, asHex(response))); + // 2 bytes returned, we only need the second byte + System.arraycopy(response, 1, initResponse, i, 1); + } + i++; + } + } + } + else { + i = i + 32; + } + } + i--; // move back one unused index byte position + } + else { + test_grp = true; + for (byte pid : supportedPidsPid) { + if (test_grp) { + request = protocol.constructReadSidPidRequest( + module, sid, new byte[]{hb, pid}); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID Group %02X%02X Request ---> %s", + module, sid, hb, pid, asHex(request))); + response = manager.send(request); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID Group %02X%02X Raw Response <--- %s", + module, sid ,hb, pid, asHex(response))); + // Validate response + response = protocol.processReadSidPidResponse(response); + System.arraycopy(response, 0, initResponse, i, 4); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s SID %02X, PID Group %02X%02X Processed Response <--- %s", + module, sid, hb, pid, asHex(response))); + // Check lsb to see if next PID group is supported + if ((response[response.length-1] & 0x01) == 0) { + test_grp = false; + } + } + i = i + 4; + } + } + } + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Init Response <--- %s", + module, asHex(initResponse))); // contains ECUID + protocol.processEcuInitResponse(callback, initResponse); + } + + @Override + public final void sendAddressReads( + Collection queries, + Module module, + PollingState pollState) { + + // ConnectionManger must have completed a fastInit to start comms + if (!commsStarted) open(module); + + // CAN Slow poll, read each parameter in a separate query, inefficient + if (settings.isCanBus() && !pollState.isFastPoll()) { + doSlowCanQueries(queries, module, pollState); + } + // Use CAN UDS 2C to load parameters and then request to read all loaded + else if (settings.isCanBus() && pollState.isFastPoll()) { + doFastCanQueries(queries, module, pollState); + } + // if not CAN do k-line queries + else { + doKlineQueries(queries, module, pollState); + } + } + + public void clearQueryCount() { + queryCount = -1; + } + + @Override + public void clearLine() { + clearQueryCount(); + manager.clearLine(); + } + + @Override + public void open(Module module) { + // For k-line, get the fast init sequence and stop command, then open + // the connection via the ConnectionManager + byte[] start = protocol.constructEcuFastInitRequest(module); + byte[] stop = protocol.constructEcuStopRequest(module); + // For CAN, start a standard diagnostics session + if (settings.isCanBus()) { + start = protocol.constructStartDiagRequest(module); + } + manager.open(start, stop); + commsStarted = true; + } + + @Override + public void close() { + commsStarted = false; + clearQueryCount(); + manager.close(); + } + + @Override + public void sendAddressWrites(Map writeQueries, Module module) { + throw new UnsupportedOperationException(); + } + + private int calcLength(String address) { + if (address.toLowerCase().startsWith("0x2")) { + return 3; + } + else { + return 5; + } + } + + private void doKlineQueries( + Collection queries, + Module module, + PollingState pollState) { + + // k-line max data bytes is 63 when length encoded into format byte + if (queries.size() != queryCount + || pollState.isNewQuery()) { + int dataLength = 0; + for (EcuQuery query : queries) { + for (final String address : query.getAddresses()) { + dataLength += calcLength(address); + } + } + // if length is too big then notify user to un-select some parameters + if (dataLength > 61) { + throw new SerialCommunicationException( + rb.getString("TOOLARGE")); + } + } + + if (queries.size() != queryCount + || pollState.isNewQuery()) { + final byte[] request = protocol.constructLoadAddressRequest(queries); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Load address request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + + byte[] response = new byte[4]; // short header response + if ((request[0] & (byte)0x80) == (byte)0x80) { + response = new byte[6]; // long header response + } + protocol.validateLoadAddressResponse( + sendRcv(module, request, response, pollState)); + queryCount = queries.size(); + } + final byte[] request = protocol.constructReadAddressRequest( + module, queries, pollState); + if (pollState.getCurrentState() == PollingState.State.STATE_0) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Read request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + pollState.setLastState(PollingState.State.STATE_0); + } + final byte[] response = protocol.constructReadAddressResponse( + queries, pollState); + protocol.processReadAddressResponses( + queries, + sendRcv(module, request, response, pollState), + pollState); + } + + /** + * SID/CID can't be combined with reading memory addresses direct, + * so we need to load and read each group separately. + * The queries are divided into and added to the class attributes scQuery + * and ramQuery collections. + * @param queries - the collection of queries to evaluate and split + */ + private void splitSidFromRamQueries(Collection queries) { + scQuery.clear(); + ramQuery.clear(); + for (EcuQuery query : queries) { + final String[] addresses = query.getAddresses(); + for (final String address : addresses) { + if (address.startsWith("0x22")) { // SID&CID + scQuery.add(query); + break; + } + else { + ramQuery.add(query); + break; + } + } + } + } + + private void doSlowCanQueries( + Collection queries, + Module module, + PollingState pollState) { + + splitSidFromRamQueries(queries); + byte[] request; + byte[] response; + if (!scQuery.isEmpty()) { + final Collection sidQuery = new ArrayList(); + for (EcuQuery query : scQuery) { + // for each query in the collection create a new collection with one item + sidQuery.clear(); + sidQuery.add(query); + if (elevatedDiag) { + request = protocol.constructStartDiagRequest(module); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Standard Diagnostics Request ---> %s", + module, asHex(request))); + response = manager.send(request); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Standard Diagnostics Response <--- %s", + module, asHex(response))); + elevatedDiag = false; + } + request = protocol.constructReadAddressRequest( + module, sidQuery); + response = new byte[0]; + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " CAN Request ---> " + asHex(request)); + response = protocol.constructReadAddressResponse( + sidQuery, pollState); + protocol.processReadAddressResponses( + sidQuery, + sendRcv(module, request, response, pollState), + pollState); + } + } + // if query address is not an SID, elevate diag session and + // switch to SID 23 using readMemoryRequest + if (!ramQuery.isEmpty()) { + if (!elevatedDiag) { + request = protocol.constructElevatedDiagRequest(module); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Elevated Diagnostics Request ---> %s", + module, asHex(request))); + response = manager.send(request); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Elevated Diagnostics Response <--- %s", + module, asHex(response))); + elevatedDiag = true; + } + // Inspect the address of each query to determine if a single query + // with a start address and byte length can be substituted as opposed + // to querying each address separately. + final EcuQueryRangeTest range = new EcuQueryRangeTest(ramQuery, 63); + final Collection newQuery = range.validate(); + int length = range.getLength(); + if (newQuery != null && length > 0) { + request = protocol.constructReadMemoryRequest(module, newQuery, length); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " CAN $23 Request ---> " + asHex(request)); + response = protocol.constructReadMemoryResponse(1, length); + protocol.processReadMemoryResponses( + ramQuery, + sendRcv(module, request, response, pollState)); + } + else { + // for each query in the collection create a new collection with one item + for (EcuQuery query : ramQuery) { + newQuery.clear(); + newQuery.add(query); + request = protocol.constructReadMemoryRequest( + module, newQuery, EcuQueryData.getDataLength(query)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Memory request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + response = protocol.constructReadMemoryResponse(1, + EcuQueryData.getDataLength(query)); + protocol.processReadMemoryResponses( + newQuery, + sendRcv(module, request, response, pollState)); + } + } + } + } + + private void doFastCanQueries ( + Collection queries, + Module module, + PollingState pollState) { + + // When parameter selection changes or there are RAM parameters present + // load and read the SID/CID parameters separate from the RAM parameters + if (queries.size() != queryCount + || pollState.isNewQuery()) { + + splitSidFromRamQueries(queries); + queryCount = queries.size(); + pollState.setNewQuery(true); + } + + byte[] request; + byte[] response; + if (!scQuery.isEmpty()) { // SID/CID queries + if (pollState.isNewQuery() || !ramQuery.isEmpty()) { + request = protocol.constructLoadAddressRequest(scQuery); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Load address request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + // CAN max is 99 bytes + if (request.length > 99) { + throw new SerialCommunicationException( + rb.getString("TOOLARGE")); + } + response = manager.send(request); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Load address response <--- %s", + pollState.getCurrentState(), module, asHex(response))); + protocol.validateLoadAddressResponse(response); + } + request = protocol.constructReadAddressRequest( + module, scQuery, pollState); + response = protocol.constructReadAddressResponse( + scQuery, pollState); + protocol.processReadAddressResponses( + scQuery, + sendRcv(module, request, response, pollState), + pollState); + } + // When parameter selection changes or there are SID CID parameters present + // load and read the RAM parameters separate from the SID CID parameters + if (!ramQuery.isEmpty()) { // RAM queries + if (pollState.isNewQuery() || !scQuery.isEmpty()) { + request = protocol.constructLoadAddressRequest(ramQuery); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Load address request ---> %s", + pollState.getCurrentState(), module, asHex(request))); + // CAN max is 99 bytes + if (request.length > 99) { + throw new SerialCommunicationException( + rb.getString("TOOLARGE")); + } + response = manager.send(request); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Load address response <--- %s", + pollState.getCurrentState(), module, asHex(response))); + protocol.validateLoadAddressResponse(response); + pollState.setFastPoll(true); + } + request = protocol.constructReadAddressRequest( + module, ramQuery, pollState); + response = protocol.constructReadAddressResponse( + ramQuery, pollState); + protocol.processReadAddressResponses( + ramQuery, + sendRcv(module, request, response, pollState), + pollState); + } + } + + private byte[] sendRcv( + Module module, byte[] request, + byte[] response, PollingState pollState) { + + manager.send(request, response, pollState); + if (LOGGER.isTraceEnabled()) + LOGGER.trace(module + " Read Raw Response <--- " + asHex(response)); + final byte[] processedResponse = protocol.preprocessResponse( + request, response, pollState); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Mode:" + pollState.getCurrentState() + " " + + module + " Response <--- " + asHex(processedResponse)); + return processedResponse; + } + +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/connection/OBDLoggerConnection.java b/src/main/java/com/romraider/logger/ecu/comms/io/connection/OBDLoggerConnection.java index 0822485f3..8ccee7832 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/io/connection/OBDLoggerConnection.java +++ b/src/main/java/com/romraider/logger/ecu/comms/io/connection/OBDLoggerConnection.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ import static org.apache.log4j.Logger.getLogger; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Map; @@ -38,6 +39,7 @@ import com.romraider.logger.ecu.comms.manager.PollingStateImpl; import com.romraider.logger.ecu.comms.query.EcuInitCallback; import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.definition.Module; public final class OBDLoggerConnection implements LoggerConnection { private static final Logger LOGGER = getLogger(OBDLoggerConnection.class); @@ -49,44 +51,50 @@ public OBDLoggerConnection(ConnectionManager manager) { checkNotNull(manager, "manager"); this.manager = manager; final Settings settings = SettingsManager.getSettings(); - this.protocol = (LoggerProtocolOBD) ProtocolFactory.getProtocol( - settings.getLoggerProtocol(), - settings.getTransportProtocol()); + this.protocol = (LoggerProtocolOBD) ProtocolFactory.getProtocol(settings.getLoggerProtocol(), settings.getTransportProtocol()); } @Override - public void ecuReset(byte id) { - byte[] request = protocol.constructEcuResetRequest(id); - LOGGER.debug(String.format("OBD Reset Request ---> %s", - asHex(request))); + public void open(Module module) { + } + + @Override + public void ecuReset(Module module, int resetCode) { + byte[] request = protocol.constructEcuResetRequest(module, resetCode); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Reset Request ---> %s", + module, asHex(request))); byte[] response = manager.send(request); byte[] processedResponse = protocol.preprocessResponse( request, response, new PollingStateImpl()); - LOGGER.debug(String.format("OBD Reset Response <--- %s", - asHex(processedResponse))); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Reset Response <--- %s", + module, asHex(processedResponse))); protocol.processEcuResetResponse(processedResponse); } @Override // Build an init string similar to the SSM version so the logger definition - // can reference supported parameters with ecubyte/bit attributes. - public void ecuInit(EcuInitCallback callback, byte id) { + // can reference supported parameters with ecubyte/bit attributes. + public void ecuInit(EcuInitCallback callback, Module module) { final byte[] processedResponse = new byte[46]; - final byte[] request = protocol.constructEcuInitRequest(id); - LOGGER.debug(String.format("OBD Calibration ID Request ---> %s", - asHex(request))); - final byte[] tmp = manager.send(request); - final byte[] response = protocol.preprocessResponse( - request, tmp, new PollingStateImpl()); - LOGGER.debug(String.format("OBD Calibration ID Response <--- %s", - asHex(response))); + final byte[] request = protocol.constructEcuInitRequest(module); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Calibration ID Request ---> %s", + module, asHex(request))); + final byte[] response = manager.send(request); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Calibration ID Response <--- %s", + module, asHex(response))); System.arraycopy(response, 0, processedResponse, 0, response.length); int j = 7; - while (response[j] != 0 && j < response.length) { j++; } - final byte[] calIdStr = new byte[j - 7]; - System.arraycopy(response, 7, calIdStr, 0, j - 7); - System.arraycopy(calIdStr, 0, processedResponse, 5, 8); - LOGGER.info(String.format("OBD Calibration ID: %s", new String(calIdStr))); + // try to find the string termination character 0x00 in the response + while (j < response.length && response[j] != 0) { j++; } + byte[] calIdStr = new byte[j - 7]; + System.arraycopy(response, 7, calIdStr, 0, calIdStr.length); + LOGGER.info(String.format("%s Calibration ID: %s", module, new String(calIdStr))); + calIdStr = Arrays.copyOf(calIdStr, 8); // extend to 8 bytes maximum + System.arraycopy(calIdStr, 0, processedResponse, 5, calIdStr.length); final byte[] supportedPidsPid = { (byte) 0x00, (byte) 0x20, (byte) 0x40, (byte) 0x60, @@ -94,14 +102,16 @@ public void ecuInit(EcuInitCallback callback, byte id) { int i = 13; for (byte pid : supportedPidsPid) { final byte[] pidRequest = protocol.constructReadPidRequest( - id, new byte[]{pid}); - LOGGER.debug(String.format("OBD PID Group %02X Request ---> %s", - pid, asHex(pidRequest))); + module, new byte[]{pid}); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s PID Group %02X Request ---> %s", + module, pid, asHex(pidRequest))); final byte[] pidtmp = manager.send(pidRequest); final byte[] pidPpResponse = protocol.preprocessResponse( pidRequest, pidtmp, new PollingStateImpl()); - LOGGER.debug(String.format("OBD PID Group %02X Response <--- %s", - pid, asHex(pidPpResponse))); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s PID Group %02X Response <--- %s", + module, pid, asHex(pidPpResponse))); System.arraycopy(pidPpResponse, 6, processedResponse, i, 4); i = i + 4; if ((pidPpResponse[pidPpResponse.length - 1] & 0x01) == 0) break; @@ -113,27 +123,31 @@ public void ecuInit(EcuInitCallback callback, byte id) { // the logger definition to indicate supported switches. if ((processedResponse[25] & 0x08) > 0) { final byte[] aiRequest = protocol.constructReadPidRequest( - id, new byte[]{0x65}); - LOGGER.debug(String.format( - "OBD Auxiliary Inputs Support Request ---> %s", - asHex(aiRequest))); + module, new byte[]{0x65}); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( + "%s Auxiliary Inputs Support Request ---> %s", + module, asHex(aiRequest))); final byte[] aiResponse = manager.send(aiRequest); final byte[] aiPpResponse = protocol.preprocessResponse( aiRequest, aiResponse, new PollingStateImpl()); - LOGGER.debug(String.format( - "OBD Auxiliary Inputs Support Response <--- %s", - asHex(aiPpResponse))); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( + "%s Auxiliary Inputs Support Response <--- %s", + module, asHex(aiPpResponse))); System.arraycopy(aiPpResponse, 6, processedResponse, 45, 1); } - LOGGER.debug(String.format("OBD Init Response <--- %s", - asHex(processedResponse))); // contains CALID not ECUID + // contains CAL ID not ECU ID + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("%s Init Response <--- %s", + module, asHex(processedResponse))); protocol.processEcuInitResponse(callback, processedResponse); } @Override public final void sendAddressReads( Collection queries, - byte id, + Module module, PollingState pollState) { final int obdQueryListLength = queries.size(); @@ -142,17 +156,19 @@ public final void sendAddressReads( obdQueries.add(((ArrayList) queries).get(j)); } final byte[] request = protocol.constructReadAddressRequest( - id, obdQueries); - LOGGER.debug(String.format("Mode:%d OBD Request ---> %s", - pollState.getCurrentState(), asHex(request))); + module, obdQueries); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Request ---> %s", + pollState.getCurrentState(), module, asHex(request))); final byte[] response = protocol.constructReadAddressResponse( obdQueries, pollState); manager.send(request, response, pollState); final byte[] processedResponse = protocol.preprocessResponse( request, response, pollState); - LOGGER.debug(String.format("Mode:%d OBD Response <--- %s", - pollState.getCurrentState(), asHex(processedResponse))); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format("Mode:%s %s Response <--- %s", + pollState.getCurrentState(), module, asHex(processedResponse))); protocol.processReadAddressResponses( obdQueries, processedResponse, pollState); obdQueries.clear(); @@ -170,7 +186,7 @@ public void close() { } @Override - public void sendAddressWrites(Map writeQueries, byte id) { + public void sendAddressWrites(Map writeQueries, Module module) { throw new UnsupportedOperationException(); } } diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/connection/SSMLoggerCANSubQuery.java b/src/main/java/com/romraider/logger/ecu/comms/io/connection/SSMLoggerCANSubQuery.java index 60ddbdf4c..f369153e4 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/io/connection/SSMLoggerCANSubQuery.java +++ b/src/main/java/com/romraider/logger/ecu/comms/io/connection/SSMLoggerCANSubQuery.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,20 +39,21 @@ import com.romraider.logger.ecu.definition.EcuData; import com.romraider.logger.ecu.definition.EcuDataConvertor; import com.romraider.logger.ecu.definition.EcuParameterImpl; +import com.romraider.logger.ecu.definition.Module; import com.romraider.util.HexUtil; public class SSMLoggerCANSubQuery { private static final Logger LOGGER = getLogger(SSMLoggerCANSubQuery.class); private static final int CAN_HEADER_LENGTH = 5; private static final ArrayList subQuery = new ArrayList(); - + public static final byte[] doSubQuery( ArrayList tcuSubQuery, ConnectionManager manager, - LoggerProtocol protocol, - byte id, + LoggerProtocol protocol, + Module module, PollingState pollState) { - + final byte[][] addresses = convertToByteAddresses(tcuSubQuery); final byte[] responses = new byte[CAN_HEADER_LENGTH + addresses.length]; for (int i = 0; i < addresses.length; i++) { @@ -62,16 +63,17 @@ public static final byte[] doSubQuery( new EcuParameterImpl(tcuSubQuery.get(0).getLoggerData().getId(), tcuSubQuery.get(0).getLoggerData().getName(), tcuSubQuery.get(0).getLoggerData().getDescription(), - ea, + ea, null, null, null, new EcuDataConvertor[] { tcuSubQuery.get(0).getLoggerData().getSelectedConvertor() } ); subQuery.clear(); - subQuery.add(new EcuQueryImpl((EcuData) epi)); + subQuery.add(new EcuQueryImpl(epi)); final byte[] request = protocol.constructReadAddressRequest( - id, subQuery); - LOGGER.debug("TCU CAN Sub Request " + i + " ---> " + asHex(request)); + module, subQuery); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " CAN Sub Request " + i + " ---> " + asHex(request)); final byte[] response = protocol.constructReadAddressResponse( subQuery, pollState); manager.send(request, response, pollState); diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/connection/SSMLoggerConnection.java b/src/main/java/com/romraider/logger/ecu/comms/io/connection/SSMLoggerConnection.java index fe14d76c0..6f19534a2 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/io/connection/SSMLoggerConnection.java +++ b/src/main/java/com/romraider/logger/ecu/comms/io/connection/SSMLoggerConnection.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +38,7 @@ import com.romraider.logger.ecu.comms.manager.PollingStateImpl; import com.romraider.logger.ecu.comms.query.EcuInitCallback; import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.definition.Module; import com.romraider.util.SettingsManager; public final class SSMLoggerConnection implements LoggerConnection { @@ -58,35 +59,43 @@ public SSMLoggerConnection(ConnectionManager manager) { } @Override - public void ecuReset(byte id) { - byte[] request = protocol.constructEcuResetRequest(id); - LOGGER.debug("Ecu Reset Request ---> " + asHex(request)); + public void open(Module module) { + } + + @Override + public void ecuReset(Module module, int resetCode) { + byte[] request = protocol.constructEcuResetRequest(module, resetCode); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Reset Request ---> " + asHex(request)); byte[] response = manager.send(request); byte[] processedResponse = protocol.preprocessResponse(request, response, new PollingStateImpl()); - LOGGER.debug("Ecu Reset Response <--- " + asHex(processedResponse)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Reset Response <--- " + asHex(processedResponse)); protocol.processEcuResetResponse(processedResponse); } @Override - public void ecuInit(EcuInitCallback callback, byte id) { - byte[] request = protocol.constructEcuInitRequest(id); - LOGGER.debug("Ecu Init Request ---> " + asHex(request)); + public void ecuInit(EcuInitCallback callback, Module module) { + byte[] request = protocol.constructEcuInitRequest(module); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Init Request ---> " + asHex(request)); byte[] response = manager.send(request); byte[] processedResponse = protocol.preprocessResponse(request, response, new PollingStateImpl()); - LOGGER.debug("Ecu Init Response <--- " + asHex(processedResponse)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Init Response <--- " + asHex(processedResponse)); protocol.processEcuInitResponse(callback, processedResponse); } @Override public final void sendAddressReads( Collection queries, - byte id, + Module module, PollingState pollState) { // Determine if ISO15765 is selected and then if TCU is selected. If // both are true then proceed to split queries so max CAN data packet // contains 8 or less bytes, otherwise don't split up the queries. - if (settings.isCanBus() && id == 0x18) { + if (settings.isCanBus() && module.getName().equalsIgnoreCase("TCU")) { tcuQueries = (ArrayList) queries; final int tcuQueryListLength = tcuQueries.size(); for (int i = 0; i < tcuQueryListLength; i++) { @@ -94,10 +103,11 @@ public final void sendAddressReads( tcuSubQuery.add(tcuQueries.get(i)); final int addrLength = tcuQueries.get(i).getAddresses().length; final byte[] request = protocol.constructReadAddressRequest( - id, tcuSubQuery); + module, tcuSubQuery); byte[] response = new byte[0]; if (addrLength == 1) { - LOGGER.debug("TCU CAN Request ---> " + asHex(request)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " CAN Request ---> " + asHex(request)); response = protocol.constructReadAddressResponse( tcuSubQuery, pollState); manager.send(request, response, pollState); @@ -105,29 +115,32 @@ public final void sendAddressReads( if (addrLength > 1) { response = SSMLoggerCANSubQuery.doSubQuery( (ArrayList) tcuSubQuery, manager, - protocol, id, pollState); + protocol, module, pollState); } final byte[] processedResponse = protocol.preprocessResponse( request, response, pollState); - LOGGER.debug("TCU CAN Response <--- " + asHex(processedResponse)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " CAN Response <--- " + asHex(processedResponse)); protocol.processReadAddressResponses( tcuSubQuery, processedResponse, pollState); } } else { final byte[] request = protocol.constructReadAddressRequest( - id, queries); - if (pollState.getCurrentState() == 0) { - LOGGER.debug("Mode:" + pollState.getCurrentState() + - " ECU Request ---> " + asHex(request)); + module, queries); + if (pollState.getCurrentState() == PollingState.State.STATE_0) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Mode:" + pollState.getCurrentState() + " " + + module + " Request ---> " + asHex(request)); } final byte[] response = protocol.constructReadAddressResponse( queries, pollState); manager.send(request, response, pollState); final byte[] processedResponse = protocol.preprocessResponse( request, response, pollState); - LOGGER.debug("Mode:" + pollState.getCurrentState() + - " ECU Response <--- " + asHex(processedResponse)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Mode:" + pollState.getCurrentState() + " " + + module + " Response <--- " + asHex(processedResponse)); protocol.processReadAddressResponses( queries, processedResponse, pollState); } @@ -145,24 +158,26 @@ public void close() { @Override public final void sendAddressWrites( - Map writeQueries, byte id) { + Map writeQueries, Module module) { for (EcuQuery writeKey : writeQueries.keySet()) { if (writeKey.getBytes().length == 3) { final byte[] request = protocol.constructWriteAddressRequest( - id, + module, writeKey.getBytes(), writeQueries.get(writeKey)[0]); - LOGGER.debug("ECU Write Request ---> " + asHex(request)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Write Request ---> " + asHex(request)); final byte[] response = manager.send(request); byte[] processedResponse = protocol.preprocessResponse( request, response, new PollingStateImpl()); - LOGGER.debug("ECU Write Response <--- " + asHex(processedResponse)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(module + " Write Response <--- " + asHex(processedResponse)); protocol.processWriteResponse( writeQueries.get(writeKey), processedResponse); } diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocol.java b/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocol.java index 3fa3c00e8..927e45fa2 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocol.java +++ b/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocol.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,14 +25,15 @@ import com.romraider.logger.ecu.comms.manager.PollingState; import com.romraider.logger.ecu.comms.query.EcuInitCallback; import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.definition.Module; public interface LoggerProtocol { - byte[] constructEcuInitRequest(byte id); + byte[] constructEcuInitRequest(Module module); - byte[] constructEcuResetRequest(byte id); + byte[] constructEcuResetRequest(Module module, int resetCode); - byte[] constructReadAddressRequest(byte id, Collection queries); + byte[] constructReadAddressRequest(Module module, Collection queries); byte[] constructReadAddressResponse(Collection queries, PollingState pollState); @@ -46,7 +47,7 @@ public interface LoggerProtocol { Protocol getProtocol(); - byte[] constructWriteAddressRequest(byte id, byte[] writeAddress, byte value); + byte[] constructWriteAddressRequest(Module module, byte[] writeAddress, byte value); void processWriteResponse(byte[] data, byte[] processedResponse); } diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocolDS2.java b/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocolDS2.java new file mode 100644 index 000000000..7523837e1 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocolDS2.java @@ -0,0 +1,61 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.io.protocol; + +import java.util.Collection; + +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.definition.Module; + +public interface LoggerProtocolDS2 extends LoggerProtocol { + + byte[] constructReadProcedureRequest(Module module, + Collection queries); + + byte[] constructReadAddressResponse( + Collection queries, int requestSize); + + byte[] constructReadGroupRequest( + Module module, String group); + + byte[] constructReadGroupResponse( + Collection queries, int requestSize); + + byte[] constructReadMemoryRequest( + Module module, Collection queryList); + + byte[] constructReadMemoryRange(Module module, + Collection queries, int length); + + public byte[] constructReadMemoryRangeResponse(int requestSize, int length); + + void processReadAddressResponse(Collection queries, + byte[] response, PollingState pollState); + + void processReadMemoryRangeResponse(Collection queries, byte[] response); + + byte[] constructSetAddressRequest( + Module module, Collection queryList); + + byte[] constructSetAddressResponse(int length); + + void validateSetAddressResponse(byte[] response); +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocolNCS.java b/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocolNCS.java new file mode 100644 index 000000000..4674702af --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocolNCS.java @@ -0,0 +1,61 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.io.protocol; + +import java.util.Collection; + +import com.romraider.logger.ecu.comms.manager.PollingState; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.definition.Module; + + +public interface LoggerProtocolNCS extends LoggerProtocol { + + byte[] constructEcuFastInitRequest(Module module); + + byte[] constructReadSidPidRequest(Module module, byte sid, byte[] pid); + + byte[] constructLoadAddressRequest(Collection queries); + + void validateLoadAddressResponse(byte[] response); + + byte[] processReadSidPidResponse(byte[] response); + + byte[] constructReadAddressRequest(Module module, + Collection queries, PollingState pollState); + + byte[] constructEcuIdRequest(Module module); + + byte[] processEcuIdResponse(byte[] response); + + byte[] constructEcuStopRequest(Module module); + + byte[] constructStartDiagRequest(Module module); + + byte[] constructElevatedDiagRequest(Module module); + + Collection filterDuplicates(Collection queries); + + byte[] constructReadMemoryRequest(Module module, Collection queries, int length); + + byte[] constructReadMemoryResponse(int requestSize, int length); + + void processReadMemoryResponses(Collection queries, byte[] response); +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocolOBD.java b/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocolOBD.java index b3485779f..d4e6122b9 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocolOBD.java +++ b/src/main/java/com/romraider/logger/ecu/comms/io/protocol/LoggerProtocolOBD.java @@ -19,8 +19,10 @@ package com.romraider.logger.ecu.comms.io.protocol; +import com.romraider.logger.ecu.definition.Module; + public interface LoggerProtocolOBD extends LoggerProtocol { - byte[] constructReadPidRequest(byte id, byte[] pid); + byte[] constructReadPidRequest(Module module, byte[] pid); } diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/DS2LearningTableValues.java b/src/main/java/com/romraider/logger/ecu/comms/learning/DS2LearningTableValues.java new file mode 100644 index 000000000..1c3abcbe8 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/DS2LearningTableValues.java @@ -0,0 +1,497 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning; + +import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection; +import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; + +import javax.swing.SwingWorker; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import com.romraider.Settings; +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.comms.io.connection.DS2LoggerConnection; +import com.romraider.logger.ecu.comms.learning.parameter.DS2Parameter; +import com.romraider.logger.ecu.comms.learning.parameter.DS2ParameterCrossReference; +import com.romraider.logger.ecu.comms.learning.parameter.ParameterIdComparator; +import com.romraider.logger.ecu.comms.learning.tableaxis.DS2TableAxisQueryParameterSet; +import com.romraider.logger.ecu.comms.learning.tables.DS2FlkcTableQueryBuilder; +import com.romraider.logger.ecu.comms.manager.PollingStateImpl; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryImpl; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.EcuDefinition; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.definition.Transport; +import com.romraider.logger.ecu.definition.xml.EcuDefinitionDocumentLoader; +import com.romraider.logger.ecu.definition.xml.EcuDefinitionInheritanceList; +import com.romraider.logger.ecu.definition.xml.EcuTableDefinitionHandler; +import com.romraider.logger.ecu.ui.MessageListener; +import com.romraider.logger.ecu.ui.paramlist.ParameterListTableModel; +import com.romraider.logger.ecu.ui.paramlist.ParameterRow; +import com.romraider.logger.ecu.ui.swing.tools.DS2LearningTableValuesResultsPanel; +import com.romraider.util.ParamChecker; +import com.romraider.util.ResourceUtil; + +/** + * This class manages the building of ECU queries and retrieving the data to + * populate the table models which will be used by the Learning Table Values + * display panel. + */ +public final class DS2LearningTableValues extends SwingWorker + implements LearningTableValues { + + private static final Logger LOGGER = + Logger.getLogger(DS2LearningTableValues.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DS2LearningTableValues.class.getName()); + private static final String[] AF_RANGE_NAMES = new String[]{" ", + "Additive Adaptation", + "Multiplicative Adaptation"}; + private static final List KNK_LOAD_TABLE_NAMES = Arrays.asList( + "Knock Tables X Axis (Load)"); + private static final List KNK_RPM_TABLE_NAMES = Arrays.asList( + "Knock Tables Y Axis (Engine Speed)"); + private final Map vehicleInfo = + new LinkedHashMap(); + private final List> afLearning = new ArrayList>(); + private EcuLogger logger; + private Settings settings; + private MessageListener messageListener; + private ParameterListTableModel parmeterList; + private EcuDefinition ecuDef; + private ParameterRow flkc; + private int flkcAddr; + + public DS2LearningTableValues() {} + + public void init( + EcuLogger logger, + ParameterListTableModel dataTabParamListTableModel, + EcuDefinition ecuDef) { + + ParamChecker.checkNotNull(logger, "EcuLogger"); + ParamChecker.checkNotNull(dataTabParamListTableModel, + "ParameterListTableModel"); + this.logger = logger; + this.settings = logger.getSettings(); + this.messageListener = logger; + this.parmeterList = dataTabParamListTableModel; + this.ecuDef = ecuDef; + this.flkc = null; + this.flkcAddr = 0; + } + + @Override + public final Void doInBackground() { + Document document = null; + if (ecuDef.getEcuDefFile() == null) { + showMessageDialog(logger, + rb.getString("DEFNOTFOUND"), + rb.getString("DEFMISSING"), + WARNING_MESSAGE); + return null; + } + else { + document = EcuDefinitionDocumentLoader.getDocument(ecuDef); + } + + final String transport = settings.getTransportProtocol(); + final Module module = settings.getDestinationTarget(); + if (settings.isCanBus()) { + settings.setTransportProtocol("ISO9141"); + final Module ecuModule = getModule("ECU"); + settings.setDestinationTarget(ecuModule); + } + final boolean logging = logger.isLogging(); + if (logging) logger.stopLogging(); + + String message = rb.getString("GETAFVALUES"); + messageListener.reportMessage(message); + buildVehicleInfoMap(ecuDef); + + try { + final DS2LoggerConnection connection = (DS2LoggerConnection) getConnection( + settings.getLoggerProtocol(), settings.getLoggerPort(), + settings.getLoggerConnectionProperties()); + try { + Collection queries = buildLearningQueries(); + + try { + LOGGER.info("Retrieving vehicle info & A/F values ..."); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("Current vehicle info & A/F values retrieved."); + } + catch (Exception e) { + LOGGER.error(message + " Error retrieving values", e); + } + + Collections.sort( + (List)queries, new ParameterIdComparator()); + + processEcuQueryResponses((List) queries); + + message = rb.getString("GETKNOCKRANGES"); + messageListener.reportMessage(message); + String[] flkcLoad = new String[0]; + queries.clear(); + queries = getTableAxisRanges(document, ecuDef, KNK_LOAD_TABLE_NAMES); + if (queries != null && !queries.isEmpty()) { + LOGGER.info("Retrieving Knock Load ranges ..."); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("Knock Load ranges retrieved."); + flkcLoad = formatRanges(queries, "%.0f"); + } + + message = rb.getString("GETRPMRANGES"); + messageListener.reportMessage(message); + String[] flkcRpm = new String[0]; + queries.clear(); + queries = getTableAxisRanges(document, ecuDef, KNK_RPM_TABLE_NAMES); + if (queries != null && !queries.isEmpty()) { + LOGGER.info("Retrieving Knock RPM ranges ..."); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("Knock RPM ranges retrieved."); + flkcRpm = formatRpmRanges(queries); + } + queries.clear(); + + List>> flkcQueryTables = new ArrayList>>(); + List> flkcQueryGroups = new ArrayList>(); + if (flkc != null) { + for (int k = 0; k < 384; k += 64) { + flkcQueryGroups = new DS2FlkcTableQueryBuilder().build( + flkc, + flkcAddr + k, + flkcRpm.length, + flkcLoad.length - 1); + flkcQueryTables.add(flkcQueryGroups); + + for (int i = 0; i < flkcQueryGroups.size(); i++) { + for (int j = 0; j < flkcQueryGroups.get(i).size(); j++) { + if (flkcQueryGroups.get(i).get(j) != null) { + queries.add(flkcQueryGroups.get(i).get(j)); + } + } + } + message = MessageFormat.format( + rb.getString("GETTABLEKNOCK"), + (k/64+1)); + messageListener.reportMessage(message); + LOGGER.info(String.format("Retrieving Table %d Knock values ...", + (k/64+1))); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info(String.format("Table %d Knock values retrieved.", + (k/64+1))); + queries.clear(); + } + } + else { + message = rb.getString("ERRTABLEKNOCK"); + messageListener.reportMessage(message); + LOGGER.error("Error retrieving Knock data values, missing Knock reference"); + } + + messageListener.reportMessage( + rb.getString("ADAPTSUCCESS")); + final DS2LearningTableValuesResultsPanel results = + new DS2LearningTableValuesResultsPanel( + logger, vehicleInfo, + AF_RANGE_NAMES, afLearning, + flkcLoad, flkcRpm, flkcQueryTables); + results.displayLearningResultsPanel(); + } + finally { + connection.close(); + settings.setTransportProtocol(transport); + settings.setDestinationTarget(module); + if (logging) logger.startLogging(); + } + } + catch (Exception e) { + messageListener.reportError( + rb.getString("ERRADAPT")); + LOGGER.error(message + " Error retrieving values", e); + showMessageDialog(logger, + MessageFormat.format( + rb.getString("ERRCONNECT"), message), + rb.getString("ATV"), + ERROR_MESSAGE); + } + return null; + } + + /** + * Build a collection of queries based on the initialized values of + * parameters defined for this ECU. Also identify the Knock + * parameters used to locate and calculate the Knock table. + * @return the supported parameter list filtered for only the Learning Table + * Value parameters needed. + */ + private final Collection buildLearningQueries() { + final Collection query = new ArrayList(); + final List parameterRows = parmeterList.getParameterRows(); + if (!ParamChecker.isNullOrEmpty(parameterRows)) { + for (ParameterRow parameterRow : parameterRows) { + final DS2Parameter parameterId = + DS2Parameter.fromValue(parameterRow.getLoggerData().getId()); + if (parameterId != null) { + query.add(buildEcuQuery(parameterRow)); + setFlkcTableAddress(parameterRow, parameterId); } + } + } + return query; + } + + /** + * Build a query object for a parameter item. + * @return a new EcuQuery. + */ + private final EcuQuery buildEcuQuery(ParameterRow parameterRow) { + final EcuQuery ecuQuery = + new EcuQueryImpl((EcuData) parameterRow.getLoggerData()); + return ecuQuery; + } + + /** + * Define the start address of the Knock table in RAM base on a Extended + * parameter if defined. + * Also isolate the Knock extended parameter to use the data converter + * when building the Knock table queries. + */ + private final void setFlkcTableAddress( + ParameterRow parameterRow, + DS2Parameter parameterId) { + + switch (parameterId) { + case E99: + flkcAddr = getParameterAddr(parameterRow); + flkc = parameterRow; + break; + default: + break; + } + } + + /** + * Return the parameter's integer address. + */ + private final int getParameterAddr(ParameterRow parameterRow) { + final EcuData ecudata = (EcuData) parameterRow.getLoggerData(); + final String addrStr = ecudata.getAddress().getAddresses()[0]; + final String addrHexStr = addrStr.replaceAll("0x", ""); + return Integer.parseInt(addrHexStr, 16); + } + + /** + * Start populating the vehicle information map with passed values. + */ + private final void buildVehicleInfoMap(EcuDefinition ecuDef) { + vehicleInfo.put("CAL ID", ecuDef.getCalId()); + vehicleInfo.put("ECU ID", ecuDef.getEcuId()); + vehicleInfo.put("Description", + ecuDef.getCarString().replaceAll("BMW ", "")); + } + + /** + * Retrieve the table axis values from the ECU definition. + */ + private final List getTableAxisRanges( + Document document, + EcuDefinition ecuDef, + List tableNames) { + + List tableAxis = new ArrayList(); + for (String tableName : tableNames) { + tableAxis = loadTable(document, ecuDef, tableName); + if (!tableAxis.isEmpty()) { + break; + } + } + return tableAxis; + } + + /** + * Once values from the ECU have been populated add the values to the + * table models datasets. + */ + private final void processEcuQueryResponses(List queries) { + final DS2ParameterCrossReference parameterMap = new DS2ParameterCrossReference(); + final List afLearningBank1 = new ArrayList(); + final List afLearningBank2 = new ArrayList(); + + for (EcuQuery query : queries) { + final DS2Parameter parameterId = + DS2Parameter.fromValue(query.getLoggerData().getId()); + final String paramDesc = parameterMap.getValue(parameterId); + String result = String.format("%.2f %s", + query.getResponse(), + query.getLoggerData().getSelectedConvertor().getUnits()); + switch (parameterId) { + case E99: + break; + case E19: + afLearningBank1.add((Object) "#1"); + afLearningBank1.add((Object) result); + break; + case E21: + afLearningBank1.add((Object) result); + afLearning.add(afLearningBank1); + break; + case E20: + afLearningBank2.add((Object) "#2"); + afLearningBank2.add((Object) result); + break; + case E22: + afLearningBank2.add((Object) result); + afLearning.add(afLearningBank2); + break; + default: + vehicleInfo.put(paramDesc, result); + break; + } + } + } + + /** + * Build a List of EcuQueries to retrieve the axis and scaling of a table. + * A table is found when the storageaddress parameter has been identified. + */ + private final List loadTable( + Document document, + EcuDefinition ecuDef, + String tableName) { + + final List inheritanceList = + EcuDefinitionInheritanceList.getInheritanceList(document, ecuDef); + final Map tableMap = + EcuTableDefinitionHandler.getTableDefinition( + document, + inheritanceList, + tableName); + List tableAxisQuery = new ArrayList(); + if (tableMap.containsKey("storageaddress")) { + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + tableMap.get("storageaddress"), + tableMap.get("storagetype"), + tableMap.get("expression"), + tableMap.get("units"), + tableMap.get("sizey"), + "0x06", "0x00", null, + tableMap.get("endian") + ); + } + return tableAxisQuery; + } + + /** + * Format the range data to be used as table column header values. + */ + private final String[] formatRanges( + Collection axisRanges, + String numberFormat) { + + final List ranges = new ArrayList(); + ranges.add(" "); + double value = 0; + for (EcuQuery ecuQuery : axisRanges) { + value = ecuQuery.getResponse(); + final String range = String.format( + numberFormat, + value); + ranges.add(range); + } + return ranges.toArray(new String[0]); + } + + /** + * Format the RPM range data to be used as Knock table row header values. + */ + private final String[] formatRpmRanges(Collection axisRanges) { + + final List ranges = new ArrayList(); + double value = 0; + for (EcuQuery ecuQuery : axisRanges) { + value = ecuQuery.getResponse(); + final String range = String.format( + "%.0f", value); + ranges.add(range); + } + return ranges.toArray(new String[0]); + } + + /** + * Return a Transport based on its String ID. + */ + private Transport getTransportById(String id) { + for (Transport transport : getTransportMap().keySet()) { + if (transport.getId().equalsIgnoreCase(id)) + return transport; + } + return null; + } + + /** + * Return a Map of Transport and associated Modules for the current protocol. + */ + private Map> getTransportMap() { + return logger.getProtocolList().get(settings.getLoggerProtocol()); + } + + /** + * Return a Module based on its String name. + */ + private Module getModule(String name) { + final Collection modules = getTransportMap().get( + getTransportById(settings.getTransportProtocol())); + for (Module module: modules) { + if (module.getName().equalsIgnoreCase(name)) + return module; + } + return null; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/LearningTableValues.java b/src/main/java/com/romraider/logger/ecu/comms/learning/LearningTableValues.java index 8d51cbbec..6264d3ac3 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/learning/LearningTableValues.java +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/LearningTableValues.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,8 +19,17 @@ package com.romraider.logger.ecu.comms.learning; +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.definition.EcuDefinition; +import com.romraider.logger.ecu.ui.paramlist.ParameterListTableModel; + public interface LearningTableValues { + void init( + EcuLogger logger, + ParameterListTableModel dataTabParamListTableModel, + EcuDefinition ecuDef); + void execute(); } diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/LearningTableValuesFactory.java b/src/main/java/com/romraider/logger/ecu/comms/learning/LearningTableValuesFactory.java new file mode 100644 index 000000000..72a2813a7 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/LearningTableValuesFactory.java @@ -0,0 +1,44 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning; + +import com.romraider.logger.ecu.exception.UnsupportedProtocolException; + +public final class LearningTableValuesFactory { + private LearningTableValuesFactory() { + } + + public static LearningTableValues getManager(String protocol) { + final String className = getClassName(protocol); + try { + final Class cls = Class.forName(className); + return (LearningTableValues) cls.newInstance(); + } catch (Exception e) { + throw new UnsupportedProtocolException(String.format( + "LearningTableValues class for %s not found: %s", + protocol, className)); + } + } + + private static String getClassName(String protocol) { + final Package pkg = LearningTableValuesFactory.class.getPackage(); + return pkg.getName() + "." + protocol.toUpperCase() + "LearningTableValues"; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/LearningTableValuesImpl.java b/src/main/java/com/romraider/logger/ecu/comms/learning/LearningTableValuesImpl.java deleted file mode 100644 index 1ee8c340d..000000000 --- a/src/main/java/com/romraider/logger/ecu/comms/learning/LearningTableValuesImpl.java +++ /dev/null @@ -1,513 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.logger.ecu.comms.learning; - -import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection; -import static javax.swing.JOptionPane.ERROR_MESSAGE; -import static javax.swing.JOptionPane.WARNING_MESSAGE; -import static javax.swing.JOptionPane.showMessageDialog; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.swing.SwingWorker; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -import com.romraider.Settings; -import com.romraider.logger.ecu.EcuLogger; -import com.romraider.logger.ecu.comms.io.connection.LoggerConnection; -import com.romraider.logger.ecu.comms.learning.flkctable.FlkcTableQueryBuilder; -import com.romraider.logger.ecu.comms.learning.parameter.Parameter; -import com.romraider.logger.ecu.comms.learning.parameter.ParameterCrossReference; -import com.romraider.logger.ecu.comms.learning.parameter.ParameterIdComparator; -import com.romraider.logger.ecu.comms.learning.tableaxis.TableAxisQueryParameterSet; -import com.romraider.logger.ecu.comms.manager.PollingStateImpl; -import com.romraider.logger.ecu.comms.query.EcuQuery; -import com.romraider.logger.ecu.comms.query.EcuQueryImpl; -import com.romraider.logger.ecu.definition.EcuData; -import com.romraider.logger.ecu.definition.EcuDefinition; -import com.romraider.logger.ecu.definition.xml.EcuDefinitionDocumentLoader; -import com.romraider.logger.ecu.definition.xml.EcuDefinitionInheritanceList; -import com.romraider.logger.ecu.definition.xml.EcuTableDefinitionHandler; -import com.romraider.logger.ecu.ui.MessageListener; -import com.romraider.logger.ecu.ui.paramlist.ParameterListTableModel; -import com.romraider.logger.ecu.ui.paramlist.ParameterRow; -import com.romraider.logger.ecu.ui.swing.tools.LearningTableValuesResultsPanel; -import com.romraider.util.ParamChecker; -import com.romraider.util.SettingsManager; - -/** - * This class manages the building of ECU queries and retrieving the data to - * populate the table models which will be used by the Learning Table Values - * display panel. - */ -public final class LearningTableValuesImpl extends SwingWorker - implements LearningTableValues { - - private static final Logger LOGGER = - Logger.getLogger(LearningTableValuesImpl.class); - private static final List AF_TABLE_NAMES = Arrays.asList( - "A/F Learning #1 Airflow Ranges", - "A/F Learning #1 Airflow Ranges ", - "A/F Learning Airflow Ranges"); - private static final List FLKC_LOAD_TABLE_NAMES = Arrays.asList( - "Fine Correction Columns (Load)", - "Fine Correction Columns (Load) "); - private static final List FLKC_RPM_TABLE_NAMES = Arrays.asList( - "Fine Correction Rows (RPM)", - "Fine Correction Rows (RPM) "); - private final Map vehicleInfo = - new LinkedHashMap(); - private final List> afLearning = new ArrayList>(); - private final EcuLogger logger; - private final Settings settings; - private final MessageListener messageListener; - private final ParameterListTableModel parmeterList; - private final EcuDefinition ecuDef; - private ParameterRow flkc; - private int flkcAddr; - - public LearningTableValuesImpl( - EcuLogger logger, - ParameterListTableModel dataTabParamListTableModel, - EcuDefinition ecuDef) { - - ParamChecker.checkNotNull(logger, "EcuLogger"); - ParamChecker.checkNotNull(dataTabParamListTableModel, - "ParameterListTableModel"); - this.logger = logger; - this.settings = logger.getSettings(); - this.messageListener = logger; - this.parmeterList = dataTabParamListTableModel; - this.ecuDef = ecuDef; - this.flkc = null; - this.flkcAddr = 0; - } - - @Override - public final Void doInBackground() { - Document document = null; - if (ecuDef.getEcuDefFile() == null) { - showMessageDialog(logger, - "ECU definition file not found or undefined. Learning\n" + - "Table Values cannot be properly retrieved until an ECU\n" + - "defintion is defined in the Editor's Definition Manager.", - "ECU Defintion Missing", WARNING_MESSAGE); - return null; - } - else { - document = EcuDefinitionDocumentLoader.getDocument(ecuDef); - } - - final String transport = settings.getTransportProtocol(); - if (settings.isCanBus()) { - settings.setTransportProtocol("ISO9141"); - } - final boolean logging = logger.isLogging(); - if (logging) logger.stopLogging(); - - String message = "Retrieving vehicle info & A/F values..."; - messageListener.reportMessage(message); - buildVehicleInfoMap(ecuDef); - - try { - LoggerConnection connection = getConnection( - settings.getLoggerProtocol(), settings.getLoggerPort(), - settings.getLoggerConnectionProperties()); - try { - Collection queries = buildLearningQueries(); - - LOGGER.info(message); - connection.sendAddressReads( - queries, - (byte) 0x10, - new PollingStateImpl()); - LOGGER.info("Current vehicle info & A/F values retrieved."); - - Collections.sort( - (List)queries, new ParameterIdComparator()); - - processEcuQueryResponses((List) queries); - - message = "Retrieving A/F Learning ranges..."; - messageListener.reportMessage(message); - String[] afRanges = new String[0]; - queries.clear(); - queries = getTableAxisRanges(document, ecuDef, AF_TABLE_NAMES); - if (queries != null && !queries.isEmpty()) { - LOGGER.info(message); - connection.sendAddressReads( - queries, - (byte) 0x10, - new PollingStateImpl()); - LOGGER.info("A/F Learning ranges retrieved."); - afRanges = formatRanges(queries, "%.2f"); - } - - message = "Retrieving FLKC Load ranges..."; - messageListener.reportMessage(message); - String[] flkcLoad = new String[0]; - queries.clear(); - queries = getTableAxisRanges(document, ecuDef, FLKC_LOAD_TABLE_NAMES); - if (queries != null && !queries.isEmpty()) { - LOGGER.info(message); - connection.sendAddressReads( - queries, - (byte) 0x10, - new PollingStateImpl()); - LOGGER.info("FLKC Load ranges retrieved."); - flkcLoad = formatRanges(queries, "%.2f"); - } - - message = "Retrieving FLKC RPM ranges..."; - messageListener.reportMessage(message); - String[] flkcRpm = new String[0]; - queries.clear(); - queries = getTableAxisRanges(document, ecuDef, FLKC_RPM_TABLE_NAMES); - if (queries != null && !queries.isEmpty()) { - LOGGER.info(message); - connection.sendAddressReads( - queries, - (byte) 0x10, - new PollingStateImpl()); - LOGGER.info("FLKC RPM ranges retrieved."); - flkcRpm = formatRpmRanges(queries); - } - - List> flkcQueryGroups = new ArrayList>(); - if (flkc != null) { - flkcQueryGroups = new FlkcTableQueryBuilder().build( - flkc, - flkcAddr, - flkcRpm.length, - flkcLoad.length - 1); - - for (int i = 0; i < flkcQueryGroups.size(); i++) { - queries.clear(); - for (int j = 0; j < flkcQueryGroups.get(i).size(); j++) { - if (flkcQueryGroups.get(i).get(j) != null) { - queries.add(flkcQueryGroups.get(i).get(j)); - } - } - message = String.format("Retrieving FLKC row %d values...", i); - messageListener.reportMessage(message); - LOGGER.info(message); - connection.sendAddressReads( - queries, - (byte) 0x10, - new PollingStateImpl()); - LOGGER.info("FLKC row " + i + " values retrieved."); - } - } - else { - message = String.format("Error retrieving FLKC data values, missing FLKC reference"); - messageListener.reportMessage(message); - LOGGER.error(message); - } - - messageListener.reportMessage( - "Learning Table Values retrieved successfully."); - final LearningTableValuesResultsPanel results = - new LearningTableValuesResultsPanel( - logger, vehicleInfo, - afRanges, afLearning, - flkcLoad, flkcRpm, flkcQueryGroups); - results.displayLearningResultsPanel(); - } - finally { - connection.close(); - SettingsManager.getSettings().setTransportProtocol(transport); - if (logging) logger.startLogging(); - } - } - catch (Exception e) { - messageListener.reportError( - "Unable to retrieve current ECU learning values"); - LOGGER.error(message + " Error retrieving values", e); - showMessageDialog(logger, - message + - "\nError performing Learning Table Values read.\n" + - "Check the following:\n" + - "* Logger has successfully conencted to the ECU\n" + - "* Correct COM port is selected (if not Openport 2)\n" + - "* Cable is connected properly\n* Ignition is ON\n", - "Learning Table Values", - ERROR_MESSAGE); - } - return null; - } - - /** - * Build a collection of queries based on the initialized values of - * parameters defined for this ECU. Also identify the IAM and FLKC - * parameters used to locate and calculate the FLKC table. - * @return the supported parameter list filtered for only the Learning Table - * Value parameters needed. - */ - private final Collection buildLearningQueries() { - final Collection query = new ArrayList(); - final List parameterRows = parmeterList.getParameterRows(); - if (!ParamChecker.isNullOrEmpty(parameterRows)) { - for (ParameterRow parameterRow : parameterRows) { - final Parameter parameterId = - Parameter.fromValue(parameterRow.getLoggerData().getId()); - if (parameterId != null) { - query.add(buildEcuQuery(parameterRow)); - setFlkcTableAddress(parameterRow, parameterId); } - } - } - return query; - } - - /** - * Build a query object for a parameter item. - * @return a new EcuQuery. - */ - private final EcuQuery buildEcuQuery(ParameterRow parameterRow) { - final EcuQuery ecuQuery = - new EcuQueryImpl((EcuData) parameterRow.getLoggerData()); - return ecuQuery; - } - - /** - * Define the start address of the FLKC table in RAM base on a Extended - * parameter if defined. - * Also isolate the FLKC extended parameter to use the data converter - * when building the FLKC table queries. - */ - private final void setFlkcTableAddress( - ParameterRow parameterRow, - Parameter parameterId) { - - switch (parameterId) { - case E1: - if (flkcAddr == 0) { - flkcAddr = getParameterAddr(parameterRow) + 0x02; - } - break; - case E31: - if (flkcAddr == 0) { - flkcAddr = getParameterAddr(parameterRow) + 0x14; - } - break; - case E12: - case E41: - if (flkc == null) { - flkc = parameterRow; - } - break; - case E173: - flkcAddr = getParameterAddr(parameterRow); - flkc = parameterRow; - break; - default: - break; - } - } - - /** - * Return the parameter's integer address. - */ - private final int getParameterAddr(ParameterRow parameterRow) { - final EcuData ecudata = (EcuData) parameterRow.getLoggerData(); - final String addrStr = ecudata.getAddress().getAddresses()[0]; - final String addrHexStr = addrStr.replaceAll("0x", ""); - return Integer.parseInt(addrHexStr, 16); - } - - /** - * Start populating the vehicle information map with passed values. - */ - private final void buildVehicleInfoMap(EcuDefinition ecuDef) { - vehicleInfo.put("CAL ID", ecuDef.getCalId()); - vehicleInfo.put("ECU ID", ecuDef.getEcuId()); - vehicleInfo.put("Description", - ecuDef.getCarString().replaceAll("Subaru ", "")); - } - - /** - * Retrieve the table axis values from the ECU definition. First try the - * 4-cyl table names, if still empty try the 6-cyl table name. - */ - private final List getTableAxisRanges( - Document document, - EcuDefinition ecuDef, - List tableNames) { - - List tableAxis = new ArrayList(); - for (String tableName : tableNames) { - tableAxis = loadTable(document, ecuDef, tableName); - if (!tableAxis.isEmpty()) { - break; - } - } - return tableAxis; - } - - /** - * Once values from the ECU have been populated add the values to the - * table models datasets. - */ - private final void processEcuQueryResponses(List queries) { - final ParameterCrossReference parameterMap = new ParameterCrossReference(); - final List afLearningBank1 = new ArrayList(); - final List afLearningBank2 = new ArrayList(); - - for (EcuQuery query : queries) { - final Parameter parameterId = - Parameter.fromValue(query.getLoggerData().getId()); - final String paramDesc = parameterMap.getValue(parameterId); - String result = String.format("%.2f %s", - query.getResponse(), - query.getLoggerData().getSelectedConvertor().getUnits()); - switch (parameterId) { - case E1: - result = String.format("%.0f", query.getResponse()); - vehicleInfo.put(paramDesc, result); - break; - case E31: - result = String.format("%.3f", query.getResponse()); - vehicleInfo.put(paramDesc, result); - break; - case E12: - case E41: - case E173: - break; - case E13: - case E44: - afLearningBank1.add((Object) "#1"); - afLearningBank1.add((Object) result); - break; - case E14: - case E45: - case E15: - case E46: - afLearningBank1.add((Object) result); - break; - case E16: - case E47: - afLearningBank1.add((Object) result); - afLearning.add(afLearningBank1); - break; - case E62: - afLearningBank2.add((Object) "#2"); - afLearningBank2.add((Object) result); - break; - case E63: - case E64: - afLearningBank2.add((Object) result); - break; - case E65: - afLearningBank2.add((Object) result); - afLearning.add(afLearningBank2); - break; - default: - vehicleInfo.put(paramDesc, result); - break; - } - } - } - - /** - * Build a List of EcuQueries to retrieve the axis and scaling of a table. - * A table is found when the storageaddress parameter has been identified. - */ - private final List loadTable( - Document document, - EcuDefinition ecuDef, - String tableName) { - - final List inheritanceList = - EcuDefinitionInheritanceList.getInheritanceList(document, ecuDef); - final Map tableMap = - EcuTableDefinitionHandler.getTableDefinition( - document, - inheritanceList, - tableName); - List tableAxisQuery = new ArrayList(); - if (tableMap.containsKey("storageaddress")) { - tableAxisQuery = TableAxisQueryParameterSet.build( - tableMap.get("storageaddress"), - tableMap.get("storagetype"), - tableMap.get("expression"), - tableMap.get("units"), - tableMap.get("sizey") - ); - } - return tableAxisQuery; - } - - /** - * Format the range data to be used as table column header values. - */ - private final String[] formatRanges( - Collection axisRanges, - String numberFormat) { - - final List ranges = new ArrayList(); - ranges.add(" "); - double rangeMin = 0; - double rangeMax = 0; - for (EcuQuery ecuQuery : axisRanges) { - rangeMax = ecuQuery.getResponse() - 0.01; - final String range = String.format( - numberFormat + " - " + numberFormat, - rangeMin, - rangeMax); - ranges.add(range); - rangeMin = ecuQuery.getResponse(); - rangeMax = ecuQuery.getResponse(); - } - final String range = String.format(numberFormat + "+", rangeMax); - ranges.add(range); - return ranges.toArray(new String[0]); - } - - /** - * Format the RPM range data to be used as FLKC table row header values. - */ - private final String[] formatRpmRanges(Collection axisRanges) { - - final List ranges = new ArrayList(); - double rangeMin = 0; - double rangeMax = 0; - for (EcuQuery ecuQuery : axisRanges) { - rangeMax = ecuQuery.getResponse() - 1; - final String range = String.format( - "%.0f - %.0f", - rangeMin, - rangeMax); - ranges.add(range); - rangeMin = ecuQuery.getResponse(); - rangeMax = ecuQuery.getResponse(); - } - final String range = String.format("%.0f+", rangeMax); - ranges.add(range); - return ranges.toArray(new String[0]); - } -} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/NCSLearningTableValues.java b/src/main/java/com/romraider/logger/ecu/comms/learning/NCSLearningTableValues.java new file mode 100644 index 000000000..650573fc4 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/NCSLearningTableValues.java @@ -0,0 +1,584 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning; + +import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection; +import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.ResourceBundle; + +import javax.swing.SwingWorker; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import com.romraider.Settings; +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.comms.io.connection.LoggerConnection; +import com.romraider.logger.ecu.comms.learning.parameter.NCSParameter; +import com.romraider.logger.ecu.comms.learning.parameter.NCSParameterCrossReference; +import com.romraider.logger.ecu.comms.learning.parameter.ParameterIdComparator; +import com.romraider.logger.ecu.comms.learning.tableaxis.NCSTableAxisQueryParameterSet; +import com.romraider.logger.ecu.comms.learning.tables.NCSLtftTableQueryBuilder; +import com.romraider.logger.ecu.comms.manager.PollingStateImpl; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryImpl; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.EcuDefinition; +import com.romraider.logger.ecu.definition.xml.EcuDefinitionDocumentLoader; +import com.romraider.logger.ecu.definition.xml.EcuDefinitionInheritanceList; +import com.romraider.logger.ecu.definition.xml.EcuTableDefinitionHandler; +import com.romraider.logger.ecu.ui.MessageListener; +import com.romraider.logger.ecu.ui.paramlist.ParameterListTableModel; +import com.romraider.logger.ecu.ui.paramlist.ParameterRow; +import com.romraider.logger.ecu.ui.swing.tools.NCSLearningTableValuesResultsPanel; +import com.romraider.util.ParamChecker; +import com.romraider.util.ResourceUtil; + + +/** + * This class manages the building of ECU queries and retrieving the data to + * populate the table models which will be used by the Learning Table Values + * display panel. + */ +public final class NCSLearningTableValues extends SwingWorker + implements LearningTableValues { + + private static final Logger LOGGER = + Logger.getLogger(NCSLearningTableValues.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + NCSLearningTableValues.class.getName()); + private static final List AF_TABLE_NAMES = Arrays.asList( + "A/F Learning #1 Airflow Ranges", + "A/F Learning #1 Airflow Ranges ", + "A/F Learning Airflow Ranges"); + // LTFT table column and row names can be overridden in the + // ./customize/ncslearning.properties file + private static List LTFT_TABLE_COLUMN_NAMES = Arrays.asList( + "Learning map TP shaft lattice point table"); + private static List LTFT_TABLE_ROW_NAMES = Arrays.asList( + "Learning map N shaft lattice point table"); + private final Map vehicleInfo = + new LinkedHashMap(); + private final List> afLearning = new ArrayList>(); + private EcuLogger logger; + private Settings settings; + private MessageListener messageListener; + private ParameterListTableModel parmeterList; + private EcuDefinition ecuDef; + private ParameterRow ltftTrim; + private int ltftTrimAddr; + private ParameterRow ltftCnt; + private int ltftCntAddr; + + public NCSLearningTableValues() {} + + @Override + public void init( + EcuLogger logger, + ParameterListTableModel dataTabParamListTableModel, + EcuDefinition ecuDef) { + + ParamChecker.checkNotNull(logger, "EcuLogger"); + ParamChecker.checkNotNull(dataTabParamListTableModel, + "ParameterListTableModel"); + this.logger = logger; + this.settings = logger.getSettings(); + this.messageListener = logger; + this.parmeterList = dataTabParamListTableModel; + this.ecuDef = ecuDef; + this.ltftTrim = null; + this.ltftTrimAddr = 0; + this.ltftCnt = null; + this.ltftCntAddr = 0; + loadProperties(); + } + + @Override + public final Void doInBackground() { + Document document = null; + if (ecuDef.getEcuDefFile() == null) { + showMessageDialog(logger, + rb.getString("DEFNOTFOUND"), + rb.getString("DEFMISSING"), WARNING_MESSAGE); + return null; + } + else { + document = EcuDefinitionDocumentLoader.getDocument(ecuDef); + } + + final boolean logging = logger.isLogging(); + if (logging) logger.stopLogging(); + + String message = rb.getString("GETLTFTVALUES"); + messageListener.reportMessage(message); + buildVehicleInfoMap(ecuDef); + + try { + LoggerConnection connection = getConnection( + settings.getLoggerProtocol(), settings.getLoggerPort(), + settings.getLoggerConnectionProperties()); + try { + Collection queries = buildLearningQueries(); + // Break queries into two sets to avoid the ECU packet limit + int setSize = queries.size() / 2; + Collection querySet1 = new ArrayList(); + Collection querySet2 = new ArrayList(); + int s = 0; + for (EcuQuery q : queries) { + if (s < setSize) { + querySet1.add(q); + } + else { + querySet2.add(q); + } + s++; + } + if (LOGGER.isTraceEnabled()) + LOGGER.trace( + String.format( + "Queries:%d, Set size:%d, Set 1 size:%d, Set 2 size:%d", + queries.size(), setSize, querySet1.size(), querySet2.size())); + + LOGGER.info("Retrieving vehicle info & LTFT values ..."); + connection.sendAddressReads( + querySet1, + settings.getDestinationTarget(), + new PollingStateImpl()); + connection.sendAddressReads( + querySet2, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("Current vehicle info & LTFT values retrieved."); + + Collections.sort( + (List)queries, new ParameterIdComparator()); + + processEcuQueryResponses((List) queries); + + //TODO: afRanges to be replaced with Knock tables once known how they operate + String[] afRanges = new String[0]; + + message = rb.getString("GETCOLRANGES"); + messageListener.reportMessage(message); + String[] ltftCol = new String[0]; + queries.clear(); + queries = getTableAxisRanges(document, ecuDef, LTFT_TABLE_COLUMN_NAMES); + if (queries != null && !queries.isEmpty()) { + LOGGER.info("Retrieving LTFT column ranges ..."); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("LTFT column ranges retrieved."); + ltftCol = formatRanges(queries, "%.2f"); + } + + message = rb.getString("GETROWRANGES"); + messageListener.reportMessage(message); + String[] ltftRow = new String[0]; + queries.clear(); + queries = getTableAxisRanges(document, ecuDef, LTFT_TABLE_ROW_NAMES); + if (queries != null && !queries.isEmpty()) { + LOGGER.info("Retrieving LTFT row ranges ..."); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("LTFT row ranges retrieved."); + ltftRow = formatRpmRanges(queries); + } + + List>> ltftQueryTables = new ArrayList>>(); + List> ltftQueryGroups = new ArrayList>(); + if (ltftTrim != null) { + for (int k = 0; k < 256; k += 128) { + ltftQueryGroups = new NCSLtftTableQueryBuilder().build( + ltftTrim, + ltftTrimAddr + k, + ltftRow.length, + ltftCol.length - 1); + ltftQueryTables.add(ltftQueryGroups); + + for (int i = 0; i < ltftQueryGroups.size(); i++) { + queries.clear(); + for (int j = 0; j < ltftQueryGroups.get(i).size(); j++) { + if (ltftQueryGroups.get(i).get(j) != null) { + queries.add(ltftQueryGroups.get(i).get(j)); + } + } + message = MessageFormat.format( + rb.getString("GETTABLELTFT"), + (k/128+1), i); + messageListener.reportMessage(message); + LOGGER.info(String.format( + "Retrieving Table %d LTFT row %d values ...", + (k/128+1), i)); + setSize = queries.size() / 2; + querySet1 = new ArrayList(); + querySet2 = new ArrayList(); + s = 0; + for (EcuQuery q : queries) { + if (s < setSize) { + querySet1.add(q); + } + else { + querySet2.add(q); + } + s++; + } + if (LOGGER.isTraceEnabled()) + LOGGER.trace( + String.format( + "Queries:%d, Set size:%d, Set 1 size:%d, Set 2 size:%d", + queries.size(), setSize, querySet1.size(), querySet2.size())); + + connection.sendAddressReads( + querySet1, + settings.getDestinationTarget(), + new PollingStateImpl()); + connection.sendAddressReads( + querySet2, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info(String.format( + "Table %d row %d LTFT values retrieved.", + (k/128+1), i)); + queries.clear(); + } + } + } + else { + message = rb.getString("ERRTABLELTFT"); + messageListener.reportMessage(message); + LOGGER.error("Error retrieving LTFT data values, missing LTFT reference"); + } + if (ltftCnt != null) { + for (int k = 0; k < 128; k += 64) { + ltftQueryGroups = new NCSLtftTableQueryBuilder().build( + ltftCnt, + ltftCntAddr + k, + ltftRow.length, + ltftCol.length - 1); + ltftQueryTables.add(ltftQueryGroups); + + for (int i = 0; i < ltftQueryGroups.size(); i++) { + queries.clear(); + for (int j = 0; j < ltftQueryGroups.get(i).size(); j++) { + if (ltftQueryGroups.get(i).get(j) != null) { + queries.add(ltftQueryGroups.get(i).get(j)); + } + } + message = MessageFormat.format( + rb.getString("GETTABLELTFT"), + (k/64+3), i); + messageListener.reportMessage(message); + LOGGER.info(String.format("Retrieving Table %d LTFT row %d values...", + (k/64+3), i)); + setSize = queries.size() / 2; + querySet1 = new ArrayList(); + querySet2 = new ArrayList(); + s = 0; + for (EcuQuery q : queries) { + if (s < setSize) { + querySet1.add(q); + } + else { + querySet2.add(q); + } + s++; + } + if (LOGGER.isTraceEnabled()) + LOGGER.trace( + String.format("Queries:%d, Set size:%d, Set 1 size:%d, Set 2 size:%d", + queries.size(), setSize, querySet1.size(), querySet2.size())); + + connection.sendAddressReads( + querySet1, + settings.getDestinationTarget(), + new PollingStateImpl()); + connection.sendAddressReads( + querySet2, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info(String.format("Table %d row %d LTFT values retrieved.", + (k/64+3), i)); + queries.clear(); + } + } + } + else { + message = rb.getString("ERRTABLELTFT"); + messageListener.reportMessage(message); + LOGGER.error("Error retrieving LTFT data values, missing LTFT reference"); + } + + messageListener.reportMessage( + rb.getString("LTFTSUCCESS")); + final NCSLearningTableValuesResultsPanel results = + new NCSLearningTableValuesResultsPanel( + logger, vehicleInfo, + afRanges, afLearning, + ltftCol, ltftRow, ltftQueryTables); + results.displayLearningResultsPanel(); + } + finally { + connection.close(); +// settings.setTransportProtocol(transport); +// settings.setDestinationTarget(module); + if (logging) logger.startLogging(); + } + } + catch (Exception e) { + messageListener.reportError( + rb.getString("ERRLTFT")); + LOGGER.error(message + " Error retrieving values", e); + showMessageDialog(logger, + MessageFormat.format( + rb.getString("ERRCONNECT"), message), + rb.getString("LTV"), + ERROR_MESSAGE); + } + return null; + } + + /** + * Build a collection of queries based on the initialized values of + * parameters defined for this ECU. Also identify the LTFT Trim and Count + * parameters used to locate the LTFT tables. + * @return the supported parameter list filtered for only the Learning Table + * Value parameters needed. + */ + private final Collection buildLearningQueries() { + final Collection query = new ArrayList(); + final List parameterRows = parmeterList.getParameterRows(); + if (!ParamChecker.isNullOrEmpty(parameterRows)) { + for (ParameterRow parameterRow : parameterRows) { + final NCSParameter parameterId = + NCSParameter.fromValue(parameterRow.getLoggerData().getId()); + if (parameterId != null) { + switch (parameterId) { + case E173: + ltftTrimAddr = getParameterAddr(parameterRow); + ltftTrim = parameterRow; + break; + case E174: + ltftCntAddr = getParameterAddr(parameterRow); + ltftCnt = parameterRow; + break; + default: + query.add(buildEcuQuery(parameterRow)); + break; + } + } + } + } + return query; + } + + /** + * Build a query object for a parameter item. + * @return a new EcuQuery. + */ + private final EcuQuery buildEcuQuery(ParameterRow parameterRow) { + final EcuQuery ecuQuery = + new EcuQueryImpl((EcuData) parameterRow.getLoggerData()); + return ecuQuery; + } + + /** + * Return the parameter's integer address. + */ + private final int getParameterAddr(ParameterRow parameterRow) { + final EcuData ecudata = (EcuData) parameterRow.getLoggerData(); + final String addrStr = ecudata.getAddress().getAddresses()[0]; + final String addrHexStr = addrStr.replaceAll("0x", ""); + return Integer.parseInt(addrHexStr, 16); + } + + /** + * Start populating the vehicle information map with passed values. + */ + private final void buildVehicleInfoMap(EcuDefinition ecuDef) { + vehicleInfo.put("CAL ID", ecuDef.getCalId()); + vehicleInfo.put("ECU ID", ecuDef.getEcuId()); + vehicleInfo.put("Description", + ecuDef.getCarString().replaceAll("Nissan ", "")); + } + + /** + * Retrieve the table axis values from the ECU definition. First try the + * 4-cyl table names, if still empty try the 6-cyl table name. + */ + private final List getTableAxisRanges( + Document document, + EcuDefinition ecuDef, + List tableNames) { + + List tableAxis = new ArrayList(); + for (String tableName : tableNames) { + tableAxis = loadTable(document, ecuDef, tableName); + if (!tableAxis.isEmpty()) { + break; + } + } + return tableAxis; + } + + /** + * Once values from the ECU have been populated add the values to the + * table models datasets. + */ + private final void processEcuQueryResponses(List queries) { + final NCSParameterCrossReference parameterMap = new NCSParameterCrossReference(); + + for (EcuQuery query : queries) { + final NCSParameter parameterId = + NCSParameter.fromValue(query.getLoggerData().getId()); + final String paramDesc = parameterMap.getValue(parameterId); + String result = String.format("%.2f %s", + query.getResponse(), + query.getLoggerData().getSelectedConvertor().getUnits()); + switch (parameterId) { + default: + vehicleInfo.put(paramDesc, result); + break; + } + } + } + + /** + * Build a List of EcuQueries to retrieve the axis and scaling of a table. + * A table is found when the storageaddress parameter has been identified. + */ + private final List loadTable( + Document document, + EcuDefinition ecuDef, + String tableName) { + + final List inheritanceList = + EcuDefinitionInheritanceList.getInheritanceList(document, ecuDef); + final Map tableMap = + EcuTableDefinitionHandler.getTableDefinition( + document, + inheritanceList, + tableName); + List tableAxisQuery = new ArrayList(); + if (tableMap.containsKey("storageaddress")) { + tableAxisQuery = NCSTableAxisQueryParameterSet.build( + tableMap.get("storageaddress"), + tableMap.get("storagetype"), + tableMap.get("expression"), + tableMap.get("units"), + tableMap.get("sizey") + ); + } + return tableAxisQuery; + } + + /** + * Format the range data to be used as table column header values. + */ + private final String[] formatRanges( + Collection axisRanges, + String numberFormat) { + + final List ranges = new ArrayList(); + ranges.add(" "); + double value = 0; + for (EcuQuery ecuQuery : axisRanges) { + value = ecuQuery.getResponse(); + final String range = String.format( + numberFormat, + value); + ranges.add(range); + } + return ranges.toArray(new String[0]); + } + + /** + * Format the RPM range data to be used as FLKC table row header values. + */ + private final String[] formatRpmRanges(Collection axisRanges) { + + final List ranges = new ArrayList(); + double value = 0; + for (EcuQuery ecuQuery : axisRanges) { + value = ecuQuery.getResponse(); + final String range = String.format( + "%.0f", value); + ranges.add(range); + } + return ranges.toArray(new String[0]); + } + + /** + * Load ECU def table names from a user customized properties file. + * The file will replace the Class defined names if it is present. + * Names in the file should be separated by the : character + * @exception FileNotFoundException if the directory or file is not present + * @exception IOException if there's some kind of IO error + */ + private void loadProperties() { + final Properties learning = new Properties(); + FileInputStream propFile; + try { + propFile = new FileInputStream("./customize/ncslearning.properties"); + learning.load(propFile); + final String ltft_table_column_names = + learning.getProperty("ltft_table_column_names"); + String[] names = ltft_table_column_names.split(":", 0); + LTFT_TABLE_COLUMN_NAMES = new ArrayList(); + for (String name : names) { + if (ParamChecker.isNullOrEmpty(name)) continue; + LTFT_TABLE_COLUMN_NAMES.add(name); + } + final String ltft_table_row_names = + learning.getProperty("ltft_table_row_names"); + names = ltft_table_row_names.split(":", 0); + LTFT_TABLE_ROW_NAMES = new ArrayList(); + for (String name : names) { + if (ParamChecker.isNullOrEmpty(name)) continue; + LTFT_TABLE_ROW_NAMES.add(name); + } + propFile.close(); + LOGGER.info("NCSLearningTableValues loaded table names from file: ./customize/ncslearning.properties"); + } catch (FileNotFoundException e) { + LOGGER.error("NCSLearningTableValues properties file: " + e.getLocalizedMessage()); + } catch (IOException e) { + LOGGER.error("NCSLearningTableValues IOException: " + e.getLocalizedMessage()); + } + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/SSMLearningTableValues.java b/src/main/java/com/romraider/logger/ecu/comms/learning/SSMLearningTableValues.java new file mode 100644 index 000000000..612d53e03 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/SSMLearningTableValues.java @@ -0,0 +1,622 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning; + +import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection; +import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.ResourceBundle; + +import javax.swing.SwingWorker; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import com.romraider.Settings; +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.comms.io.connection.LoggerConnection; +import com.romraider.logger.ecu.comms.learning.parameter.SSMParameter; +import com.romraider.logger.ecu.comms.learning.parameter.SSMParameterCrossReference; +import com.romraider.logger.ecu.comms.learning.parameter.ParameterIdComparator; +import com.romraider.logger.ecu.comms.learning.tableaxis.SSMTableAxisQueryParameterSet; +import com.romraider.logger.ecu.comms.learning.tables.SSMFlkcTableQueryBuilder; +import com.romraider.logger.ecu.comms.manager.PollingStateImpl; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryImpl; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.EcuDefinition; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.definition.Transport; +import com.romraider.logger.ecu.definition.xml.EcuDefinitionDocumentLoader; +import com.romraider.logger.ecu.definition.xml.EcuDefinitionInheritanceList; +import com.romraider.logger.ecu.definition.xml.EcuTableDefinitionHandler; +import com.romraider.logger.ecu.ui.MessageListener; +import com.romraider.logger.ecu.ui.paramlist.ParameterListTableModel; +import com.romraider.logger.ecu.ui.paramlist.ParameterRow; +import com.romraider.logger.ecu.ui.swing.tools.SSMLearningTableValuesResultsPanel; +import com.romraider.util.ParamChecker; +import com.romraider.util.ResourceUtil; + +/** + * This class manages the building of ECU queries and retrieving the data to + * populate the table models which will be used by the Learning Table Values + * display panel. + */ +public final class SSMLearningTableValues extends SwingWorker + implements LearningTableValues { + + private static final Logger LOGGER = + Logger.getLogger(SSMLearningTableValues.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + SSMLearningTableValues.class.getName()); + private static List AF_TABLE_NAMES = Arrays.asList( + "A/F Learning #1 Airflow Ranges", + "A/F Learning #1 Airflow Ranges ", + "A/F Learning Airflow Ranges"); + private static List FLKC_LOAD_TABLE_NAMES = Arrays.asList( + "Fine Correction Columns (Load)", + "Fine Correction Columns (Load) "); + private static List FLKC_RPM_TABLE_NAMES = Arrays.asList( + "Fine Correction Rows (RPM)", + "Fine Correction Rows (RPM) "); + private final Map vehicleInfo = + new LinkedHashMap(); + private final List> afLearning = new ArrayList>(); + private EcuLogger logger; + private Settings settings; + private MessageListener messageListener; + private ParameterListTableModel parmeterList; + private EcuDefinition ecuDef; + private ParameterRow flkc; + private int flkcAddr; + + public SSMLearningTableValues() {} + + @Override + public void init( + EcuLogger logger, + ParameterListTableModel dataTabParamListTableModel, + EcuDefinition ecuDef) { + + ParamChecker.checkNotNull(logger, "EcuLogger"); + ParamChecker.checkNotNull(dataTabParamListTableModel, + "ParameterListTableModel"); + this.logger = logger; + this.settings = logger.getSettings(); + this.messageListener = logger; + this.parmeterList = dataTabParamListTableModel; + this.ecuDef = ecuDef; + this.flkc = null; + this.flkcAddr = 0; + loadProperties(); + } + + @Override + public final Void doInBackground() { + Document document = null; + if (ecuDef.getEcuDefFile() == null) { + showMessageDialog(logger, + rb.getString("DEFNOTFOUND"), + rb.getString("DEFMISSING"), + WARNING_MESSAGE); + return null; + } + else { + document = EcuDefinitionDocumentLoader.getDocument(ecuDef); + } + + final String transport = settings.getTransportProtocol(); + final Module module = settings.getDestinationTarget(); + if (settings.isCanBus()) { + settings.setTransportProtocol("ISO9141"); + final Module ecuModule = getModule("ECU"); + settings.setDestinationTarget(ecuModule); + } + final boolean logging = logger.isLogging(); + if (logging) logger.stopLogging(); + + String message = rb.getString("GETAFVALUES"); + messageListener.reportMessage(message); + buildVehicleInfoMap(ecuDef); + + try { + LoggerConnection connection = getConnection( + settings.getLoggerProtocol(), settings.getLoggerPort(), + settings.getLoggerConnectionProperties()); + try { + Collection queries = buildLearningQueries(); + // Break queries into two sets to avoid the ECU packet limit + final int setSize = queries.size() / 2; + final Collection querySet1 = new ArrayList(); + final Collection querySet2 = new ArrayList(); + int s = 0; + for (EcuQuery q : queries) { + if (s < setSize) { + querySet1.add(q); + } + else { + querySet2.add(q); + } + s++; + } + if (LOGGER.isTraceEnabled()) + LOGGER.trace( + String.format("Queries:%d, Set size:%d, Set 1 size:%d, Set 2 size:%d", + queries.size(), setSize, querySet1.size(), querySet2.size())); + + LOGGER.info(message); + connection.sendAddressReads( + querySet1, + settings.getDestinationTarget(), + new PollingStateImpl()); + connection.sendAddressReads( + querySet2, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("Current vehicle info & A/F values retrieved."); + + Collections.sort( + (List)queries, new ParameterIdComparator()); + + processEcuQueryResponses((List) queries); + + message = rb.getString("GETAFSUCCESS"); + messageListener.reportMessage(message); + String[] afRanges = new String[0]; + queries.clear(); + queries = getTableAxisRanges(document, ecuDef, AF_TABLE_NAMES); + if (queries != null && !queries.isEmpty()) { + LOGGER.info(message); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("A/F Learning ranges retrieved."); + afRanges = formatRanges(queries, "%.2f"); + } + + message = rb.getString("GETKNOCKRANGES"); + messageListener.reportMessage(message); + String[] flkcLoad = new String[0]; + queries.clear(); + queries = getTableAxisRanges(document, ecuDef, FLKC_LOAD_TABLE_NAMES); + if (queries != null && !queries.isEmpty()) { + LOGGER.info(message); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("FLKC Load ranges retrieved."); + flkcLoad = formatRanges(queries, "%.2f"); + } + + message = rb.getString("GETRPMRANGES"); + messageListener.reportMessage(message); + String[] flkcRpm = new String[0]; + queries.clear(); + queries = getTableAxisRanges(document, ecuDef, FLKC_RPM_TABLE_NAMES); + if (queries != null && !queries.isEmpty()) { + LOGGER.info(message); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("FLKC RPM ranges retrieved."); + flkcRpm = formatRpmRanges(queries); + } + + List> flkcQueryGroups = new ArrayList>(); + if (flkc != null) { + flkcQueryGroups = new SSMFlkcTableQueryBuilder().build( + flkc, + flkcAddr, + flkcRpm.length, + flkcLoad.length - 1); + + for (int i = 0; i < flkcQueryGroups.size(); i++) { + queries.clear(); + for (int j = 0; j < flkcQueryGroups.get(i).size(); j++) { + if (flkcQueryGroups.get(i).get(j) != null) { + queries.add(flkcQueryGroups.get(i).get(j)); + } + } + message = MessageFormat.format(rb.getString("GETKNOCKROW"), i); + messageListener.reportMessage(message); + LOGGER.info(message); + connection.sendAddressReads( + queries, + settings.getDestinationTarget(), + new PollingStateImpl()); + LOGGER.info("FLKC row " + i + " values retrieved."); + } + } + else { + message = rb.getString("ERRTABLEKNOCK"); + messageListener.reportMessage(message); + LOGGER.error(message); + } + + messageListener.reportMessage(rb.getString("LTVSUCCESS")); + final SSMLearningTableValuesResultsPanel results = + new SSMLearningTableValuesResultsPanel( + logger, vehicleInfo, + afRanges, afLearning, + flkcLoad, flkcRpm, flkcQueryGroups); + results.displayLearningResultsPanel(); + } + finally { + connection.close(); + settings.setTransportProtocol(transport); + settings.setDestinationTarget(module); + if (logging) logger.startLogging(); + } + } + catch (Exception e) { + messageListener.reportError(rb.getString("ERRLTV")); + LOGGER.error(message + " Error retrieving values", e); + showMessageDialog(logger, + MessageFormat.format( + rb.getString("ERRCONNECT"), message), + rb.getString("LTV"), + ERROR_MESSAGE); + } + return null; + } + + /** + * Build a collection of queries based on the initialized values of + * parameters defined for this ECU. Also identify the IAM and FLKC + * parameters used to locate and calculate the FLKC table. + * @return the supported parameter list filtered for only the Learning Table + * Value parameters needed. + */ + private final Collection buildLearningQueries() { + final Collection query = new ArrayList(); + final List parameterRows = parmeterList.getParameterRows(); + if (!ParamChecker.isNullOrEmpty(parameterRows)) { + for (ParameterRow parameterRow : parameterRows) { + final SSMParameter parameterId = + SSMParameter.fromValue(parameterRow.getLoggerData().getId()); + if (parameterId != null) { + query.add(buildEcuQuery(parameterRow)); + setFlkcTableAddress(parameterRow, parameterId); } + } + } + return query; + } + + /** + * Build a query object for a parameter item. + * @return a new EcuQuery. + */ + private final EcuQuery buildEcuQuery(ParameterRow parameterRow) { + final EcuQuery ecuQuery = + new EcuQueryImpl((EcuData) parameterRow.getLoggerData()); + return ecuQuery; + } + + /** + * Define the start address of the FLKC table in RAM base on a Extended + * parameter if defined. + * Also isolate the FLKC extended parameter to use the data converter + * when building the FLKC table queries. + */ + private final void setFlkcTableAddress( + ParameterRow parameterRow, + SSMParameter parameterId) { + + switch (parameterId) { + case E1: + if (flkcAddr == 0) { + flkcAddr = getParameterAddr(parameterRow) + 0x02; + } + break; + case E31: + if (flkcAddr == 0) { + flkcAddr = getParameterAddr(parameterRow) + 0x14; + } + break; + case E12: + case E41: + if (flkc == null) { + flkc = parameterRow; + } + break; + case E173: + flkcAddr = getParameterAddr(parameterRow); + flkc = parameterRow; + break; + default: + break; + } + } + + /** + * Return the parameter's integer address. + */ + private final int getParameterAddr(ParameterRow parameterRow) { + final EcuData ecudata = (EcuData) parameterRow.getLoggerData(); + final String addrStr = ecudata.getAddress().getAddresses()[0]; + final String addrHexStr = addrStr.replaceAll("0x", ""); + return Integer.parseInt(addrHexStr, 16); + } + + /** + * Start populating the vehicle information map with passed values. + */ + private final void buildVehicleInfoMap(EcuDefinition ecuDef) { + vehicleInfo.put("CAL ID", ecuDef.getCalId()); + vehicleInfo.put("ECU ID", ecuDef.getEcuId()); + vehicleInfo.put("Description", + ecuDef.getCarString().replaceAll("Subaru ", "")); + } + + /** + * Retrieve the table axis values from the ECU definition. First try the + * 4-cyl table names, if still empty try the 6-cyl table name. + */ + private final List getTableAxisRanges( + Document document, + EcuDefinition ecuDef, + List tableNames) { + + List tableAxis = new ArrayList(); + for (String tableName : tableNames) { + tableAxis = loadTable(document, ecuDef, tableName); + if (!tableAxis.isEmpty()) { + break; + } + } + return tableAxis; + } + + /** + * Once values from the ECU have been populated add the values to the + * table models datasets. + */ + private final void processEcuQueryResponses(List queries) { + final SSMParameterCrossReference parameterMap = new SSMParameterCrossReference(); + final List afLearningBank1 = new ArrayList(); + final List afLearningBank2 = new ArrayList(); + + for (EcuQuery query : queries) { + final SSMParameter parameterId = + SSMParameter.fromValue(query.getLoggerData().getId()); + final String paramDesc = parameterMap.getValue(parameterId); + String result = String.format("%.2f %s", + query.getResponse(), + query.getLoggerData().getSelectedConvertor().getUnits()); + switch (parameterId) { + case E1: + result = String.format("%.0f", query.getResponse()); + vehicleInfo.put(paramDesc, result); + break; + case E31: + result = String.format("%.3f", query.getResponse()); + vehicleInfo.put(paramDesc, result); + break; + case E12: + case E41: + case E173: + break; + case E13: + case E44: + afLearningBank1.add("#1"); + afLearningBank1.add(result); + break; + case E14: + case E45: + case E15: + case E46: + afLearningBank1.add(result); + break; + case E16: + case E47: + afLearningBank1.add(result); + afLearning.add(afLearningBank1); + break; + case E62: + afLearningBank2.add("#2"); + afLearningBank2.add(result); + break; + case E63: + case E64: + afLearningBank2.add(result); + break; + case E65: + afLearningBank2.add(result); + afLearning.add(afLearningBank2); + break; + default: + vehicleInfo.put(paramDesc, result); + break; + } + } + } + + /** + * Build a List of EcuQueries to retrieve the axis and scaling of a table. + * A table is found when the storageaddress parameter has been identified. + */ + private final List loadTable( + Document document, + EcuDefinition ecuDef, + String tableName) { + + final List inheritanceList = + EcuDefinitionInheritanceList.getInheritanceList(document, ecuDef); + final Map tableMap = + EcuTableDefinitionHandler.getTableDefinition( + document, + inheritanceList, + tableName); + List tableAxisQuery = new ArrayList(); + if (tableMap.containsKey("storageaddress")) { + tableAxisQuery = SSMTableAxisQueryParameterSet.build( + tableMap.get("storageaddress"), + tableMap.get("storagetype"), + tableMap.get("expression"), + tableMap.get("units"), + tableMap.get("sizey") + ); + } + return tableAxisQuery; + } + + /** + * Format the range data to be used as table column header values. + */ + private final String[] formatRanges( + Collection axisRanges, + String numberFormat) { + + final List ranges = new ArrayList(); + ranges.add(" "); + double rangeMin = 0; + double rangeMax = 0; + for (EcuQuery ecuQuery : axisRanges) { + rangeMax = ecuQuery.getResponse() - 0.01; + final String range = String.format( + numberFormat + " - " + numberFormat, + rangeMin, + rangeMax); + ranges.add(range); + rangeMin = ecuQuery.getResponse(); + rangeMax = ecuQuery.getResponse(); + } + final String range = String.format(numberFormat + "+", rangeMax); + ranges.add(range); + return ranges.toArray(new String[0]); + } + + /** + * Format the RPM range data to be used as FLKC table row header values. + */ + private final String[] formatRpmRanges(Collection axisRanges) { + + final List ranges = new ArrayList(); + double rangeMin = 0; + double rangeMax = 0; + for (EcuQuery ecuQuery : axisRanges) { + rangeMax = ecuQuery.getResponse() - 1; + final String range = String.format( + "%.0f - %.0f", + rangeMin, + rangeMax); + ranges.add(range); + rangeMin = ecuQuery.getResponse(); + rangeMax = ecuQuery.getResponse(); + } + final String range = String.format("%.0f+", rangeMax); + ranges.add(range); + return ranges.toArray(new String[0]); + } + + /** + * Return a Transport based on its String ID. + */ + private Transport getTransportById(String id) { + for (Transport transport : getTransportMap().keySet()) { + if (transport.getId().equalsIgnoreCase(id)) + return transport; + } + return null; + } + + /** + * Return a Map of Transport and associated Modules for the current protocol. + */ + private Map> getTransportMap() { + return logger.getProtocolList().get(settings.getLoggerProtocol()); + } + + /** + * Return a Module based on its String name. + */ + private Module getModule(String name) { + final Collection modules = getTransportMap().get( + getTransportById(settings.getTransportProtocol())); + for (Module module: modules) { + if (module.getName().equalsIgnoreCase(name)) + return module; + } + return null; + } + /** + * Load ECU def table names from a user customized properties file. + * The file will replace the Class defined names if it is present. + * Names in the file should be separated by the : character + * @exception FileNotFoundException if the directory or file is not present + * @exception IOException if there's some kind of IO error + */ + private void loadProperties() { + final Properties learning = new Properties(); + FileInputStream propFile; + try { + propFile = new FileInputStream("./customize/ssmlearning.properties"); + learning.load(propFile); + final String af_table_names = + learning.getProperty("af_table_names"); + String[] names = af_table_names.split(":", 0); + AF_TABLE_NAMES = new ArrayList(); + for (String name : names) { + if (ParamChecker.isNullOrEmpty(name)) continue; + AF_TABLE_NAMES.add(name); + } + final String flkc_table_column_names = + learning.getProperty("flkc_table_column_names"); + names = flkc_table_column_names.split(":", 0); + FLKC_LOAD_TABLE_NAMES = new ArrayList(); + for (String name : names) { + if (ParamChecker.isNullOrEmpty(name)) continue; + FLKC_LOAD_TABLE_NAMES.add(name); + } + final String flkc_table_row_names = + learning.getProperty("flkc_table_row_names"); + names = flkc_table_row_names.split(":", 0); + FLKC_RPM_TABLE_NAMES = new ArrayList(); + for (String name : names) { + if (ParamChecker.isNullOrEmpty(name)) continue; + FLKC_RPM_TABLE_NAMES.add(name); + } + propFile.close(); + LOGGER.info("SSMLearningTableValues loaded table names from file: ./customize/ssmlearning.properties"); + } catch (FileNotFoundException e) { + LOGGER.error("SSMLearningTableValues properties file: " + e.getLocalizedMessage()); + } catch (IOException e) { + LOGGER.error("SSMLearningTableValues IOException: " + e.getLocalizedMessage()); + } + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/flkctable/FlkcTableQueryBuilder.java b/src/main/java/com/romraider/logger/ecu/comms/learning/flkctable/FlkcTableQueryBuilder.java deleted file mode 100644 index 47db997e1..000000000 --- a/src/main/java/com/romraider/logger/ecu/comms/learning/flkctable/FlkcTableQueryBuilder.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.logger.ecu.comms.learning.flkctable; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; - -import com.romraider.logger.ecu.comms.learning.parameter.Parameter; -import com.romraider.logger.ecu.comms.query.EcuQuery; -import com.romraider.logger.ecu.comms.query.EcuQueryImpl; -import com.romraider.logger.ecu.definition.EcuAddress; -import com.romraider.logger.ecu.definition.EcuAddressImpl; -import com.romraider.logger.ecu.definition.EcuData; -import com.romraider.logger.ecu.definition.EcuDataConvertor; -import com.romraider.logger.ecu.definition.EcuParameterImpl; -import com.romraider.logger.ecu.ui.paramlist.ParameterRow; -import com.romraider.util.HexUtil; - -/** - * Build an EcuQuery for each of the cells in the FLKC RAM table. - */ -public class FlkcTableQueryBuilder { - private static final Logger LOGGER = - Logger.getLogger(FlkcTableQueryBuilder.class); - - public FlkcTableQueryBuilder() { - } - - /** - * Build an EcuQuery for each cell of the FLKC RAM table. Note this - * returns an extra null query for column 0 of each row which is later - * populated with the row header (RPM Ranges) data. - * @param flkc - a ParameterRow item that helps to identify the - * ECU bitness and provide a Converter for the raw data. - * @param flkcAddr - the address in RAM of the start of the table. - * @param rows - the number of rows in the table. - * @param columns - the number of columns in the table. - * @return EcuQueries divided into groups to query each row separately to - * avoid maxing out the ECU send/receive buffer. - */ - public final List> build( - ParameterRow flkc, - int flkcAddr, - int rows, - int columns) { - - final List> flkcQueryRows = new ArrayList>(); - int checksummed = 1; - int dataSize = 1; - if (Parameter.fromValue(flkc.getLoggerData().getId()) == Parameter.E41 || - Parameter.fromValue(flkc.getLoggerData().getId()) == Parameter.E173) { - checksummed = 2; - dataSize = 4; - } - LOGGER.debug( - String.format( - "FLKC Data format rows:%d col:%d checksummed:%d " + - "dataSize:%d FLKC:%s", - rows, columns, checksummed, dataSize, - flkc.getLoggerData().getId())); - - int i = 0; - for (int j = 0; j < rows; j++) { - final List flkcQueryCols = new ArrayList(); - flkcQueryCols.add(null); - for (int k = 0; k < columns; k++) { - String id = "flkc-r" + j + "c" + k; - final String addrStr = - HexUtil.intToHexString( - flkcAddr + (i * dataSize * checksummed)); - LOGGER.debug( - String.format( - "FLKC Data row:%d col:%d addr:%s", - j, k, addrStr)); - final EcuAddress ea = new EcuAddressImpl(addrStr, dataSize, -1); - final EcuParameterImpl epi = - new EcuParameterImpl(id, addrStr, id, ea, - new EcuDataConvertor[] { - flkc.getLoggerData().getSelectedConvertor() - } - ); - flkcQueryCols.add(new EcuQueryImpl((EcuData) epi)); - i++; - } - flkcQueryRows.add(flkcQueryCols); - } - return flkcQueryRows; - } -} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/DS2Parameter.java b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/DS2Parameter.java new file mode 100644 index 000000000..f97f667a8 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/DS2Parameter.java @@ -0,0 +1,74 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.parameter; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +/** + * This Emun defines all the possible parameters used to query the Learning + * Table Values of an ECU. + */ +public enum DS2Parameter { + P2("P2"), // ECT + P11("P11"), // IAT + P17("P17"), // Battery Volts + E19("E19"), // Lambda Additive Adaptation - Bank 1 + E20("E20"), // Lambda Additive Adaptation - Bank 2 + E21("E21"), // Lambda Multiplicative Adaptation - Bank 1 + E22("E22"), // Lambda Multiplicative Adaptation - Bank 2 + E23("E23"), // Throttle Position Adaptation + E24("E24"), // Knock Retard - Global + E99("E99"), // Knock Adaption Table 1 Index** + E217("E217"); // Knock Retard - Current + + private static final Map lookup + = new HashMap(); + + static { + for(DS2Parameter s : EnumSet.allOf(DS2Parameter.class)) + lookup.put(s.toString(), s); + } + + private DS2Parameter(final String text) { + this.text = text; + } + + private final String text; + + @Override + public final String toString() { + return text; + } + + /** + * Retrieve the Parameter that has the given value. + * @param value - the value of the Parameter in String format + * @return the Parameter that has the given value or null if undefined. + */ + public static DS2Parameter fromValue(String value) { + DS2Parameter result = null; + if (lookup.containsKey(value)) { + result = lookup.get(value); + } + return result; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/DS2ParameterCrossReference.java b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/DS2ParameterCrossReference.java new file mode 100644 index 000000000..1e918a1dd --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/DS2ParameterCrossReference.java @@ -0,0 +1,56 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.parameter; + +import static com.romraider.logger.ecu.comms.learning.parameter.DS2Parameter.E217; +import static com.romraider.logger.ecu.comms.learning.parameter.DS2Parameter.E23; +import static com.romraider.logger.ecu.comms.learning.parameter.DS2Parameter.E24; +import static com.romraider.logger.ecu.comms.learning.parameter.DS2Parameter.P11; +import static com.romraider.logger.ecu.comms.learning.parameter.DS2Parameter.P17; +import static com.romraider.logger.ecu.comms.learning.parameter.DS2Parameter.P2; + +import java.util.HashMap; +import java.util.Map; + +/** + * A Map of Parameter and value specific to the Vehicle Information Table. + */ +public class DS2ParameterCrossReference { + final Map map; + + public DS2ParameterCrossReference() { + map = new HashMap(); + map.put(P17, "Battery"); + map.put(P11, "IAT"); + map.put(P2, "ECT"); + map.put(E23, "TPS AD"); + map.put(E24, "Knk Gbl"); + map.put(E217, "Knk Cur"); + } + +/** + * Retrieve the string value associated with the supplied Parameter. + * @param parameter - Parameter to lookup value for. + * @return the value of the Parameter. + */ + public final String getValue(DS2Parameter parameter) { + return map.get(parameter); + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/NCSParameter.java b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/NCSParameter.java new file mode 100644 index 000000000..02e8e1016 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/NCSParameter.java @@ -0,0 +1,71 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2018 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.parameter; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +/** + * This Emun defines all the possible parameters used to query the Learning + * Table Values of an ECU. + */ +public enum NCSParameter { + P2("P2"), // ECT + P11("P11"), // IAT + P17("P17"), // Battery Volts + E173("E173"), // mixed ratio learning map trim + E174("E174"), // mixed ratio learning map count + P4389("P4389"), // Learned Fuel Trim B1 + P4390("P4390"); // Learned Fuel Trim B2 + + + private static final Map lookup + = new HashMap(); + + static { + for(NCSParameter s : EnumSet.allOf(NCSParameter.class)) + lookup.put(s.toString(), s); + } + + private NCSParameter(final String text) { + this.text = text; + } + + private final String text; + + @Override + public final String toString() { + return text; + } + + /** + * Retrieve the Parameter that has the given value. + * @param value - the value of the Parameter in String format + * @return the Parameter that has the given value or null if undefined. + */ + public static NCSParameter fromValue(String value) { + NCSParameter result = null; + if (lookup.containsKey(value)) { + result = lookup.get(value); + } + return result; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/NCSParameterCrossReference.java b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/NCSParameterCrossReference.java new file mode 100644 index 000000000..4a63a60a8 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/NCSParameterCrossReference.java @@ -0,0 +1,54 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2018 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.parameter; + +import static com.romraider.logger.ecu.comms.learning.parameter.NCSParameter.P4390; +import static com.romraider.logger.ecu.comms.learning.parameter.NCSParameter.P4389; +import static com.romraider.logger.ecu.comms.learning.parameter.NCSParameter.P11; +import static com.romraider.logger.ecu.comms.learning.parameter.NCSParameter.P17; +import static com.romraider.logger.ecu.comms.learning.parameter.NCSParameter.P2; + +import java.util.HashMap; +import java.util.Map; + +/** + * A Map of Parameter and value specific to the Vehicle Information Table. + */ +public class NCSParameterCrossReference { + final Map map; + + public NCSParameterCrossReference() { + map = new HashMap(); + map.put(P4390, "LFTB2"); + map.put(P4389, "LFTB1"); + map.put(P17, "Battery"); + map.put(P11, "IAT"); + map.put(P2, "ECT"); + } + +/** + * Retrieve the string value associated with the supplied Parameter. + * @param parameter - Parameter to lookup value for. + * @return the value of the Parameter. + */ + public final String getValue(NCSParameter parameter) { + return map.get(parameter); + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/Parameter.java b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/Parameter.java deleted file mode 100644 index 28300fae8..000000000 --- a/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/Parameter.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.logger.ecu.comms.learning.parameter; - -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Map; - -/** - * This Emun defines all the possible parameters used to query the Learning - * Table Values of an ECU. - */ -public enum Parameter { - E1("E1"), // IAM 16 bit - E31("E31"), // IAM 32 bit - E12("E12"), // Fine Learning Knock Correction* - E41("E41"), // Fine Learning Knock Correction (4-byte)* - E13("E13"), // AF Learning 1A 16 bit - E14("E14"), // AF Learning 1B 16 bit - E15("E15"), // AF Learning 1C 16 bit - E16("E16"), // AF Learning 1D 16 bit - E44("E44"), // AF Learning 1A 32 bit - E45("E45"), // AF Learning 1B 32 bit - E46("E46"), // AF Learning 1C 32 bit - E47("E47"), // AF Learning 1D 32 bit - E62("E62"), // AF Learning 2A 32 bit - E63("E63"), // AF Learning 2B 32 bit - E64("E64"), // AF Learning 2C 32 bit - E65("E65"), // AF Learning 2D 32 bit - P2("P2"), // ECT - P11("P11"), // IAT - P17("P17"), // Battery Volts - P24("P24"), // ATM - P66("P66"), // AF Learning 3 - P115("P115"), // Learned Throttle Closed Voltage - P118("P118"), // AF Learning 4 - P153("P153"), // Whole Learning value in timing - E173("E173"); // Fine Learning Knock Correction Table Start (4-byte)* - - private static final Map lookup - = new HashMap(); - - static { - for(Parameter s : EnumSet.allOf(Parameter.class)) - lookup.put(s.toString(), s); - } - - private Parameter(final String text) { - this.text = text; - } - - private final String text; - - @Override - public final String toString() { - return text; - } - - /** - * Retrieve the Parameter that has the given value. - * @param value - the value of the Parameter in String format - * @return the Parameter that has the given value or null if undefined. - */ - public static Parameter fromValue(String value) { - Parameter result = null; - if (lookup.containsKey(value)) { - result = lookup.get(value); - } - return result; - } -} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/ParameterCrossReference.java b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/ParameterCrossReference.java deleted file mode 100644 index 94a9a60f6..000000000 --- a/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/ParameterCrossReference.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.logger.ecu.comms.learning.parameter; - -import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.E1; -import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.E31; -import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P11; -import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P115; -import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P118; -import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P153; -import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P17; -import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P2; -import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P24; -import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P66; - -import java.util.HashMap; -import java.util.Map; - -/** - * A Map of Parameter and value specific to the Vehicle Information Table. - */ -public class ParameterCrossReference { - final Map map; - - public ParameterCrossReference() { - map = new HashMap(); - map.put(P17, "Battery"); - map.put(P24, "ATM"); - map.put(P11, "IAT"); - map.put(P2, "ECT"); - map.put(E1, "IAM"); - map.put(E31, "IAM"); - map.put(P66, "A/F #3"); - map.put(P118, "A/F #4"); - map.put(P115, "TPS VDC"); - map.put(P153, "Lrn Timing"); - } - -/** - * Retrieve the string value associated with the supplied Parameter. - * @param parameter - Parameter to lookup value for. - * @return the value of the Parameter. - */ - public final String getValue(Parameter parameter) { - return map.get(parameter); - } -} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/SSMParameter.java b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/SSMParameter.java new file mode 100644 index 000000000..cce3b8ef2 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/SSMParameter.java @@ -0,0 +1,88 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.parameter; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +/** + * This Emun defines all the possible parameters used to query the Learning + * Table Values of an ECU. + */ +public enum SSMParameter { + E1("E1"), // IAM 16 bit + E31("E31"), // IAM 32 bit + E12("E12"), // Fine Learning Knock Correction* + E41("E41"), // Fine Learning Knock Correction (4-byte)* + E13("E13"), // AF Learning 1A 16 bit + E14("E14"), // AF Learning 1B 16 bit + E15("E15"), // AF Learning 1C 16 bit + E16("E16"), // AF Learning 1D 16 bit + E44("E44"), // AF Learning 1A 32 bit + E45("E45"), // AF Learning 1B 32 bit + E46("E46"), // AF Learning 1C 32 bit + E47("E47"), // AF Learning 1D 32 bit + E62("E62"), // AF Learning 2A 32 bit + E63("E63"), // AF Learning 2B 32 bit + E64("E64"), // AF Learning 2C 32 bit + E65("E65"), // AF Learning 2D 32 bit + P2("P2"), // ECT + P11("P11"), // IAT + P17("P17"), // Battery Volts + P24("P24"), // ATM + P66("P66"), // AF Learning 3 + P115("P115"), // Learned Throttle Closed Voltage + P118("P118"), // AF Learning 4 + P153("P153"), // Whole Learning value in timing + E173("E173"); // Fine Learning Knock Correction Table Start (4-byte)* + + private static final Map lookup + = new HashMap(); + + static { + for(SSMParameter s : EnumSet.allOf(SSMParameter.class)) + lookup.put(s.toString(), s); + } + + private SSMParameter(final String text) { + this.text = text; + } + + private final String text; + + @Override + public final String toString() { + return text; + } + + /** + * Retrieve the Parameter that has the given value. + * @param value - the value of the Parameter in String format + * @return the Parameter that has the given value or null if undefined. + */ + public static SSMParameter fromValue(String value) { + SSMParameter result = null; + if (lookup.containsKey(value)) { + result = lookup.get(value); + } + return result; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/SSMParameterCrossReference.java b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/SSMParameterCrossReference.java new file mode 100644 index 000000000..c5f5cc84e --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/parameter/SSMParameterCrossReference.java @@ -0,0 +1,64 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.parameter; + +import static com.romraider.logger.ecu.comms.learning.parameter.SSMParameter.E1; +import static com.romraider.logger.ecu.comms.learning.parameter.SSMParameter.E31; +import static com.romraider.logger.ecu.comms.learning.parameter.SSMParameter.P11; +import static com.romraider.logger.ecu.comms.learning.parameter.SSMParameter.P115; +import static com.romraider.logger.ecu.comms.learning.parameter.SSMParameter.P118; +import static com.romraider.logger.ecu.comms.learning.parameter.SSMParameter.P153; +import static com.romraider.logger.ecu.comms.learning.parameter.SSMParameter.P17; +import static com.romraider.logger.ecu.comms.learning.parameter.SSMParameter.P2; +import static com.romraider.logger.ecu.comms.learning.parameter.SSMParameter.P24; +import static com.romraider.logger.ecu.comms.learning.parameter.SSMParameter.P66; + +import java.util.HashMap; +import java.util.Map; + +/** + * A Map of Parameter and value specific to the Vehicle Information Table. + */ +public class SSMParameterCrossReference { + final Map map; + + public SSMParameterCrossReference() { + map = new HashMap(); + map.put(P17, "Battery"); + map.put(P24, "ATM"); + map.put(P11, "IAT"); + map.put(P2, "ECT"); + map.put(E1, "IAM"); + map.put(E31, "IAM"); + map.put(P66, "A/F #3"); + map.put(P118, "A/F #4"); + map.put(P115, "TPS VDC"); + map.put(P153, "Lrn Timing"); + } + +/** + * Retrieve the string value associated with the supplied Parameter. + * @param parameter - Parameter to lookup value for. + * @return the value of the Parameter. + */ + public final String getValue(SSMParameter parameter) { + return map.get(parameter); + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/DS2TableAxisQueryParameterSet.java b/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/DS2TableAxisQueryParameterSet.java new file mode 100644 index 000000000..5ab28419a --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/DS2TableAxisQueryParameterSet.java @@ -0,0 +1,127 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.tableaxis; + +import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getDefault; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import com.romraider.Settings; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryData; +import com.romraider.logger.ecu.comms.query.EcuQueryImpl; +import com.romraider.logger.ecu.definition.EcuAddress; +import com.romraider.logger.ecu.definition.EcuAddressImpl; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.EcuDataConvertor; +import com.romraider.logger.ecu.definition.EcuParameterConvertorImpl; +import com.romraider.logger.ecu.definition.EcuParameterImpl; +import com.romraider.util.HexUtil; + +/** + * Build a List of ECU Queries to retrieve a Table's axis values. + */ +public class DS2TableAxisQueryParameterSet { + + private DS2TableAxisQueryParameterSet() { + } + + /** + * Build a List of ECU Queries. + * @param storageAddress - the starting address of the Table. + * @param storageType - the data storage type. + * @param expression - the equation to convert byte data to a real number. + * @param units - the value's unit of measure. + * @param size - the length of the Table's axis. + * @param group - the group for an EcuParameter. + * @param subgroup - the subgroup for an EcuParameter. + * @param groupsize - the groupsize for an EcuParameter. + * @param endian - the data storage endian. + * @return a List of ECU Query items. + */ + public static final List build( + String storageAddress, + String storageType, + String expression, + String units, + String size, + String group, + String subgroup, + String groupsize, + String endian) { + + final List tableAxisQuery = new ArrayList(); + final String tableAddrStr = storageAddress.replaceAll("0x", ""); + int tableAddrBase = Integer.parseInt(tableAddrStr, 16); + //Adjust address from ECU table def to linear RAM read address + //MS41 256kB - full + if (tableAddrBase > 0x16000 && tableAddrBase < 0x17000) { + tableAddrBase -= 0x4000; + } + //MS41 24kB - partial + else if (tableAddrBase > 0x2000 && tableAddrBase < 0x3000) { + tableAddrBase += 0x10000; + } + //MS42 512kB - full + else if (tableAddrBase > 0x48000 && tableAddrBase < 0x49000) { + //no change + } + //MS42 32kB - partial + else if (tableAddrBase > 0x800 && tableAddrBase < 0x930) { + tableAddrBase += 0x48000; + } + //MS43 512kB - full + else if (tableAddrBase > 0x74000 && tableAddrBase < 0x74100) { + //no change + } + //MS43 32kB - partial + else if (tableAddrBase > 0x4000 && tableAddrBase < 0x4100) { + tableAddrBase += 0x70000; + } + + int dataSize = EcuQueryData.getDataLength(storageType); + Settings.Endian dataEndian = Settings.Endian.BIG; + if (endian != null) { + dataEndian = endian.equalsIgnoreCase("little") ? Settings.Endian.LITTLE : Settings.Endian.BIG; + } + + final int count = Integer.parseInt(size, 10); + for (int i = 0; i < count; i++) { + final String addrStr = + HexUtil.intToHexString(tableAddrBase + (i * dataSize)); + final String id = addrStr + "-" + i; + final EcuAddress ea = new EcuAddressImpl(addrStr, dataSize, -1); + final EcuParameterImpl epi = + new EcuParameterImpl(id, addrStr, id, ea, group, subgroup, groupsize, + new EcuDataConvertor[] { + new EcuParameterConvertorImpl( + units, expression, "0.000", -1, storageType, + dataEndian, new HashMap(), + getDefault() + ) + } + ); + tableAxisQuery.add(new EcuQueryImpl((EcuData) epi)); + } + return tableAxisQuery; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/NCSTableAxisQueryParameterSet.java b/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/NCSTableAxisQueryParameterSet.java new file mode 100644 index 000000000..31956384f --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/NCSTableAxisQueryParameterSet.java @@ -0,0 +1,92 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.tableaxis; + +import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getDefault; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import com.romraider.Settings; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryData; +import com.romraider.logger.ecu.comms.query.EcuQueryImpl; +import com.romraider.logger.ecu.definition.EcuAddress; +import com.romraider.logger.ecu.definition.EcuAddressImpl; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.EcuDataConvertor; +import com.romraider.logger.ecu.definition.EcuParameterConvertorImpl; +import com.romraider.logger.ecu.definition.EcuParameterImpl; +import com.romraider.util.HexUtil; + +/** + * Build a List of ECU Queries to retrieve a Table's axis values. + */ +public class NCSTableAxisQueryParameterSet { + + private NCSTableAxisQueryParameterSet() { + } + + /** + * Build a List of ECU Queries. + * @param storageAddress - the starting address of the Table. + * @param storageType - the data storage type (big endian assumed). + * @param expression - the equation to convert byte data to a real number. + * @param units - the value's unit of measure. + * @param size - the length of the Table's axis. + * @param endian - the data endian. + * @return a List of ECU Query items. + */ + public static final List build( + String storageAddress, + String storageType, + String expression, + String units, + String size) { + + final List tableAxisQuery = new ArrayList(); + final String tableAddrStr = storageAddress.replaceAll("0x", ""); + final int tableAddrBase = Integer.parseInt(tableAddrStr, 16); + + int dataSize = EcuQueryData.getDataLength(storageType); + final Settings.Endian dataEndian = Settings.Endian.BIG; + + final int count = Integer.parseInt(size, 10); + for (int i = 0; i < count; i++) { + final String addrStr = + HexUtil.intToHexString(tableAddrBase + (i * dataSize)); + final String id = addrStr + "-" + i; + final EcuAddress ea = new EcuAddressImpl(addrStr, dataSize, -1); + final EcuParameterImpl epi = + new EcuParameterImpl(id, addrStr, id, ea, null, null, null, + new EcuDataConvertor[] { + new EcuParameterConvertorImpl( + units, expression, "0.000", -1, storageType, + dataEndian, new HashMap(), + getDefault() + ) + } + ); + tableAxisQuery.add(new EcuQueryImpl((EcuData) epi)); + } + return tableAxisQuery; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/SSMTableAxisQueryParameterSet.java b/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/SSMTableAxisQueryParameterSet.java new file mode 100644 index 000000000..8b69c916b --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/SSMTableAxisQueryParameterSet.java @@ -0,0 +1,90 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2018 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.tableaxis; + +import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getDefault; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import com.romraider.Settings; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryData; +import com.romraider.logger.ecu.comms.query.EcuQueryImpl; +import com.romraider.logger.ecu.definition.EcuAddress; +import com.romraider.logger.ecu.definition.EcuAddressImpl; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.EcuDataConvertor; +import com.romraider.logger.ecu.definition.EcuParameterConvertorImpl; +import com.romraider.logger.ecu.definition.EcuParameterImpl; +import com.romraider.util.HexUtil; + +/** + * Build a List of ECU Queries to retrieve a Table's axis values. + */ +public class SSMTableAxisQueryParameterSet { + + private SSMTableAxisQueryParameterSet() { + } + + /** + * Build a List of ECU Queries. + * @param storageAddress - the starting address of the Table. + * @param storageType - the data storage type (big endian assumed). + * @param expression - the equation to convert byte data to a real number. + * @param units - the value's unit of measure. + * @param size - the length of the Table's axis. + * @return a List of ECU Query items. + */ + public static final List build( + String storageAddress, + String storageType, + String expression, + String units, + String size) { + + final List tableAxisQuery = new ArrayList(); + final String tableAddrStr = storageAddress.replaceAll("0x", ""); + final int tableAddrBase = Integer.parseInt(tableAddrStr, 16); + + int dataSize = EcuQueryData.getDataLength(storageType); + + final int count = Integer.parseInt(size, 10); + for (int i = 0; i < count; i++) { + final String addrStr = + HexUtil.intToHexString(tableAddrBase + (i * dataSize)); + final String id = addrStr + "-" + i; + final EcuAddress ea = new EcuAddressImpl(addrStr, dataSize, -1); + final EcuParameterImpl epi = + new EcuParameterImpl(id, addrStr, id, ea, null, null, null, + new EcuDataConvertor[] { + new EcuParameterConvertorImpl( + units, expression, "0.000", -1, storageType, + Settings.Endian.BIG, new HashMap(), + getDefault() + ) + } + ); + tableAxisQuery.add(new EcuQueryImpl((EcuData) epi)); + } + return tableAxisQuery; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/TableAxisQueryParameterSet.java b/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/TableAxisQueryParameterSet.java deleted file mode 100644 index 41c5883aa..000000000 --- a/src/main/java/com/romraider/logger/ecu/comms/learning/tableaxis/TableAxisQueryParameterSet.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.logger.ecu.comms.learning.tableaxis; - -import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getDefault; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import com.romraider.logger.ecu.comms.query.EcuQuery; -import com.romraider.logger.ecu.comms.query.EcuQueryImpl; -import com.romraider.logger.ecu.definition.EcuAddress; -import com.romraider.logger.ecu.definition.EcuAddressImpl; -import com.romraider.logger.ecu.definition.EcuData; -import com.romraider.logger.ecu.definition.EcuDataConvertor; -import com.romraider.logger.ecu.definition.EcuParameterConvertorImpl; -import com.romraider.logger.ecu.definition.EcuParameterImpl; -import com.romraider.util.HexUtil; - -/** - * Build a List of ECU Queries to retrieve a Table's axis values. - */ -public class TableAxisQueryParameterSet { - - private TableAxisQueryParameterSet() { - } - - /** - * Build a List of ECU Queries. - * @param storageAddress - the starting address of the Table. - * @param storageType - the data storage type (big endian assumed). - * @param expression - the equation to convert byte data to a real number. - * @param units - the value's unit of measure. - * @param size - the length of the Table's axis. - * @return a List of ECU Query items. - */ - public static final List build( - String storageAddress, - String storageType, - String expression, - String units, - String size) { - - final List tableAxisQuery = new ArrayList(); - final String tableAddrStr = storageAddress.replaceAll("0x", ""); - final int tableAddrBase = Integer.parseInt(tableAddrStr, 16); - - int dataSize = 1; - if (storageType.toLowerCase().contains("int16")) { - dataSize = 2; - } - if (storageType.toLowerCase().contains("float")) { - dataSize = 4; - } - - final int count = Integer.parseInt(size, 16); - for (int i = 0; i < count; i++) { - final String addrStr = - HexUtil.intToHexString(tableAddrBase + (i * dataSize)); - final String id = addrStr + "-" + i; - final EcuAddress ea = new EcuAddressImpl(addrStr, dataSize, -1); - final EcuParameterImpl epi = - new EcuParameterImpl(id, addrStr, id, ea, - new EcuDataConvertor[] { - new EcuParameterConvertorImpl( - units, expression, "0.000", -1, storageType, - new HashMap(), getDefault() - ) - } - ); - tableAxisQuery.add(new EcuQueryImpl((EcuData) epi)); - } - return tableAxisQuery; - } -} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/tables/DS2FlkcTableQueryBuilder.java b/src/main/java/com/romraider/logger/ecu/comms/learning/tables/DS2FlkcTableQueryBuilder.java new file mode 100644 index 000000000..a3c330bf4 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/tables/DS2FlkcTableQueryBuilder.java @@ -0,0 +1,106 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.tables; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; + +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryData; +import com.romraider.logger.ecu.comms.query.EcuQueryImpl; +import com.romraider.logger.ecu.definition.EcuAddress; +import com.romraider.logger.ecu.definition.EcuAddressImpl; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.EcuDataConvertor; +import com.romraider.logger.ecu.definition.EcuParameterImpl; +import com.romraider.logger.ecu.ui.paramlist.ParameterRow; + +/** + * Build an EcuQuery for each of the cells in the FLKC RAM table. + */ +public class DS2FlkcTableQueryBuilder { + private static final Logger LOGGER = + Logger.getLogger(DS2FlkcTableQueryBuilder.class); + + public DS2FlkcTableQueryBuilder() { + } + + /** + * Build an EcuQuery for each cell of the Knock Adaptation RAM table. + * Note this returns an extra null query for column 0 of each row + * which is later populated with the row header (RPM Ranges) data. + * @param flkc - a ParameterRow item that helps to identify the + * ECU bitness and provide a Converter for the raw data. + * @param flkcAddr - the address in RAM of the start of the table. + * @param rows - the number of rows in the table. + * @param columns - the number of columns in the table. + * @return EcuQueries divided into groups to query each row separately to + * avoid maxing out the ECU send/receive buffer. + */ + public final List> build( + ParameterRow flkc, + int flkcAddr, + int rows, + int columns) { + + final List> flkcQueryRows = new ArrayList>(); + final EcuData parameter = (EcuData) flkc.getLoggerData(); + int dataSize = EcuQueryData.getDataLength(parameter); + if (LOGGER.isDebugEnabled()) + LOGGER.debug( + String.format( + "Knock Data format rows:%d col:%d " + + "dataSize:%d Knock Index:%s", + rows, columns, dataSize, + parameter.getId())); + + int i = 0; + for (int j = 0; j < rows; j++) { + final List flkcQueryCols = new ArrayList(); + flkcQueryCols.add(null); + for (int k = 0; k < columns; k++) { + String id = "Knock-r" + j + "c" + k; + final String addrStr = String.format("0x%06X", flkcAddr + (i * dataSize)); + if (LOGGER.isTraceEnabled()) + LOGGER.trace( + String.format( + "Knock Data row:%d col:%d addr:%s", + j, k, addrStr)); + final EcuAddress ea = new EcuAddressImpl(addrStr, dataSize, -1); + new String(); + final EcuParameterImpl epi = + new EcuParameterImpl(id, addrStr, id, ea, + parameter.getGroup(), + parameter.getSubgroup(), + String.valueOf(parameter.getGroupSize()), + new EcuDataConvertor[] { + parameter.getSelectedConvertor() + } + ); + flkcQueryCols.add(new EcuQueryImpl(epi)); + i++; + } + flkcQueryRows.add(flkcQueryCols); + } + return flkcQueryRows; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/tables/NCSLtftTableQueryBuilder.java b/src/main/java/com/romraider/logger/ecu/comms/learning/tables/NCSLtftTableQueryBuilder.java new file mode 100644 index 000000000..5f40bd301 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/tables/NCSLtftTableQueryBuilder.java @@ -0,0 +1,105 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.tables; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; + +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryData; +import com.romraider.logger.ecu.comms.query.EcuQueryImpl; +import com.romraider.logger.ecu.definition.EcuAddress; +import com.romraider.logger.ecu.definition.EcuAddressImpl; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.EcuDataConvertor; +import com.romraider.logger.ecu.definition.EcuParameterImpl; +import com.romraider.logger.ecu.ui.paramlist.ParameterRow; +import com.romraider.util.HexUtil; + +/** + * Build an EcuQuery for each of the cells in the FLKC RAM table. + */ +public class NCSLtftTableQueryBuilder { + private static final Logger LOGGER = + Logger.getLogger(NCSLtftTableQueryBuilder.class); + + public NCSLtftTableQueryBuilder() { + } + + /** + * Build an EcuQuery for each cell of the LTFT RAM table. Note this + * returns an extra null query for column 0 of each row which is later + * populated with the row header (RPM Ranges) data. + * @param ltft - a ParameterRow item that helps to identify the + * ECU bitness and provide a Converter for the raw data. + * @param ltftAddr - the address in RAM of the start of the table. + * @param rows - the number of rows in the table. + * @param columns - the number of columns in the table. + * @return EcuQueries divided into groups to query each row separately to + * avoid maxing out the ECU send/receive buffer. + */ + public final List> build( + ParameterRow ltft, + int ltftAddr, + int rows, + int columns) { + + final List> ltftQueryRows = new ArrayList>(); + final EcuData parameter = (EcuData) ltft.getLoggerData(); + int dataSize = EcuQueryData.getDataLength(parameter); + if (LOGGER.isDebugEnabled()) + LOGGER.debug( + String.format( + "LTFT Data format rows:%d col:%d " + + "dataSize:%d LTFT:%s", + rows, columns, dataSize, + ltft.getLoggerData().getId())); + + int i = 0; + for (int j = 0; j < rows; j++) { + final List ltftQueryCols = new ArrayList(); + ltftQueryCols.add(null); + for (int k = 0; k < columns; k++) { + String id = "flkc-r" + j + "c" + k; + final String addrStr = + HexUtil.intToHexString( + ltftAddr + (i * dataSize)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug( + String.format( + "LTFT Data row:%d col:%d addr:%s", + j, k, addrStr)); + final EcuAddress ea = new EcuAddressImpl(addrStr, dataSize, -1); + final EcuParameterImpl epi = + new EcuParameterImpl(id, addrStr, id, ea, null, null, null, + new EcuDataConvertor[] { + ltft.getLoggerData().getSelectedConvertor() + } + ); + ltftQueryCols.add(new EcuQueryImpl(epi)); + i++; + } + ltftQueryRows.add(ltftQueryCols); + } + return ltftQueryRows; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/learning/tables/SSMFlkcTableQueryBuilder.java b/src/main/java/com/romraider/logger/ecu/comms/learning/tables/SSMFlkcTableQueryBuilder.java new file mode 100644 index 000000000..d13cb500e --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/learning/tables/SSMFlkcTableQueryBuilder.java @@ -0,0 +1,110 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.tables; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; + +import com.romraider.logger.ecu.comms.learning.parameter.SSMParameter; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.comms.query.EcuQueryImpl; +import com.romraider.logger.ecu.definition.EcuAddress; +import com.romraider.logger.ecu.definition.EcuAddressImpl; +import com.romraider.logger.ecu.definition.EcuData; +import com.romraider.logger.ecu.definition.EcuDataConvertor; +import com.romraider.logger.ecu.definition.EcuParameterImpl; +import com.romraider.logger.ecu.ui.paramlist.ParameterRow; +import com.romraider.util.HexUtil; + +/** + * Build an EcuQuery for each of the cells in the FLKC RAM table. + */ +public class SSMFlkcTableQueryBuilder { + private static final Logger LOGGER = + Logger.getLogger(SSMFlkcTableQueryBuilder.class); + + public SSMFlkcTableQueryBuilder() { + } + + /** + * Build an EcuQuery for each cell of the FLKC RAM table. Note this + * returns an extra null query for column 0 of each row which is later + * populated with the row header (RPM Ranges) data. + * @param flkc - a ParameterRow item that helps to identify the + * ECU bitness and provide a Converter for the raw data. + * @param flkcAddr - the address in RAM of the start of the table. + * @param rows - the number of rows in the table. + * @param columns - the number of columns in the table. + * @return EcuQueries divided into groups to query each row separately to + * avoid maxing out the ECU send/receive buffer. + */ + public final List> build( + ParameterRow flkc, + int flkcAddr, + int rows, + int columns) { + + final List> flkcQueryRows = new ArrayList>(); + int checksummed = 1; + int dataSize = 1; + if (SSMParameter.fromValue(flkc.getLoggerData().getId()) == SSMParameter.E41 || + SSMParameter.fromValue(flkc.getLoggerData().getId()) == SSMParameter.E173) { + checksummed = 2; + dataSize = 4; + } + if (LOGGER.isDebugEnabled()) + LOGGER.debug( + String.format( + "FLKC Data format rows:%d col:%d checksummed:%d " + + "dataSize:%d FLKC:%s", + rows, columns, checksummed, dataSize, + flkc.getLoggerData().getId())); + + int i = 0; + for (int j = 0; j < rows; j++) { + final List flkcQueryCols = new ArrayList(); + flkcQueryCols.add(null); + for (int k = 0; k < columns; k++) { + String id = "flkc-r" + j + "c" + k; + final String addrStr = + HexUtil.intToHexString( + flkcAddr + (i * dataSize * checksummed)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug( + String.format( + "FLKC Data row:%d col:%d addr:%s", + j, k, addrStr)); + final EcuAddress ea = new EcuAddressImpl(addrStr, dataSize, -1); + final EcuParameterImpl epi = + new EcuParameterImpl(id, addrStr, id, ea, null, null, null, + new EcuDataConvertor[] { + flkc.getLoggerData().getSelectedConvertor() + } + ); + flkcQueryCols.add(new EcuQueryImpl(epi)); + i++; + } + flkcQueryRows.add(flkcQueryCols); + } + return flkcQueryRows; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/manager/AsyncDataUpdateHandler.java b/src/main/java/com/romraider/logger/ecu/comms/manager/AsyncDataUpdateHandler.java new file mode 100644 index 000000000..54b125e78 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/manager/AsyncDataUpdateHandler.java @@ -0,0 +1,85 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.manager; + + +import java.util.Vector; + +import org.apache.log4j.Logger; +import com.romraider.logger.ecu.comms.query.Response; +import com.romraider.logger.ecu.ui.handler.DataUpdateHandler; + + +public class AsyncDataUpdateHandler extends Thread { + private static final Logger LOGGER = Logger.getLogger(AsyncDataUpdateHandler.class); + + Vector responsesToUpdate = new Vector(); + DataUpdateHandler[] handlers; + private boolean stop = false; + private volatile boolean isRunning = false; + + public AsyncDataUpdateHandler(DataUpdateHandler[] handlers) { + this.handlers = handlers; + setName("AsyncDataUpdater"); + } + + public void run(){ + LOGGER.info("Starting AsyncDataUpdateHandler"); + stop = false; + + while(!stop) { + isRunning = true; + + synchronized(responsesToUpdate) { + Response r; + while(!responsesToUpdate.isEmpty()) { + r = responsesToUpdate.get(0); + + for(DataUpdateHandler handler: handlers) { + handler.handleDataUpdate(r); + } + + responsesToUpdate.remove(0); + } + } + + try { + Thread.sleep(16); //60 FPS + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + LOGGER.info("AsyncDataUpdater stopped."); + isRunning = false; + } + + public void stopUpdater() { + stop = true; + } + + public boolean isRunning() { + return isRunning; + } + + public void addResponse(Response response) { + responsesToUpdate.add(response); + } + } \ No newline at end of file diff --git a/src/main/java/com/romraider/logger/ecu/comms/manager/PollingState.java b/src/main/java/com/romraider/logger/ecu/comms/manager/PollingState.java index b96253a17..7c8b8ba7e 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/manager/PollingState.java +++ b/src/main/java/com/romraider/logger/ecu/comms/manager/PollingState.java @@ -21,14 +21,18 @@ public interface PollingState { + enum State { + STATE_0, + STATE_1 + } - int getCurrentState(); + State getCurrentState(); - void setCurrentState(int i); + void setCurrentState(State state); - int getLastState(); + State getLastState(); - void setLastState(int i); + void setLastState(State state); boolean isNewQuery(); diff --git a/src/main/java/com/romraider/logger/ecu/comms/manager/PollingStateImpl.java b/src/main/java/com/romraider/logger/ecu/comms/manager/PollingStateImpl.java index ecc7c347a..69564a652 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/manager/PollingStateImpl.java +++ b/src/main/java/com/romraider/logger/ecu/comms/manager/PollingStateImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2018 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,34 +20,36 @@ package com.romraider.logger.ecu.comms.manager; public final class PollingStateImpl implements PollingState { - private static int currentState; - private static int lastpollState; + // todo: something is not right here! why are these fields all 'static'? looks like should be instance variables + // todo: not class variables? + private static State currentState; + private static State lastpollState; private static boolean newQuery; private static boolean lastQuery; private static boolean fastPoll; public PollingStateImpl() { - setCurrentState(0); - setLastState(0); + setCurrentState(State.STATE_0); + setLastState(State.STATE_0); setNewQuery(true); setLastQuery(false); setFastPoll(false); } - public int getCurrentState() { + public State getCurrentState() { return currentState; } - public void setCurrentState(int i) { - currentState = i; + public void setCurrentState(State state) { + currentState = state; } - public int getLastState() { + public State getLastState() { return lastpollState; } - public void setLastState(int i) { - lastpollState = i; + public void setLastState(State state) { + lastpollState = state; } public boolean isNewQuery() { @@ -76,9 +78,9 @@ public void setFastPoll(boolean state) { public String toString() { final String state = String.format( - "Polling State [isFastPoll=%s, CurrentState=%d, LastState=%d, " + + "Polling State [isFastPoll=%s, CurrentState=%s, LastState=%s, " + "isNewQuery=%s, isLastQuery=%s]", - isFastPoll(), + isFastPoll(), getCurrentState(), getLastState(), isNewQuery(), diff --git a/src/main/java/com/romraider/logger/ecu/comms/manager/QueryManagerImpl.java b/src/main/java/com/romraider/logger/ecu/comms/manager/QueryManagerImpl.java index 5b574125c..46daf16e4 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/manager/QueryManagerImpl.java +++ b/src/main/java/com/romraider/logger/ecu/comms/manager/QueryManagerImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,23 +22,28 @@ import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection; import static com.romraider.logger.ecu.definition.EcuDataType.EXTERNAL; import static com.romraider.util.ParamChecker.checkNotNull; -import static com.romraider.util.ThreadUtil.runAsDaemon; +import static com.romraider.util.ParamChecker.isNullOrEmpty; import static com.romraider.util.ThreadUtil.sleep; import static java.lang.System.currentTimeMillis; import static java.util.Collections.synchronizedList; import static java.util.Collections.synchronizedMap; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.ResourceBundle; +import java.util.Set; import javax.swing.SwingUtilities; import org.apache.log4j.Logger; import com.romraider.Settings; +import com.romraider.io.j2534.api.J2534Library; +import com.romraider.io.j2534.api.J2534LibraryLocator; import com.romraider.logger.ecu.comms.io.connection.LoggerConnection; import com.romraider.logger.ecu.comms.query.EcuInitCallback; import com.romraider.logger.ecu.comms.query.EcuQuery; @@ -51,14 +56,18 @@ import com.romraider.logger.ecu.definition.EcuData; import com.romraider.logger.ecu.definition.ExternalData; import com.romraider.logger.ecu.definition.LoggerData; +import com.romraider.logger.ecu.definition.Module; import com.romraider.logger.ecu.ui.MessageListener; import com.romraider.logger.ecu.ui.StatusChangeListener; import com.romraider.logger.ecu.ui.handler.DataUpdateHandler; import com.romraider.logger.ecu.ui.handler.file.FileLoggerControllerSwitchMonitor; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; public final class QueryManagerImpl implements QueryManager { private static final Logger LOGGER = Logger.getLogger(QueryManagerImpl.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + QueryManagerImpl.class.getName()); private final List listeners = synchronizedList(new ArrayList()); private final Map queryMap = @@ -67,17 +76,18 @@ public final class QueryManagerImpl implements QueryManager { private final List removeList = new ArrayList(); private static final PollingState pollState = new PollingStateImpl(); private static final Settings settings = SettingsManager.getSettings(); - private static final String ECU = "ECU"; - private static final String TCU = "TCU"; private static final String EXT = "Externals"; private final EcuInitCallback ecuInitCallback; private final MessageListener messageListener; - private final DataUpdateHandler[] dataUpdateHandlers; private FileLoggerControllerSwitchMonitor monitor; private EcuQuery fileLoggerQuery; private Thread queryManagerThread; private static boolean started; private static boolean stop; + private AsyncDataUpdateHandler dataUpdater; + private DataUpdateHandler[] updateHandlers; + private int queryCounter; + private long queryStart; public QueryManagerImpl(EcuInitCallback ecuInitCallback, MessageListener messageListener, @@ -87,7 +97,7 @@ public QueryManagerImpl(EcuInitCallback ecuInitCallback, dataUpdateHandlers); this.ecuInitCallback = ecuInitCallback; this.messageListener = messageListener; - this.dataUpdateHandlers = dataUpdateHandlers; + this.updateHandlers = dataUpdateHandlers; stop = true; } @@ -107,6 +117,11 @@ public void setFileLoggerSwitchMonitor(FileLoggerControllerSwitchMonitor monitor @Override public synchronized void addQuery(String callerId, LoggerData loggerData) { checkNotNull(callerId, loggerData); + + //Reset stats + queryCounter = 1; + queryStart = currentTimeMillis(); + //FIXME: This is a hack!! String queryId = buildQueryId(callerId, loggerData); if (loggerData.getDataType() == EXTERNAL) { @@ -121,10 +136,16 @@ public synchronized void addQuery(String callerId, LoggerData loggerData) { @Override public synchronized void removeQuery(String callerId, LoggerData loggerData) { checkNotNull(callerId, loggerData); + + //Reset stats + queryCounter = 1; + queryStart = currentTimeMillis(); + removeList.add(buildQueryId(callerId, loggerData)); if (loggerData.getDataType() != EXTERNAL) { pollState.setNewQuery(true); } + } @Override @@ -141,20 +162,23 @@ public boolean isRunning() { public void run() { started = true; queryManagerThread = Thread.currentThread(); - LOGGER.debug("QueryManager started."); + queryManagerThread.setName("Query Manager"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("QueryManager started."); try { stop = false; + while (!stop) { notifyConnecting(); - if (!settings.isLogExternalsOnly() && - doEcuInit(settings.getDestinationId())) { + Module target = settings.getDestinationTarget(); + if (!settings.isLogExternalsOnly() && doEcuInit(target)) { notifyReading(); - runLogger(settings.getDestinationId()); + runLogger(target); } else if (settings.isLogExternalsOnly()) { notifyReading(); - runLogger((byte) -1); + runLogger(null); } else { sleep(1000L); } @@ -163,80 +187,112 @@ public void run() { messageListener.reportError(e); } finally { notifyStopped(); - messageListener.reportMessage("Disconnected."); - LOGGER.debug("QueryManager stopped."); + messageListener.reportMessage(rb.getString("DISCONNECTED")); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("QueryManager stopped."); + + if (dataUpdater != null) { + dataUpdater.stopUpdater(); + } } } - private boolean doEcuInit(byte id) { - String target = null; - if (id == 0x10){ - target = ECU; - } - if (id == 0x18){ - target = TCU; - } + private boolean doEcuInit(Module module) { - try { - LoggerConnection connection = - getConnection(settings.getLoggerProtocol(), - settings.getLoggerPort(), - settings.getLoggerConnectionProperties()); - try { - messageListener.reportMessage("Sending " + target + " Init..."); - connection.ecuInit(ecuInitCallback, id); - messageListener.reportMessage("Sending " + target + " Init...done."); + final Set libraries = J2534LibraryLocator.getLibraries( + settings.getTransportProtocol().toUpperCase()); + + if (isNullOrEmpty(settings.getJ2534Device())) { + // No previous J2534 library selected in settings + for (J2534Library dll : libraries) { + LOGGER.info(String.format("Trying new J2534/%s connection: %s", + settings.getTransportProtocol(), + dll.getVendor())); + + settings.setJ2534Device(dll.getLibrary()); + if (initConnection(module, dll.getVendor())) { + return true; + } + } + } + else { + // Try previous J2534 library from settings + LOGGER.info(String.format( + "Trying previous J2534/%s connection: %s", + settings.getTransportProtocol(), + settings.getJ2534Device())); + if (initConnection(module, settings.getJ2534Device())) { return true; - } finally { - connection.close(); } - } catch (Exception e) { - messageListener.reportMessage("Unable to send " + target + - " init - check cable is connected and ignition is on."); - logError(e); - return false; } + settings.setJ2534Device(""); + // Finally try Serial + if (initConnection(module, settings.getLoggerPort())) { + return true; + } + return false; } - private void logError(Exception e) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Error sending init", e); - } else { - LOGGER.info("Error sending init: " + e.getMessage()); + private boolean initConnection(final Module module, final String name) { + LoggerConnection connection = null; + boolean rv = false; + try { + messageListener.reportMessage(MessageFormat.format( + rb.getString("SENDINIT"), module.getName(), name)); + connection = getConnection(settings.getLoggerProtocol(), + settings.getLoggerPort(), + settings.getLoggerConnectionProperties()); + connection.ecuInit(ecuInitCallback, module); + messageListener.reportMessage(MessageFormat.format( + rb.getString("INITDONE"), module.getName(), name)); + rv = true; + } catch (Exception e) { + messageListener.reportMessage(MessageFormat.format( + rb.getString("INITFAIL"), module.getName())); + LOGGER.error("Error sending init: " + e.getMessage()); } + finally { + if (connection != null) connection.close(); + } + return rv; } - private void runLogger(byte id) { - String target = null; - if (id == -1){ - target = EXT; - } - if (id == 0x10){ - target = ECU; + private void runLogger(Module module) { + String moduleName = null; + if (module == null){ + moduleName = EXT; } - if (id == 0x18){ - target = TCU; + else { + moduleName = module.getName(); } TransmissionManager txManager = new TransmissionManagerImpl(); - long start = currentTimeMillis(); + queryStart = currentTimeMillis(); + queryCounter = 1; long end = currentTimeMillis(); - int count = 0; + try { txManager.start(); + + if(dataUpdater != null && dataUpdater.isRunning()) { + dataUpdater.stopUpdater(); + } + + dataUpdater = new AsyncDataUpdateHandler(updateHandlers); + dataUpdater.start(); + boolean lastPollState = settings.isFastPoll(); while (!stop) { pollState.setFastPoll(settings.isFastPoll()); updateQueryList(); if (queryMap.isEmpty()) { if (pollState.isLastQuery() && - pollState.getCurrentState() == 0) { + pollState.getCurrentState() == PollingState.State.STATE_0) { endEcuQueries(txManager); - pollState.setLastState(0); + pollState.setLastState(PollingState.State.STATE_0); } - start = System.currentTimeMillis(); - count = 0; - messageListener.reportMessage("Select parameters to be logged..."); - sleep(1000L); + + messageListener.reportMessage(rb.getString("SELECTPARAMS")); + sleep(100L); } else { end = currentTimeMillis() + 1L; // update once every 1msec final List ecuQueries = @@ -249,40 +305,40 @@ private void runLogger(byte id) { endEcuQueries(txManager); } if (pollState.isFastPoll()) { - if (pollState.getCurrentState() == 0 && + if (pollState.getCurrentState() == PollingState.State.STATE_0 && pollState.isNewQuery()) { - pollState.setCurrentState(1); + pollState.setCurrentState(PollingState.State.STATE_1); pollState.setNewQuery(false); } - if (pollState.getCurrentState() == 0 && + if (pollState.getCurrentState() == PollingState.State.STATE_0 && !pollState.isNewQuery()) { - pollState.setCurrentState(1); + pollState.setCurrentState(PollingState.State.STATE_1); } - if (pollState.getCurrentState() == 1 && + if (pollState.getCurrentState() == PollingState.State.STATE_1 && pollState.isNewQuery()) { - pollState.setCurrentState(0); - pollState.setLastState(1); + pollState.setCurrentState(PollingState.State.STATE_0); + pollState.setLastState(PollingState.State.STATE_1); pollState.setNewQuery(false); } - if (pollState.getCurrentState() == 1 && + if (pollState.getCurrentState() == PollingState.State.STATE_1 && !pollState.isNewQuery()) { - pollState.setLastState(1); + pollState.setLastState(PollingState.State.STATE_1); } pollState.setLastQuery(true); } else { - pollState.setCurrentState(0); - pollState.setLastState(0); + pollState.setCurrentState(PollingState.State.STATE_0); + pollState.setLastState(PollingState.State.STATE_0); pollState.setNewQuery(false); } lastPollState = pollState.isFastPoll(); } else { if (pollState.isLastQuery() && - pollState.getLastState() == 1) { + pollState.getLastState() == PollingState.State.STATE_1) { endEcuQueries(txManager); - pollState.setLastState(0); - pollState.setCurrentState(0); + pollState.setLastState(PollingState.State.STATE_0); + pollState.setCurrentState(PollingState.State.STATE_0); pollState.setNewQuery(true); } } @@ -292,17 +348,21 @@ private void runLogger(byte id) { while (currentTimeMillis() < end) { sleep(1L); } + handleQueryResponse(); - count++; - messageListener.reportMessage("Querying " + target + "..."); - messageListener.reportStats(buildStatsMessage(start, count)); + queryCounter++; + messageListener.reportMessage(MessageFormat.format( + rb.getString("QUERYING"), moduleName)); + messageListener.reportStats(buildStatsMessage(queryStart, queryCounter)); } } } catch (Exception e) { messageListener.reportError(e); + sleep(500L); } finally { + messageListener.reportMessage(rb.getString("STOPPING")); txManager.stop(); - pollState.setCurrentState(0); + pollState.setCurrentState(PollingState.State.STATE_0); pollState.setNewQuery(true); } } @@ -312,7 +372,7 @@ private void sendEcuQueries(TransmissionManager txManager) { if (fileLoggerQuery != null && settings.isFileLoggingControllerSwitchActive()) ecuQueries.add(fileLoggerQuery); - txManager.sendQueries(ecuQueries, pollState); + txManager.sendQueries(ecuQueries, pollState); } private void sendExternalQueries() { @@ -334,14 +394,9 @@ private void handleQueryResponse() { if (settings.isFileLoggingControllerSwitchActive()) monitor.monitorFileLoggerSwitch(fileLoggerQuery.getResponse()); final Response response = buildResponse(queryMap.values()); - for (final DataUpdateHandler dataUpdateHandler : dataUpdateHandlers) { - runAsDaemon(new Runnable() { - @Override - public void run() { - dataUpdateHandler.handleDataUpdate(response); - } - }); - } + + + dataUpdater.addResponse(response); } private Response buildResponse(Collection queries) { @@ -403,22 +458,26 @@ private void removeQueries() { } private String buildStatsMessage(long start, int count) { - String state = "Slow-K:"; + String state = MessageFormat.format( + rb.getString("SLOWK"), settings.getLoggerProtocol()); if (pollState.isFastPoll()) { - state = "Fast-K:"; + state = MessageFormat.format( + rb.getString("FASTK"), settings.getLoggerProtocol()); } if (settings.getTransportProtocol().equals("ISO15765")) { - state = "CAN bus:"; + state = MessageFormat.format( + rb.getString("CANBUS"), settings.getLoggerProtocol()); } if (settings.isLogExternalsOnly()) { - state = "Externals:"; + state = MessageFormat.format( + rb.getString("EXTERNALS"), settings.getLoggerProtocol()); } - double duration = (System.currentTimeMillis() - start) / 1000.0; - String result = String.format( - "%s[ %.2f queries/sec, %.2f sec/query ]", + double duration = (currentTimeMillis() - start) / 1000.0; + String result = MessageFormat.format( + rb.getString("QUERYSTATS"), state, - (count) / duration, - duration / (count) + (count / duration), + (duration / count) ); return result; } @@ -439,7 +498,10 @@ private void notifyReading() { @Override public void run() { for (StatusChangeListener listener : listeners) { - listener.readingData(); + if(settings.isLogExternalsOnly()) listener.readingDataExternal(); + else { + listener.readingData(); + } } } }); diff --git a/src/main/java/com/romraider/logger/ecu/comms/manager/TransmissionManagerImpl.java b/src/main/java/com/romraider/logger/ecu/comms/manager/TransmissionManagerImpl.java index 81606e040..9d4191c2f 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/manager/TransmissionManagerImpl.java +++ b/src/main/java/com/romraider/logger/ecu/comms/manager/TransmissionManagerImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2014 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,7 +56,7 @@ public void sendQueries(Collection queries, PollingState pollState) { checkNotNull(queries, "queries"); checkNotNull(pollState, "pollState"); if (connection == null) throw new NotConnectedException("TransmissionManager must be started before queries can be sent!"); - connection.sendAddressReads(queries, SettingsManager.getSettings().getDestinationId(), pollState); + connection.sendAddressReads(queries, SettingsManager.getSettings().getDestinationTarget(), pollState); } @Override diff --git a/src/main/java/com/romraider/logger/ecu/comms/query/DS2EcuInit.java b/src/main/java/com/romraider/logger/ecu/comms/query/DS2EcuInit.java new file mode 100644 index 000000000..66a01a902 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/query/DS2EcuInit.java @@ -0,0 +1,45 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2014 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.query; + +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import static java.lang.System.arraycopy; + +public final class DS2EcuInit implements EcuInit { + private byte[] ecuInitBytes; + private String ecuId; + + public DS2EcuInit(byte[] ecuInitBytes) { + checkNotNullOrEmpty(ecuInitBytes, "ecuInitBytes"); + this.ecuInitBytes = ecuInitBytes; + final byte[] ecuIdBytes = new byte[7]; + arraycopy(ecuInitBytes, 0, ecuIdBytes, 0, 7); + ecuId = new String(ecuIdBytes); + } + + public String getEcuId() { + return ecuId; + } + + public byte[] getEcuInitBytes() { + return ecuInitBytes; + } + +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/query/EcuInit.java b/src/main/java/com/romraider/logger/ecu/comms/query/EcuInit.java index b7d70cf2e..17362aa0b 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/query/EcuInit.java +++ b/src/main/java/com/romraider/logger/ecu/comms/query/EcuInit.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,8 +21,16 @@ public interface EcuInit { + /** + * Get the module ID string. + * @return ID string + */ String getEcuId(); + /** + * Get the module initialization sequence. + * @return byte array of the module initialization sequence + */ byte[] getEcuInitBytes(); } diff --git a/src/main/java/com/romraider/logger/ecu/comms/query/EcuQuery.java b/src/main/java/com/romraider/logger/ecu/comms/query/EcuQuery.java index a0aad1ab6..ed8d94705 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/query/EcuQuery.java +++ b/src/main/java/com/romraider/logger/ecu/comms/query/EcuQuery.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,11 +21,28 @@ public interface EcuQuery extends Query { + /** + * Return a list of Strings, each entry in the list is an address of this + * query. For byte data there's only one address in the list, for word + * data there are two addresses in the list, for Dword there are four + * addresses in the list. + */ String[] getAddresses(); + /** + * Return a byte array made up from all of the addresses for this query. + */ byte[] getBytes(); + /** + * Return a String made up from all of the addresses for this query in hex + * format. + */ String getHex(); + /** + * Set the byte array that represents the response data for the query. + * @param bytes + */ void setResponse(byte[] bytes); } diff --git a/src/main/java/com/romraider/logger/ecu/comms/query/EcuQueryData.java b/src/main/java/com/romraider/logger/ecu/comms/query/EcuQueryData.java new file mode 100644 index 000000000..007d3cc94 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/query/EcuQueryData.java @@ -0,0 +1,75 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.query; + +import com.romraider.logger.ecu.definition.LoggerData; + +/** + * @return the length of the data based on the data storage type + * value set in the selected converter. + */ +public final class EcuQueryData { + + /** + * Return the length for an ECU Query item. The larger of either the + * number of addresses or the length defined by the data storagetype. + * @param ecuQuery - the ECU query to evaluate + * @return the length of the data type + */ + public final static int getDataLength(EcuQuery ecuQuery) { + // A query has its data length encoded in the definition using either + // the length="#" attribute of an address element or, by the + // storagetype="?" attribute in a conversion element. + final int addressLength = ecuQuery.getAddresses().length; + int dataTypeLength = getDataLength(ecuQuery.getLoggerData()); + if (addressLength > dataTypeLength) { + dataTypeLength = addressLength; + } + return dataTypeLength; + } + + /** + * Return the length for an Logger Data item. + * @param loggerData - the Logger Data to evaluate + * @return the length of the data type + */ + public final static int getDataLength(LoggerData loggerData) { + final String dataType = + loggerData.getSelectedConvertor().getDataType().toLowerCase(); + return getDataLength(dataType); + } + + /** + * Return the length for a Data type, int8, uint8, int16, etc. + * @param dataType - the Data type string to evaluate + * @return the length of the data type + */ + public final static int getDataLength(String dataType) { + int dataLength = 1; + if (dataType.contains("int16")) { + dataLength = 2; + } + else if (dataType.contains("int32") || + dataType.contains("float")) { + dataLength = 4; + } + return dataLength; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/query/EcuQueryRangeTest.java b/src/main/java/com/romraider/logger/ecu/comms/query/EcuQueryRangeTest.java new file mode 100644 index 000000000..a65e19366 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/query/EcuQueryRangeTest.java @@ -0,0 +1,109 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.query; + +import static com.romraider.util.HexUtil.hexToInt; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.apache.log4j.Logger; + +/** + * Inspect the address of each query to determine if a single query + * with a start address and byte length can be substituted as opposed + * to querying each address separately. + */ +public final class EcuQueryRangeTest { + private static final Logger LOGGER = + Logger.getLogger(EcuQueryRangeTest.class); + private final Collection queries; + private int datalength; + private int maxLength; + + + /** + * Initialize the class with a collection of queries and the maximum + * distance between the lowest and highest allowed. + * @param queries - collection of queries + * @param maxLength - the maximum data length + */ + public EcuQueryRangeTest(Collection queries, int maxLength) { + this.queries = queries; + this.maxLength = maxLength; + } + + /** + * Inspect the address of each query to determine if a single query + * with a start address and byte length can be substituted as opposed + * to querying each address separately. + */ + public final Collection validate() { + if (queries == null) { + datalength = -1; + return null; + } + + final List queryList = (List) queries; + final Collection newQuery = new ArrayList(); + datalength = 0; + int lowestAddress = Integer.MAX_VALUE; + int highestAddress = 0; + for (EcuQuery query : queryList) { + final int dataTypeLength = EcuQueryData.getDataLength(query); + for (int i = 0; i < dataTypeLength; i++) { + int address = hexToInt(query.getAddresses()[0]) + i; + if (address < lowestAddress) { + lowestAddress = address; + newQuery.clear(); + newQuery.add(query); + } + if (address > highestAddress) { + highestAddress = address; + } + if (LOGGER.isTraceEnabled()) + LOGGER.trace( + String.format( + "addr:%d size:%d lowest:%d highest:%d", + address, highestAddress - lowestAddress + 1, + lowestAddress, highestAddress)); + } + } + datalength = highestAddress - lowestAddress + 1; + if (datalength > maxLength) { + datalength = 0; + newQuery.clear(); + } + return newQuery; + } + + /** + * Return the datalength calculated between the lowest address and the + * highest address (included the datatype length) for the queries. + * @return the length or -1 if not properly initialized + */ + public final int getLength() { + if (LOGGER.isTraceEnabled()) + LOGGER.trace( + String.format("EcuQueryRange length:%d", datalength)); + return datalength; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/query/NCSEcuInit.java b/src/main/java/com/romraider/logger/ecu/comms/query/NCSEcuInit.java new file mode 100644 index 000000000..a2e8da7be --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/comms/query/NCSEcuInit.java @@ -0,0 +1,44 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.query; + +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import static java.lang.System.arraycopy; + +public final class NCSEcuInit implements EcuInit { + final private byte[] ecuInitBytes; + final private String ecuId; + + public NCSEcuInit(byte[] ecuInitBytes) { + checkNotNullOrEmpty(ecuInitBytes, "ecuInitBytes"); + this.ecuInitBytes = ecuInitBytes; + final byte[] ecuIdBytes = new byte[6]; + arraycopy(ecuInitBytes, 2, ecuIdBytes, 0, ecuIdBytes.length); + ecuId = new String(ecuIdBytes); + } + + public String getEcuId() { + return ecuId; + } + + public byte[] getEcuInitBytes() { + return ecuInitBytes; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/comms/query/SSMEcuInit.java b/src/main/java/com/romraider/logger/ecu/comms/query/SSMEcuInit.java index abf578c84..1e670d9e5 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/query/SSMEcuInit.java +++ b/src/main/java/com/romraider/logger/ecu/comms/query/SSMEcuInit.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,11 @@ public final class SSMEcuInit implements EcuInit { private byte[] ecuInitBytes; private String ecuId; + /** + * Create a SSM ECU init class for the module and determine the ECU ID from + * within the init byte sequence. + * @param ecuInitBytes - init sequence from the module + */ public SSMEcuInit(byte[] ecuInitBytes) { checkNotNullOrEmpty(ecuInitBytes, "ecuInitBytes"); this.ecuInitBytes = ecuInitBytes; @@ -35,10 +40,26 @@ public SSMEcuInit(byte[] ecuInitBytes) { ecuId = asHex(ecuIdBytes); } + /** + * Create a SSM ECU init class for the module and set the ECU ID to the value + * provided. Use this when the ECU ID contains characters that can't be + * encoded in the init byte sequence. + * @param ecuInitBytes - init sequence from the module + * @param ecuIdString - ECU ID string + */ + public SSMEcuInit(byte[] ecuInitBytes, String ecuIdString) { + checkNotNullOrEmpty(ecuInitBytes, "ecuInitBytes"); + checkNotNullOrEmpty(ecuIdString, "ecuIdString"); + this.ecuInitBytes = ecuInitBytes; + this.ecuId = ecuIdString; + } + + @Override public String getEcuId() { return ecuId; } + @Override public byte[] getEcuInitBytes() { return ecuInitBytes; } diff --git a/src/main/java/com/romraider/logger/ecu/comms/readcodes/ReadCodesManagerImpl.java b/src/main/java/com/romraider/logger/ecu/comms/readcodes/ReadCodesManagerImpl.java index 6d77597d3..44b16da9d 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/readcodes/ReadCodesManagerImpl.java +++ b/src/main/java/com/romraider/logger/ecu/comms/readcodes/ReadCodesManagerImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,9 +22,11 @@ import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection; import static com.romraider.util.ParamChecker.checkNotNull; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.ResourceBundle; import org.apache.log4j.Logger; @@ -37,11 +39,14 @@ import com.romraider.logger.ecu.definition.EcuSwitch; import com.romraider.logger.ecu.ui.MessageListener; import com.romraider.logger.ecu.ui.swing.tools.ReadCodesResultsPanel; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; public final class ReadCodesManagerImpl implements ReadCodesManager { private static final Logger LOGGER = Logger.getLogger(ReadCodesManagerImpl.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + ReadCodesManagerImpl.class.getName()); private final MessageListener messageListener; private final EcuLogger logger; private final List dtcodes; @@ -67,26 +72,27 @@ public final int readCodes() { else if (ecuInitLength < 56) { lastCode = "D256"; } - LOGGER.debug( + if (LOGGER.isDebugEnabled()) + LOGGER.debug( "DT codes ECU init length: " + ecuInitLength + ", Last code: " + lastCode); for (int i = 0; !dtcodes.get(i).getId().equals(lastCode); i++) { queries.add(new EcuQueryImpl(dtcodes.get(i))); - LOGGER.debug("Adding query for DTC: " + dtcodes.get(i).getName()); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Adding query for DTC: " + dtcodes.get(i).getName()); } - String target = "ECU"; + final Settings settings = SettingsManager.getSettings(); + final String target = settings.getDestinationTarget().getName().toUpperCase(); try { - Settings settings = SettingsManager.getSettings(); final LoggerConnection connection = getConnection( settings.getLoggerProtocol(), - logger.getSettings().getLoggerPort(), - logger.getSettings().getLoggerConnectionProperties()); + settings.getLoggerPort(), + settings.getLoggerConnectionProperties()); try { - if (settings.getDestinationId() == 0x18) target = "TCU"; - messageListener.reportMessage( - "Reading " + target + " DTC codes..."); + messageListener.reportMessage(MessageFormat.format( + rb.getString("READCODES"), target)); final Collection querySet = new ArrayList(); for (int i = 0; i < queries.size(); i += 150) { for (int j = i; (j < i + 150) && (j < queries.size()); j++) { @@ -94,12 +100,12 @@ else if (ecuInitLength < 56) { } connection.sendAddressReads( querySet, - settings.getDestinationId(), + settings.getDestinationTarget(), new PollingStateImpl()); querySet.clear(); } - messageListener.reportMessage( - "Reading " + target + " DTC codes...complete."); + messageListener.reportMessage(MessageFormat.format( + rb.getString("COMPLETE"), target)); double result = 0; final ArrayList dtcSet = new ArrayList(); @@ -110,7 +116,8 @@ else if (ecuInitLength < 56) { int mem = 0; if (result == 1 || result == 3) tmp = 1; if (result == 2 || result == 3) mem = 1; - LOGGER.debug("DTC: " + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("DTC: " + query.getLoggerData().getName() + " tmp:" + tmp + " mem:" + mem); dtcSet.add(query); @@ -131,10 +138,8 @@ else if (ecuInitLength < 56) { } } catch (Exception e) { - messageListener.reportMessage( - "Unable to read " + target + " DTC " + - " codes - check correct serial port has been selected," + - " cable is connected and ignition is on."); + messageListener.reportMessage(MessageFormat.format( + rb.getString("FAILED"), target)); LOGGER.error("Error reading " + target + " DTC codes", e); return 0; diff --git a/src/main/java/com/romraider/logger/ecu/comms/reset/ResetManager.java b/src/main/java/com/romraider/logger/ecu/comms/reset/ResetManager.java index 081c08f65..003335136 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/reset/ResetManager.java +++ b/src/main/java/com/romraider/logger/ecu/comms/reset/ResetManager.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,5 +20,5 @@ package com.romraider.logger.ecu.comms.reset; public interface ResetManager { - boolean resetEcu(); + boolean resetEcu(int resetCode); } diff --git a/src/main/java/com/romraider/logger/ecu/comms/reset/ResetManagerImpl.java b/src/main/java/com/romraider/logger/ecu/comms/reset/ResetManagerImpl.java index 78c83f084..aec8d7a03 100644 --- a/src/main/java/com/romraider/logger/ecu/comms/reset/ResetManagerImpl.java +++ b/src/main/java/com/romraider/logger/ecu/comms/reset/ResetManagerImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,16 +39,15 @@ public ResetManagerImpl(MessageListener messageListener) { } @Override - public boolean resetEcu() { - String target = "ECU"; + public boolean resetEcu(int resetCode) { + final Settings settings = SettingsManager.getSettings(); + final String target = settings.getDestinationTarget().getName(); try { - Settings settings = SettingsManager.getSettings(); LoggerConnection connection = getConnection(settings.getLoggerProtocol(), settings.getLoggerPort(), settings.getLoggerConnectionProperties()); try { - if (settings.getDestinationId() == 0x18) target = "TCU"; messageListener.reportMessage("Sending " + target + " Reset..."); - connection.ecuReset(settings.getDestinationId()); + connection.ecuReset(settings.getDestinationTarget(), resetCode); messageListener.reportMessage("Sending " + target + " Reset...done."); return true; } finally { diff --git a/src/main/java/com/romraider/logger/ecu/definition/EcuData.java b/src/main/java/com/romraider/logger/ecu/definition/EcuData.java index f08260f65..811a506a5 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/EcuData.java +++ b/src/main/java/com/romraider/logger/ecu/definition/EcuData.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2014 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,4 +23,9 @@ public interface EcuData extends LoggerData { EcuAddress getAddress(); + String getGroup(); + + String getSubgroup(); + + int getGroupSize(); } diff --git a/src/main/java/com/romraider/logger/ecu/definition/EcuDataLoader.java b/src/main/java/com/romraider/logger/ecu/definition/EcuDataLoader.java index 843996248..595abe8c5 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/EcuDataLoader.java +++ b/src/main/java/com/romraider/logger/ecu/definition/EcuDataLoader.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2014 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ import com.romraider.io.connection.ConnectionProperties; import com.romraider.logger.ecu.comms.query.EcuInit; import java.io.File; +import java.util.Collection; import java.util.List; import java.util.Map; @@ -44,4 +45,6 @@ public interface EcuDataLoader { String getDefVersion(); List getEcuCodes(); + + Map>> getProtocols(); } diff --git a/src/main/java/com/romraider/logger/ecu/definition/EcuDataLoaderImpl.java b/src/main/java/com/romraider/logger/ecu/definition/EcuDataLoaderImpl.java index 478441359..43d9473b9 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/EcuDataLoaderImpl.java +++ b/src/main/java/com/romraider/logger/ecu/definition/EcuDataLoaderImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,10 @@ import com.romraider.logger.ecu.definition.xml.EcuDefinitionHandler; import com.romraider.logger.ecu.definition.xml.LoggerDefinitionHandler; import com.romraider.logger.ecu.exception.ConfigurationException; +import com.romraider.util.ResourceUtil; +import com.romraider.util.SettingsManager; +import com.romraider.Settings; + import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; import static com.romraider.util.SaxParserFactory.getSaxParser; @@ -33,16 +37,22 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; +import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.ResourceBundle; public final class EcuDataLoaderImpl implements EcuDataLoader { + private static final ResourceBundle rb = new ResourceUtil().getBundle( + EcuDataLoaderImpl.class.getName()); private Map ecuDefinitionMap = new HashMap(); private List ecuParameters = new ArrayList(); private List ecuSwitches = new ArrayList(); private List dtcodes = new ArrayList(); + private Map>> protocolList = new HashMap>>(); private EcuSwitch fileLoggingControllerSwitch; private ConnectionProperties connectionProperties; private String defVersion; @@ -50,52 +60,108 @@ public final class EcuDataLoaderImpl implements EcuDataLoader { public void loadEcuDefsFromXml(File ecuDefsFile) { checkNotNull(ecuDefsFile, "ecuDefsFile"); try { - InputStream inputStream = new BufferedInputStream(new FileInputStream(ecuDefsFile)); + InputStream inputStream = new BufferedInputStream( + new FileInputStream(ecuDefsFile)); try { EcuDefinitionHandler handler = new EcuDefinitionHandler(ecuDefsFile); - getSaxParser().parse(inputStream, handler); + getSaxParser().parse(inputStream, handler, ecuDefsFile.getAbsolutePath()); ecuDefinitionMap = handler.getEcuDefinitionMap(); } finally { inputStream.close(); } } catch (SAXParseException spe) { - // catch general parsing exception - enough people don't unzip the defs that a better error message is in order - throw new ConfigurationException("Unable to read ECU definition file " + ecuDefsFile + ". Please make sure the definition file is correct. If it is in a ZIP archive, unzip the file and try again."); + // catch general parsing exception - enough people don't + // unzip the defs that a better error message is in order + throw new ConfigurationException(MessageFormat.format( + rb.getString("UNZIPECU"), ecuDefsFile)); } catch (FileNotFoundException fnfe) { - throw new ConfigurationException("The specified ECU definition file " + ecuDefsFile + " does not exist."); + throw new ConfigurationException(MessageFormat.format( + rb.getString("ECUFNF"), ecuDefsFile)); } catch (Exception e) { throw new ConfigurationException(e); } } - public void loadConfigFromXml(String loggerConfigFilePath, String protocol, String fileLoggingControllerSwitchId, EcuInit ecuInit) { + public void loadConfigFromXml(String loggerConfigFilePath, + String protocol, + String fileLoggingControllerSwitchId, + EcuInit ecuInit) { checkNotNullOrEmpty(loggerConfigFilePath, "loggerConfigFilePath"); checkNotNullOrEmpty(protocol, "protocol"); checkNotNullOrEmpty(fileLoggingControllerSwitchId, "fileLoggingControllerSwitchId"); + + + Settings s = SettingsManager.getSettings(); + boolean valid = true; + try { InputStream inputStream = new BufferedInputStream(new FileInputStream(new File(loggerConfigFilePath))); try { - LoggerDefinitionHandler handler = new LoggerDefinitionHandler(protocol, fileLoggingControllerSwitchId, ecuInit); - getSaxParser().parse(inputStream, handler); + LoggerDefinitionHandler handler = new LoggerDefinitionHandler( + protocol, fileLoggingControllerSwitchId, ecuInit); + getSaxParser().parse(inputStream, handler, loggerConfigFilePath); + ecuParameters = handler.getEcuParameters(); ecuSwitches = handler.getEcuSwitches(); fileLoggingControllerSwitch = handler.getFileLoggingControllerSwitch(); connectionProperties = handler.getConnectionProperties(); defVersion = handler.getVersion(); dtcodes = handler.getEcuCodes(); + protocolList = handler.getProtocols(); + + valid = isCurrentProtocolValid(); + + if(!valid) { + s.setLoggerProtocol(protocolList.keySet().iterator().next()); + s.setTransportProtocol(protocolList.values().iterator().next(). + keySet().iterator().next().getId()); + } } finally { inputStream.close(); } - } catch (FileNotFoundException fnfe) { - throw new ConfigurationException("The specified Logger Config file " + loggerConfigFilePath + " does not exist."); + }/* catch (FileNotFoundException fnfe) { + throw new ConfigurationException(MessageFormat.format( + rb.getString("LOGFNF"), loggerConfigFilePath)); } catch (SAXParseException spe) { - // catch general parsing exception - enough people don't unzip the defs that a better error message is in order - throw new ConfigurationException("Unable to read Logger Config file " + loggerConfigFilePath + ". Please make sure the configuration file is correct. If it is in a ZIP archive, unzip the file and try again."); - } catch (Exception e) { + // catch general parsing exception - enough people don't + // unzip the defs that a better error message is in order + throw new ConfigurationException(MessageFormat.format( + rb.getString("UNZIPLOG"), loggerConfigFilePath)); + } */catch (Exception e) { throw new ConfigurationException(e); } + + //If the new definition did not contain the desired protocol, we have to + // re-call the function with the new (available) protocol + // because only the loaded protocol gets parsed fully + if(!valid && isCurrentProtocolValid()) { + loadConfigFromXml(loggerConfigFilePath,s.getLoggerProtocol(), + fileLoggingControllerSwitchId, ecuInit); + } } - + + private boolean isCurrentProtocolValid() { + Map> transportMap; + Settings s = SettingsManager.getSettings(); + + if(!protocolList.containsKey(s.getLoggerProtocol())){ + return false; + } + else { + transportMap = protocolList.get(s.getLoggerProtocol()); + + if(transportMap != null) { + for (Transport transport : transportMap.keySet()) { + if (transport.getId().equalsIgnoreCase(s.getTransportProtocol())) { + return true; + } + } + } + + return false; + } + } + public Map getEcuDefinitionMap() { return ecuDefinitionMap; } @@ -123,4 +189,8 @@ public String getDefVersion() { public List getEcuCodes() { return dtcodes; } + + public Map>> getProtocols() { + return protocolList; + } } diff --git a/src/main/java/com/romraider/logger/ecu/definition/EcuDerivedParameterImpl.java b/src/main/java/com/romraider/logger/ecu/definition/EcuDerivedParameterImpl.java index 13cd8974e..90ec419bf 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/EcuDerivedParameterImpl.java +++ b/src/main/java/com/romraider/logger/ecu/definition/EcuDerivedParameterImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2014 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,30 +50,37 @@ public EcuDerivedParameterImpl(String id, String name, String description, EcuDa setEcuDatas(ecuDatas); } + @Override public String getId() { return id; } + @Override public String getName() { return name; } + @Override public String getDescription() { return description; } + @Override public EcuAddress getAddress() { return address; } + @Override public EcuDataConvertor getSelectedConvertor() { return convertors[selectedConvertorIndex]; } + @Override public EcuDataConvertor[] getConvertors() { return convertors; } + @Override public void selectConvertor(EcuDataConvertor convertor) { if (convertor != getSelectedConvertor()) { for (int i = 0; i < convertors.length; i++) { @@ -86,23 +93,42 @@ public void selectConvertor(EcuDataConvertor convertor) { } } + @Override public EcuDataType getDataType() { return PARAMETER; } + @Override public boolean isSelected() { return selected; } + @Override public void setSelected(boolean selected) { this.selected = selected; } + @Override public void addConvertorUpdateListener(ConvertorUpdateListener listener) { checkNotNull(listener, "listener"); listeners.add(listener); } + @Override + public String getGroup() { + return null; + } + + @Override + public String getSubgroup() { + return null; + } + + @Override + public int getGroupSize() { + return 0; + } + private EcuAddress buildCombinedAddress(EcuData[] ecuDatas) { String[] addresses = new String[0]; for (EcuData ecuData : ecuDatas) { diff --git a/src/main/java/com/romraider/logger/ecu/definition/EcuParameterConvertorImpl.java b/src/main/java/com/romraider/logger/ecu/definition/EcuParameterConvertorImpl.java index 24a03218a..e98ee72d4 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/EcuParameterConvertorImpl.java +++ b/src/main/java/com/romraider/logger/ecu/definition/EcuParameterConvertorImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2018 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,36 +20,41 @@ package com.romraider.logger.ecu.definition; import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getDefault; -import static com.romraider.util.ByteUtil.asFloat; -import static com.romraider.util.ByteUtil.asSignedInt; import static com.romraider.util.ByteUtil.asUnsignedInt; import static com.romraider.util.JEPUtil.evaluate; import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; import java.text.DecimalFormat; import java.util.HashMap; import java.util.Map; +import com.romraider.Settings; import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax; public final class EcuParameterConvertorImpl implements EcuDataConvertor { - private final String FLOAT = "float"; - private final String INT = "int"; + private static final String FLOAT = "float"; + private static final String UINT = "uint"; private final String units; private final String expression; private final DecimalFormat format; private final int bit; private final String dataType; + private final Settings.Endian endian; private final Map replaceMap; private final GaugeMinMax gaugeMinMax; public EcuParameterConvertorImpl() { - this("Raw data", "x", "0", -1, "uint", new HashMap(), getDefault()); + this("Raw data", "x", "0", -1, "uint", Settings.Endian.BIG, + new HashMap(), getDefault()); } - public EcuParameterConvertorImpl(String units, String expression, String format, int bit, String dataType, Map replaceMap, - GaugeMinMax gaugeMinMax) { + public EcuParameterConvertorImpl(String units, String expression, + String format, int bit, String dataType, Settings.Endian endian, + Map replaceMap, GaugeMinMax gaugeMinMax) { + checkNotNullOrEmpty(units, "units"); checkNotNullOrEmpty(expression, "expression"); checkNotNullOrEmpty(format, "format"); @@ -59,27 +64,53 @@ public EcuParameterConvertorImpl(String units, String expression, String format, this.format = new DecimalFormat(format); this.bit = bit; this.dataType = (dataType == null ? "uint8" : dataType); + this.endian = endian; this.replaceMap = replaceMap; this.gaugeMinMax = gaugeMinMax; } public double convert(byte[] bytes) { + final ByteBuffer bb = ByteBuffer.wrap(bytes); + if (endian == Settings.Endian.LITTLE) { + bb.order(ByteOrder.LITTLE_ENDIAN); + } + + double result = 0; if (bit >= 0 && bit <= 31) { return (asUnsignedInt(bytes) & (1 << bit)) != 0 ? 1 : 0; - } else { - double value = 0; - if (dataType.equalsIgnoreCase(FLOAT)) { - value = (double) asFloat(bytes, 0 , bytes.length); - } - else if (dataType.toLowerCase().startsWith(INT)) { - value = (double) asSignedInt(bytes); + } + else if (dataType.equalsIgnoreCase(FLOAT)) { + result = evaluate(expression, bb.getFloat()); + } + else { + long value = 0; + switch (bb.capacity()) { + case 1: + value = bb.get(); + break; + case 2: + value = bb.getShort(); + break; + case 4: + value = bb.getInt(); + break; } - else { - value = (double) asUnsignedInt(bytes); + if (dataType.toLowerCase().startsWith(UINT)) { + switch (bb.capacity()) { + case 1: + value = value & 0xff; + break; + case 2: + value = value & 0xffff; + break; + case 4: + value = value & 0xffffffffL; + break; + } } - double result = evaluate(expression, value); - return Double.isNaN(result) || Double.isInfinite(result) ? 0.0 : result; + result = evaluate(expression, value); } + return Double.isNaN(result) || Double.isInfinite(result) ? 0.0 : result; } public String getUnits() { diff --git a/src/main/java/com/romraider/logger/ecu/definition/EcuParameterImpl.java b/src/main/java/com/romraider/logger/ecu/definition/EcuParameterImpl.java index c5c12564a..0b48eee17 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/EcuParameterImpl.java +++ b/src/main/java/com/romraider/logger/ecu/definition/EcuParameterImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2014 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ import static com.romraider.logger.ecu.definition.EcuDataType.PARAMETER; import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; + import java.util.HashSet; import java.util.Set; @@ -30,12 +31,18 @@ public final class EcuParameterImpl implements EcuParameter { private final String name; private final String description; private final EcuAddress address; + private final String group; + private final String subgroup; + private final int groupsize; private final EcuDataConvertor[] convertors; private final Set listeners = new HashSet(); private int selectedConvertorIndex; private boolean selected; - public EcuParameterImpl(String id, String name, String description, EcuAddress address, EcuDataConvertor[] convertors) { + public EcuParameterImpl( + String id, String name, String description, EcuAddress address, + String group, String subgroup, String groupsize, + EcuDataConvertor[] convertors) { checkNotNullOrEmpty(id, "id"); checkNotNullOrEmpty(name, "name"); checkNotNull(description, "description"); @@ -45,33 +52,58 @@ public EcuParameterImpl(String id, String name, String description, EcuAddress a this.name = name; this.description = description; this.address = address; + this.group = group == null ? null : group.toLowerCase(); + this.subgroup = subgroup == null ? null : subgroup.toLowerCase(); + this.groupsize = groupsize == null ? 0 : Integer.parseInt(groupsize); this.convertors = convertors; } + @Override public String getId() { return id; } + @Override public String getName() { return name; } + @Override public String getDescription() { return description; } + @Override public EcuAddress getAddress() { return address; } + @Override + public String getGroup() { + return group; + } + + @Override + public String getSubgroup() { + return subgroup; + } + + @Override + public int getGroupSize() { + return groupsize; + } + + @Override public EcuDataConvertor getSelectedConvertor() { return convertors[selectedConvertorIndex]; } + @Override public EcuDataConvertor[] getConvertors() { return convertors; } + @Override public void selectConvertor(EcuDataConvertor convertor) { if (convertor != getSelectedConvertor()) { for (int i = 0; i < convertors.length; i++) { @@ -84,18 +116,22 @@ public void selectConvertor(EcuDataConvertor convertor) { } } + @Override public EcuDataType getDataType() { return PARAMETER; } + @Override public boolean isSelected() { return selected; } + @Override public void setSelected(boolean selected) { this.selected = selected; } + @Override public void addConvertorUpdateListener(ConvertorUpdateListener listener) { checkNotNull(listener, "listener"); listeners.add(listener); diff --git a/src/main/java/com/romraider/logger/ecu/definition/EcuSwitchConvertorImpl.java b/src/main/java/com/romraider/logger/ecu/definition/EcuSwitchConvertorImpl.java index 3b4fba206..06860dfde 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/EcuSwitchConvertorImpl.java +++ b/src/main/java/com/romraider/logger/ecu/definition/EcuSwitchConvertorImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2018 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,10 +26,14 @@ public final class EcuSwitchConvertorImpl implements EcuDataConvertor { private static final GaugeMinMax GAUGE_MIN_MAX = new GaugeMinMax(0.0, 1.0, 1.0); private static final String FORMAT = "0"; private final int bit; + private final String units; + private final String dataType; - public EcuSwitchConvertorImpl(int bit) { + public EcuSwitchConvertorImpl(int bit, String dataType, String units) { checkBit(bit); this.bit = bit; + this.dataType = (dataType == null ? "uint8" : dataType); + this.units = (units == null ? "On/Off" : units); } public double convert(byte[] bytes) { @@ -37,7 +41,7 @@ public double convert(byte[] bytes) { } public String getUnits() { - return "On/Off"; + return units; } public GaugeMinMax getGaugeMinMax() { @@ -63,6 +67,7 @@ public String getExpression() { @Override public String getDataType() { - return null; + // return "uint16"; // usually a bit within a byte + return dataType; // NCS provides a byte followed by a mask byte } } diff --git a/src/main/java/com/romraider/logger/ecu/definition/EcuSwitchImpl.java b/src/main/java/com/romraider/logger/ecu/definition/EcuSwitchImpl.java index 90647aa59..06e1976fd 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/EcuSwitchImpl.java +++ b/src/main/java/com/romraider/logger/ecu/definition/EcuSwitchImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2014 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,12 +28,18 @@ public final class EcuSwitchImpl implements EcuSwitch { private final String name; private final String description; private final EcuAddress address; + private final String group; + private final String subgroup; + private final int groupsize; private final EcuDataConvertor[] convertors; private int selectedConvertorIndex; private boolean fileLogController; private boolean selected; - public EcuSwitchImpl(String id, String name, String description, EcuAddress address, EcuDataConvertor[] convertors) { + public EcuSwitchImpl( + String id, String name, String description, EcuAddress address, + String group, String subgroup, String groupsize, + EcuDataConvertor[] convertors) { checkNotNullOrEmpty(id, "id"); checkNotNullOrEmpty(name, "name"); checkNotNull(description, "description"); @@ -43,33 +49,58 @@ public EcuSwitchImpl(String id, String name, String description, EcuAddress addr this.name = name; this.description = description; this.address = address; + this.group = group; + this.subgroup = subgroup; + this.groupsize = groupsize == null ? 0 : Integer.parseInt(groupsize); this.convertors = convertors; } + @Override public String getId() { return id; } + @Override public String getName() { return name; } + @Override public String getDescription() { return description; } + @Override public EcuAddress getAddress() { return address; } + @Override + public String getGroup() { + return group; + } + + @Override + public String getSubgroup() { + return subgroup; + } + + @Override + public int getGroupSize() { + return groupsize; + } + + @Override public EcuDataConvertor getSelectedConvertor() { return convertors[selectedConvertorIndex]; } + @Override public EcuDataConvertor[] getConvertors() { return convertors; } + @Override public void selectConvertor(EcuDataConvertor convertor) { for (int i = 0; i < convertors.length; i++) { EcuDataConvertor dataConvertor = convertors[i]; @@ -79,14 +110,17 @@ public void selectConvertor(EcuDataConvertor convertor) { } } + @Override public EcuDataType getDataType() { return SWITCH; } + @Override public boolean isSelected() { return selected; } + @Override public void setSelected(boolean selected) { this.selected = selected; } diff --git a/src/main/java/com/romraider/logger/ecu/definition/Module.java b/src/main/java/com/romraider/logger/ecu/definition/Module.java new file mode 100644 index 000000000..4ed5109d3 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/definition/Module.java @@ -0,0 +1,71 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2014 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.definition; + +import static com.romraider.util.ParamChecker.checkNotNull; +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; + +public final class Module { + private final String name; + private final byte[] address; + private final String description; + private final byte[] tester; + private final boolean fastpoll; + + public Module( + String name, byte[] address, String description, + byte[] tester, boolean fastpoll) { + + checkNotNull(name, "name"); + checkNotNullOrEmpty(address, "address"); + checkNotNull(description, "description"); + checkNotNull(tester, "tester"); + this.name = name; + this.address = address; + this.description = description; + this.tester = tester; + this.fastpoll = fastpoll; + } + + public String getName() { + return name; + } + + public byte[] getAddress() { + return address; + } + + public String getDescription() { + return description; + } + + public byte[] getTester() { + return tester; + } + + public boolean getFastPoll() { + return fastpoll; + } + + @Override + public String toString() { + return name.toUpperCase(); + } +} diff --git a/src/main/java/com/romraider/logger/ecu/definition/Transport.java b/src/main/java/com/romraider/logger/ecu/definition/Transport.java new file mode 100644 index 000000000..8785020b9 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/definition/Transport.java @@ -0,0 +1,54 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.definition; + +import static com.romraider.util.ParamChecker.checkNotNull; + +public final class Transport { + private final String id; + private final String name; + private final String description; + + public Transport(String id, String name, String description) { + checkNotNull(name, "id"); + checkNotNull(name, "name"); + checkNotNull(description, "description"); + this.id = id.toUpperCase(); + this.name = name; + this.description = description; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + @Override + public String toString() { + return name; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/definition/xml/EcuDefinitionHandler.java b/src/main/java/com/romraider/logger/ecu/definition/xml/EcuDefinitionHandler.java index 999703692..e4b70e8c8 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/xml/EcuDefinitionHandler.java +++ b/src/main/java/com/romraider/logger/ecu/definition/xml/EcuDefinitionHandler.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ */ public final class EcuDefinitionHandler extends DefaultHandler { private static final Logger LOGGER = Logger.getLogger(EcuDefinitionHandler.class); - private static final String TAG_ROM = "rom"; + private static final String TAG_ROM = "rom"; private static final String TAG_ROMID = "romid"; private static final String TAG_CALID = "internalidstring"; private static final String TAG_ECUID = "ecuid"; @@ -86,10 +86,12 @@ public EcuDefinitionHandler(File ecuDefsFile) { this.ecuDefsFile = ecuDefsFile; } + @Override public void startDocument() { ecuDefinitionMap = new HashMap(); } + @Override public void startElement(String uri, String localName, String qName, Attributes attributes) { if (TAG_ROM.equals(qName)) { inherit = attributes.getValue(ATTR_BASE); @@ -114,16 +116,18 @@ else if (TAG_ROMID.equals(qName)) { charBuffer = new StringBuilder(); } + @Override public void characters(char[] ch, int start, int length) { charBuffer.append(ch, start, length); } + @Override public void endElement(String uri, String localName, String qName) { if (TAG_ROM.equals(qName)) { inherit = null; } else if (TAG_ROMID.equals(qName)) { - if (!isNullOrEmpty(ecuId) && + if (!isNullOrEmpty(ecuId) && !isNullOrEmpty(calId) && !isNullOrEmpty(year) && !isNullOrEmpty(market) && @@ -138,7 +142,7 @@ else if (TAG_ROMID.equals(qName)) { new EcuDefinitionImpl( ecuId, calId, carString, inherit, ecuDefsFile)); } - if (!isNullOrEmpty(ecuId) && + if (!isNullOrEmpty(ecuId) && !isNullOrEmpty(calId) && !isNullOrEmpty(address) && !isNullOrEmpty(year) && @@ -151,7 +155,8 @@ else if (TAG_ROMID.equals(qName)) { !isNullOrEmpty(flashmethod) && !isNullOrEmpty(obsolete) ) { - LOGGER.debug(romDetail()); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(romDetail()); } } else if (TAG_CALID.equals(qName)) { @@ -177,7 +182,7 @@ else if (TAG_YEAR.equals(qName)) { catch (NumberFormatException e) { if ((year.contains("/") || year.contains("-")) && year.length() < 6 ) - year = "20" + year; + year = "20" + year; } } else { diff --git a/src/main/java/com/romraider/logger/ecu/definition/xml/EcuTableDefinitionHandler.java b/src/main/java/com/romraider/logger/ecu/definition/xml/EcuTableDefinitionHandler.java index 534d65309..8c5f1a9d5 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/xml/EcuTableDefinitionHandler.java +++ b/src/main/java/com/romraider/logger/ecu/definition/xml/EcuTableDefinitionHandler.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2017 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,9 +105,11 @@ private static final void addAttributesAsMap( final NamedNodeMap attrs = node.getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { - tableMap.put( - attrs.item(i).getNodeName(), - attrs.item(i).getNodeValue()); + if (!tableMap.containsKey(attrs.item(i).getNodeName())) { + tableMap.put( + attrs.item(i).getNodeName(), + attrs.item(i).getNodeValue()); + } } } } diff --git a/src/main/java/com/romraider/logger/ecu/definition/xml/LoggerDefinitionHandler.java b/src/main/java/com/romraider/logger/ecu/definition/xml/LoggerDefinitionHandler.java index 087d4c7b2..eb665a4ee 100644 --- a/src/main/java/com/romraider/logger/ecu/definition/xml/LoggerDefinitionHandler.java +++ b/src/main/java/com/romraider/logger/ecu/definition/xml/LoggerDefinitionHandler.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2018 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,14 +19,17 @@ package com.romraider.logger.ecu.definition.xml; +import static com.romraider.Settings.COMMA; import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getMax; import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getMin; import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getStep; +import static com.romraider.util.HexUtil.asBytes; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; import static com.romraider.util.ParamChecker.isNullOrEmpty; import static java.lang.Double.parseDouble; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; @@ -37,8 +40,10 @@ import org.xml.sax.Attributes; import org.xml.sax.helpers.DefaultHandler; +import com.romraider.Settings; import com.romraider.io.connection.ConnectionProperties; -import com.romraider.io.connection.ConnectionPropertiesImpl; +import com.romraider.io.connection.KwpSerialConnectionProperties; +import com.romraider.io.connection.SerialConnectionProperties; import com.romraider.logger.ecu.comms.query.EcuInit; import com.romraider.logger.ecu.definition.EcuAddress; import com.romraider.logger.ecu.definition.EcuAddressImpl; @@ -54,6 +59,8 @@ import com.romraider.logger.ecu.definition.EcuSwitch; import com.romraider.logger.ecu.definition.EcuSwitchConvertorImpl; import com.romraider.logger.ecu.definition.EcuSwitchImpl; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.definition.Transport; import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax; public final class LoggerDefinitionHandler extends DefaultHandler { @@ -69,6 +76,8 @@ public final class LoggerDefinitionHandler extends DefaultHandler { private static final String TAG_ECUPARAM = "ecuparam"; private static final String TAG_ECU = "ecu"; private static final String TAG_DTCODE = "dtcode"; + private static final String TAG_TRANSPORT = "transport"; + private static final String TAG_MODULE = "module"; private static final String ATTR_VERSION = "version"; private static final String ATTR_ID = "id"; private static final String ATTR_NAME = "name"; @@ -77,13 +86,20 @@ public final class LoggerDefinitionHandler extends DefaultHandler { private static final String ATTR_LENGTH = "length"; private static final String ATTR_ECUBIT = "ecubit"; private static final String ATTR_UNITS = "units"; + private static final String ATTR_GROUP = "group"; + private static final String ATTR_SUBGROUP = "subgroup"; + private static final String ATTR_GROUPSIZE = "groupsize"; private static final String ATTR_EXPRESSION = "expr"; private static final String ATTR_FORMAT = "format"; private static final String ATTR_BYTE = "byte"; private static final String ATTR_BIT = "bit"; private static final String ATTR_PARAMETER = "parameter"; private static final String ATTR_STORAGETYPE = "storagetype"; + private static final String ATTR_ENDIAN = "endian"; private static final String ATTR_BAUD = "baud"; + private static final String ATTR_CANID = "canid"; + private static final String ATTR_SAE = "sae"; + private static final String ATTR_KWP = "kwp"; private static final String ATTR_DATABITS = "databits"; private static final String ATTR_STOPBITS = "stopbits"; private static final String ATTR_PARITY = "parity"; @@ -97,6 +113,12 @@ public final class LoggerDefinitionHandler extends DefaultHandler { private static final String ATTR_TARGET = "target"; private static final String ATTR_TMPADDR = "tmpaddr"; private static final String ATTR_MEMADDR = "memaddr"; + private static final String ATTR_ADDRESS = "address"; + private static final String ATTR_TESTER = "tester"; + private static final String ATTR_FASTPOLL = "fastpoll"; + private static final String ATTR_P1_MAX = "p1_max"; + private static final String ATTR_P3_MIN = "p3_min"; + private static final String ATTR_P4_MIN = "p4_min"; private final String protocol; private final String fileLoggingControllerSwitchId; private final EcuInit ecuInit; @@ -112,6 +134,9 @@ public final class LoggerDefinitionHandler extends DefaultHandler { private String desc; private String ecuByteIndex; private String ecuBit; + private String group; + private String subgroup; + private String groupsize; private String ecuIds; private List addrStrings = new ArrayList(); private boolean EcuAddressCreated; @@ -129,9 +154,15 @@ public final class LoggerDefinitionHandler extends DefaultHandler { private String conversionExpression; private String conversionFormat; private String conversionStorageType; + private Settings.Endian conversionEndian; private GaugeMinMax conversionGauge; private String target; private String version; + private String protocolId; + private Transport transport; + private Collection moduleList; + private Map> transportMap; + private Map>> protocolMap; public LoggerDefinitionHandler(String protocol, String fileLoggingControllerSwitchId, EcuInit ecuInit) { checkNotNullOrEmpty(protocol, "protocol"); @@ -146,19 +177,50 @@ public void startDocument() { switches = new ArrayList(); ecuDataMap = new HashMap(); dtcodes = new ArrayList(); + protocolMap = new HashMap>>(); } public void startElement(String uri, String localName, String qName, Attributes attributes) { if (TAG_LOGGER.equals(qName)) { version = attributes.getValue(ATTR_VERSION); } else if (TAG_PROTOCOL.equals(qName)) { - parseProtocol = protocol.equalsIgnoreCase(attributes.getValue(ATTR_ID)); + protocolId = attributes.getValue(ATTR_ID); + parseProtocol = protocol.equalsIgnoreCase(protocolId); if (parseProtocol) { - connectionProperties = new ConnectionPropertiesImpl(Integer.parseInt(attributes.getValue(ATTR_BAUD)), + if ("NCS".equalsIgnoreCase(protocolId)) { + connectionProperties = new KwpSerialConnectionProperties(Integer.parseInt(attributes.getValue(ATTR_BAUD)), + Integer.parseInt(attributes.getValue(ATTR_DATABITS)), Integer.parseInt(attributes.getValue(ATTR_STOPBITS)), + Integer.parseInt(attributes.getValue(ATTR_PARITY)), Integer.parseInt(attributes.getValue(ATTR_CONNECT_TIMEOUT)), + Integer.parseInt(attributes.getValue(ATTR_SEND_TIMEOUT)), Integer.parseInt(attributes.getValue(ATTR_P1_MAX)), + Integer.parseInt(attributes.getValue(ATTR_P3_MIN)), Integer.parseInt(attributes.getValue(ATTR_P4_MIN))); + } + else { + connectionProperties = new SerialConnectionProperties(Integer.parseInt(attributes.getValue(ATTR_BAUD)), Integer.parseInt(attributes.getValue(ATTR_DATABITS)), Integer.parseInt(attributes.getValue(ATTR_STOPBITS)), Integer.parseInt(attributes.getValue(ATTR_PARITY)), Integer.parseInt(attributes.getValue(ATTR_CONNECT_TIMEOUT)), Integer.parseInt(attributes.getValue(ATTR_SEND_TIMEOUT))); + } + } + transportMap = new HashMap>(); + } else if (TAG_TRANSPORT.equals(qName)) { + id = attributes.getValue(ATTR_ID); + name = attributes.getValue(ATTR_NAME); + desc = attributes.getValue(ATTR_DESC); + transport = new Transport(id, name, desc); + moduleList = new ArrayList(); + } else if (TAG_MODULE.equals(qName)) { + id = attributes.getValue(ATTR_ID); + final String modAddr = attributes.getValue(ATTR_ADDRESS); + desc = attributes.getValue(ATTR_DESC); + final String testerAddr = attributes.getValue(ATTR_TESTER); + final String fastpoll = attributes.getValue(ATTR_FASTPOLL); + boolean fp = false; + if (fastpoll != null && fastpoll.equalsIgnoreCase("true")) { + fp = true; } + final Module module = new Module( + id, asBytes(modAddr), desc, asBytes(testerAddr), fp); + moduleList.add(module); } else if (parseProtocol) { if (TAG_PARAMETER.equals(qName)) { id = attributes.getValue(ATTR_ID); @@ -166,6 +228,9 @@ public void startElement(String uri, String localName, String qName, Attributes desc = attributes.getValue(ATTR_DESC); ecuByteIndex = attributes.getValue(ATTR_ECUBYTEINDEX); ecuBit = attributes.getValue(ATTR_ECUBIT); + group = attributes.getValue(ATTR_GROUP); + subgroup = attributes.getValue(ATTR_SUBGROUP); + groupsize = attributes.getValue(ATTR_GROUPSIZE); target = attributes.getValue(ATTR_TARGET); resetLists(); } else if (TAG_ADDRESS.equals(qName)) { @@ -184,6 +249,13 @@ public void startElement(String uri, String localName, String qName, Attributes conversionExpression = attributes.getValue(ATTR_EXPRESSION); conversionFormat = attributes.getValue(ATTR_FORMAT); conversionStorageType = attributes.getValue(ATTR_STORAGETYPE); + String endian = attributes.getValue(ATTR_ENDIAN); + if (endian != null) { + conversionEndian = endian.equalsIgnoreCase("little") ? Settings.Endian.LITTLE : Settings.Endian.BIG; + } + else { + conversionEndian = Settings.Endian.BIG; + } double gaugeMin = getConversionMin(attributes, conversionUnits); double gaugeMax = getConversionMax(attributes, conversionUnits); double gaugeStep = getConversionStep(attributes, conversionUnits); @@ -201,6 +273,11 @@ public void startElement(String uri, String localName, String qName, Attributes desc = attributes.getValue(ATTR_DESC); ecuByteIndex = attributes.getValue(ATTR_ECUBYTEINDEX); ecuBit = attributes.getValue(ATTR_BIT); + group = attributes.getValue(ATTR_GROUP); + subgroup = attributes.getValue(ATTR_SUBGROUP); + groupsize = attributes.getValue(ATTR_GROUPSIZE); + conversionStorageType = attributes.getValue(ATTR_STORAGETYPE); + conversionUnits = attributes.getValue(ATTR_UNITS); target = attributes.getValue(ATTR_TARGET); address = new EcuAddressImpl(attributes.getValue(ATTR_BYTE), 1, Integer.valueOf(attributes.getValue(ATTR_BIT))); resetLists(); @@ -208,6 +285,9 @@ public void startElement(String uri, String localName, String qName, Attributes id = attributes.getValue(ATTR_ID); name = attributes.getValue(ATTR_NAME); desc = attributes.getValue(ATTR_DESC); + group = attributes.getValue(ATTR_GROUP); + subgroup = attributes.getValue(ATTR_SUBGROUP); + groupsize = attributes.getValue(ATTR_GROUPSIZE); target = attributes.getValue(ATTR_TARGET); resetLists(); ecuAddressMap = new HashMap(); @@ -239,6 +319,9 @@ public void characters(char[] ch, int start, int length) { public void endElement(String uri, String localName, String qName) { if (TAG_PROTOCOL.equals(qName)) { parseProtocol = false; + protocolMap.put(protocolId, transportMap); + } else if (TAG_TRANSPORT.equals(qName)) { + transportMap.put(transport, moduleList); } else if (parseProtocol) { if (TAG_ADDRESS.equals(qName)) { addrStrings.add(charBuffer.toString()); @@ -263,7 +346,8 @@ public void endElement(String uri, String localName, String qName) { if (convertorList.isEmpty()) { convertorList.add(new EcuParameterConvertorImpl()); } - EcuParameter param = new EcuParameterImpl(id, name, desc, address, + EcuParameter param = new EcuParameterImpl( + id, name, desc, address, group, subgroup, groupsize, convertorList.toArray(new EcuDataConvertor[convertorList.size()])); params.add(param); ecuDataMap.put(param.getId(), param); @@ -274,15 +358,19 @@ public void endElement(String uri, String localName, String qName) { derivedConvertorList.add(new EcuDerivedParameterConvertorImpl(conversionUnits, conversionExpression, conversionFormat, replaceMap, conversionGauge)); } else { - convertorList.add(new EcuParameterConvertorImpl(conversionUnits, conversionExpression, conversionFormat, address.getBit(), - conversionStorageType, replaceMap, conversionGauge)); + convertorList.add(new EcuParameterConvertorImpl( + conversionUnits, conversionExpression, conversionFormat, + address.getBit(), conversionStorageType, conversionEndian, + replaceMap, conversionGauge)); } } else if (TAG_ECUPARAM.equals(qName)) { if (ecuInit != null && ecuAddressMap.containsKey(ecuInit.getEcuId())) { if (convertorList.isEmpty()) { convertorList.add(new EcuParameterConvertorImpl()); } - EcuParameter param = new EcuParameterImpl(id, name, desc, ecuAddressMap.get(ecuInit.getEcuId()), + EcuParameter param = new EcuParameterImpl( + id, name, desc, ecuAddressMap.get(ecuInit.getEcuId()), + group, subgroup, groupsize, convertorList.toArray(new EcuDataConvertor[convertorList.size()])); params.add(param); ecuDataMap.put(param.getId(), param); @@ -290,24 +378,34 @@ public void endElement(String uri, String localName, String qName) { } else if (TAG_ECU.equals(qName)) { address = new EcuAddressImpl(addrStrings.toArray(new String[0]), addressLength, addressBit); EcuAddressCreated = true; - for (String ecuId : ecuIds.split(",")) { + for (String ecuId : ecuIds.split(COMMA)) { ecuAddressMap.put(ecuId, address); } addrStrings.clear(); } else if (TAG_SWITCH.equals(qName)) { if (ecuByteIndex == null || ecuBit == null || ecuInit == null || isSupportedParameter(ecuInit, ecuByteIndex, ecuBit)) { - EcuDataConvertor[] convertors = new EcuDataConvertor[]{new EcuSwitchConvertorImpl(address.getBit())}; - EcuSwitch ecuSwitch = new EcuSwitchImpl(id, name, desc, address, convertors); + EcuDataConvertor[] convertors = + new EcuDataConvertor[]{new EcuSwitchConvertorImpl( + address.getBit(), + conversionStorageType, + conversionUnits)}; + EcuSwitch ecuSwitch = new EcuSwitchImpl( + id, name, desc, address, + group, subgroup, groupsize, convertors); switches.add(ecuSwitch); ecuDataMap.put(ecuSwitch.getId(), ecuSwitch); if (id.equalsIgnoreCase(fileLoggingControllerSwitchId)) { - fileLoggingControllerSwitch = new EcuSwitchImpl(id, name, desc, address, convertors); + fileLoggingControllerSwitch = new EcuSwitchImpl( + id, name, desc, address, + group, subgroup, groupsize, convertors); } } } else if (TAG_DTCODE.equals(qName)) { final EcuDataConvertor[] convertors = new EcuDataConvertor[]{new EcuDtcConvertorImpl(address.getBit())}; - final EcuSwitch ecuSwitch = new EcuSwitchImpl(id, name, desc, address, convertors); + final EcuSwitch ecuSwitch = new EcuSwitchImpl( + id, name, desc, address, + group, subgroup, groupsize, convertors); dtcodes.add(ecuSwitch); ecuDataMap.put(ecuSwitch.getId(), ecuSwitch); } @@ -338,6 +436,22 @@ public List getEcuCodes() { return dtcodes; } + public Map>> getProtocols() { + /* + if (protocolMap.get(protocol).isEmpty()) { + final Module module = new Module( + "ecu", new byte[]{0x10}, "Engine Control Unit", + new byte[]{(byte)0xF0}, true); + moduleList = new ArrayList(); + moduleList.add(module); + transport = new Transport("iso9141", "K-Line", "Low speed serial"); + transportMap = new HashMap>(); + transportMap.put(transport, moduleList); + protocolMap.put(protocol, transportMap); + }*/ + return protocolMap; + } + private void resetLists() { addrStrings.clear(); EcuAddressCreated = false; diff --git a/src/main/java/com/romraider/logger/ecu/exception/PluginNotInstalledException.java b/src/main/java/com/romraider/logger/ecu/exception/PluginNotInstalledException.java new file mode 100644 index 000000000..f208d2b0a --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/exception/PluginNotInstalledException.java @@ -0,0 +1,40 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.exception; + +public final class PluginNotInstalledException extends RuntimeException { + + private static final long serialVersionUID = -523838685805525387L; + + public PluginNotInstalledException() { + } + + public PluginNotInstalledException(String string) { + super(string); + } + + public PluginNotInstalledException(String string, Throwable throwable) { + super(string, throwable); + } + + public PluginNotInstalledException(Throwable throwable) { + super(throwable); + } +} diff --git a/src/main/java/com/romraider/logger/ecu/profile/UserProfileFileFilter.java b/src/main/java/com/romraider/logger/ecu/profile/UserProfileFileFilter.java index 6f8ac25f9..0ffe17c81 100644 --- a/src/main/java/com/romraider/logger/ecu/profile/UserProfileFileFilter.java +++ b/src/main/java/com/romraider/logger/ecu/profile/UserProfileFileFilter.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,12 +20,17 @@ package com.romraider.logger.ecu.profile; import com.romraider.swing.GenericFileFilter; +import com.romraider.util.ResourceUtil; + import javax.swing.filechooser.FileFilter; import java.io.File; +import java.util.ResourceBundle; public final class UserProfileFileFilter extends FileFilter { - - private final FileFilter filter = new GenericFileFilter("ECU Logger User Profiles", "xml"); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + UserProfileFileFilter.class.getName()); + private final FileFilter filter = new GenericFileFilter( + rb.getString("FILTER"), "xml"); public boolean accept(File file) { return filter.accept(file); diff --git a/src/main/java/com/romraider/logger/ecu/profile/UserProfileImpl.java b/src/main/java/com/romraider/logger/ecu/profile/UserProfileImpl.java index 0e4ca5e51..e1a68b987 100644 --- a/src/main/java/com/romraider/logger/ecu/profile/UserProfileImpl.java +++ b/src/main/java/com/romraider/logger/ecu/profile/UserProfileImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,14 +26,21 @@ import com.romraider.logger.ecu.definition.ExternalData; import com.romraider.logger.ecu.definition.LoggerData; import com.romraider.logger.ecu.exception.ConfigurationException; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ParamChecker.isNullOrEmpty; + +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; import java.util.Map; +import java.util.ResourceBundle; public final class UserProfileImpl implements UserProfile { private static final String NEW_LINE = System.getProperty("line.separator"); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + UserProfileImpl.class.getName()); private final Map params; private final Map switches; private final Map external; @@ -82,14 +89,27 @@ public EcuDataConvertor getSelectedConvertor(LoggerData loggerData) { for (EcuDataConvertor convertor : loggerData.getConvertors()) { if (defaultUnits.equals(convertor.getUnits())) return convertor; } - throw new ConfigurationException("Unknown default units, '" + defaultUnits + "', specified for [" + loggerData.getId() + "] " + loggerData.getName()); + throw new ConfigurationException(MessageFormat.format( + rb.getString("UNKNDEFAULT"), + defaultUnits, + loggerData.getId(), + loggerData.getName())); } } return loggerData.getSelectedConvertor(); } public byte[] getBytes() { - return buildXml().getBytes(); + byte[] profile = null; + try { + profile = buildXml().getBytes("ISO-8859-1"); + } + catch (UnsupportedEncodingException e) { + throw new UnsupportedOperationException(MessageFormat.format( + rb.getString("UNSUPPORTEDENCODE"), + e.getMessage())); + } + return profile; } @Override @@ -101,7 +121,7 @@ private String buildXml() { final Settings settings = SettingsManager.getSettings(); StringBuilder builder = new StringBuilder(); builder.append("").append(NEW_LINE); - builder.append("").append(NEW_LINE).append(NEW_LINE); + //builder.append("").append(NEW_LINE).append(NEW_LINE); builder.append("").append(NEW_LINE); if (!params.isEmpty()) { builder.append(" ").append(NEW_LINE); @@ -146,6 +166,8 @@ private Map getMap(LoggerData loggerData) { if (loggerData instanceof EcuParameter) return params; else if (loggerData instanceof EcuSwitch) return switches; else if (loggerData instanceof ExternalData) return external; - else throw new UnsupportedOperationException("Unknown LoggerData type: " + loggerData.getClass()); + else throw new UnsupportedOperationException(MessageFormat.format( + rb.getString("UNKNLOGGERDATA"), + loggerData.getClass())); } } diff --git a/src/main/java/com/romraider/logger/ecu/profile/UserProfileLoaderImpl.java b/src/main/java/com/romraider/logger/ecu/profile/UserProfileLoaderImpl.java index 6884432b9..5db2763f1 100644 --- a/src/main/java/com/romraider/logger/ecu/profile/UserProfileLoaderImpl.java +++ b/src/main/java/com/romraider/logger/ecu/profile/UserProfileLoaderImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,9 +25,16 @@ import org.apache.log4j.Logger; import org.xml.sax.SAXParseException; import java.io.BufferedInputStream; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; import java.io.InputStream; +import java.util.LinkedList; +import java.util.List; public final class UserProfileLoaderImpl implements UserProfileLoader { private static final Logger LOGGER = Logger.getLogger(UserProfileLoaderImpl.class); @@ -44,6 +51,16 @@ public UserProfile loadProfile(String userProfileFilePath) { } finally { inputStream.close(); } + } catch (FileNotFoundException fileException) { + if(fileException.getMessage().contains("profile.dtd")) { + LOGGER.info("Profile.dtd missing, applying patch: " + userProfileFilePath); + patchUserProfile(userProfileFilePath); + return loadProfile(userProfileFilePath); + } + else { + LOGGER.error("Error loading user profile file: " + userProfileFilePath, fileException); + return null; + } } catch (SAXParseException spe) { // catch general parsing exception - enough people don't unzip the defs that a better error message is in order LOGGER.error("Error loading user profile file: " + userProfileFilePath + ". Please make sure the definition file is correct. If it is in a ZIP archive, unzip the file and try again."); @@ -53,4 +70,28 @@ public UserProfile loadProfile(String userProfileFilePath) { return null; } } + + //The .dtd file was removed in a later version. This causes an error while loading the profile.xml, because profile.dtd is missing + //This removes the line from the profile.xml + private void patchUserProfile(String userProfileFilePath) { + try { + BufferedReader br = new BufferedReader(new FileReader(userProfileFilePath)); + List newLines = new LinkedList(); + String line; + while ((line = br.readLine()) != null) { + if (!line.contains("profile.dtd")) { + newLines.add(line); + } + } + br.close(); + + FileWriter writer = new FileWriter(userProfileFilePath); + for(String str: newLines) { + writer.write(str + "\n"); + } + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/CustomButtonGroup.java b/src/main/java/com/romraider/logger/ecu/ui/CustomButtonGroup.java new file mode 100644 index 000000000..b80ce8bb1 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/ui/CustomButtonGroup.java @@ -0,0 +1,46 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.ui; + +import javax.swing.ButtonGroup; +import javax.swing.ButtonModel; + +/** + * Custom ButtonGroup allows none or only one button in the group to be selected. + */ +public class CustomButtonGroup extends ButtonGroup { + private static final long serialVersionUID = 3271988244802054464L; + + /** + * Sets the selected value for the ButtonModel. + * Only one button in the group may be selected at a time but this + * override allows a selected button to be un-selected so none in the group + * are selected. + */ + @Override + public void setSelected(ButtonModel m, boolean b) { + if (b && m != null && m != getSelection()) { + super.setSelected(m, b); + } + else if (!b && m == getSelection()) { + clearSelection(); + } + } +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/DataRegistrationBrokerImpl.java b/src/main/java/com/romraider/logger/ecu/ui/DataRegistrationBrokerImpl.java index d5844449d..a24f41cc2 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/DataRegistrationBrokerImpl.java +++ b/src/main/java/com/romraider/logger/ecu/ui/DataRegistrationBrokerImpl.java @@ -75,7 +75,11 @@ public synchronized void connecting() { public synchronized void readingData() { } - + + public void readingDataExternal() { + + } + public synchronized void loggingData() { } @@ -90,4 +94,6 @@ private void deregisterLoggerDataFromDependants(LoggerData loggerData) { handlerManager.deregisterData(loggerData); } + + } diff --git a/src/main/java/com/romraider/logger/ecu/ui/StatusChangeListener.java b/src/main/java/com/romraider/logger/ecu/ui/StatusChangeListener.java index 00bce5eff..9a1997d43 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/StatusChangeListener.java +++ b/src/main/java/com/romraider/logger/ecu/ui/StatusChangeListener.java @@ -24,6 +24,8 @@ public interface StatusChangeListener { void connecting(); void readingData(); + + void readingDataExternal(); void loggingData(); diff --git a/src/main/java/com/romraider/logger/ecu/ui/StatusIndicator.java b/src/main/java/com/romraider/logger/ecu/ui/StatusIndicator.java index 5c1480357..0627982e0 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/StatusIndicator.java +++ b/src/main/java/com/romraider/logger/ecu/ui/StatusIndicator.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,19 +25,26 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; + +import com.romraider.util.ResourceUtil; + import java.awt.BorderLayout; +import java.util.ResourceBundle; public final class StatusIndicator extends JPanel implements StatusChangeListener { private static final long serialVersionUID = -3244690866698807677L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + StatusIndicator.class.getName()); private final JLabel statusLabel = new JLabel(); - private static final String TEXT_CONNECTING = "Connecting "; - private static final String TEXT_READING = "Reading data "; - private static final String TEXT_LOGGING = "Logging to file "; - private static final String TEXT_STOPPED = "Stopped "; - private static final ImageIcon ICON_CONNECTING = new ImageIcon(StatusIndicator.class.getClass().getResource("/graphics/logger_blue.png")); - private static final ImageIcon ICON_READING = new ImageIcon(StatusIndicator.class.getClass().getResource("/graphics/logger_green.png")); - private static final ImageIcon ICON_LOGGING = new ImageIcon(StatusIndicator.class.getClass().getResource("/graphics/logger_recording.png")); - private static final ImageIcon ICON_STOPPED = new ImageIcon(StatusIndicator.class.getClass().getResource("/graphics/logger_stop.png")); + private static final String TEXT_CONNECTING = rb.getString("CONNECTING"); + private static final String TEXT_READING = rb.getString("READING"); + private static final String TEXT_READING_EXTERNAL = rb.getString("READING_EXTERNAL"); + private static final String TEXT_LOGGING = rb.getString("LOGGING"); + private static final String TEXT_STOPPED = rb.getString("STOPPED"); + private static final ImageIcon ICON_CONNECTING = new ImageIcon(StatusIndicator.class.getResource("/graphics/logger_blue.png")); + private static final ImageIcon ICON_READING = new ImageIcon(StatusIndicator.class.getResource("/graphics/logger_green.png")); + private static final ImageIcon ICON_LOGGING = new ImageIcon(StatusIndicator.class.getResource("/graphics/logger_recording.png")); + private static final ImageIcon ICON_STOPPED = new ImageIcon(StatusIndicator.class.getResource("/graphics/logger_stop.png")); public StatusIndicator() { setLayout(new BorderLayout()); @@ -46,24 +53,34 @@ public StatusIndicator() { stopped(); } + @Override public void connecting() { updateStatusLabel(TEXT_CONNECTING, ICON_CONNECTING); } + @Override public void readingData() { updateStatusLabel(TEXT_READING, ICON_READING); } + @Override + public void readingDataExternal() { + updateStatusLabel(TEXT_READING_EXTERNAL, ICON_READING); + } + + @Override public void loggingData() { updateStatusLabel(TEXT_LOGGING, ICON_LOGGING); } + @Override public void stopped() { updateStatusLabel(TEXT_STOPPED, ICON_STOPPED); } private void updateStatusLabel(final String text, final ImageIcon icon) { SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { statusLabel.setText(text); statusLabel.setIcon(icon); diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/dash/DashboardUpdateHandler.java b/src/main/java/com/romraider/logger/ecu/ui/handler/dash/DashboardUpdateHandler.java index 22bb5e0a3..e10390b61 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/dash/DashboardUpdateHandler.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/dash/DashboardUpdateHandler.java @@ -36,10 +36,11 @@ public final class DashboardUpdateHandler implements DataUpdateHandler, Converto private static final Class[] STYLES = {PlainGaugeStyle.class, SmallGaugeStyle.class, NoFrillsGaugeStyle.class, DialGaugeStyle.class, SmallDialGaugeStyle.class}; private final Map gauges = synchronizedMap(new HashMap()); private final JPanel dashboardPanel; - private int styleIndex; + public int styleIndex; - public DashboardUpdateHandler(JPanel dashboardPanel) { + public DashboardUpdateHandler(JPanel dashboardPanel, int styleIndex) { this.dashboardPanel = dashboardPanel; + this.styleIndex = styleIndex; } public synchronized void registerData(final LoggerData loggerData) { @@ -51,13 +52,15 @@ public synchronized void registerData(final LoggerData loggerData) { } public synchronized void handleDataUpdate(Response response) { - for (LoggerData loggerData : response.getData()) { - Gauge gauge = gauges.get(loggerData); - if (gauge != null) { - double value = response.getDataValue(loggerData); - gauge.updateValue(value); - } - } + if (dashboardPanel.isShowing()) { + for (LoggerData loggerData : response.getData()) { + Gauge gauge = gauges.get(loggerData); + if (gauge != null) { + double value = response.getDataValue(loggerData); + gauge.updateValue(value); + } + } + } } public synchronized void deregisterData(LoggerData loggerData) { diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/dash/DialGaugeStyle.java b/src/main/java/com/romraider/logger/ecu/ui/handler/dash/DialGaugeStyle.java index 4c0b27e0c..22ae9daa6 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/dash/DialGaugeStyle.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/dash/DialGaugeStyle.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,6 @@ import static java.awt.Font.BOLD; import static java.awt.Font.PLAIN; import static java.lang.Double.MAX_VALUE; -import static java.lang.Double.MIN_VALUE; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.dial.DialBackground; @@ -61,7 +60,7 @@ public class DialGaugeStyle implements GaugeStyle { protected final DefaultValueDataset min = new DefaultValueDataset(0.0); protected final DialTextAnnotation unitsLabel = new DialTextAnnotation(""); protected final LoggerData loggerData; - private double maxValue = MIN_VALUE; + private double maxValue = MAX_VALUE * -1; private double minValue = MAX_VALUE; private JPanel panel; @@ -108,7 +107,8 @@ public void run() { if (value > maxValue) { maxValue = value; max.setValue(value); - } else if (value < minValue) { + } + if (value < minValue) { minValue = value; min.setValue(value); } @@ -127,7 +127,7 @@ public void resetValue() { private void resetMinMax(final double value) { SwingUtilities.invokeLater(new Runnable() { public void run() { - maxValue = MIN_VALUE; + maxValue = MAX_VALUE * -1; minValue = MAX_VALUE; max.setValue(value); min.setValue(value); diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/dash/Gauge.java b/src/main/java/com/romraider/logger/ecu/ui/handler/dash/Gauge.java index bf4cce029..572d60563 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/dash/Gauge.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/dash/Gauge.java @@ -29,7 +29,6 @@ public final class Gauge extends JPanel { private GaugeStyle style; public Gauge(GaugeStyle style) { - super(); setLayout(new BorderLayout(0, 0)); setGaugeStyle(style); } diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/dash/PlainGaugeStyle.java b/src/main/java/com/romraider/logger/ecu/ui/handler/dash/PlainGaugeStyle.java index e265fed60..23e64ea22 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/dash/PlainGaugeStyle.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/dash/PlainGaugeStyle.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +20,8 @@ package com.romraider.logger.ecu.ui.handler.dash; import com.romraider.logger.ecu.definition.LoggerData; -import com.romraider.tts.Speaker; +import com.romraider.util.ResourceUtil; + import static com.romraider.util.ParamChecker.checkNotNull; import static java.awt.BorderLayout.CENTER; import static java.awt.BorderLayout.NORTH; @@ -30,6 +31,9 @@ import static java.awt.Font.BOLD; import static java.awt.Font.PLAIN; import static javax.swing.BorderFactory.createLineBorder; + +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.Clip; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; @@ -43,11 +47,15 @@ import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.File; +import java.util.ResourceBundle; public class PlainGaugeStyle implements GaugeStyle, ActionListener { + protected static final ResourceBundle rb = new ResourceUtil().getBundle( + PlainGaugeStyle.class.getName()); private static final String BLANK = ""; - private static final String ABOVE = "above"; - private static final String BELOW = "below"; + private static final String ABOVE = rb.getString("ABOVE"); + private static final String BELOW = rb.getString("BELOW"); protected static final Color RED = new Color(190, 30, 30); protected static final Color GREEN = new Color(34, 139, 34); protected static final Color DARK_GREY = new Color(40, 40, 40); @@ -59,14 +67,15 @@ public class PlainGaugeStyle implements GaugeStyle, ActionListener { protected final JLabel minLabel = new JLabel(BLANK, JLabel.CENTER); protected final JLabel title = new JLabel(BLANK, JLabel.CENTER); protected final JProgressBar progressBar = new JProgressBar(JProgressBar.VERTICAL); - protected final JCheckBox warnCheckBox = new JCheckBox("Warn"); + protected final JCheckBox warnCheckBox = new JCheckBox(rb.getString("LBLWARN")); protected final JComboBox warnType = new JComboBox(new Object[]{ABOVE, BELOW}); protected final JTextField warnTextField = new JTextField(); private final String zeroText; private final LoggerData loggerData; - private double max = Double.MIN_VALUE; + private double max = Double.MAX_VALUE * -1; private double min = Double.MAX_VALUE; private JPanel panel = new JPanel(); + private String warningFilePath = "customize/warningSound.wav"; public PlainGaugeStyle(LoggerData loggerData) { checkNotNull(loggerData, "loggerData"); @@ -97,13 +106,15 @@ public void resetValue() { SwingUtilities.invokeLater(new Runnable() { public void run() { liveValueLabel.setText(zeroText); - max = Double.MIN_VALUE; + max = Double.MAX_VALUE * -1; maxLabel.setText(zeroText); min = Double.MAX_VALUE; minLabel.setText(zeroText); + progressBar.setIndeterminate(true); progressBar.setMinimum(scaleForProgressBar(min)); progressBar.setMaximum(scaleForProgressBar(max)); progressBar.setValue(scaleForProgressBar(min)); + progressBar.setIndeterminate(false); } }); } @@ -146,8 +157,8 @@ protected void doApply(JPanel panel) { // max/min panel JPanel maxMinPanel = new JPanel(new BorderLayout(2, 2)); maxMinPanel.setBackground(BLACK); - JPanel maxPanel = buildMaxMinPanel("max", maxLabel); - JPanel minPanel = buildMaxMinPanel("min", minLabel); + JPanel maxPanel = buildMaxMinPanel(rb.getString("LBLMAX"), maxLabel); + JPanel minPanel = buildMaxMinPanel(rb.getString("LBLMIN"), minLabel); maxMinPanel.add(maxPanel, NORTH); maxMinPanel.add(minPanel, SOUTH); data.add(maxMinPanel); @@ -241,21 +252,28 @@ private double getWarnThreshold() { return Double.parseDouble(warnTextField.getText()); } - private void setWarning(final boolean enabled) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - if (enabled) { - panel.setBackground(RED); - liveValuePanel.setBackground(RED); - progressBar.setForeground(RED); - Speaker.say("Warning!"); - } else { - panel.setBackground(LIGHT_GREY); - liveValuePanel.setBackground(LIGHT_GREY); - progressBar.setForeground(GREEN); - } + private void setWarning(boolean enabled) { + if (enabled) { + panel.setBackground(RED); + liveValuePanel.setBackground(RED); + progressBar.setForeground(RED); + + // Play Warning Sound + try + { + Clip clip = AudioSystem.getClip(); + clip.open(AudioSystem.getAudioInputStream(new File(warningFilePath))); + clip.start(); } - }); + catch (Exception exc) + { + exc.printStackTrace(); + } + } else { + panel.setBackground(LIGHT_GREY); + liveValuePanel.setBackground(LIGHT_GREY); + progressBar.setForeground(GREEN); + } } private String format(LoggerData loggerData, double value) { diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/dash/SmallGaugeStyle.java b/src/main/java/com/romraider/logger/ecu/ui/handler/dash/SmallGaugeStyle.java index 640598842..d9bad746a 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/dash/SmallGaugeStyle.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/dash/SmallGaugeStyle.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,8 +62,8 @@ protected void doApply(JPanel panel) { // max/min panel JPanel maxMinPanel = new JPanel(new BorderLayout(1, 1)); maxMinPanel.setBackground(BLACK); - JPanel maxPanel = buildMaxMinPanel("max", maxLabel); - JPanel minPanel = buildMaxMinPanel("min", minLabel); + JPanel maxPanel = buildMaxMinPanel(rb.getString("LBLMAX"), maxLabel); + JPanel minPanel = buildMaxMinPanel(rb.getString("LBLMIN"), minLabel); maxMinPanel.add(maxPanel, NORTH); maxMinPanel.add(minPanel, SOUTH); data.add(maxMinPanel); diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/dataflow/DataflowSimulationHandler.java b/src/main/java/com/romraider/logger/ecu/ui/handler/dataflow/DataflowSimulationHandler.java new file mode 100644 index 000000000..932748dbd --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/dataflow/DataflowSimulationHandler.java @@ -0,0 +1,99 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2023 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.ui.handler.dataflow; + +import static java.util.Collections.synchronizedMap; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.ListIterator; +import java.util.Map; + +import com.romraider.logger.ecu.comms.query.Response; +import com.romraider.logger.ecu.definition.LoggerData; +import com.romraider.logger.ecu.ui.handler.DataUpdateHandler; +import com.romraider.dataflowSimulation.DataflowSimulation; + +public final class DataflowSimulationHandler implements DataUpdateHandler { + private static final DataflowSimulationHandler INSTANCE = new DataflowSimulationHandler(); + // LoggerID --> List of (Variable Name, Simulation) + private final Map>> simulations = synchronizedMap( + new HashMap>>()); + + public DataflowSimulationHandler() { + simulations.clear(); + } + + @Override + public void registerData(LoggerData loggerData) { + } + + @Override + public void handleDataUpdate(Response response) { + if (!simulations.isEmpty()) { + for (LoggerData loggerData : response.getData()) { + synchronized (simulations) { + LinkedList> simsForID = simulations.get(loggerData.getId()); + if (simsForID != null) { + double dataValue = response.getDataValue(loggerData); + + for (ListIterator> item = simsForID.listIterator(); item + .hasNext();) { + Map.Entry value = item.next(); + value.getValue().updateVariableFromLogger(value.getKey(), dataValue); + } + } + } + } + } + } + + @Override + public void deregisterData(LoggerData loggerData) { + } + + @Override + public void cleanUp() { + simulations.clear(); + } + + @Override + public void reset() { + } + + public void registerInput(String logParam, String varName, DataflowSimulation sim) { + if(!logParam.isEmpty() && !varName.isEmpty() && sim != null) + { + if (!simulations.containsKey(logParam)) { + LinkedList> list = new LinkedList>(); + list.add(new AbstractMap.SimpleImmutableEntry(varName, sim)); + simulations.put(logParam, list); + } else { + LinkedList> list = simulations.get(logParam); + list.add(new AbstractMap.SimpleImmutableEntry(varName, sim)); + } + } + } + + public static DataflowSimulationHandler getInstance() { + return INSTANCE; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/dyno/DynoUpdateHandler.java b/src/main/java/com/romraider/logger/ecu/ui/handler/dyno/DynoUpdateHandler.java index cd20d370f..393dc027c 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/dyno/DynoUpdateHandler.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/dyno/DynoUpdateHandler.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,6 +35,7 @@ public final class DynoUpdateHandler implements DataUpdateHandler { private static final String VS = "P9"; private static final String IAT = "P11"; private static final String TA = "P13"; + private static final String TV = "P19"; private static final String ATM = "P24"; private static final Boolean TEST = false; private DynoTab dynoTab; @@ -44,6 +45,7 @@ public final class DynoUpdateHandler implements DataUpdateHandler { private static final double[] logRpm = {1690, 1733, 1776, 1852, 1935, 2004, 2091, 2148, 2241, 2325, 2405, 2496, 2597, 2754, 2871, 2943, 3093, 3243, 3350, 3475, 3617, 3780, 3843, 4025, 4125, 4234, 4355, 4511, 4618, 4720, 4835, 4947, 5067, 5138, 5254, 5351, 5485, 5581, 5642, 5735, 5816, 5939, 6041, 6104, 6183, 6280, 6347, 6406, 6483, 6548, 6651, 6693, 6800, 6870, 6924, 6974, 7079}; private static final double[] logThrottle = {49.78, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 99.96, 10}; private static final double[] logKph = {36, 37, 39, 40, 42, 43, 45, 46, 48, 50, 52, 54, 56, 59, 61, 64, 67, 70, 73, 75, 78, 81, 83, 86, 89, 92, 94, 97, 99, 102, 104, 106, 109, 111, 113, 116, 118, 120, 122, 124, 126, 128, 130, 132, 133, 135, 137, 138, 140, 141, 143, 145, 146, 148, 149, 150, 150}; + private static final double[] logTv = {4.78, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 4.96, 1}; // 05 LGT tingtang (http://legacygt.com/forums/showpost.php?p=2783186&postcount=185) 3rd gear, 5800ft, 45 degrees F // private static final long[] logTime = {825, 1050, 1238, 1454, 1655, 1875, 2087, 2295, 2502, 2713, 2918, 3125, 3334, 3546, 3753, 3969, 4167, 4382, 4580, 4798, 4995, 5232, 5426, 5639, 5832, 6040, 6248, 6456, 6664, 6880, 7083, 7289, 7498, 7708, 7912, 8138, 8331, 8546, 8748, 8957, 9165, 9373, 9617, 9811, 10006, 10208, 10428, 10644, 10844, 11053, 11264, 11469, 11677}; @@ -96,13 +98,15 @@ public final class DynoUpdateHandler implements DataUpdateHandler { private double rpm; private double vs; private double ta; + private double tv; private long now; private long startNow = -999999999; private double iat; private double atm; public synchronized void handleDataUpdate(Response response) { - if (dynoTab.isRecordData() && (containsData(response, RPM, TA) + if (dynoTab!=null && dynoTab.isRecordData() && (containsData(response, RPM, TA) + || containsData(response, RPM, TV) || containsData(response, VS, TA) || containsData(response, VS))) { boolean valid = true; @@ -126,6 +130,25 @@ public synchronized void handleDataUpdate(Response response) { LOGGER.info("DYNO Sample: [Time]: " + now + " [RPM:P8]: " + rpm + " [TA:P13]: " + ta); if (valid) addRawData(now, rpm); } + if (valid && containsData(response, RPM, TV) && + dynoTab.isManual()) { + if (TEST) { + if (i >= logTime.length) { + i = 0; + } + now = logTime[i]; + rpm = logRpm[i]; + tv = logTv[i]; + i++; + } else { + now = currentTimeMillis(); + rpm = findValue(response, RPM); + tv = findValue(response, TV); + } + valid = dynoTab.isValidData(rpm, tv); + LOGGER.info("DYNO Sample: [Time]: " + now + " [RPM:P8]: " + rpm + " [TV:P19]: " + tv); + if (valid) addRawData(now, rpm); + } if (valid && containsData(response, VS, TA) && !dynoTab.isManual()) { if (TEST) { @@ -146,6 +169,26 @@ public synchronized void handleDataUpdate(Response response) { LOGGER.info("DYNO Sample: [Time]: " + now + " [RPM:calc]: " + rpm + " [TA:P13]: " + ta + " [VS:P9]: " + vs); if (valid) addRawData(now, vs); } + if (valid && containsData(response, VS, TV) && + !dynoTab.isManual()) { + if (TEST) { + if (i >= logTime.length) { + i = 0; + } + vs = logKph[i]; + tv = logTv[i]; + now = logTime[i]; + i++; + } else { + now = currentTimeMillis(); + vs = findValue(response, VS); + tv = findValue(response, TV); + } + rpm = dynoTab.calcRpm(vs); + valid = dynoTab.isValidData(rpm, tv); + LOGGER.info("DYNO Sample: [Time]: " + now + " [RPM:calc]: " + rpm + " [TV:P19]: " + ta + " [VS:P9]: " + vs); + if (valid) addRawData(now, vs); + } if (valid && dynoTab.isRecordET() && containsData(response, VS)) { if (TEST) { if (i >= logTime.length) { @@ -166,7 +209,7 @@ public synchronized void handleDataUpdate(Response response) { startNow = -999999999; } - if (dynoTab.getEnv() && containsData(response, IAT, ATM)) { + if (dynoTab!=null && dynoTab.getEnv() && containsData(response, IAT, ATM)) { if (TEST) { iat = 27; atm = 14.54; diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/file/FileLoggerImpl.java b/src/main/java/com/romraider/logger/ecu/ui/handler/file/FileLoggerImpl.java index 74018aba3..072bbec15 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/file/FileLoggerImpl.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/file/FileLoggerImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,24 +25,29 @@ import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; +import java.text.MessageFormat; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.ResourceBundle; import com.romraider.Settings; import com.romraider.logger.ecu.exception.FileLoggerException; import com.romraider.logger.ecu.ui.MessageListener; import com.romraider.util.FormatFilename; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; public final class FileLoggerImpl implements FileLogger { private static final String NEW_LINE = System.getProperty("line.separator"); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + FileLoggerImpl.class.getName()); private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss"); private final SimpleDateFormat timestampFormat = new SimpleDateFormat("HH:mm:ss.SSS"); private final MessageListener messageListener; private boolean started; private OutputStream os; private long startTimestamp; - private boolean zero; + //private boolean zero; public FileLoggerImpl(MessageListener messageListener) { checkNotNull(messageListener); @@ -56,15 +61,16 @@ public void start() { try { String filePath = buildFilePath(); os = new BufferedOutputStream(new FileOutputStream(filePath)); - messageListener.reportMessageInTitleBar( - "Started logging to file: " + - FormatFilename.getShortName(filePath)); - zero = true; + messageListener.reportMessageInTitleBar(MessageFormat.format( + rb.getString("STARTLOG"), + FormatFilename.getShortName(filePath))); } catch (Exception e) { stop(); throw new FileLoggerException(e); } + started = true; + startTimestamp = 0; } } @@ -73,7 +79,7 @@ public void stop() { if (os != null) { try { os.close(); - messageListener.reportMessageInTitleBar("Stopped logging to file."); + messageListener.reportMessageInTitleBar(rb.getString("STOPLOG")); } catch (Exception e) { throw new FileLoggerException(e); } @@ -117,13 +123,8 @@ private String prependTimestamp(String line, long timestamp) { if (SettingsManager.getSettings().isFileLoggingAbsoluteTimestamp()) { formattedTimestamp = timestampFormat.format(new Date(timestamp)); } else { - if (zero) { - formattedTimestamp = "0"; - startTimestamp = System.currentTimeMillis(); - zero = false; - } else { - formattedTimestamp = String.valueOf(System.currentTimeMillis() - startTimestamp); - } + if(startTimestamp == 0) startTimestamp = timestamp; + formattedTimestamp = String.valueOf(timestamp - startTimestamp); } return new StringBuilder(formattedTimestamp).append(line).toString(); } diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/file/FileUpdateHandlerImpl.java b/src/main/java/com/romraider/logger/ecu/ui/handler/file/FileUpdateHandlerImpl.java index 7795075bf..2095ba427 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/file/FileUpdateHandlerImpl.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/file/FileUpdateHandlerImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2017 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,8 @@ package com.romraider.logger.ecu.ui.handler.file; +import static com.romraider.Settings.COMMA; +import static com.romraider.Settings.SEMICOLON; import static com.romraider.util.ParamChecker.checkNotNull; import static java.util.Collections.synchronizedList; import static java.util.Collections.synchronizedMap; @@ -42,6 +44,24 @@ public final class FileUpdateHandlerImpl implements FileUpdateHandler, Convertor private final Map loggerDatas = synchronizedMap(new LinkedHashMap()); private final List listeners = synchronizedList(new ArrayList()); private final FileLogger fileLogger; + private final Set locales = new HashSet( + Arrays.asList(new String[] { + "be_BY","bg_BG","ca_ES","cs_CZ","da_DK","de_AT","de_CH","de_DE","de_LU", + "el_CY","el_GR","es_AR","es_BO","es_CL","es_CO","es_EC","es_ES","es_PE", + "es_PY","es_UY","es_VE","et_EE","fi_FI","fr_BE","fr_CA","fr_CH","fr_FR", + "fr_LU","hr_HR","hu_HU","in_ID","is_IS","it_CH","it_IT","lt_LT","lv_LV", + "mk_MK","nl_BE","nl_NL","no_NO","no_NO_NY","pl_PL","pt_BR","pt_PT", + "ro_RO","ru_RU","sk_SK","sl_SI","sq_AL","sr_BA","sr_CS","sr_ME","sr_RS", + "sv_SE","tr_TR","uk_UA","vi_VN" + } + )); + private final String language = System.getProperty("user.language.format"); + private final String country = System.getProperty("user.country.format"); + + private final String delimiter = language == null ? + locales.contains(Locale.getDefault().toString()) ? SEMICOLON : COMMA + : locales.contains(language + "_" + country) ? SEMICOLON : COMMA; + private Line currentLine = new Line(loggerDatas.keySet()); public FileUpdateHandlerImpl(MessageListener messageListener) { @@ -144,30 +164,7 @@ private void notifyListeners(boolean loggingToFile) { } private final class Line { - private final Locale userLocale = Locale.getDefault(); - private static final char COMMA = ','; - private static final char SEMICOLON = ';'; - private final Set locales = new HashSet( - Arrays.asList(new String[] { - "be_BY","bg_BG","ca_ES","cs_CZ","da_DK","de_AT","de_CH","de_DE","de_LU", - "el_CY","el_GR","es_AR","es_BO","es_CL","es_CO","es_EC","es_ES","es_PE", - "es_PY","es_UY","es_VE","et_EE","fi_FI","fr_BE","fr_CA","fr_CH","fr_FR", - "fr_LU","hr_HR","hu_HU","in_ID","is_IS","it_CH","it_IT","lt_LT","lv_LV", - "mk_MK","nl_BE","nl_NL","no_NO","no_NO_NY","pl_PL","pt_BR","pt_PT", - "ro_RO","ru_RU","sk_SK","sl_SI","sq_AL","sr_BA","sr_CS","sr_ME","sr_RS", - "sv_SE","tr_TR","uk_UA","vi_VN" - } - )); private final Map loggerDataValues; - private final char delimiter; - { - if (locales.contains(userLocale.toString())) { - delimiter = SEMICOLON; - } - else { - delimiter = COMMA; - } - } public Line(Set loggerDatas) { this.loggerDataValues = new LinkedHashMap(); @@ -192,7 +189,7 @@ public synchronized boolean isFull() { } public synchronized String headers() { - StringBuilder buffer = new StringBuilder(); + final StringBuilder buffer = new StringBuilder(); for (LoggerData loggerData : loggerDataValues.keySet()) { buffer.append(delimiter).append(loggerData.getName()).append(" (") .append(loggerData.getSelectedConvertor().getUnits()).append(')'); @@ -201,7 +198,7 @@ public synchronized String headers() { } public synchronized String values() { - StringBuilder buffer = new StringBuilder(); + final StringBuilder buffer = new StringBuilder(); for (LoggerData loggerData : loggerDataValues.keySet()) { String value = loggerDataValues.get(loggerData); buffer.append(delimiter).append(value); diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/graph/GraphUpdateHandler.java b/src/main/java/com/romraider/logger/ecu/ui/handler/graph/GraphUpdateHandler.java index 6d0a6ac91..832ef2eee 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/graph/GraphUpdateHandler.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/graph/GraphUpdateHandler.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,8 @@ import com.romraider.logger.ecu.definition.ConvertorUpdateListener; import com.romraider.logger.ecu.definition.LoggerData; import com.romraider.logger.ecu.ui.handler.DataUpdateHandler; +import com.romraider.util.ResourceUtil; + import static com.romraider.logger.ecu.ui.handler.graph.SpringUtilities.makeCompactGrid; import static java.awt.BorderLayout.CENTER; import static java.awt.BorderLayout.NORTH; @@ -53,8 +55,11 @@ import java.awt.event.ActionListener; import java.util.HashMap; import java.util.Map; +import java.util.ResourceBundle; public final class GraphUpdateHandler implements DataUpdateHandler, ConvertorUpdateListener { + private static final ResourceBundle rb = new ResourceUtil().getBundle( + GraphUpdateHandler.class.getName()); private static final Color DARK_GREY = new Color(80, 80, 80); private static final Color LIGHT_GREY = new Color(110, 110, 110); private final Map chartMap = synchronizedMap(new HashMap()); @@ -71,9 +76,10 @@ public final class GraphUpdateHandler implements DataUpdateHandler, ConvertorUpd public GraphUpdateHandler(final JPanel panel) { this.graphPanel = new JPanel(new SpringLayout()); - final JCheckBox combinedCheckbox = new JCheckBox("Combine Graphs", combinedChart); + final JCheckBox combinedCheckbox = new JCheckBox( + rb.getString("COMBINE"), combinedChart); combinedCheckbox.addActionListener(new CombinedActionListener(combinedCheckbox)); - JToggleButton playPauseButton = new JToggleButton("Pause Graphs"); + JToggleButton playPauseButton = new JToggleButton(rb.getString("PAUSE")); playPauseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { paused = !paused; @@ -147,16 +153,18 @@ private void layoutForCombined() { } public synchronized void handleDataUpdate(final Response response) { - for (final LoggerData loggerData : response.getData()) { - final XYSeries series = seriesMap.get(loggerData); - if (series != null && !paused) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - series.add((response.getTimestamp() - startTime) / 1000.0, response.getDataValue(loggerData)); - } - }); - } - } + if(!paused) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + for (final LoggerData loggerData : response.getData()) { + final XYSeries series = seriesMap.get(loggerData); + if (series != null) { + series.add((response.getTimestamp() - startTime) / 1000.0, response.getDataValue(loggerData)); + } + } + } + }); + } } public synchronized void deregisterData(LoggerData loggerData) { @@ -214,9 +222,11 @@ private void registerSeries(LoggerData loggerData) { } private JFreeChart createXYLineChart(LoggerData loggerData, XYDataset dataset, boolean combined) { - String title = combined ? "Combined Data" : loggerData.getName(); - String rangeAxisTitle = combined ? "Data" : buildRangeAxisTitle(loggerData); - JFreeChart chart = ChartFactory.createXYLineChart(title, "Time (sec)", rangeAxisTitle, dataset, VERTICAL, false, true, false); + String title = combined ? rb.getString("COMBINED") : loggerData.getName(); + String rangeAxisTitle = combined ? rb.getString("DATA") : buildRangeAxisTitle(loggerData); + JFreeChart chart = ChartFactory.createXYLineChart(title, + rb.getString("LBLXAXIS"), rangeAxisTitle, + dataset, VERTICAL, false, true, false); chart.setBackgroundPaint(BLACK); chart.getTitle().setPaint(WHITE); XYPlot plot = chart.getXYPlot(); diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/graph/SpringUtilities.java b/src/main/java/com/romraider/logger/ecu/ui/handler/graph/SpringUtilities.java index 26942935a..9aa7e4d71 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/graph/SpringUtilities.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/graph/SpringUtilities.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,9 +43,11 @@ private SpringUtilities() { * minimum, preferred, and maximum sizes. */ public static void printSizes(Component c) { - LOGGER.debug("minimumSize = " + c.getMinimumSize()); - LOGGER.debug("preferredSize = " + c.getPreferredSize()); - LOGGER.debug("maximumSize = " + c.getMaximumSize()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("minimumSize = " + c.getMinimumSize()); + LOGGER.debug("preferredSize = " + c.getPreferredSize()); + LOGGER.debug("maximumSize = " + c.getMaximumSize()); + } } /** diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/injector/InjectorUpdateHandler.java b/src/main/java/com/romraider/logger/ecu/ui/handler/injector/InjectorUpdateHandler.java index e7381b82f..32c4cfb34 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/injector/InjectorUpdateHandler.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/injector/InjectorUpdateHandler.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,11 +39,13 @@ public final class InjectorUpdateHandler implements DataUpdateHandler { private double lastMafv; private long lastUpdate; + @Override public synchronized void registerData(LoggerData loggerData) { } + @Override public synchronized void handleDataUpdate(Response response) { - if (injectorTab.isRecordData() + if (injectorTab!= null && injectorTab.isRecordData() && (containsData(response, PULSE_WIDTH_16, ENGINE_LOAD_16) || containsData(response, PULSE_WIDTH_32, ENGINE_LOAD_32))) { boolean valid = true; @@ -53,54 +55,67 @@ public synchronized void handleDataUpdate(Response response) { double clOl = -1; if (containsData(response, "E3")) { clOl = (int) findValue(response, "E3"); - LOGGER.trace("INJ:[CL/OL:E3]: " + clOl); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[CL/OL:E3]: " + clOl); } if (containsData(response, "E33")) { clOl = (int) findValue(response, "E33"); - LOGGER.trace("INJ:[CL/OL:E33]: " + clOl); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[CL/OL:E33]: " + clOl); } valid = injectorTab.isValidClOl(clOl); - LOGGER.trace("INJ:[CL/OL]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[CL/OL]: " + valid); } // afr check if (valid && containsData(response, "P58")) { double afr = findValue(response, "P58"); - LOGGER.trace("INJ:[AFR:P58]: " + afr); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[AFR:P58]: " + afr); valid = injectorTab.isValidAfr(afr); - LOGGER.trace("INJ:[AFR]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[AFR]: " + valid); } // rpm check if (valid && containsData(response, "P8")) { double rpm = findValue(response, "P8"); - LOGGER.trace("INJ:[RPM:P8]: " + rpm); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[RPM:P8]: " + rpm); valid = injectorTab.isValidRpm(rpm); - LOGGER.trace("INJ:[RPM]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[RPM]: " + valid); } // maf check if (valid && containsData(response, "P12")) { double maf = findValue(response, "P12"); - LOGGER.trace("INJ:[MAF:P12]: " + maf); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[MAF:P12]: " + maf); valid = injectorTab.isValidMaf(maf); - LOGGER.trace("INJ:[MAF]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[MAF]: " + valid); } // intake air temp check if (valid && containsData(response, "P11")) { double temp = findValue(response, "P11"); - LOGGER.trace("INJ:[IAT:P11]: " + temp); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[IAT:P11]: " + temp); valid = injectorTab.isValidIntakeAirTemp(temp); - LOGGER.trace("INJ:[IAT]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[IAT]: " + valid); } // coolant temp check if (valid && containsData(response, "P2")) { double temp = findValue(response, "P2"); - LOGGER.trace("INJ:[CT:P2]: " + temp); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[CT:P2]: " + temp); valid = injectorTab.isValidCoolantTemp(temp); - LOGGER.trace("INJ:[CT]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[CT]: " + valid); } // dMAFv/dt check @@ -108,9 +123,11 @@ public synchronized void handleDataUpdate(Response response) { double mafv = findValue(response, "P18"); long now = currentTimeMillis(); double mafvChange = abs((mafv - lastMafv) / (now - lastUpdate) * 1000); - LOGGER.trace("INJ:[dMAFv/dt]: " + mafvChange); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[dMAFv/dt]: " + mafvChange); valid = injectorTab.isValidMafvChange(mafvChange); - LOGGER.trace("INJ:[dMAFv/dt]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[dMAFv/dt]: " + valid); lastMafv = mafv; lastUpdate = now; } @@ -120,14 +137,17 @@ public synchronized void handleDataUpdate(Response response) { double tipIn = -1; if (containsData(response, "E23")) { tipIn = findValue(response, "E23"); - LOGGER.trace("INJ:[TIP:E23]: " + tipIn); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[TIP:E23]: " + tipIn); } if (containsData(response, "E54")) { tipIn = findValue(response, "E54"); - LOGGER.trace("INJ:[TIP:E54]: " + tipIn); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[TIP:E54]: " + tipIn); } valid = injectorTab.isValidTipInThrottle(tipIn); - LOGGER.trace("INJ:[TIP]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("INJ:[TIP]: " + valid); } if (valid) { @@ -136,8 +156,10 @@ public synchronized void handleDataUpdate(Response response) { double stoichAfr = injectorTab.getFuelStoichAfr(); double density = injectorTab.getFuelDensity(); final double fuelcc = load / 2 / stoichAfr * 1000 / density; - LOGGER.trace("Injector Data: " + pulseWidth + "ms, " + fuelcc + "cc"); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Injector Data: " + pulseWidth + "ms, " + fuelcc + "cc"); SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { injectorTab.addData(pulseWidth, fuelcc); } @@ -172,12 +194,15 @@ private double findValue(Response response, String id) { throw new IllegalStateException("Expected data item " + id + " not in response."); } + @Override public synchronized void deregisterData(LoggerData loggerData) { } + @Override public synchronized void cleanUp() { } + @Override public synchronized void reset() { } diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/livedata/LiveDataTableModel.java b/src/main/java/com/romraider/logger/ecu/ui/handler/livedata/LiveDataTableModel.java index 8a2c6baa1..142d3cbd1 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/livedata/LiveDataTableModel.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/livedata/LiveDataTableModel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +20,8 @@ package com.romraider.logger.ecu.ui.handler.livedata; import com.romraider.logger.ecu.definition.LoggerData; +import com.romraider.util.ResourceUtil; + import static java.util.Collections.synchronizedList; import static java.util.Collections.synchronizedMap; import javax.swing.table.AbstractTableModel; @@ -27,12 +29,19 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.ResourceBundle; public final class LiveDataTableModel extends AbstractTableModel { private static final long serialVersionUID = 3712433453224086342L; - private final String[] columnNames = {"Logger Data", "Min Value", "Current Value", "Max Value", "Units"}; - private final List registeredLoggerData = synchronizedList(new LinkedList()); - private final Map dataRowMap = synchronizedMap(new LinkedHashMap()); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + LiveDataTableModel.class.getName()); + private final String[] columnNames = {rb.getString("LBLCOL1"), + rb.getString("LBLCOL2"), rb.getString("LBLCOL3"), + rb.getString("LBLCOL4"), rb.getString("LBLCOL5")}; + private final List registeredLoggerData = synchronizedList( + new LinkedList()); + private final Map dataRowMap = synchronizedMap( + new LinkedHashMap()); public synchronized int getRowCount() { return dataRowMap.size(); @@ -64,7 +73,7 @@ public synchronized Object getValueAt(int row, int col) { case 4: return dataRow.getUnits(); default: - return "Error!"; + return rb.getString("ERROR"); } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/maf/MafUpdateHandler.java b/src/main/java/com/romraider/logger/ecu/ui/handler/maf/MafUpdateHandler.java index ac6d7f7d2..ed4c0ce89 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/maf/MafUpdateHandler.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/maf/MafUpdateHandler.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,11 +39,13 @@ public final class MafUpdateHandler implements DataUpdateHandler { private double lastMafv; private long lastUpdate; + @Override public synchronized void registerData(LoggerData loggerData) { } + @Override public synchronized void handleDataUpdate(Response response) { - if (mafTab.isRecordData() && containsData(response, MAFV, AF_LEARNING_1, AF_CORRECTION_1)) { + if (mafTab!= null && mafTab.isRecordData() && containsData(response, MAFV, AF_LEARNING_1, AF_CORRECTION_1)) { boolean valid = true; // cl/ol check @@ -51,54 +53,67 @@ public synchronized void handleDataUpdate(Response response) { double clOl = -1; if (containsData(response, "E3")) { clOl = (int) findValue(response, "E3"); - LOGGER.trace("MAF:[CL/OL:E3]: " + clOl); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[CL/OL:E3]: " + clOl); } if (containsData(response, "E33")) { clOl = (int) findValue(response, "E33"); - LOGGER.trace("MAF:[CL/OL:E33]: " + clOl); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[CL/OL:E33]: " + clOl); } valid = mafTab.isValidClOl(clOl); - LOGGER.trace("MAF:[CL/OL]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[CL/OL]: " + valid); } // afr check if (valid && containsData(response, "P58")) { double afr = findValue(response, "P58"); - LOGGER.trace("MAF:[AFR:P58]: " + afr); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[AFR:P58]: " + afr); valid = mafTab.isValidAfr(afr); - LOGGER.trace("MAF:[AFR]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[AFR]: " + valid); } // rpm check if (valid && containsData(response, "P8")) { double rpm = findValue(response, "P8"); - LOGGER.trace("MAF:[RPM:P8]: " + rpm); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[RPM:P8]: " + rpm); valid = mafTab.isValidRpm(rpm); - LOGGER.trace("MAF:[RPM]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[RPM]: " + valid); } // maf check if (valid && containsData(response, "P12")) { double maf = findValue(response, "P12"); - LOGGER.trace("MAF:[MAF:P12]: " + maf); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[MAF:P12]: " + maf); valid = mafTab.isValidMaf(maf); - LOGGER.trace("MAF:[MAF]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[MAF]: " + valid); } // intake air temp check if (valid && containsData(response, "P11")) { double temp = findValue(response, "P11"); - LOGGER.trace("MAF:[IAT:P11]: " + temp); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[IAT:P11]: " + temp); valid = mafTab.isValidIntakeAirTemp(temp); - LOGGER.trace("MAF:[IAT]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[IAT]: " + valid); } // coolant temp check if (valid && containsData(response, "P2")) { double temp = findValue(response, "P2"); - LOGGER.trace("MAF:[CT:P2]: " + temp); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[CT:P2]: " + temp); valid = mafTab.isValidCoolantTemp(temp); - LOGGER.trace("MAF:[CT]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[CT]: " + valid); } // dMAFv/dt check @@ -106,9 +121,11 @@ public synchronized void handleDataUpdate(Response response) { double mafv = findValue(response, "P18"); long now = currentTimeMillis(); double mafvChange = abs((mafv - lastMafv) / (now - lastUpdate) * 1000); - LOGGER.trace("MAF:[dMAFv/dt]: " + mafvChange); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[dMAFv/dt]: " + mafvChange); valid = mafTab.isValidMafvChange(mafvChange); - LOGGER.trace("MAF:[dMAFv/dt]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[dMAFv/dt]: " + valid); lastMafv = mafv; lastUpdate = now; } @@ -118,22 +135,27 @@ public synchronized void handleDataUpdate(Response response) { double tipIn = -1; if (containsData(response, "E23")) { tipIn = findValue(response, "E23"); - LOGGER.trace("MAF:[TIP:E23]: " + tipIn); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[TIP:E23]: " + tipIn); } if (containsData(response, "E54")) { tipIn = findValue(response, "E54"); - LOGGER.trace("MAF:[TIP:E54]: " + tipIn); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[TIP:E54]: " + tipIn); } valid = mafTab.isValidTipInThrottle(tipIn); - LOGGER.trace("MAF:[TIP]: " + valid); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF:[TIP]: " + valid); } if (valid) { final double mafv = findValue(response, MAFV); final double learning = findValue(response, AF_LEARNING_1); final double correction = findValue(response, AF_CORRECTION_1); - LOGGER.trace("MAF Data: " + mafv + "v, " + correction + "%"); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MAF Data: " + mafv + "v, " + correction + "%"); SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { mafTab.addData(mafv, learning + correction); } @@ -168,12 +190,15 @@ private double findValue(Response response, String id) { throw new IllegalStateException("Expected data item " + id + " not in response."); } + @Override public synchronized void deregisterData(LoggerData loggerData) { } + @Override public synchronized void cleanUp() { } + @Override public synchronized void reset() { } diff --git a/src/main/java/com/romraider/logger/ecu/ui/handler/table/TableUpdateHandler.java b/src/main/java/com/romraider/logger/ecu/ui/handler/table/TableUpdateHandler.java index f6a1498e2..b478e4cc9 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/handler/table/TableUpdateHandler.java +++ b/src/main/java/com/romraider/logger/ecu/ui/handler/table/TableUpdateHandler.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2016 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,6 +34,7 @@ import com.romraider.maps.Table; import com.romraider.maps.Table2D; import com.romraider.maps.Table3D; +import com.romraider.maps.TableView; public final class TableUpdateHandler implements DataUpdateHandler { private static final TableUpdateHandler INSTANCE = new TableUpdateHandler(); @@ -49,15 +50,20 @@ public void registerData(LoggerData loggerData) { @Override public void handleDataUpdate(Response response) { - for (LoggerData loggerData : response.getData()) { - List tables = tableMap.get(loggerData.getId()); - if (tables != null && !tables.isEmpty()) { - String formattedValue = loggerData.getSelectedConvertor().format(response.getDataValue(loggerData)); - for(ListIterator
item = tables.listIterator(); item.hasNext();) { - item.next().highlightLiveData(formattedValue); - } - } - } + if(!tableMap.isEmpty()) { + for (LoggerData loggerData : response.getData()) { + synchronized(tableMap) { + List
tables = tableMap.get(loggerData.getId()); + if (tables != null && !tables.isEmpty()) { + String formattedValue = loggerData.getSelectedConvertor().format(response.getDataValue(loggerData)); + for(ListIterator
item = tables.listIterator(); item.hasNext();) { + TableView v = item.next().getTableView(); + if(v!= null) v.highlightLiveData(formattedValue); + } + } + } + } + } } @Override @@ -66,6 +72,8 @@ public void deregisterData(LoggerData loggerData) { @Override public void cleanUp() { + for(List
t: tableMap.values())t.clear(); + tableMap.clear(); } @Override @@ -84,6 +92,8 @@ public void registerTable(Table table) { } public void deregisterTable(Table table) { + if(table == null) return; + String logParam = table.getLogParam(); if (tableMap.containsKey(logParam)) { List
tables = tableMap.get(logParam); diff --git a/src/main/java/com/romraider/logger/ecu/ui/paramlist/ParameterListTable.java b/src/main/java/com/romraider/logger/ecu/ui/paramlist/ParameterListTable.java index fa8032082..c08ab9236 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/paramlist/ParameterListTable.java +++ b/src/main/java/com/romraider/logger/ecu/ui/paramlist/ParameterListTable.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,15 +19,18 @@ package com.romraider.logger.ecu.ui.paramlist; +import com.romraider.logger.ecu.EcuLogger; import com.romraider.logger.ecu.definition.EcuData; import com.romraider.logger.ecu.definition.ExternalData; import static com.romraider.util.ParamChecker.isNullOrEmpty; + import javax.swing.JTable; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableRowSorter; +import java.awt.Font; import java.awt.event.MouseEvent; import java.util.List; @@ -42,15 +45,23 @@ public ParameterListTable(ParameterListTableModel tableModel) { this.tableModel = tableModel; this.getTableHeader().setReorderingAllowed(false); for (int column = 0; column < tableModel.getColumnCount(); column++) { - if (tableModel.getColumnName(2).equalsIgnoreCase("units")) { + if (tableModel.getColumnName(2).equalsIgnoreCase( + ParameterListTableModel.rb.getString("LBLCOL3"))) { setColumnSortable(column, false); } else { setColumnSortable(column, true); } } + if (EcuLogger.isTouchEnabled() == true) + { + this.setRowHeight(40); + + Font font = new Font("Tahoma", Font.PLAIN, 16); + this.setFont(font); + } } - + public TableCellRenderer getCellRenderer(int row, int col) { return displayComboBox(row, col) ? comboBoxRenderer : super.getCellRenderer(row, col); } @@ -62,7 +73,9 @@ public TableCellEditor getCellEditor(int row, int col) { public String getToolTipText(MouseEvent mouseEvent) { List parameterRows = tableModel.getParameterRows(); if (!isNullOrEmpty(parameterRows)) { - ParameterRow parameterRow = parameterRows.get(rowAtPoint(mouseEvent.getPoint())); + ParameterRow parameterRow = parameterRows.get( + convertRowIndexToModel( + rowAtPoint(mouseEvent.getPoint()))); if (parameterRow != null) { String description = parameterRow.getLoggerData().getDescription(); if (!isNullOrEmpty(description)) { diff --git a/src/main/java/com/romraider/logger/ecu/ui/paramlist/ParameterListTableModel.java b/src/main/java/com/romraider/logger/ecu/ui/paramlist/ParameterListTableModel.java index f62ae4e06..6bb5b9b98 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/paramlist/ParameterListTableModel.java +++ b/src/main/java/com/romraider/logger/ecu/ui/paramlist/ParameterListTableModel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,8 @@ import com.romraider.logger.ecu.definition.LoggerData; import com.romraider.logger.ecu.ui.DataRegistrationBroker; +import com.romraider.util.ResourceUtil; + import static java.util.Collections.synchronizedList; import static java.util.Collections.synchronizedMap; import javax.swing.table.AbstractTableModel; @@ -29,17 +31,23 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.ResourceBundle; public final class ParameterListTableModel extends AbstractTableModel { private static final long serialVersionUID = -2556400867696538881L; + protected static final ResourceBundle rb = new ResourceUtil().getBundle( + ParameterListTableModel.class.getName()); private final String[] columnNames; - private final List registeredLoggerData = synchronizedList(new LinkedList()); - private final Map paramRowMap = synchronizedMap(new LinkedHashMap()); + private final List registeredLoggerData = synchronizedList( + new LinkedList()); + private final Map paramRowMap = synchronizedMap( + new LinkedHashMap()); private final DataRegistrationBroker broker; public ParameterListTableModel(DataRegistrationBroker broker, String dataType) { this.broker = broker; - columnNames = new String[]{"Selected?", dataType, "Units"}; + columnNames = new String[]{rb.getString("LBLCOL1"), dataType, + rb.getString("LBLCOL3")}; } public synchronized int getRowCount() { @@ -69,7 +77,7 @@ public synchronized Object getValueAt(int row, int col) { LoggerData loggerData = paramRow.getLoggerData(); return loggerData.getConvertors().length > 1 ? loggerData : loggerData.getSelectedConvertor().getUnits(); default: - return "Error!"; + return rb.getString("ERROR"); } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/paramlist/UnitsComboBoxEditor.java b/src/main/java/com/romraider/logger/ecu/ui/paramlist/UnitsComboBoxEditor.java index 18d9f25d6..72031b499 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/paramlist/UnitsComboBoxEditor.java +++ b/src/main/java/com/romraider/logger/ecu/ui/paramlist/UnitsComboBoxEditor.java @@ -19,6 +19,7 @@ package com.romraider.logger.ecu.ui.paramlist; +import com.romraider.logger.ecu.EcuLogger; import com.romraider.logger.ecu.definition.EcuDataConvertor; import com.romraider.logger.ecu.definition.LoggerData; @@ -26,7 +27,9 @@ import javax.swing.JComboBox; import javax.swing.JTable; import javax.swing.table.TableCellEditor; + import java.awt.Component; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -43,6 +46,12 @@ public Component getTableCellEditorComponent(JTable table, Object ecuData, boole currentEcuData = (LoggerData) ecuData; EcuDataConvertor[] convertors = currentEcuData.getConvertors(); JComboBox comboBox = new JComboBox(); + if (EcuLogger.isTouchEnabled() == true) + { + comboBox.setRenderer(new FontCellRenderer()); + Font font = new Font("Tahoma", Font.PLAIN, 18); + comboBox.setFont(font); + } for (EcuDataConvertor convertor : convertors) { comboBox.addItem(convertor); } diff --git a/src/main/java/com/romraider/logger/ecu/ui/paramlist/UnitsComboBoxRenderer.java b/src/main/java/com/romraider/logger/ecu/ui/paramlist/UnitsComboBoxRenderer.java index b77f77858..ff153f976 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/paramlist/UnitsComboBoxRenderer.java +++ b/src/main/java/com/romraider/logger/ecu/ui/paramlist/UnitsComboBoxRenderer.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,13 +19,20 @@ package com.romraider.logger.ecu.ui.paramlist; +import com.romraider.logger.ecu.EcuLogger; import com.romraider.logger.ecu.definition.EcuDataConvertor; import com.romraider.logger.ecu.definition.LoggerData; +import javax.swing.DefaultListCellRenderer; import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JList; import javax.swing.JTable; import javax.swing.table.TableCellRenderer; + import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; public final class UnitsComboBoxRenderer extends JComboBox implements TableCellRenderer { @@ -35,10 +42,36 @@ public Component getTableCellRendererComponent(JTable table, Object ecuData, boo LoggerData currentEcuData = (LoggerData) ecuData; EcuDataConvertor[] convertors = currentEcuData.getConvertors(); JComboBox comboBox = new JComboBox(); + + if (EcuLogger.isTouchEnabled() == true) + { + comboBox.setPreferredSize(new Dimension(75, 100)); + comboBox.setRenderer(new FontCellRenderer()); + } + for (EcuDataConvertor convertor : convertors) { comboBox.addItem(convertor); } + comboBox.setSelectedItem(currentEcuData.getSelectedConvertor()); return comboBox; } } + +class FontCellRenderer extends DefaultListCellRenderer { + + private static final long serialVersionUID = 5963151264549169227L; + + public Component getListCellRendererComponent( + JList list, + Object value, + int index, + boolean isSelected, + boolean cellHasFocus) { + JLabel label = (JLabel)super.getListCellRendererComponent( + list,value,index,isSelected,cellHasFocus); + Font font = new Font("Tahoma", Font.PLAIN, 18); + label.setFont(font); + return label; + } +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.java index a1abb8805..11210de26 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,8 +20,6 @@ package com.romraider.logger.ecu.ui.swing.menubar; import static com.romraider.Version.PRODUCT_NAME; -import static com.romraider.util.Platform.WINDOWS; -import static com.romraider.util.Platform.isPlatform; import static java.awt.event.InputEvent.ALT_MASK; import static java.awt.event.InputEvent.CTRL_MASK; import static java.awt.event.InputEvent.SHIFT_MASK; @@ -39,7 +37,6 @@ import static java.awt.event.KeyEvent.VK_I; import static java.awt.event.KeyEvent.VK_L; import static java.awt.event.KeyEvent.VK_M; -import static java.awt.event.KeyEvent.VK_N; import static java.awt.event.KeyEvent.VK_O; import static java.awt.event.KeyEvent.VK_P; import static java.awt.event.KeyEvent.VK_R; @@ -50,7 +47,9 @@ import static java.awt.event.KeyEvent.VK_X; import static javax.swing.KeyStroke.getKeyStroke; +import java.text.MessageFormat; import java.util.List; +import java.util.ResourceBundle; import javax.swing.Action; import javax.swing.ButtonGroup; @@ -60,9 +59,10 @@ import com.romraider.Settings; import com.romraider.logger.ecu.EcuLogger; -import com.romraider.logger.ecu.ui.swing.menubar.action.CanBusModeAction; +import com.romraider.logger.ecu.ui.swing.menubar.action.AutoConnectAction; import com.romraider.logger.ecu.ui.swing.menubar.action.ComPortAutoRefreshAction; import com.romraider.logger.ecu.ui.swing.menubar.action.DisconnectAction; +import com.romraider.logger.ecu.ui.swing.menubar.action.ElmEnabledAction; import com.romraider.logger.ecu.ui.swing.menubar.action.ExitAction; import com.romraider.logger.ecu.ui.swing.menubar.action.FastPollModeAction; import com.romraider.logger.ecu.ui.swing.menubar.action.GlobalAdjustmentAction; @@ -75,84 +75,101 @@ import com.romraider.logger.ecu.ui.swing.menubar.action.LoggerDebugLocationAction; import com.romraider.logger.ecu.ui.swing.menubar.action.LoggerDebuggingLevelAction; import com.romraider.logger.ecu.ui.swing.menubar.action.LoggerDefinitionLocationAction; -import com.romraider.logger.ecu.ui.swing.menubar.action.ObdModeAction; import com.romraider.logger.ecu.ui.swing.menubar.action.ReadEcuCodesAction; import com.romraider.logger.ecu.ui.swing.menubar.action.ReloadProfileAction; import com.romraider.logger.ecu.ui.swing.menubar.action.ResetConnectionAction; import com.romraider.logger.ecu.ui.swing.menubar.action.ResetEcuAction; import com.romraider.logger.ecu.ui.swing.menubar.action.SaveProfileAction; import com.romraider.logger.ecu.ui.swing.menubar.action.SaveProfileAsAction; +import com.romraider.logger.ecu.ui.swing.menubar.action.SelectProtocolAction; import com.romraider.logger.ecu.ui.swing.menubar.action.UpdateLoggerDefAction; import com.romraider.logger.external.core.ExternalDataSource; import com.romraider.swing.menubar.Menu; import com.romraider.swing.menubar.MenuItem; import com.romraider.swing.menubar.RadioButtonMenuItem; import com.romraider.swing.menubar.action.AboutAction; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; public class EcuLoggerMenuBar extends JMenuBar { private static final long serialVersionUID = 7081586516953740186L; + private static final ResourceBundle rb = new ResourceUtil().getBundle(EcuLoggerMenuBar.class.getName()); final Settings settings = SettingsManager.getSettings(); public EcuLoggerMenuBar(EcuLogger logger, List externalDataSources) { // file menu items - JMenu fileMenu = new Menu("File", VK_F); - fileMenu.add(new MenuItem("Load Profile...", new LoadProfileAction(logger), VK_L, getKeyStroke(VK_L, CTRL_MASK))); - fileMenu.add(new MenuItem("Reload Profile", new ReloadProfileAction(logger), VK_P, getKeyStroke(VK_P, CTRL_MASK))); - fileMenu.add(new MenuItem("Save Profile", new SaveProfileAction(logger), VK_S, getKeyStroke(VK_S, CTRL_MASK))); - fileMenu.add(new MenuItem("Save Profile As...", new SaveProfileAsAction(logger), VK_A, getKeyStroke(VK_S, CTRL_MASK | SHIFT_MASK))); + JMenu fileMenu = new Menu(rb.getString("FILE"), VK_F); + fileMenu.add(new MenuItem(rb.getString("LOADPROFILE"), new LoadProfileAction(logger), VK_L, getKeyStroke(VK_L, CTRL_MASK))); + fileMenu.add(new MenuItem(rb.getString("RELOADPROFILE"), new ReloadProfileAction(logger), VK_P, getKeyStroke(VK_P, CTRL_MASK))); + fileMenu.add(new MenuItem(rb.getString("SAVEPROFILE"), new SaveProfileAction(logger), VK_S, getKeyStroke(VK_S, CTRL_MASK))); + fileMenu.add(new MenuItem(rb.getString("SAVEPROFILEAS"), new SaveProfileAsAction(logger), VK_A, getKeyStroke(VK_S, CTRL_MASK | SHIFT_MASK))); fileMenu.add(new JSeparator()); - fileMenu.add(new MenuItem("Exit", new ExitAction(logger), VK_X)); + fileMenu.add(new MenuItem(rb.getString("EXIT"), new ExitAction(logger), VK_X)); add(fileMenu); // settings menu items - JMenu settingsMenu = new Menu("Settings", VK_S); - settingsMenu.add(new MenuItem("Logger Definition Location...", new LoggerDefinitionLocationAction(logger), VK_F, getKeyStroke(VK_F, CTRL_MASK))); - settingsMenu.add(new MenuItem("Log File Output Location...", new LogFileLocationAction(logger), VK_O, getKeyStroke(VK_O, CTRL_MASK))); + JMenu settingsMenu = new Menu(rb.getString("SETTINGS"), VK_S); + settingsMenu.add(new MenuItem(rb.getString("DEFLOCATION"), new LoggerDefinitionLocationAction(logger), VK_F, getKeyStroke(VK_F, CTRL_MASK))); + settingsMenu.add(new MenuItem(rb.getString("OUTLOCATION"), new LogFileLocationAction(logger), VK_O, getKeyStroke(VK_O, CTRL_MASK))); settingsMenu.add(new JSeparator()); - settingsMenu.add(new RadioButtonMenuItem("Control File Logging With Defogger Switch", VK_C, getKeyStroke(VK_C, CTRL_MASK), new LogFileControllerSwitchAction(logger), logger.getSettings().isFileLoggingControllerSwitchActive())); - RadioButtonMenuItem autoRefresh = new RadioButtonMenuItem("Enable COM port Auto Refresh", VK_E, getKeyStroke(VK_E, CTRL_MASK), new ComPortAutoRefreshAction(logger), logger.getSettings().getRefreshMode()); - autoRefresh.setToolTipText("Select to enable automatic COM port refreshing"); + MenuItem selectProtocol = new MenuItem(rb.getString("PROTOOPTIONS"), new SelectProtocolAction(logger), VK_O, getKeyStroke(VK_O, ALT_MASK)); + selectProtocol.setToolTipText(rb.getString("PROTOOPTIONSTT")); + settingsMenu.add(selectProtocol); + RadioButtonMenuItem fileLoggingControl = new RadioButtonMenuItem(rb.getString("DEFOGGERSW"), VK_C, getKeyStroke(VK_C, CTRL_MASK), new LogFileControllerSwitchAction(logger), logger.getSettings().isFileLoggingControllerSwitchActive()); + fileLoggingControl.setEnabled(false); + fileLoggingControl.setSelected(false); + settingsMenu.add(fileLoggingControl); + logger.getComponentList().put("fileLoggingControl", fileLoggingControl); + RadioButtonMenuItem autoConnect = new RadioButtonMenuItem(rb.getString("AUTOCONNECT"), VK_A, getKeyStroke(VK_A, CTRL_MASK), new AutoConnectAction(logger), logger.getSettings().getAutoConnectOnStartup()); + autoConnect.setToolTipText(rb.getString("AUTOCONNECT")); + settingsMenu.add(autoConnect); + RadioButtonMenuItem autoRefresh = new RadioButtonMenuItem(rb.getString("COMREFRESH"), VK_E, getKeyStroke(VK_E, CTRL_MASK), new ComPortAutoRefreshAction(logger), logger.getSettings().getRefreshMode()); + autoRefresh.setToolTipText(rb.getString("COMREFRESHTT")); settingsMenu.add(autoRefresh); - RadioButtonMenuItem fastPoll = new RadioButtonMenuItem("Enable Fast Polling Mode", VK_M, getKeyStroke(VK_M, CTRL_MASK), new FastPollModeAction(logger), logger.getSettings().isFastPoll()); - fastPoll.setToolTipText("Select to enable faster K-line polling of the ECU"); + RadioButtonMenuItem elmEnabled = new RadioButtonMenuItem(rb.getString("ELM327ENABLED"), VK_C, getKeyStroke(VK_C, CTRL_MASK), new ElmEnabledAction(logger), logger.getSettings().getElm327Enabled()); + elmEnabled.setToolTipText(rb.getString("ELM327ENABLEDTT")); + elmEnabled.setSelected(false); + logger.getComponentList().put("elmEnabled", elmEnabled); + logger.updateElmSelectable(); + + settingsMenu.add(elmEnabled); + + RadioButtonMenuItem fastPoll = new RadioButtonMenuItem(rb.getString("FASTPOLL"), VK_M, getKeyStroke(VK_M, CTRL_MASK), new FastPollModeAction(logger), logger.getSettings().isFastPoll()); + fastPoll.setToolTipText(rb.getString("FASTPOLLTT")); + fastPoll.setEnabled(false); + fastPoll.setSelected(false); settingsMenu.add(fastPoll); - RadioButtonMenuItem canBus = new RadioButtonMenuItem("CAN bus Logging (2007+)", VK_N, getKeyStroke(VK_N, CTRL_MASK), new CanBusModeAction(logger), settings.isCanBus()); - canBus.setToolTipText("Select to enable logging via CAN bus using a J2534 compatible cable"); - RadioButtonMenuItem obdProtocol = new RadioButtonMenuItem("OBD Logging Protocol", VK_B, getKeyStroke(VK_B, ALT_MASK), new ObdModeAction(logger), settings.isObdProtocol()); - obdProtocol.setToolTipText("Select to switch logging comminucations protocol to OBD. Only supported for CAN bus using a J2534 compatible cable."); - if (isPlatform(WINDOWS)) { - settingsMenu.add(canBus); - settingsMenu.add(obdProtocol); - } + logger.getComponentList().put("fastPoll", fastPoll); settingsMenu.add(new JSeparator()); - settingsMenu.add(new RadioButtonMenuItem("Use Absolute Timestamp In Log File", VK_T, getKeyStroke(VK_T, CTRL_MASK), new LogFileAbsoluteTimestampAction(logger), logger.getSettings().isFileLoggingAbsoluteTimestamp())); - final RadioButtonMenuItem numFormat = new RadioButtonMenuItem("Use US English number format in Log File", VK_B, getKeyStroke(VK_B, CTRL_MASK), new LogFileNumberFormatAction(logger), logger.getSettings().isUsNumberFormat()); - numFormat.setToolTipText("Select to force log files to be written with . decimal point and , field separator"); + settingsMenu.add(new RadioButtonMenuItem(rb.getString("ABSTIMESTAMP"), VK_T, getKeyStroke(VK_T, CTRL_MASK), new LogFileAbsoluteTimestampAction(logger), logger.getSettings().isFileLoggingAbsoluteTimestamp())); + final RadioButtonMenuItem numFormat = new RadioButtonMenuItem(rb.getString("USNUMBERS"), VK_B, getKeyStroke(VK_B, CTRL_MASK), new LogFileNumberFormatAction(logger), logger.getSettings().isUsNumberFormat()); + numFormat.setToolTipText(rb.getString("USNUMBERSTT")); settingsMenu.add(numFormat); add(settingsMenu); // connection menu items - JMenu connectionMenu = new Menu("Connection", VK_C); - connectionMenu.add(new MenuItem("Reset", new ResetConnectionAction(logger), VK_R, getKeyStroke(VK_R, CTRL_MASK))); - connectionMenu.add(new MenuItem("Disconnect", new DisconnectAction(logger), VK_D, getKeyStroke(VK_D, CTRL_MASK))); + JMenu connectionMenu = new Menu(rb.getString("CONNECTION"), VK_C); + connectionMenu.add(new MenuItem(rb.getString("RESET"), new ResetConnectionAction(logger), VK_R, getKeyStroke(VK_R, CTRL_MASK))); + connectionMenu.add(new MenuItem(rb.getString("DISCONNECT"), new DisconnectAction(logger), VK_D, getKeyStroke(VK_D, CTRL_MASK))); add(connectionMenu); // tools menu items - JMenu toolsMenu = new Menu("Tools", VK_T); - toolsMenu.add(new MenuItem("Reset ECU/TCU", new ResetEcuAction(logger), VK_R, getKeyStroke(VK_F7, 0))); + JMenu toolsMenu = new Menu(rb.getString("TOOLS"), VK_T); + final MenuItem resetMenu = new MenuItem(rb.getString("RESETECU"), new ResetEcuAction(logger), VK_R, getKeyStroke(VK_F7, 0)); + toolsMenu.add(resetMenu); + logger.getComponentList().put("resetMenu", resetMenu); toolsMenu.add(new JSeparator()); - toolsMenu.add(new MenuItem("Read Diagnostic Codes", new ReadEcuCodesAction(logger), VK_D, getKeyStroke(VK_F8, 0))); + toolsMenu.add(new MenuItem(rb.getString("READDTC"), new ReadEcuCodesAction(logger), VK_D, getKeyStroke(VK_F8, 0))); toolsMenu.add(new JSeparator()); - toolsMenu.add(new MenuItem("Global Timing & Idle RPM Adjustment", new GlobalAdjustmentAction(logger), VK_T, getKeyStroke(VK_F5, 0))); + toolsMenu.add(new MenuItem(rb.getString("GLOBALADJ"), new GlobalAdjustmentAction(logger), VK_T, getKeyStroke(VK_F5, 0))); toolsMenu.add(new JSeparator()); - toolsMenu.add(new MenuItem("Learning Table Values", new LearningTableValuesAction(logger), VK_V, getKeyStroke(VK_F6, 0))); + toolsMenu.add(new MenuItem(rb.getString("LTV"), new LearningTableValuesAction(logger), VK_V, getKeyStroke(VK_F6, 0))); add(toolsMenu); // plugins menu items - JMenu pluginsMenu = new Menu("Plugins", VK_P); + JMenu pluginsMenu = new Menu(rb.getString("PLUGINS"), VK_P); pluginsMenu.setEnabled(!externalDataSources.isEmpty()); for (ExternalDataSource dataSource : externalDataSources) { Action action = dataSource.getMenuAction(logger); @@ -163,16 +180,16 @@ public EcuLoggerMenuBar(EcuLogger logger, List externalDataS add(pluginsMenu); // help menu stuff - JMenu helpMenu = new Menu("Help", VK_H); - helpMenu.add(new MenuItem("Update Logger Definition...", new UpdateLoggerDefAction(logger), VK_U)); + JMenu helpMenu = new Menu(rb.getString("HELP"), VK_H); + helpMenu.add(new MenuItem(rb.getString("UPDATEDEF"), new UpdateLoggerDefAction(logger), VK_U)); helpMenu.add(new JSeparator()); ButtonGroup group = new ButtonGroup(); - JMenu debug = new JMenu("Debugging Level"); + JMenu debug = new JMenu(rb.getString("DEBUGLVL")); debug.setMnemonic(VK_D); - debug.setToolTipText("Level of detail recorded in the rr_system.log file"); - RadioButtonMenuItem info = new RadioButtonMenuItem("INFO - normal", VK_I, null, new LoggerDebuggingLevelAction(logger, "INFO"), logger.getSettings().getLoggerDebuggingLevel().equalsIgnoreCase("INFO")); - RadioButtonMenuItem db = new RadioButtonMenuItem("DEBUG - detailed", VK_D, null, new LoggerDebuggingLevelAction(logger, "DEBUG"), logger.getSettings().getLoggerDebuggingLevel().equalsIgnoreCase("DEBUG")); - RadioButtonMenuItem trace = new RadioButtonMenuItem("TRACE - verbose", VK_T, null, new LoggerDebuggingLevelAction(logger, "TRACE"), logger.getSettings().getLoggerDebuggingLevel().equalsIgnoreCase("TRACE")); + debug.setToolTipText(rb.getString("DEBUGLVLTT")); + RadioButtonMenuItem info = new RadioButtonMenuItem(rb.getString("INFO"), VK_I, null, new LoggerDebuggingLevelAction(logger, "INFO"), logger.getSettings().getLoggerDebuggingLevel().equalsIgnoreCase("INFO")); + RadioButtonMenuItem db = new RadioButtonMenuItem(rb.getString("DEBUG"), VK_D, null, new LoggerDebuggingLevelAction(logger, "DEBUG"), logger.getSettings().getLoggerDebuggingLevel().equalsIgnoreCase("DEBUG")); + RadioButtonMenuItem trace = new RadioButtonMenuItem(rb.getString("TRACE"), VK_T, null, new LoggerDebuggingLevelAction(logger, "TRACE"), logger.getSettings().getLoggerDebuggingLevel().equalsIgnoreCase("TRACE")); group.add(info); group.add(db); group.add(trace); @@ -180,10 +197,10 @@ public EcuLoggerMenuBar(EcuLogger logger, List externalDataS debug.add(db); debug.add(trace); debug.add(new JSeparator()); - debug.add(new MenuItem("Open Debug Log Location...", new LoggerDebugLocationAction(logger), VK_O, getKeyStroke(VK_O, ALT_MASK))); + debug.add(new MenuItem(rb.getString("DEBUGLOC"), new LoggerDebugLocationAction(logger), VK_O, getKeyStroke(VK_O, ALT_MASK))); helpMenu.add(debug); helpMenu.add(new JSeparator()); - helpMenu.add(new MenuItem("About " + PRODUCT_NAME, new AboutAction(logger), VK_A)); + helpMenu.add(new MenuItem(MessageFormat.format(rb.getString("ABOUT"), PRODUCT_NAME), new AboutAction(logger), VK_A)); add(helpMenu); } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/AutoConnectAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/AutoConnectAction.java new file mode 100644 index 000000000..b2d03c0b0 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/AutoConnectAction.java @@ -0,0 +1,39 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.ui.swing.menubar.action; + +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.swing.menubar.action.AbstractAction; +import java.awt.event.ActionEvent; + +public final class AutoConnectAction extends AbstractAction { + + public AutoConnectAction(EcuLogger logger) { + super(logger); + } + + public void actionPerformed(ActionEvent actionEvent) { + try { + logger.getSettings().setAutoConnectOnStartup((Boolean) getValue(SELECTED_KEY)); + } catch (Exception e) { + logger.reportError(e); + } + } +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/CanBusModeAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/CanBusModeAction.java deleted file mode 100644 index 15561c89f..000000000 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/CanBusModeAction.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.logger.ecu.ui.swing.menubar.action; - -import java.awt.event.ActionEvent; - -import com.romraider.Settings; -import com.romraider.logger.ecu.EcuLogger; -import com.romraider.swing.menubar.action.AbstractAction; -import com.romraider.util.SettingsManager; - -public final class CanBusModeAction extends AbstractAction { - - public CanBusModeAction(EcuLogger logger) { - super(logger); - } - - @Override - public void actionPerformed(ActionEvent actionEvent) { - try { - Settings settings = SettingsManager.getSettings(); - if ((Boolean) getValue(SELECTED_KEY)) { - - settings.setTransportProtocol("ISO15765"); - } - else { - settings.setTransportProtocol("ISO9141"); - } - logger.stopLogging(); - logger.startLogging(); - } catch (Exception e) { - logger.reportError(e); - } - } -} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ElmEnabledAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ElmEnabledAction.java new file mode 100644 index 000000000..7ccb3ba91 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ElmEnabledAction.java @@ -0,0 +1,39 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.ui.swing.menubar.action; + +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.swing.menubar.action.AbstractAction; +import java.awt.event.ActionEvent; + +public final class ElmEnabledAction extends AbstractAction { + + public ElmEnabledAction(EcuLogger logger) { + super(logger); + } + + public void actionPerformed(ActionEvent actionEvent) { + try { + logger.setElmEnabled((Boolean) getValue(SELECTED_KEY)); + } catch (Exception e) { + logger.reportError(e); + } + } +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GenericPluginMenuAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GenericPluginMenuAction.java index 5e452cf4b..2337e32c7 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GenericPluginMenuAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GenericPluginMenuAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,16 +19,19 @@ package com.romraider.logger.ecu.ui.swing.menubar.action; +import static javax.swing.JOptionPane.QUESTION_MESSAGE; +import static javax.swing.JOptionPane.showInputDialog; + +import java.awt.event.ActionEvent; +import java.text.MessageFormat; +import java.util.List; + +import com.fazecast.jSerialComm.SerialPort; import com.romraider.io.serial.port.SerialPortDiscoverer; import com.romraider.io.serial.port.SerialPortDiscovererImpl; import com.romraider.logger.ecu.EcuLogger; import com.romraider.logger.external.core.ExternalDataSource; import com.romraider.swing.menubar.action.AbstractAction; -import gnu.io.CommPortIdentifier; -import static javax.swing.JOptionPane.QUESTION_MESSAGE; -import static javax.swing.JOptionPane.showInputDialog; -import java.awt.event.ActionEvent; -import java.util.List; public final class GenericPluginMenuAction extends AbstractAction { private final SerialPortDiscoverer portDiscoverer = new SerialPortDiscovererImpl(); @@ -40,10 +43,11 @@ public GenericPluginMenuAction(EcuLogger logger, ExternalDataSource dataSource) } public void actionPerformed(ActionEvent actionEvent) { - String port = (String) showInputDialog( + final String port = (String) showInputDialog( logger, - "Select COM port:", - dataSource.getName() + " Plugin Settings", + rb.getString("SELECTPORT"), + MessageFormat.format( + rb.getString("PLUGINSETTINGS"), dataSource.getName()), QUESTION_MESSAGE, null, getPorts(), @@ -52,11 +56,11 @@ public void actionPerformed(ActionEvent actionEvent) { } private String[] getPorts() { - List portIdentifiers = portDiscoverer.listPorts(); - String[] ports = new String[portIdentifiers.size()]; + final List portIdentifiers = portDiscoverer.listPorts(); + final String[] ports = new String[portIdentifiers.size()]; for (int i = 0; i < portIdentifiers.size(); i++) { - CommPortIdentifier identifier = portIdentifiers.get(i); - ports[i] = identifier.getName(); + final SerialPort identifier = portIdentifiers.get(i); + ports[i] = identifier.getSystemPortName(); } return ports; } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GlobalAdjustmentAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GlobalAdjustmentAction.java index 80dcdba85..c3e541ab9 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GlobalAdjustmentAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GlobalAdjustmentAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,9 +28,13 @@ import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; +import java.util.Collection; +import java.util.Map; import com.romraider.Settings; import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.definition.Transport; import com.romraider.swing.menubar.action.AbstractAction; import com.romraider.util.SettingsManager; @@ -45,21 +49,25 @@ public GlobalAdjustmentAction(EcuLogger logger) { public final void actionPerformed(ActionEvent actionEvent) { if (showConfirmation() == OK_OPTION) { final String transport = settings.getTransportProtocol(); + final Module module = settings.getDestinationTarget(); if (settings.isCanBus()) { settings.setTransportProtocol("ISO9141"); + final Module ecuModule = getModule("ECU"); + settings.setDestinationTarget(ecuModule); } final boolean logging = logger.isLogging(); if (logging) logger.stopLogging(); adjustEcu(); settings.setTransportProtocol(transport); + settings.setDestinationTarget(module); if (logging) logger.startLogging(); } } private final int showConfirmation() { return showConfirmDialog(logger, - "Do you want to adjust the ECU's Global Timing or Idle RPM values?", - "Adjust ECU Global Parameters", + rb.getString("GAACONFIRM"), + rb.getString("GAATITLE"), YES_NO_OPTION, QUESTION_MESSAGE); } @@ -68,26 +76,20 @@ private final void adjustEcu() { final int result = doAdjustEcu(); if (result == 1) { showMessageDialog(logger, - "ECU global adjustment successful !", - "Adjust ECU Global Parameters", + rb.getString("GAASUCCESSMSG"), + rb.getString("GAATITLE"), INFORMATION_MESSAGE); } else if (result == 0) { showMessageDialog(logger, - "Error performing ECU Global Timing or Idle RPM adjustment.\n" + - "Check the following:\n" + - "* Logger has successfully conencted to the ECU\n" + - "* Correct COM port is selected (if not Openport 2)\n" + - "* CAN bus logging mode is disabled\n" + - "* Cable is connected properly\n* Ignition is ON\n" + - "* Logger definition XML file is up to date\n", - "Adjust ECU Global Parameters", + rb.getString("GAAERRORMSG"), + rb.getString("GAATITLE"), ERROR_MESSAGE); } if (result == -1) { showMessageDialog(logger, - "User cancelled ECU global adjustments.", - "Adjust ECU Global Parameters", + rb.getString("GAACANCELMSG"), + rb.getString("GAATITLE"), INFORMATION_MESSAGE); } } @@ -100,4 +102,26 @@ private final int doAdjustEcu() { return 0; } } + + private Transport getTransportById(String id) { + for (Transport transport : getTransportMap().keySet()) { + if (transport.getId().equalsIgnoreCase(id)) + return transport; + } + return null; + } + + private Map> getTransportMap() { + return logger.getProtocolList().get(settings.getLoggerProtocol()); + } + + private Module getModule(String name) { + final Collection modules = getTransportMap().get( + getTransportById(settings.getTransportProtocol())); + for (Module module: modules) { + if (module.getName().equalsIgnoreCase(name)) + return module; + } + return null; + } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LearningTableValuesAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LearningTableValuesAction.java index 194f2dd00..4fe981e12 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LearningTableValuesAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LearningTableValuesAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; import com.romraider.logger.ecu.EcuLogger; import com.romraider.swing.menubar.action.AbstractAction; @@ -38,14 +39,10 @@ public LearningTableValuesAction(EcuLogger logger) { public final void actionPerformed(ActionEvent actionEvent) { if (!logger.isEcuInit()) { - final String notInit = "To read Learning Table Values the " + - "Logger must first intialize with the\n" + - logger.getTarget() + - ". Press the Restart button to connect with the Logger then try\n" + - "reading the Learning Table Values again.\n"; showMessageDialog(logger, - notInit, - "Not Initialized", ERROR_MESSAGE); + MessageFormat.format( + rb.getString("LTVINITMSG"), logger.getTarget()), + rb.getString("LTVINTTITLE"), ERROR_MESSAGE); } else { if (!logger.isLogging() || @@ -59,8 +56,8 @@ public final void actionPerformed(ActionEvent actionEvent) { private final int showConfirmation() { return showConfirmDialog(logger, - "Interrupt Logging to read the Learning Table values?", - "Learning Table Values", + rb.getString("LTVINTERRUPT"), + rb.getString("LTVTITLE"), YES_NO_OPTION, QUESTION_MESSAGE); } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoadProfileAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoadProfileAction.java index b2fa4c325..ebb53faba 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoadProfileAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoadProfileAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ import java.awt.event.ActionEvent; import java.io.File; +import java.text.MessageFormat; import javax.swing.JFileChooser; @@ -54,9 +55,9 @@ private void loadProfileDialog() throws Exception { if (logger.loadUserProfile(profileFilePath)) { logger.getSettings().setLoggerProfileFilePath(profileFilePath); logger.restartLogging(); - logger.reportMessage("Profile succesfully loaded: " + profileFilePath); + logger.reportMessage(MessageFormat.format( + rb.getString("LPASUCCESS"), profileFilePath)); } } } - } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileLocationAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileLocationAction.java index fa50d2625..fa950124d 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileLocationAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileLocationAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ import java.awt.event.ActionEvent; import java.io.File; +import java.text.MessageFormat; import javax.swing.JFileChooser; @@ -53,7 +54,8 @@ private void setLogFileLocationDialog() throws Exception { if (fc.showOpenDialog(logger) == APPROVE_OPTION) { String loggerOutputDirPath = fc.getSelectedFile().getAbsolutePath(); logger.getSettings().setLoggerOutputDirPath(loggerOutputDirPath); - logger.reportMessage("Log file output location successfully updated: " + loggerOutputDirPath); + logger.reportMessage(MessageFormat.format( + rb.getString("LFLAUPDATE"), loggerOutputDirPath)); } } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileNumberFormatAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileNumberFormatAction.java index 0c584257d..8694f1606 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileNumberFormatAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileNumberFormatAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; import com.romraider.logger.ecu.EcuLogger; import com.romraider.swing.menubar.action.AbstractAction; @@ -43,10 +44,9 @@ public void actionPerformed(ActionEvent actionEvent) { else { logger.getSettings().setLocale(SYSTEM_NUMFORMAT); } - showMessageDialog(logger, "The Logger has been set to use the " + - logger.getSettings().getLocale() + " number format.\n\n" + - "Exit and restart the Logger to apply the new setting.", - "Log File Number Format Change", INFORMATION_MESSAGE); + showMessageDialog(logger, MessageFormat.format( + rb.getString("LFNFAMSG"), logger.getSettings().getLocale()), + rb.getString("LFNFATITLE"), INFORMATION_MESSAGE); } catch (Exception e) { logger.reportError(e); } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoggerDefinitionLocationAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoggerDefinitionLocationAction.java index fa2b5f70f..35e6855f9 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoggerDefinitionLocationAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoggerDefinitionLocationAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ import java.awt.event.ActionEvent; import java.io.File; +import java.text.MessageFormat; import javax.swing.JFileChooser; @@ -55,7 +56,8 @@ private void setDefinitionLocationDialog() throws Exception { if (fc.showOpenDialog(logger) == APPROVE_OPTION) { String path = fc.getSelectedFile().getAbsolutePath(); logger.getSettings().setLoggerDefinitionFilePath(path); - logger.reportMessage("Logger definition location successfully updated: " + path); + logger.reportMessage(MessageFormat.format( + rb.getString("LDLASUCCESS"), path)); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ObdModeAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ObdModeAction.java deleted file mode 100644 index f4e49d637..000000000 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ObdModeAction.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.logger.ecu.ui.swing.menubar.action; - -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.QUESTION_MESSAGE; -import static javax.swing.JOptionPane.YES_NO_OPTION; -import static javax.swing.JOptionPane.showConfirmDialog; - -import java.awt.event.ActionEvent; - -import com.romraider.Settings; -import com.romraider.logger.ecu.EcuLogger; -import com.romraider.swing.menubar.action.AbstractAction; -import com.romraider.util.SettingsManager; - -public final class ObdModeAction extends AbstractAction { - - public ObdModeAction(EcuLogger logger) { - super(logger); - } - - public void actionPerformed(ActionEvent actionEvent) { - final Settings settings = SettingsManager.getSettings(); - try { - logger.stopLogging(); - if ((Boolean) getValue(SELECTED_KEY) && - !settings.isObdProtocol() && - showConfirmation() == OK_OPTION) { - settings.setTransportProtocol("ISO15765"); - settings.setLoggerProtocol("OBD"); - } - else { - settings.setLoggerProtocol("SSM"); - } - logger.loadLoggerParams(); - logger.startLogging(); - } - catch (Exception e) { - logger.reportError(e); - } - } - - private final int showConfirmation() { - return showConfirmDialog(logger, - "Confirm switching to the OBD communications protocol.\n" + - "This mode is only supported for CAN enabled ECUs using " + - "a J2534 compatible cable.", - "OBD Comminucations Mode", - YES_NO_OPTION, - QUESTION_MESSAGE); - } -} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ReadEcuCodesAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ReadEcuCodesAction.java index cfb5a2be5..98b58bf5b 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ReadEcuCodesAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ReadEcuCodesAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; import com.romraider.logger.ecu.EcuLogger; import com.romraider.swing.menubar.action.AbstractAction; @@ -39,24 +40,14 @@ public ReadEcuCodesAction(EcuLogger logger) { public final void actionPerformed(ActionEvent actionEvent) { if (logger.getDtcodesEmpty()) { - final String wrongDefVersion = "To read diagnostic codes the " + - "Logger requires a logger definfition\n" + - "XML file containing compatible DTC parameter definitions.\n" + - "Use the Help menu 'Update Logger Definition' item to\n" + - "go online and download the latest logger definition.\n"; showMessageDialog(logger, - wrongDefVersion, - "Definition Error", ERROR_MESSAGE); + rb.getString("RECADEFERROR"), + rb.getString("RECADEFERRORTITLE"), ERROR_MESSAGE); } else if (!logger.isEcuInit()) { - final String notInit = "To read diagnostic codes the " + - "Logger must first intialize with the\n" + - logger.getTarget() + - ". Press the Restart button to connect with the Logger then\n" + - "try reading the codes again.\n"; - showMessageDialog(logger, - notInit, - "Not Initialized", ERROR_MESSAGE); + showMessageDialog(logger,MessageFormat.format( + rb.getString("RECANOINIT"), logger.getTarget()), + rb.getString("RECANOINITTITLE"), ERROR_MESSAGE); } else { final boolean logging = logger.isLogging(); @@ -71,9 +62,10 @@ else if (!logger.isEcuInit()) { private final int showConfirmation() { return showConfirmDialog( logger, - "Do you want to read the " + logger.getTarget() + - " diagnostic codes?", - "Read " + logger.getTarget() + " diagnostic codes", + MessageFormat.format( + rb.getString("RECACONFIRM"), logger.getTarget()), + MessageFormat.format( + rb.getString("RECACONFIRMTITLE"), logger.getTarget()), YES_NO_OPTION, WARNING_MESSAGE); } @@ -82,19 +74,18 @@ private final void readEcu() { if (result == -1) { showMessageDialog( logger, - "No diagnostic codes set.", "Read Success", + rb.getString("RECANOCODES"), + rb.getString("RECANOCODESTILTE"), INFORMATION_MESSAGE); } else if (result == 0) { showMessageDialog( logger, - "Error reading " + logger.getTarget() + " diagnostic codes.\n" + - "Check the following:\n" + - "* Logger has successfully conencted to the ECU\n" + - "* Correct COM port is selected (if not Openport 2)\n" + - "* Cable is connected properly\n* Ignition is ON\n* " + - "* Logger definition XML file is up to date", - "Error Read " + logger.getTarget(), ERROR_MESSAGE); + MessageFormat.format( + rb.getString("RECAREADERROR"), logger.getTarget()), + MessageFormat.format( + rb.getString("RECAREADERRORTITLE"), logger.getTarget()), + ERROR_MESSAGE); } } @@ -103,7 +94,10 @@ private int doRead() { return logger.readEcuCodes(); } catch (Exception e) { logger.reportError( - "Error performing " + logger.getTarget() + " codes read", e); + MessageFormat.format( + rb.getString("RECAREPORTERROR"), + logger.getTarget()), + e); return 0; } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ResetEcuAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ResetEcuAction.java index b741051fe..3089668e7 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ResetEcuAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ResetEcuAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +20,7 @@ package com.romraider.logger.ecu.ui.swing.menubar.action; import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.ui.swing.tools.DS2ResetPanel; import com.romraider.swing.menubar.action.AbstractAction; import static javax.swing.JOptionPane.ERROR_MESSAGE; import static javax.swing.JOptionPane.INFORMATION_MESSAGE; @@ -29,6 +30,7 @@ import static javax.swing.JOptionPane.showConfirmDialog; import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; public final class ResetEcuAction extends AbstractAction { public ResetEcuAction(EcuLogger logger) { @@ -39,31 +41,61 @@ public void actionPerformed(ActionEvent actionEvent) { if (showConfirmation() == OK_OPTION) { boolean logging = logger.isLogging(); if (logging) logger.stopLogging(); - resetEcu(); + if (logger.getSettings().getLoggerProtocol().equals("DS2")) { + selectResetItems(); + } + else { + resetEcu(0x40); + } if (logging) logger.startLogging(); } } private int showConfirmation() { - return showConfirmDialog(logger, "Do you want to reset the " + logger.getTarget() + "?", "Reset " + logger.getTarget(), YES_NO_OPTION, WARNING_MESSAGE); + return showConfirmDialog(logger, + MessageFormat.format( + rb.getString("REACONFIM"), logger.getTarget()), + MessageFormat.format( + rb.getString("REATITLE"), logger.getTarget()), + YES_NO_OPTION, + WARNING_MESSAGE); } - private void resetEcu() { - if (doReset()) { - showMessageDialog(logger, "Reset Successful!\nTurn your ignition OFF and then\nback ON to complete the process.", - "Reset " + logger.getTarget(), INFORMATION_MESSAGE); + private void resetEcu(int resetCode) { + if (doReset(resetCode)) { + showMessageDialog(logger, + rb.getString("REASUCCESS"), + MessageFormat.format( + rb.getString("REATITLE"), logger.getTarget()), + INFORMATION_MESSAGE); } else { - showMessageDialog(logger, "Error performing " + logger.getTarget() + " reset.\nCheck the following:\n* Correct COM port selected\n" + - "* Cable is connected properly\n* Ignition is ON\n* Logger is stopped", "Reset " + logger.getTarget(), ERROR_MESSAGE); + showMessageDialog(logger, + MessageFormat.format( + rb.getString("REAERROR"), logger.getTarget()), + MessageFormat.format( + rb.getString("REATITLE"), logger.getTarget()), + ERROR_MESSAGE); } } - private boolean doReset() { + private boolean doReset(int resetCode) { try { - return logger.resetEcu(); + return logger.resetEcu(resetCode); } catch (Exception e) { - logger.reportError("Error performing " + logger.getTarget() + " reset", e); + logger.reportError(MessageFormat.format( + rb.getString("REAREPORTERROR"), logger.getTarget()), + e); return false; } } + + private void selectResetItems() { + final DS2ResetPanel resetPanel = new DS2ResetPanel(logger); + resetPanel.showResetPanel(); + final int result = resetPanel.getResults(); + if (result > 0) { + resetEcu(result); + } + } + } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAction.java index b8bc8787b..56c06b9a6 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ import java.awt.event.ActionEvent; import java.io.File; +import java.text.MessageFormat; import com.romraider.logger.ecu.EcuLogger; import com.romraider.swing.menubar.action.AbstractAction; @@ -48,7 +49,9 @@ private void saveProfile() throws Exception { File lastProfileFile = new File(SettingsManager.getSettings().getLoggerProfileFilePath()); String profileFilePath = saveProfileToFile(logger.getCurrentProfile(), lastProfileFile); logger.getSettings().setLoggerProfileFilePath(profileFilePath); - logger.reportMessageInTitleBar("Profile: " + profileFilePath); - logger.reportMessage("Profile succesfully saved: " + profileFilePath); + logger.reportMessageInTitleBar(MessageFormat.format( + rb.getString("SPATITLE"), profileFilePath)); + logger.reportMessage(MessageFormat.format( + rb.getString("SPAMSG"), profileFilePath)); } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAsAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAsAction.java index 9ab9a01f6..12e9acefc 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAsAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAsAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ import java.awt.event.ActionEvent; import java.io.File; +import java.text.MessageFormat; import javax.swing.JFileChooser; @@ -56,11 +57,17 @@ private void saveProfileAs() throws Exception { JFileChooser fc = getProfileFileChooser(lastProfileFile); if (fc.showSaveDialog(logger) == APPROVE_OPTION) { File selectedFile = fc.getSelectedFile(); - if (!selectedFile.exists() || showConfirmDialog(logger, selectedFile.getName() + " already exists! Overwrite?") == OK_OPTION) { + if (!selectedFile.exists() || + showConfirmDialog(logger, + MessageFormat.format( + rb.getString("SPAACONFIRM"), + selectedFile.getName())) == OK_OPTION) { String profileFilePath = saveProfileToFile(logger.getCurrentProfile(), selectedFile); logger.getSettings().setLoggerProfileFilePath(profileFilePath); - logger.reportMessageInTitleBar("Profile: " + profileFilePath); - logger.reportMessage("Profile succesfully saved as: " + profileFilePath); + logger.reportMessageInTitleBar(MessageFormat.format( + rb.getString("SPATITLE"), profileFilePath)); + logger.reportMessage(MessageFormat.format( + rb.getString("SPAMSG"), profileFilePath)); } } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SelectProtocolAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SelectProtocolAction.java new file mode 100644 index 000000000..0f83646fc --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SelectProtocolAction.java @@ -0,0 +1,266 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.ui.swing.menubar.action; + +import static javax.swing.JOptionPane.QUESTION_MESSAGE; +import static javax.swing.JOptionPane.YES_NO_OPTION; +import static javax.swing.JOptionPane.showConfirmDialog; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.ToolTipManager; +import javax.swing.border.EmptyBorder; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.MutableTreeNode; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.definition.Transport; +import com.romraider.swing.menubar.action.AbstractAction; + +public final class SelectProtocolAction extends AbstractAction { + + public SelectProtocolAction(EcuLogger logger) { + super(logger); + } + + @Override + public void actionPerformed(ActionEvent actionEvent) { + try { + logger.stopLogging(); + new CommSettings(); + } catch (Exception e) { + logger.reportError(e); + } + } + + private class CommSettings extends JDialog { + private static final long serialVersionUID = -6226102628115868401L; + private final JButton selectButton = new JButton(rb.getString("SPRABTN")); + private final Map>> protocolList; + private TreePath selectedPath; + + private CommSettings() { + this.protocolList = logger.getProtocolList(); + setTitle(rb.getString("SPRATITLE")); + setModalityType(ModalityType.APPLICATION_MODAL); + setIconImage(logger.getIconImage()); + setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + setBounds( + logger.getX() + (logger.getWidth() / 2) - 250, + logger.getY() + 90, + 300, + 300); + getContentPane().setLayout(new BorderLayout()); + + final JPanel contentPanel = new JPanel(); + contentPanel.setLayout(new BorderLayout()); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + contentPanel.add(buildTree(), BorderLayout.CENTER); + getContentPane().add(contentPanel, BorderLayout.CENTER); + + final JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + + selectButton.setEnabled(false); + selectButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + confirmSelection(); + } + }); + buttonPane.add(selectButton); + getRootPane().setDefaultButton(selectButton); + + final JButton cancelButton = new JButton(rb.getString("SPRACANCEL")); + cancelButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + closeDialog(); + } + }); + buttonPane.add(cancelButton); + setVisible(true); + } + + private Component buildTree() { + final JTree tree = new JTree(buildNodeTree()) { + private static final long serialVersionUID = 4718749407995133513L; + + @Override + protected void setExpandedState(TreePath path, boolean state) { + if (state) { + super.setExpandedState(path, state); + } + } + + @Override + public String getToolTipText(MouseEvent e) { + if (e != null) { + final TreePath path = super.getPathForLocation( + e.getX(), e.getY()); + if (path != null) { + final DefaultMutableTreeNode node = getTreeNode(path); + if (node != null) { + final Object o = node.getUserObject(); + if (o instanceof Transport) { + return String.format("%s [%s]", + ((Transport) o).getDescription(), + ((Transport) o).getId()); + } + } + } + else { + return rb.getString("SPRATRANSPORT"); + } + } + return null; + } + }; + ToolTipManager.sharedInstance().registerComponent(tree); + + final DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); + renderer.setOpenIcon(null); + renderer.setLeafIcon(null); + tree.setCellRenderer(renderer); + + tree.setEditable(true); + tree.setRootVisible(true); + tree.setShowsRootHandles(false); + tree.getSelectionModel().setSelectionMode( + TreeSelectionModel.SINGLE_TREE_SELECTION); + + final String currentProtocol = logger.getSettings().getLoggerProtocol(); + final String currentTransport = logger.getSettings().getTransportProtocol(); + for (int i = 0; i < tree.getRowCount(); i++) { + tree.expandRow(i); + final TreePath path = tree.getPathForRow(i); + final DefaultMutableTreeNode node = getTreeNode(path); + final Object o = node.getUserObject(); + + if (o instanceof Transport) { + final DefaultMutableTreeNode parent = + (DefaultMutableTreeNode) node.getParent(); + final String parentName = (String) parent.getUserObject(); + final String transportId = ((Transport) o).getId(); + + if (currentTransport.equalsIgnoreCase(transportId) && + currentProtocol.equalsIgnoreCase(parentName)) { + tree.setSelectionPath(path); + } + } + } + + tree.addTreeSelectionListener(new TreeSelectionListener() { + @Override + public void valueChanged(TreeSelectionEvent e) { + + final DefaultMutableTreeNode node = + (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); + if (node != null) { + if (node.isLeaf()) { + selectButton.setEnabled(true); + selectedPath = tree.getSelectionPath(); + } + else { + selectButton.setEnabled(false); + } + } + } + }); + + final JScrollPane scrollPane = new JScrollPane(tree); + return scrollPane; + } + + private MutableTreeNode buildNodeTree() { + final DefaultMutableTreeNode root; + root = new DefaultMutableTreeNode(rb.getString("SPRATREE")); + for (String protocol : protocolList.keySet()) { + final DefaultMutableTreeNode protocolNode = + new DefaultMutableTreeNode(protocol); + root.add(protocolNode); + final Map> transportMap = + protocolList.get(protocol); + final Set trasnports = transportMap.keySet(); + for (Transport transport : trasnports) { + final DefaultMutableTreeNode transportNode = + new DefaultMutableTreeNode(transport); + protocolNode.add(transportNode); + } + } + return root; + } + + private DefaultMutableTreeNode getTreeNode(TreePath path) { + return (DefaultMutableTreeNode) path.getLastPathComponent(); + } + + private final void confirmSelection() { + final int result = showConfirmDialog(logger, + rb.getString("SPRACONFIRM"), + rb.getString("SPRACONFIRMTITLE"), + YES_NO_OPTION, + QUESTION_MESSAGE); + + if (result == 0) { + final DefaultMutableTreeNode node = getTreeNode(selectedPath); + final Object o = node.getUserObject(); + if (o instanceof Transport) { + final DefaultMutableTreeNode parent = + (DefaultMutableTreeNode) node.getParent(); + final String parentName = (String) parent.getUserObject(); + logger.getSettings().setLoggerProtocol(parentName); + logger.getSettings().setTransportProtocol(((Transport) o).getId()); + + } + + logger.updateElmSelectable(); + logger.loadLoggerParams(); + closeDialog(); + } + } + + private final void closeDialog() { + setVisible(false); + dispose(); + logger.startLogging(); + } + } +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/util/FileHelper.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/util/FileHelper.java index 8ae0f2c55..e5d4ad664 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/util/FileHelper.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/util/FileHelper.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,15 +21,20 @@ import com.romraider.logger.ecu.profile.UserProfile; import com.romraider.swing.GenericFileFilter; +import com.romraider.util.ResourceUtil; + import static com.romraider.util.ParamChecker.isNullOrEmpty; import static javax.swing.JFileChooser.DIRECTORIES_ONLY; import javax.swing.JFileChooser; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.util.ResourceBundle; public final class FileHelper { private static final String USER_HOME_DIR = System.getProperty("user.home"); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + FileHelper.class.getName()); private FileHelper() { throw new UnsupportedOperationException(); @@ -40,11 +45,11 @@ public static File getFile(String filePath) { } public static JFileChooser getProfileFileChooser(File lastProfileFile) { - return getFileChooser(lastProfileFile, "ECU Logger User Profiles", "xml"); + return getFileChooser(lastProfileFile, rb.getString("LOGUSERPROFILE"), "xml"); } public static JFileChooser getDefinitionFileChooser(File lastDefFile) { - return getFileChooser(lastDefFile, "ECU Logger Definitions", "xml"); + return getFileChooser(lastDefFile, rb.getString("LOGDEFINITIONS"), "xml"); } public static String saveProfileToFile(UserProfile profile, File destinationFile) throws IOException { diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/DS2LearningTableValuesResultsPanel.java b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/DS2LearningTableValuesResultsPanel.java new file mode 100644 index 000000000..634cddd63 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/DS2LearningTableValuesResultsPanel.java @@ -0,0 +1,453 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.ui.swing.tools; + +import static com.romraider.Settings.COMMA; +import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.INFORMATION_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; + +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; + +import javax.imageio.ImageIO; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.border.EmptyBorder; +import javax.swing.border.EtchedBorder; +import javax.swing.border.TitledBorder; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumn; + +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.AirFuelLearningTableModel; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.FineLearningKnockCorrectionTableModel; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.VehicleInformationTableModel; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.renderers.CentreRenderer; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.renderers.LtvCellRenderer; +import com.romraider.logger.ecu.ui.swing.vertical.VerticalLabelUI; +import com.romraider.swing.SetFont; +import com.romraider.util.FormatFilename; +import com.romraider.util.ResourceUtil; +import com.romraider.util.SettingsManager; + +/** + * This class is used to build and display the Adaptation Table Values + * retrieved from the ECU. + */ +public class DS2LearningTableValuesResultsPanel extends JDialog { + private static final long serialVersionUID = 6716454294436022709L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DS2LearningTableValuesResultsPanel.class.getName()); + private final String DIALOG_TITLE = rb.getString("DIALOGTITLE"); + private final String DT_FORMAT = "%1$tY%1$tm%1$td-%1$tH%1$tM%1$tS"; + private final int LTV_WIDTH = 720; + private final int LTV_HEIGHT = 595; + private final JPanel contentPanel = new JPanel(); + private JTable vehicleInfoTable; + private JTable afLearningTable; + private List knockTables = new ArrayList(); + private final String FLKC_NAME = rb.getString("FLKCNAME"); + + public DS2LearningTableValuesResultsPanel( + EcuLogger logger, + Map vehicleInfo, + String[] afRanges, + List> afLearning, + String[] flkcLoad, + String[] flkcRpm, + List>> flkcQueryTables) { + + super(logger, false); + setIconImage(logger.getIconImage()); + setTitle(DIALOG_TITLE); + setBounds( + (logger.getWidth() > LTV_WIDTH) ? + logger.getX() + (logger.getWidth() - LTV_WIDTH) / 2 : 0, + (logger.getHeight() > LTV_HEIGHT) ? + logger.getY() + ((logger.getHeight() - LTV_HEIGHT) / 2) : 0, + LTV_WIDTH, + LTV_HEIGHT); + getContentPane().setLayout(new BorderLayout()); + + contentPanel.setBorder(new EmptyBorder(2, 2, 2, 2)); + contentPanel.setLayout(null); + contentPanel.add(buildVehicleInfoPanel(vehicleInfo)); + contentPanel.add(buildAfLearningPanel(afRanges, afLearning)); + contentPanel.add(buildFlkcPanel(flkcLoad, flkcRpm, flkcQueryTables)); + + getContentPane().add(contentPanel, BorderLayout.CENTER); + getContentPane().add(buildSaveReultsPanel(), BorderLayout.SOUTH); + } + + /** + * This method is called to display the Adaptation Table Values + * retrieved from the ECU. + */ + public final void displayLearningResultsPanel() { + setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + setVisible(true); + } + + private final JPanel buildVehicleInfoPanel( + Map vehicleInfo) { + + final JPanel vehicleInfoTitlePanel = new JPanel(); + vehicleInfoTitlePanel.setBorder( + BorderFactory.createTitledBorder(rb.getString("VEHICLEINFOTITLE"))); + vehicleInfoTitlePanel.setBounds(10, 2, 692, 70); + vehicleInfoTitlePanel.setLayout(new BorderLayout(0, 0)); + + JPanel vehicleInfoTablePanel = new JPanel(); + vehicleInfoTablePanel.setBorder( + new EtchedBorder(EtchedBorder.LOWERED, null, null)); + vehicleInfoTablePanel.setLayout(new BorderLayout(0, 0)); + + final VehicleInformationTableModel tableModel = + new VehicleInformationTableModel(); + tableModel.setVehicleInfo(vehicleInfo); + vehicleInfoTable = new JTable(tableModel); + setTableBehaviour(vehicleInfoTable); + + TableColumn column = null; + for (int i = 0; i < vehicleInfoTable.getColumnCount(); i++) { + column = vehicleInfoTable.getColumnModel().getColumn(i); + if (i == 0 || i ==1) { + column.setPreferredWidth(85); + } + else if (i == 2) { + column.setPreferredWidth(200); + } + } + + vehicleInfoTablePanel.add( + formatTableHeader(vehicleInfoTable), + BorderLayout.PAGE_START); + vehicleInfoTablePanel.add(vehicleInfoTable); + + vehicleInfoTitlePanel.add(vehicleInfoTablePanel, BorderLayout.CENTER); + return vehicleInfoTitlePanel; + } + + private final JPanel buildAfLearningPanel( + String[] afRanges, + List> afLearning) { + + final JPanel afLearningTitlePanel = new JPanel(); + afLearningTitlePanel.setBorder( + new TitledBorder(null, + rb.getString("AFSTORED"), + TitledBorder.LEADING, + TitledBorder.TOP, null, null)); + afLearningTitlePanel.setBounds(10, 72, 450, 100); + afLearningTitlePanel.setLayout(new BorderLayout(0, 0)); + + final JLabel xLabel = new JLabel(rb.getString("APPLIEDADAPTIONS")); + SetFont.plain(xLabel); + xLabel.setHorizontalAlignment(SwingConstants.CENTER); + afLearningTitlePanel.add(xLabel, BorderLayout.NORTH); + + final JLabel yLabel = new JLabel(rb.getString("BANK")); + SetFont.plain(yLabel); + yLabel.setUI(new VerticalLabelUI(false)); + afLearningTitlePanel.add(yLabel, BorderLayout.WEST); + + final JPanel afLearningTablePanel = new JPanel(); + afLearningTablePanel.setBorder( + new EtchedBorder(EtchedBorder.LOWERED, null, null)); + afLearningTablePanel.setLayout(new BorderLayout(0, 0)); + + final AirFuelLearningTableModel tableModel = + new AirFuelLearningTableModel(); + tableModel.setColumnHeadings(afRanges); + tableModel.setAfLearningInfo(afLearning); + afLearningTable = new JTable(tableModel); + setTableBehaviour(afLearningTable); + + TableColumn column = null; + for (int i = 0; i < afLearningTable.getColumnCount(); i++) { + column = afLearningTable.getColumnModel().getColumn(i); + if (i == 0) { + column.setPreferredWidth(40); + } + else { + column.setPreferredWidth(120); + } + } + + afLearningTablePanel.add( + formatTableHeader(afLearningTable), + BorderLayout.PAGE_START); + if (afLearning.size() > 0) { + afLearningTablePanel.add(afLearningTable); + } + else { + afLearningTablePanel.add(new JLabel(rb.getString("AFNODATA"))); + } + + afLearningTitlePanel.add(afLearningTablePanel, BorderLayout.CENTER); + return afLearningTitlePanel; + } + + private final JPanel buildFlkcPanel( + String[] flkcLoad, + String[] flkcRpm, + List>> flkcQueryTables) { + + final JPanel flkcTitlePanel = new JPanel(); + flkcTitlePanel.setBorder( + new TitledBorder(null, + FLKC_NAME, + TitledBorder.LEADING, + TitledBorder.TOP, null, null)); + flkcTitlePanel.setBounds(10, 172, 692, 354); + flkcTitlePanel.setLayout(new BorderLayout(0, 0)); + + final JLabel xLabel = new JLabel(rb.getString("ENGINELOAD")); + SetFont.plain(xLabel); + xLabel.setHorizontalAlignment(SwingConstants.CENTER); + flkcTitlePanel.add(xLabel, BorderLayout.NORTH); + + final JLabel yLabel = new JLabel(rb.getString("ENGINESPEED")); + SetFont.plain(yLabel); + yLabel.setUI(new VerticalLabelUI(false)); + flkcTitlePanel.add(yLabel, BorderLayout.WEST); + + final JTabbedPane tabs = new JTabbedPane(); + for (int i = 0; i < flkcQueryTables.size(); i++) { + final FineLearningKnockCorrectionTableModel tableModel = + new FineLearningKnockCorrectionTableModel(); + tableModel.setColumnHeadings(flkcLoad); + tableModel.setRomHeadings(flkcRpm); + tableModel.setFlkcData(flkcQueryTables.get(i)); + final JTable knockTable = new JTable(tableModel); + knockTables.add(knockTable); + setTableBehaviour(knockTable); + formatTableHeader(knockTable); + final JScrollPane flkcTablePanel = new JScrollPane(knockTable); + flkcTablePanel.setBorder( + new EtchedBorder(EtchedBorder.LOWERED, null, null)); + tabs.addTab(MessageFormat.format( + rb.getString("TABLE"), (i + 1)), flkcTablePanel); + } + if (flkcQueryTables.size() > 0) { + flkcTitlePanel.add(tabs, BorderLayout.CENTER); + } + else { + flkcTitlePanel.removeAll(); + flkcTitlePanel.add(new JLabel(rb.getString("KNKNODATA")), + BorderLayout.CENTER); + } + return flkcTitlePanel; + } + + private final void setTableBehaviour(JTable table) { + table.setBorder(null); + table.setColumnSelectionAllowed(false); + table.setRowSelectionAllowed(false); + table.setFont(new Font("Tahoma", Font.PLAIN, 11)); + table.setFillsViewportHeight(true); + table.setDefaultRenderer(Double.class, new LtvCellRenderer()); + table.setDefaultRenderer(String.class, new LtvCellRenderer()); + } + + private final JTableHeader formatTableHeader(JTable table) { + final JTableHeader th = table.getTableHeader(); + th.setReorderingAllowed(false); + th.setDefaultRenderer(new CentreRenderer(table)); + SetFont.bold(th, 11); + return th; + } + + private final JPanel buildSaveReultsPanel() { + + final JPanel controlPanel = new JPanel(); + final JButton toFile = new JButton(rb.getString("SAVETOFILE")); + toFile.setToolTipText(rb.getString("SAVETOFILETT")); + toFile.setMnemonic(KeyEvent.VK_F); + toFile.addActionListener(new ActionListener() { + @Override + public final void actionPerformed(ActionEvent actionEvent) { + saveTableText(); + } + }); + final JButton toImage = new JButton(rb.getString("SAVETOIMAGE")); + toImage.setToolTipText(rb.getString("SAVETOIMAGETT")); + toImage.setMnemonic(KeyEvent.VK_I); + toImage.addActionListener(new ActionListener() { + @Override + public final void actionPerformed(ActionEvent actionEvent) { + saveTableImage(); + } + }); + controlPanel.add(toFile); + controlPanel.add(toImage); + return controlPanel; + } + + private final void saveTableText() { + final String nowStr = String.format(DT_FORMAT, System.currentTimeMillis()); + final String fileName = String.format("%s%sromraiderADPT_%s.csv", + SettingsManager.getSettings().getLoggerOutputDirPath(), + File.separator, + nowStr); + try { + final File csvFile = new File(fileName); + final String EOL = System.getProperty("line.separator"); + final BufferedWriter bw = new BufferedWriter( + new FileWriter(csvFile)); + bw.write(rb.getString("DIALOGTITLE") + EOL); + Object result = 0; + int columnCount = vehicleInfoTable.getColumnCount(); + for (int i = 0; i < columnCount; i++ ) { + result = vehicleInfoTable.getTableHeader().getColumnModel(). + getColumn(i).getHeaderValue(); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL); + for (int i = 0; i < columnCount; i++ ) { + result = vehicleInfoTable.getValueAt(0, i); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL + EOL); + bw.write(rb.getString("AFSTORED") + EOL); + columnCount = afLearningTable.getColumnCount(); + int rowCount = afLearningTable.getRowCount(); + for (int i = 0; i < columnCount; i++) { + result = afLearningTable.getTableHeader().getColumnModel(). + getColumn(i).getHeaderValue(); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL); + for (int i = 0; i < rowCount; i++) { + for (int j = 0; j < columnCount; j++) { + result = afLearningTable.getValueAt(i, j); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL); + } + bw.append(EOL); + bw.write(FLKC_NAME + EOL); + int k = 1; + for (JTable knockTable : knockTables) { + columnCount = knockTable.getColumnCount(); + for (int i = 0; i < columnCount; i++) { + result = knockTable.getTableHeader().getColumnModel(). + getColumn(i).getHeaderValue(); + if (result.toString().equals(" ")) { + result = MessageFormat.format( + rb.getString("TABLE"), k); + } + bw.append(result.toString()); + bw.append(COMMA); + } + k++; + } + bw.append(EOL); + rowCount = knockTables.get(0).getRowCount(); + for (int i = 0; i < rowCount; i++) { + for (JTable knockTable : knockTables) { + columnCount = knockTable.getColumnCount(); + for (int j = 0; j < columnCount; j++) { + result = knockTable.getValueAt(i, j); + bw.append(result.toString()); + bw.append(COMMA); + } + } + bw.append(EOL); + } + bw.close(); + final String shortName = FormatFilename.getShortName(fileName); + showMessageDialog( + null, + MessageFormat.format( + rb.getString("SAVEMSG"), shortName), + rb.getString("SAVEMSGTITLE"), + INFORMATION_MESSAGE); + } + catch (Exception e) { + showMessageDialog( + null, + MessageFormat.format( + rb.getString("SAVEFAILED"), fileName), + rb.getString("SAVEFAILEDTITLE"), + ERROR_MESSAGE); + } + } + + private final void saveTableImage() { + final BufferedImage resultsImage = new BufferedImage( + contentPanel.getWidth(), + contentPanel.getHeight(), + BufferedImage.TYPE_INT_ARGB); + contentPanel.paint(resultsImage.createGraphics()); + final String nowStr = String.format(DT_FORMAT, System.currentTimeMillis()); + final String fileName = String.format("%s%sromraiderADPT_%s.png", + SettingsManager.getSettings().getLoggerOutputDirPath(), + File.separator, + nowStr); + final String shortName = FormatFilename.getShortName(fileName); + try { + final File imageFile = new File(fileName); + ImageIO.write( + resultsImage, + "png", + imageFile); + showMessageDialog( + null, + MessageFormat.format( + rb.getString("SAVEIMAGE"), shortName), + rb.getString("SAVEMSGTITLE"), + INFORMATION_MESSAGE); + } + catch (Exception e) { + showMessageDialog( + null, + MessageFormat.format( + rb.getString("FAILEDIMAGE"), fileName), + rb.getString("SAVEFAILEDTITLE"), + ERROR_MESSAGE); + } + } +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/DS2ResetPanel.java b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/DS2ResetPanel.java new file mode 100644 index 000000000..331ac4757 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/DS2ResetPanel.java @@ -0,0 +1,168 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.ui.swing.tools; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.ResourceBundle; + +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.border.EmptyBorder; +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.util.ResourceUtil; + +public final class DS2ResetPanel extends JDialog { + private static final long serialVersionUID = 2406346286060014312L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DS2ResetPanel.class.getName()); + private static final String DIALOG_TITLE = rb.getString("DIALOGTITLE"); + private static final String OK_BUTTON_TEXT = rb.getString("OKBTN"); + private static final String CANCEL_BUTTON_TEXT = rb.getString("CANCELBTN"); + private static final String PANEL_TT = rb.getString("PANELTT"); + private static int results; + private final JCheckBox selectAll = new JCheckBox(rb.getString("SELECTALL")); + private final ResetCheckBox[] resetItems = { + new ResetCheckBox(rb.getString("CHKBOX1"), 0x0100), + new ResetCheckBox(rb.getString("CHKBOX2"), 0x0200), + new ResetCheckBox(rb.getString("CHKBOX3"), 0x0400), + new ResetCheckBox(rb.getString("CHKBOX4"), 0x0800), + new ResetCheckBox(rb.getString("CHKBOX5"), 0x1000), + new ResetCheckBox(rb.getString("CHKBOX6"), 0x2000), + new ResetCheckBox(rb.getString("CHKBOX7"), 0x4000), + new ResetCheckBox(rb.getString("CHKBOX8"), 0x8000), + new ResetCheckBox(rb.getString("CHKBOX9"), 0x0001), + new ResetCheckBox(rb.getString("CHKBOX10"), 0x0002), + new ResetCheckBox(rb.getString("CHKBOX11"), 0x0004), + new ResetCheckBox(rb.getString("CHKBOX12"), 0x0008) + }; + + public DS2ResetPanel(EcuLogger logger) { + + super(logger, true); + setIconImage(logger.getIconImage()); + setTitle(DIALOG_TITLE); + setBounds( + logger.getX() + (logger.getWidth() / 2) - 180, + logger.getY() + 90, + 286, + 377); + + final JPanel contentPanel = new JPanel(); + contentPanel.setToolTipText(PANEL_TT); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS)); + getContentPane().setLayout(new BorderLayout()); + getContentPane().add(contentPanel, BorderLayout.CENTER); + + selectAll.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + for (ResetCheckBox item : resetItems) { + item.setSelected(selectAll.isSelected()); + } + } + }); + + for (ResetCheckBox checkBox : resetItems) { + contentPanel.add(checkBox); + } + contentPanel.add(new JSeparator()); + contentPanel.add(selectAll); + + final JPanel buttonPanel = new JPanel(); + buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPanel, BorderLayout.SOUTH); + + final JButton okButton = new JButton(OK_BUTTON_TEXT); + okButton.setActionCommand(OK_BUTTON_TEXT); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + for (ResetCheckBox checkBox : resetItems) { + if(checkBox.isSelected()) { + results |= checkBox.mask; + } + } + closeDialog(); + } + }); + buttonPanel.add(okButton); + + final JButton cancelButton = new JButton(CANCEL_BUTTON_TEXT); + cancelButton.setActionCommand(CANCEL_BUTTON_TEXT); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + results = 0; + closeDialog(); + } + }); + buttonPanel.add(cancelButton); + getRootPane().setDefaultButton(cancelButton); + } + + public final void showResetPanel() { + setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + results = 0; + closeDialog(); + } + }); + results = 0; + setVisible(true); + } + + public final int getResults() { + return results; + } + + private final void closeDialog() { + setVisible(false); + dispose(); + } + + class ResetCheckBox extends JCheckBox { + private static final long serialVersionUID = 6324945868965147832L; + public int mask; + + public ResetCheckBox(String name, int mask) { + this.mask = mask; + this.setText(name); + this.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + final JCheckBox source = (JCheckBox) actionEvent.getSource(); + if (!source.isSelected()) { + selectAll.setSelected(false); + } + } + }); + } + } +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/GlobalAdjustmentsPanel.java b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/GlobalAdjustmentsPanel.java index bf9c712f4..321232407 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/GlobalAdjustmentsPanel.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/GlobalAdjustmentsPanel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.Collection; +import java.util.ResourceBundle; import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultListCellRenderer; @@ -42,29 +43,33 @@ import com.romraider.logger.ecu.EcuLogger; import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.util.ResourceUtil; public final class GlobalAdjustmentsPanel extends JDialog { private static final long serialVersionUID = 6751698409230811074L; - private static final String DIALOG_TITLE = "Global Parameter Adjustments"; - private static final String TIMING_ADJUST_LABEL_TEXT = "Timing Adjustment"; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + GlobalAdjustmentsPanel.class.getName()); + private static final String DIALOG_TITLE = rb.getString("DIALOGTITLE"); + private static final String TIMING_ADJUST_LABEL_TEXT = + rb.getString("TIMINGADJ"); private static final String[] COMBO_DATA = new String[] {"0", "-1", "-2", "-3", "-4", "-5"}; private static final String TIMING_UNITS_LABEL_TEXT = "\u00B0"; private static final String IDLE_AC_OFF_LABEL_TEXT = - "Idle Engine Speed A/C Off"; - private static final String IDLE_RPM_LABEL_TEXT = "RPM"; + rb.getString("IDLEACOFF"); + private static final String IDLE_RPM_LABEL_TEXT = rb.getString("RPM"); private static final String IDLE_RPM_TT_TEXT = - "valid range: -100 to 300 in steps of 25"; + rb.getString("IDLERPMTT"); private static final SpinnerNumberModel OFF_RPM_SPINNER = new SpinnerNumberModel(0, -100, 300, 25); private static final SpinnerNumberModel ON_RPM_SPINNER = new SpinnerNumberModel(0, -100, 300, 25); private static final String IDLE_AC_ON_LABEL_TEXT = - "Idle Engine Speed A/C On"; + rb.getString("IDLEACON"); private static final String RESET_WARNING = - "Note: These values will be set to 0 by a Reset"; - private static final String APPLY_BUTTON_TEXT = "Apply"; - private static final String CANCEL_BUTTON_TEXT = "Cancel"; + rb.getString("RESETWARNING"); + private static final String APPLY_BUTTON_TEXT = rb.getString("APPLY"); + private static final String CANCEL_BUTTON_TEXT = rb.getString("CANCEL"); private static int[] results; public GlobalAdjustmentsPanel( diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/LearningTableValuesResultsPanel.java b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/LearningTableValuesResultsPanel.java deleted file mode 100644 index bfd442450..000000000 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/LearningTableValuesResultsPanel.java +++ /dev/null @@ -1,423 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.logger.ecu.ui.swing.tools; - -import static javax.swing.JOptionPane.ERROR_MESSAGE; -import static javax.swing.JOptionPane.INFORMATION_MESSAGE; -import static javax.swing.JOptionPane.showMessageDialog; - -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.awt.image.BufferedImage; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.util.List; -import java.util.Map; - -import javax.imageio.ImageIO; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTable; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.border.EtchedBorder; -import javax.swing.border.TitledBorder; -import javax.swing.table.JTableHeader; -import javax.swing.table.TableColumn; - -import com.romraider.logger.ecu.EcuLogger; -import com.romraider.logger.ecu.comms.query.EcuQuery; -import com.romraider.logger.ecu.ui.swing.tools.tablemodels.AirFuelLearningTableModel; -import com.romraider.logger.ecu.ui.swing.tools.tablemodels.FineLearningKnockCorrectionTableModel; -import com.romraider.logger.ecu.ui.swing.tools.tablemodels.VehicleInformationTableModel; -import com.romraider.logger.ecu.ui.swing.tools.tablemodels.renderers.CentreRenderer; -import com.romraider.logger.ecu.ui.swing.tools.tablemodels.renderers.LtvCellRenderer; -import com.romraider.logger.ecu.ui.swing.vertical.VerticalLabelUI; -import com.romraider.swing.SetFont; -import com.romraider.util.FormatFilename; -import com.romraider.util.SettingsManager; - -/** - * This class is used to build and display the Learning Table Values - * retrieved from the ECU. - */ -public class LearningTableValuesResultsPanel extends JDialog { - private static final long serialVersionUID = 6716454297236022709L; - private final String DIALOG_TITLE = "Learning Table Values"; - private final String DT_FORMAT = "%1$tY%1$tm%1$td-%1$tH%1$tM%1$tS"; - private final int LTV_WIDTH = 720; - private final int LTV_HEIGHT = 450; - private final JPanel contentPanel = new JPanel(); - private JTable vehicleInfoTable; - private JTable afLearningTable; - private JTable flkcTable; - private final String FLKC_NAME = "Fine Learning Knock Correction (\u00B0 of correction)"; - - public LearningTableValuesResultsPanel( - EcuLogger logger, - Map vehicleInfo, - String[] afRanges, - List> afLearning, - String[] flkcLoad, - String[] flkcRpm, - List> flkcData) { - - super(logger, false); - setIconImage(logger.getIconImage()); - setTitle(DIALOG_TITLE); - setBounds( - (logger.getWidth() > LTV_WIDTH) ? - logger.getX() + (logger.getWidth() - LTV_WIDTH) / 2 : 0, - (logger.getHeight() > LTV_HEIGHT) ? - logger.getY() + ((logger.getHeight() - LTV_HEIGHT) / 2) : 0, - LTV_WIDTH, - LTV_HEIGHT); - getContentPane().setLayout(new BorderLayout()); - - contentPanel.setBorder(new EmptyBorder(2, 2, 2, 2)); - contentPanel.setLayout(null); - contentPanel.add(buildVehicleInfoPanel(vehicleInfo)); - contentPanel.add(buildAfLearningPanel(afRanges, afLearning)); - contentPanel.add(buildFlkcPanel(flkcLoad, flkcRpm, flkcData)); - - getContentPane().add(contentPanel, BorderLayout.CENTER); - getContentPane().add(buildSaveReultsPanel(), BorderLayout.SOUTH); - } - - /** - * This method is called to display the Learning Table Values - * retrieved from the ECU. - */ - public final void displayLearningResultsPanel() { - setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - setVisible(true); - } - - private final JPanel buildVehicleInfoPanel( - Map vehicleInfo) { - - final JPanel vehicleInfoTitlePanel = new JPanel(); - vehicleInfoTitlePanel.setBorder( - BorderFactory.createTitledBorder("Vehicle Information")); - vehicleInfoTitlePanel.setBounds(10, 2, 692, 70); - vehicleInfoTitlePanel.setLayout(new BorderLayout(0, 0)); - - JPanel vehicleInfoTablePanel = new JPanel(); - vehicleInfoTablePanel.setBorder( - new EtchedBorder(EtchedBorder.LOWERED, null, null)); - vehicleInfoTablePanel.setLayout(new BorderLayout(0, 0)); - - final VehicleInformationTableModel tableModel = - new VehicleInformationTableModel(); - tableModel.setVehicleInfo(vehicleInfo); - vehicleInfoTable = new JTable(tableModel); - setTableBehaviour(vehicleInfoTable); - - TableColumn column = null; - for (int i = 0; i < vehicleInfoTable.getColumnCount(); i++) { - column = vehicleInfoTable.getColumnModel().getColumn(i); - if (i == 0 || i ==1) { - column.setPreferredWidth(85); - } - else if (i == 2) { - column.setPreferredWidth(200); - } - } - - vehicleInfoTablePanel.add( - formatTableHeader(vehicleInfoTable), - BorderLayout.PAGE_START); - vehicleInfoTablePanel.add(vehicleInfoTable); - - vehicleInfoTitlePanel.add(vehicleInfoTablePanel, BorderLayout.CENTER); - return vehicleInfoTitlePanel; - } - - private final JPanel buildAfLearningPanel( - String[] afRanges, - List> afLearning) { - - final JPanel afLearningTitlePanel = new JPanel(); - afLearningTitlePanel.setBorder( - new TitledBorder(null, - "A/F Learning (Stored)", - TitledBorder.LEADING, - TitledBorder.TOP, null, null)); - afLearningTitlePanel.setBounds(10, 72, 450, 100); - afLearningTitlePanel.setLayout(new BorderLayout(0, 0)); - - final JLabel xLabel = new JLabel("Air/Fuel Ranges (g/s)"); - SetFont.plain(xLabel); - xLabel.setHorizontalAlignment(SwingConstants.CENTER); - afLearningTitlePanel.add(xLabel, BorderLayout.NORTH); - - final JLabel yLabel = new JLabel("Bank"); - SetFont.plain(yLabel); - yLabel.setUI(new VerticalLabelUI(false)); - afLearningTitlePanel.add(yLabel, BorderLayout.WEST); - - final JPanel afLearningTablePanel = new JPanel(); - afLearningTablePanel.setBorder( - new EtchedBorder(EtchedBorder.LOWERED, null, null)); - afLearningTablePanel.setLayout(new BorderLayout(0, 0)); - - final AirFuelLearningTableModel tableModel = - new AirFuelLearningTableModel(); - tableModel.setColumnHeadings(afRanges); - tableModel.setAfLearningInfo(afLearning); - afLearningTable = new JTable(tableModel); - setTableBehaviour(afLearningTable); - - TableColumn column = null; - for (int i = 0; i < afLearningTable.getColumnCount(); i++) { - column = afLearningTable.getColumnModel().getColumn(i); - if (i == 0) { - column.setPreferredWidth(40); - } - else { - column.setPreferredWidth(120); - } - } - - afLearningTablePanel.add( - formatTableHeader(afLearningTable), - BorderLayout.PAGE_START); - if (afLearning.size() > 0) { - afLearningTablePanel.add(afLearningTable); - } - else { - afLearningTablePanel.add(new JLabel( - " No data - A/F Extended parameter IDs not defined")); - } - - afLearningTitlePanel.add(afLearningTablePanel, BorderLayout.CENTER); - return afLearningTitlePanel; - } - - private final JPanel buildFlkcPanel( - String[] flkcLoad, - String[] flkcRpm, - List> flkcData) { - - final JPanel flkcTitlePanel = new JPanel(); - flkcTitlePanel.setBorder( - new TitledBorder(null, - FLKC_NAME, - TitledBorder.LEADING, - TitledBorder.TOP, null, null)); - flkcTitlePanel.setBounds(10, 172, 692, 204); - flkcTitlePanel.setLayout(new BorderLayout(0, 0)); - - final JLabel xLabel = new JLabel("Engine Load Ranges (g/rev)"); - SetFont.plain(xLabel); - xLabel.setHorizontalAlignment(SwingConstants.CENTER); - flkcTitlePanel.add(xLabel, BorderLayout.NORTH); - - final JLabel yLabel = new JLabel("Engine Speed Ranges (RPM)"); - SetFont.plain(yLabel); - yLabel.setUI(new VerticalLabelUI(false)); - flkcTitlePanel.add(yLabel, BorderLayout.WEST); - - final JPanel flkcTablePanel = new JPanel(); - flkcTablePanel.setBorder( - new EtchedBorder(EtchedBorder.LOWERED, null, null)); - flkcTablePanel.setLayout(new BorderLayout(0, 0)); - - final FineLearningKnockCorrectionTableModel tableModel = - new FineLearningKnockCorrectionTableModel(); - tableModel.setColumnHeadings(flkcLoad); - tableModel.setRomHeadings(flkcRpm); - tableModel.setFlkcData(flkcData); - flkcTable = new JTable(tableModel); - setTableBehaviour(flkcTable); - flkcTablePanel.add( - formatTableHeader(flkcTable), - BorderLayout.PAGE_START); - if (flkcData.size() > 0) { - flkcTablePanel.add(flkcTable); - } - else { - flkcTablePanel.add(new JLabel( - " No data - FLKC reference parameter ID not defined")); - } - - flkcTitlePanel.add(flkcTablePanel, BorderLayout.CENTER); - return flkcTitlePanel; - } - - private final void setTableBehaviour(JTable table) { - table.setBorder(null); - table.setColumnSelectionAllowed(false); - table.setRowSelectionAllowed(false); - table.setFont(new Font("Tahoma", Font.PLAIN, 11)); - table.setFillsViewportHeight(true); - table.setDefaultRenderer(Double.class, new LtvCellRenderer()); - table.setDefaultRenderer(String.class, new LtvCellRenderer()); - } - - private final JTableHeader formatTableHeader(JTable table) { - final JTableHeader th = table.getTableHeader(); - th.setReorderingAllowed(false); - th.setDefaultRenderer(new CentreRenderer(table)); - SetFont.bold(th, 11); - return th; - } - - private final JPanel buildSaveReultsPanel() { - - final JPanel controlPanel = new JPanel(); - final JButton toFile = new JButton("Save to File"); - toFile.setToolTipText("Save tables to a text file"); - toFile.setMnemonic(KeyEvent.VK_F); - toFile.addActionListener(new ActionListener() { - @Override - public final void actionPerformed(ActionEvent actionEvent) { - saveTableText(); - } - }); - final JButton toImage = new JButton("Save as Image"); - toImage.setToolTipText("Save tables as an image"); - toImage.setMnemonic(KeyEvent.VK_I); - toImage.addActionListener(new ActionListener() { - @Override - public final void actionPerformed(ActionEvent actionEvent) { - saveTableImage(); - } - }); - controlPanel.add(toFile); - controlPanel.add(toImage); - return controlPanel; - } - - private final void saveTableText() { - final String nowStr = String.format(DT_FORMAT, System.currentTimeMillis()); - final String fileName = String.format("%s%sromraiderLTV_%s.csv", - SettingsManager.getSettings().getLoggerOutputDirPath(), - File.separator, - nowStr); - try { - final File csvFile = new File(fileName); - final String EOL = System.getProperty("line.separator"); - final BufferedWriter bw = new BufferedWriter( - new FileWriter(csvFile)); - bw.write("Learning Table Values" + EOL); - Object result = 0; - int columnCount = vehicleInfoTable.getColumnCount(); - for (int i = 0; i < columnCount; i++ ) { - result = vehicleInfoTable.getTableHeader().getColumnModel(). - getColumn(i).getHeaderValue(); - bw.append(result.toString() + ","); - } - bw.append(EOL); - for (int i = 0; i < columnCount; i++ ) { - result = vehicleInfoTable.getValueAt(0, i); - bw.append(result + ","); - } - bw.append(EOL + EOL); - bw.write("A/F Learning (Stored)" + EOL); - columnCount = afLearningTable.getColumnCount(); - int rowCount = afLearningTable.getRowCount(); - for (int i = 0; i < columnCount; i++) { - result = afLearningTable.getTableHeader().getColumnModel(). - getColumn(i).getHeaderValue(); - bw.append(result.toString() + ","); - } - bw.append(EOL); - for (int i = 0; i < rowCount; i++) { - for (int j = 0; j < columnCount; j++) { - result = afLearningTable.getValueAt(i, j); - bw.append(result + ","); - } - bw.append(EOL); - } - bw.append(EOL); - bw.write(FLKC_NAME + EOL); - columnCount = flkcTable.getColumnCount(); - rowCount = flkcTable.getRowCount(); - for (int i = 0; i < columnCount; i++) { - result = flkcTable.getTableHeader().getColumnModel(). - getColumn(i).getHeaderValue(); - bw.append(result.toString() + ","); - } - bw.append(EOL); - for (int i = 0; i < rowCount; i++) { - for (int j = 0; j < columnCount; j++) { - result = flkcTable.getValueAt(i, j); - bw.append(result + ","); - } - bw.append(EOL); - } - bw.close(); - final String shortName = FormatFilename.getShortName(fileName); - showMessageDialog( - null, - "Table's text saved to: " + shortName, - "Save Success", - INFORMATION_MESSAGE); - } - catch (Exception e) { - showMessageDialog( - null, - "Failed to save tables, check path:\n" + fileName, - "Save Failed", - ERROR_MESSAGE); - } - } - - private final void saveTableImage() { - final BufferedImage resultsImage = new BufferedImage( - contentPanel.getWidth(), - contentPanel.getHeight(), - BufferedImage.TYPE_INT_ARGB); - contentPanel.paint(resultsImage.createGraphics()); - final String nowStr = String.format(DT_FORMAT, System.currentTimeMillis()); - final String fileName = String.format("%s%sromraiderLTV_%s.png", - SettingsManager.getSettings().getLoggerOutputDirPath(), - File.separator, - nowStr); - final String shortName = FormatFilename.getShortName(fileName); - try { - final File imageFile = new File(fileName); - ImageIO.write( - resultsImage, - "png", - imageFile); - showMessageDialog( - null, - "Learning Table Values image saved to: " + shortName, - "Save Success", - INFORMATION_MESSAGE); - } - catch (Exception e) { - showMessageDialog( - null, - "Failed to save image, check path:\n" + fileName, - "Save Failed", - ERROR_MESSAGE); - } - } -} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/NCSLearningTableValuesResultsPanel.java b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/NCSLearningTableValuesResultsPanel.java new file mode 100644 index 000000000..15012bfed --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/NCSLearningTableValuesResultsPanel.java @@ -0,0 +1,418 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.ui.swing.tools; + +import static com.romraider.Settings.COMMA; +import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.INFORMATION_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; + +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; + +import javax.imageio.ImageIO; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.border.EmptyBorder; +import javax.swing.border.EtchedBorder; +import javax.swing.border.TitledBorder; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumn; + +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.FineLearningKnockCorrectionTableModel; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.VehicleInformationTableModel; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.renderers.CentreRenderer; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.renderers.LtvCellRenderer; +import com.romraider.logger.ecu.ui.swing.vertical.VerticalLabelUI; +import com.romraider.swing.SetFont; +import com.romraider.util.FormatFilename; +import com.romraider.util.ResourceUtil; +import com.romraider.util.SettingsManager; + +/** + * This class is used to build and display the Learning Table Values + * retrieved from the ECU. + */ +public class NCSLearningTableValuesResultsPanel extends JDialog { + private static final long serialVersionUID = 6716454297236022709L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + NCSLearningTableValuesResultsPanel.class.getName()); + private final String DIALOG_TITLE = rb.getString("DIALOGTITLE"); + private final String DT_FORMAT = "%1$tY%1$tm%1$td-%1$tH%1$tM%1$tS"; + private final int LTV_WIDTH = 720; + private final int LTV_HEIGHT = 450; + private final JPanel contentPanel = new JPanel(); + private JTable vehicleInfoTable; + //TODO: replace AF learning with a knock table + private JTable afLearningTable; + private List ltftTables = new ArrayList(); + private final String LTFT_NAME = rb.getString("LTFTNAME"); + + public NCSLearningTableValuesResultsPanel( + EcuLogger logger, + Map vehicleInfo, + String[] afRanges, + List> afLearning, + String[] ltftCol, + String[] ltftRow, + List>> ltftData) { + + super(logger, false); + setIconImage(logger.getIconImage()); + setTitle(DIALOG_TITLE); + setBounds( + (logger.getWidth() > LTV_WIDTH) ? + logger.getX() + (logger.getWidth() - LTV_WIDTH) / 2 : 0, + (logger.getHeight() > LTV_HEIGHT) ? + logger.getY() + ((logger.getHeight() - LTV_HEIGHT) / 2) : 0, + LTV_WIDTH, + LTV_HEIGHT); + getContentPane().setLayout(new BorderLayout()); + + contentPanel.setBorder(new EmptyBorder(2, 2, 2, 2)); + contentPanel.setLayout(null); + contentPanel.add(buildVehicleInfoPanel(vehicleInfo)); +// contentPanel.add(buildAfLearningPanel(afRanges, afLearning)); + contentPanel.add(buildLtftPanel(ltftCol, ltftRow, ltftData)); + + getContentPane().add(contentPanel, BorderLayout.CENTER); + getContentPane().add(buildSaveReultsPanel(), BorderLayout.SOUTH); + } + + /** + * This method is called to display the Learning Table Values + * retrieved from the ECU. + */ + public final void displayLearningResultsPanel() { + setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + setVisible(true); + } + + private final JPanel buildVehicleInfoPanel( + Map vehicleInfo) { + + final JPanel vehicleInfoTitlePanel = new JPanel(); + vehicleInfoTitlePanel.setBorder( + BorderFactory.createTitledBorder(rb.getString("VITITLE"))); + vehicleInfoTitlePanel.setBounds(10, 2, 692, 70); + vehicleInfoTitlePanel.setLayout(new BorderLayout(0, 0)); + + JPanel vehicleInfoTablePanel = new JPanel(); + vehicleInfoTablePanel.setBorder( + new EtchedBorder(EtchedBorder.LOWERED, null, null)); + vehicleInfoTablePanel.setLayout(new BorderLayout(0, 0)); + + final VehicleInformationTableModel tableModel = + new VehicleInformationTableModel(); + tableModel.setVehicleInfo(vehicleInfo); + vehicleInfoTable = new JTable(tableModel); + setTableBehaviour(vehicleInfoTable); + + TableColumn column = null; + for (int i = 0; i < vehicleInfoTable.getColumnCount(); i++) { + column = vehicleInfoTable.getColumnModel().getColumn(i); + if (i == 0 || i ==1) { + column.setPreferredWidth(85); + } + else if (i == 2) { + column.setPreferredWidth(200); + } + } + + vehicleInfoTablePanel.add( + formatTableHeader(vehicleInfoTable), + BorderLayout.PAGE_START); + vehicleInfoTablePanel.add(vehicleInfoTable); + + vehicleInfoTitlePanel.add(vehicleInfoTablePanel, BorderLayout.CENTER); + return vehicleInfoTitlePanel; + } + + private final JPanel buildLtftPanel( + String[] ltftLoad, + String[] ltftRpm, + List>> ltftQueryTables) { + + final JPanel ltftTitlePanel = new JPanel(); + ltftTitlePanel.setBorder( + new TitledBorder(null, + LTFT_NAME, + TitledBorder.LEADING, + TitledBorder.TOP, null, null)); + ltftTitlePanel.setBounds(10, 72, 692, 226); + ltftTitlePanel.setLayout(new BorderLayout(0, 0)); + + final JLabel xLabel = new JLabel(rb.getString("INJPWLABEL")); + SetFont.plain(xLabel); + xLabel.setHorizontalAlignment(SwingConstants.CENTER); + ltftTitlePanel.add(xLabel, BorderLayout.NORTH); + + final JLabel yLabel = new JLabel(rb.getString("ENGINESPEED")); + SetFont.plain(yLabel); + yLabel.setUI(new VerticalLabelUI(false)); + ltftTitlePanel.add(yLabel, BorderLayout.WEST); + + final JTabbedPane tabs = new JTabbedPane(); + for (int i = 0; i < ltftQueryTables.size(); i++) { + final FineLearningKnockCorrectionTableModel tableModel = + new FineLearningKnockCorrectionTableModel(); + tableModel.setColumnHeadings(ltftLoad); + tableModel.setRomHeadings(ltftRpm); + tableModel.setFlkcData(ltftQueryTables.get(i)); + final JTable ltftTable = new JTable(tableModel); + ltftTables.add(ltftTable); + setTableBehaviour(ltftTable); + formatTableHeader(ltftTable); + final JScrollPane ltftTablePanel = new JScrollPane(ltftTable); + ltftTablePanel.setBorder( + new EtchedBorder(EtchedBorder.LOWERED, null, null)); + switch (i) { + case 0: + tabs.addTab(rb.getString("LBTRIM"), ltftTablePanel); + break; + case 1: + tabs.addTab(rb.getString("RBTRIM"), ltftTablePanel); + break; + case 2: + tabs.addTab(rb.getString("LBCOUNT"), ltftTablePanel); + break; + case 3: + tabs.addTab(rb.getString("RBCOUNT"), ltftTablePanel); + break; + } + } + if (ltftQueryTables.size() > 0) { + ltftTitlePanel.add(tabs, BorderLayout.CENTER); + } + else { + ltftTitlePanel.removeAll(); + ltftTitlePanel.add(new JLabel( + rb.getString("NOKNDATA")), + BorderLayout.CENTER); + } + return ltftTitlePanel; + } + + private final void setTableBehaviour(JTable table) { + table.setBorder(null); + table.setColumnSelectionAllowed(false); + table.setRowSelectionAllowed(false); + table.setFont(new Font("Tahoma", Font.PLAIN, 11)); + table.setFillsViewportHeight(true); + table.setDefaultRenderer(Double.class, new LtvCellRenderer()); + table.setDefaultRenderer(String.class, new LtvCellRenderer()); + } + + private final JTableHeader formatTableHeader(JTable table) { + final JTableHeader th = table.getTableHeader(); + th.setReorderingAllowed(false); + th.setDefaultRenderer(new CentreRenderer(table)); + SetFont.bold(th, 11); + return th; + } + + private final JPanel buildSaveReultsPanel() { + + final JPanel controlPanel = new JPanel(); + final JButton toFile = new JButton(rb.getString("SAVETOFILE")); + toFile.setToolTipText(rb.getString("SAVETOFILETT")); + toFile.setMnemonic(KeyEvent.VK_F); + toFile.addActionListener(new ActionListener() { + @Override + public final void actionPerformed(ActionEvent actionEvent) { + saveTableText(); + } + }); + final JButton toImage = new JButton(rb.getString("SAVEASIMAGE")); + toImage.setToolTipText(rb.getString("SAVEASIMAGETT")); + toImage.setMnemonic(KeyEvent.VK_I); + toImage.addActionListener(new ActionListener() { + @Override + public final void actionPerformed(ActionEvent actionEvent) { + saveTableImage(); + } + }); + controlPanel.add(toFile); + controlPanel.add(toImage); + return controlPanel; + } + + private final void saveTableText() { + final String nowStr = String.format(DT_FORMAT, System.currentTimeMillis()); + final String fileName = String.format("%s%sromraiderLTV_%s.csv", + SettingsManager.getSettings().getLoggerOutputDirPath(), + File.separator, + nowStr); + try { + final File csvFile = new File(fileName); + final String EOL = System.getProperty("line.separator"); + final BufferedWriter bw = new BufferedWriter( + new FileWriter(csvFile)); + bw.write(rb.getString("DIALOGTITLE") + EOL); + Object result = 0; + int columnCount = vehicleInfoTable.getColumnCount(); + for (int i = 0; i < columnCount; i++ ) { + result = vehicleInfoTable.getTableHeader().getColumnModel(). + getColumn(i).getHeaderValue(); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL); + for (int i = 0; i < columnCount; i++ ) { + result = vehicleInfoTable.getValueAt(0, i); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL + EOL); +// bw.write("A/F Adaptation (Stored)" + EOL); +// columnCount = afLearningTable.getColumnCount(); +// int rowCount = afLearningTable.getRowCount(); +// for (int i = 0; i < columnCount; i++) { +// result = afLearningTable.getTableHeader().getColumnModel(). +// getColumn(i).getHeaderValue(); +// bw.append(result.toString()); +// bw.append(COMMA); +// } +// bw.append(EOL); +// for (int i = 0; i < rowCount; i++) { +// for (int j = 0; j < columnCount; j++) { +// result = afLearningTable.getValueAt(i, j); +// bw.append(result.toString()); +// bw.append(COMMA); +// } +// bw.append(EOL); +// } + bw.append(EOL); + bw.write(LTFT_NAME + EOL); + int k = 1; + for (JTable ltftTable : ltftTables) { + columnCount = ltftTable.getColumnCount(); + for (int i = 0; i < columnCount; i++) { + result = ltftTable.getTableHeader().getColumnModel(). + getColumn(i).getHeaderValue(); + if (result.toString().equals(" ")) { + switch (k) { + case 1: + result = rb.getObject("LBTRIM"); + break; + case 2: + result = rb.getObject("RBTRIM"); + break; + case 3: + result = rb.getObject("LBCOUNT"); + break; + case 4: + result = rb.getObject("RBCOUNT"); + break; + } + } + bw.append(result.toString()); + bw.append(COMMA); + } + k++; + } + bw.append(EOL); + int rowCount = ltftTables.get(0).getRowCount(); + for (int i = 0; i < rowCount; i++) { + for (JTable ltftTable : ltftTables) { + columnCount = ltftTable.getColumnCount(); + for (int j = 0; j < columnCount; j++) { + result = ltftTable.getValueAt(i, j); + bw.append(result.toString()); + bw.append(COMMA); + } + } + bw.append(EOL); + } + bw.close(); + final String shortName = FormatFilename.getShortName(fileName); + showMessageDialog( + null, + MessageFormat.format( + rb.getString("TABLESAVED"), shortName), + rb.getString("SUCCESS"), + INFORMATION_MESSAGE); + } + catch (Exception e) { + showMessageDialog( + null, + MessageFormat.format( + rb.getString("SAVEFAILED"), fileName), + rb.getString("FAILED"), + ERROR_MESSAGE); + } + } + + private final void saveTableImage() { + final BufferedImage resultsImage = new BufferedImage( + contentPanel.getWidth(), + contentPanel.getHeight(), + BufferedImage.TYPE_INT_ARGB); + contentPanel.paint(resultsImage.createGraphics()); + final String nowStr = String.format(DT_FORMAT, System.currentTimeMillis()); + final String fileName = String.format("%s%sromraiderLTV_%s.png", + SettingsManager.getSettings().getLoggerOutputDirPath(), + File.separator, + nowStr); + final String shortName = FormatFilename.getShortName(fileName); + try { + final File imageFile = new File(fileName); + ImageIO.write( + resultsImage, + "png", + imageFile); + showMessageDialog( + null, + MessageFormat.format( + rb.getString("IMAGESAVED"), shortName), + rb.getString("SUCCESS"), + INFORMATION_MESSAGE); + } + catch (Exception e) { + showMessageDialog( + null, + MessageFormat.format( + rb.getString("IMAGEFAILED"), fileName), + rb.getString("FAILED"), + ERROR_MESSAGE); + } + } +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/ReadCodesResultsPanel.java b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/ReadCodesResultsPanel.java index 39a34f35c..c0cb13566 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/ReadCodesResultsPanel.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/ReadCodesResultsPanel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ package com.romraider.logger.ecu.ui.swing.tools; +import static com.romraider.Settings.COMMA; import static javax.swing.JOptionPane.ERROR_MESSAGE; import static javax.swing.JOptionPane.INFORMATION_MESSAGE; import static javax.swing.JOptionPane.showMessageDialog; @@ -34,7 +35,9 @@ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; +import java.text.MessageFormat; import java.util.ArrayList; +import java.util.ResourceBundle; import javax.imageio.ImageIO; import javax.swing.BorderFactory; @@ -49,11 +52,14 @@ import com.romraider.logger.ecu.EcuLogger; import com.romraider.logger.ecu.comms.query.EcuQuery; -import com.romraider.util.SettingsManager; import com.romraider.logger.ecu.ui.swing.tools.tablemodels.ReadCodesTableModel; +import com.romraider.util.ResourceUtil; +import com.romraider.util.SettingsManager; public final class ReadCodesResultsPanel extends JPanel { private static final long serialVersionUID = -3180488605471088911L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + ReadCodesResultsPanel.class.getName()); private static final JPanel resultsPanel = new JPanel(); private static final String DT_FORMAT = "%1$tY%1$tm%1$td-%1$tH%1$tM%1$tS"; @@ -95,7 +101,7 @@ private ReadCodesResultsPanel(ArrayList dtcSet) { public final static void displayResultsPane( EcuLogger logger, ArrayList dtcSet) { - final JDialog frame = new JDialog(logger, "Diagnostic Code Read Results"); + final JDialog frame = new JDialog(logger, rb.getString("READRESULTS")); frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS)); @@ -120,15 +126,15 @@ private final static JPanel createSaveReultsPanel( final ArrayList dtcSet) { final JPanel basePanel = new JPanel(new BorderLayout()); - basePanel.setBorder(BorderFactory.createTitledBorder("Save Results")); + basePanel.setBorder(BorderFactory.createTitledBorder( + rb.getString("SAVETITLE"))); final JLabel comment = new JLabel(); - comment.setText("Click table, press Ctrl-A then Ctrl-C to copy " + - "table to clipboard, or..."); + comment.setText(rb.getString("COPYTIP")); final JPanel controlPanel = new JPanel(); - final JButton toFile = new JButton("Save to File"); - toFile.setToolTipText("Save table to a text file"); + final JButton toFile = new JButton(rb.getString("SAVETOFILE")); + toFile.setToolTipText(rb.getString("SAVETOFILETT")); toFile.setMnemonic(KeyEvent.VK_F); toFile.addActionListener(new ActionListener() { @Override @@ -136,8 +142,8 @@ public final void actionPerformed(ActionEvent actionEvent) { saveTableText(dtcSet); } }); - final JButton toImage = new JButton("Save as Image"); - toImage.setToolTipText("Save table as an image"); + final JButton toImage = new JButton(rb.getString("SAVETOIMAGE")); + toImage.setToolTipText(rb.getString("SAVETOIMAGETT")); toImage.setMnemonic(KeyEvent.VK_I); toImage.addActionListener(new ActionListener() { @Override @@ -163,30 +169,35 @@ private static final void saveTableText(ArrayList dtcSet) { final String eol = System.getProperty("line.separator"); final BufferedWriter bw = new BufferedWriter( new FileWriter(csvFile)); - bw.write("Diagnostic Code Name,Temporary,Memorized" + eol); + bw.write(rb.getString("TABLEHEADER") + eol); double result = 0; for (EcuQuery query : dtcSet) { result = query.getResponse(); - String tmp = "false"; - String mem = "false"; - if (result == 1 || result == 3) tmp = "true"; - if (result == 2 || result == 3) mem = "true"; - bw.append(query.getLoggerData().getName() + "," + - tmp + "," + - mem + eol); + String tmp = rb.getString("FALSE"); + String mem = rb.getString("FALSE"); + if (result == 1 || result == 3) tmp = rb.getString("TRUE"); + if (result == 2 || result == 3) mem = rb.getString("TRUE"); + bw.append(query.getLoggerData().getName()); + bw.append(COMMA); + bw.append(tmp); + bw.append(COMMA); + bw.append(mem); + bw.append(eol); } bw.close(); showMessageDialog( null, - "Table text saved to: " + fileName, - "Save Success", + MessageFormat.format( + rb.getString("TABLESAVED"), fileName), + rb.getString("SUCCESS"), INFORMATION_MESSAGE); } catch (Exception e) { showMessageDialog( null, - "Failed to save table, check path:\n" + fileName, - "Save Failed", + MessageFormat.format( + rb.getString("TABLEFAILED"), fileName), + rb.getString("FAILED"), ERROR_MESSAGE); } } @@ -210,15 +221,17 @@ private static final void saveTableImage() { imageFile); showMessageDialog( null, - "Table image saved to: " + fileName, - "Save Success", + MessageFormat.format( + rb.getString("IMAGESAVED"), fileName), + rb.getString("SUCCESS"), INFORMATION_MESSAGE); } catch (Exception e) { showMessageDialog( null, - "Failed to save image, check path:\n" + fileName, - "Save Failed", + MessageFormat.format( + rb.getString("IMAGEFAILED"), fileName), + rb.getString("FAILED"), ERROR_MESSAGE); } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/SSMLearningTableValuesResultsPanel.java b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/SSMLearningTableValuesResultsPanel.java new file mode 100644 index 000000000..0be127fe3 --- /dev/null +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/SSMLearningTableValuesResultsPanel.java @@ -0,0 +1,439 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.ui.swing.tools; + +import static com.romraider.Settings.COMMA; +import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.INFORMATION_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; + +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.text.MessageFormat; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; + +import javax.imageio.ImageIO; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.border.EmptyBorder; +import javax.swing.border.EtchedBorder; +import javax.swing.border.TitledBorder; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumn; + +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.AirFuelLearningTableModel; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.FineLearningKnockCorrectionTableModel; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.VehicleInformationTableModel; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.renderers.CentreRenderer; +import com.romraider.logger.ecu.ui.swing.tools.tablemodels.renderers.LtvCellRenderer; +import com.romraider.logger.ecu.ui.swing.vertical.VerticalLabelUI; +import com.romraider.swing.SetFont; +import com.romraider.util.FormatFilename; +import com.romraider.util.ResourceUtil; +import com.romraider.util.SettingsManager; + +/** + * This class is used to build and display the Learning Table Values + * retrieved from the ECU. + */ +public class SSMLearningTableValuesResultsPanel extends JDialog { + private static final long serialVersionUID = 6716454297236022709L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + SSMLearningTableValuesResultsPanel.class.getName()); + private final String DIALOG_TITLE = rb.getString("DIALOGTITLE"); + private final String DT_FORMAT = "%1$tY%1$tm%1$td-%1$tH%1$tM%1$tS"; + private final int LTV_WIDTH = 720; + private final int LTV_HEIGHT = 450; + private final JPanel contentPanel = new JPanel(); + private JTable vehicleInfoTable; + private JTable afLearningTable; + private JTable flkcTable; + private final String FLKC_NAME = rb.getString("FLKCNAME"); + + public SSMLearningTableValuesResultsPanel( + EcuLogger logger, + Map vehicleInfo, + String[] afRanges, + List> afLearning, + String[] flkcLoad, + String[] flkcRpm, + List> flkcData) { + + super(logger, false); + setIconImage(logger.getIconImage()); + setTitle(DIALOG_TITLE); + setBounds( + (logger.getWidth() > LTV_WIDTH) ? + logger.getX() + (logger.getWidth() - LTV_WIDTH) / 2 : 0, + (logger.getHeight() > LTV_HEIGHT) ? + logger.getY() + ((logger.getHeight() - LTV_HEIGHT) / 2) : 0, + LTV_WIDTH, + LTV_HEIGHT); + getContentPane().setLayout(new BorderLayout()); + + contentPanel.setBorder(new EmptyBorder(2, 2, 2, 2)); + contentPanel.setLayout(null); + contentPanel.add(buildVehicleInfoPanel(vehicleInfo)); + contentPanel.add(buildAfLearningPanel(afRanges, afLearning)); + contentPanel.add(buildFlkcPanel(flkcLoad, flkcRpm, flkcData)); + + getContentPane().add(contentPanel, BorderLayout.CENTER); + getContentPane().add(buildSaveReultsPanel(), BorderLayout.SOUTH); + } + + /** + * This method is called to display the Learning Table Values + * retrieved from the ECU. + */ + public final void displayLearningResultsPanel() { + setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + setVisible(true); + } + + private final JPanel buildVehicleInfoPanel( + Map vehicleInfo) { + + final JPanel vehicleInfoTitlePanel = new JPanel(); + vehicleInfoTitlePanel.setBorder( + BorderFactory.createTitledBorder(rb.getString("VITITLE"))); + vehicleInfoTitlePanel.setBounds(10, 2, 692, 70); + vehicleInfoTitlePanel.setLayout(new BorderLayout(0, 0)); + + JPanel vehicleInfoTablePanel = new JPanel(); + vehicleInfoTablePanel.setBorder( + new EtchedBorder(EtchedBorder.LOWERED, null, null)); + vehicleInfoTablePanel.setLayout(new BorderLayout(0, 0)); + + final VehicleInformationTableModel tableModel = + new VehicleInformationTableModel(); + tableModel.setVehicleInfo(vehicleInfo); + vehicleInfoTable = new JTable(tableModel); + setTableBehaviour(vehicleInfoTable); + + TableColumn column = null; + for (int i = 0; i < vehicleInfoTable.getColumnCount(); i++) { + column = vehicleInfoTable.getColumnModel().getColumn(i); + if (i == 0 || i ==1) { + column.setPreferredWidth(85); + } + else if (i == 2) { + column.setPreferredWidth(200); + } + } + + vehicleInfoTablePanel.add( + formatTableHeader(vehicleInfoTable), + BorderLayout.PAGE_START); + vehicleInfoTablePanel.add(vehicleInfoTable); + + vehicleInfoTitlePanel.add(vehicleInfoTablePanel, BorderLayout.CENTER); + return vehicleInfoTitlePanel; + } + + private final JPanel buildAfLearningPanel( + String[] afRanges, + List> afLearning) { + + final JPanel afLearningTitlePanel = new JPanel(); + afLearningTitlePanel.setBorder( + new TitledBorder(null, + rb.getString("AFLEARNING"), + TitledBorder.LEADING, + TitledBorder.TOP, null, null)); + afLearningTitlePanel.setBounds(10, 72, 450, 100); + afLearningTitlePanel.setLayout(new BorderLayout(0, 0)); + + final JLabel xLabel = new JLabel(rb.getString("AFRANGES")); + SetFont.plain(xLabel); + xLabel.setHorizontalAlignment(SwingConstants.CENTER); + afLearningTitlePanel.add(xLabel, BorderLayout.NORTH); + + final JLabel yLabel = new JLabel(rb.getString("BANK")); + SetFont.plain(yLabel); + yLabel.setUI(new VerticalLabelUI(false)); + afLearningTitlePanel.add(yLabel, BorderLayout.WEST); + + final JPanel afLearningTablePanel = new JPanel(); + afLearningTablePanel.setBorder( + new EtchedBorder(EtchedBorder.LOWERED, null, null)); + afLearningTablePanel.setLayout(new BorderLayout(0, 0)); + + final AirFuelLearningTableModel tableModel = + new AirFuelLearningTableModel(); + tableModel.setColumnHeadings(afRanges); + tableModel.setAfLearningInfo(afLearning); + afLearningTable = new JTable(tableModel); + setTableBehaviour(afLearningTable); + + TableColumn column = null; + for (int i = 0; i < afLearningTable.getColumnCount(); i++) { + column = afLearningTable.getColumnModel().getColumn(i); + if (i == 0) { + column.setPreferredWidth(40); + } + else { + column.setPreferredWidth(120); + } + } + + afLearningTablePanel.add( + formatTableHeader(afLearningTable), + BorderLayout.PAGE_START); + if (afLearning.size() > 0) { + afLearningTablePanel.add(afLearningTable); + } + else { + afLearningTablePanel.add(new JLabel( + rb.getString("AFNODATA"))); + } + + afLearningTitlePanel.add(afLearningTablePanel, BorderLayout.CENTER); + return afLearningTitlePanel; + } + + private final JPanel buildFlkcPanel( + String[] flkcLoad, + String[] flkcRpm, + List> flkcData) { + + final JPanel flkcTitlePanel = new JPanel(); + flkcTitlePanel.setBorder( + new TitledBorder(null, + FLKC_NAME, + TitledBorder.LEADING, + TitledBorder.TOP, null, null)); + flkcTitlePanel.setBounds(10, 172, 692, 204); + flkcTitlePanel.setLayout(new BorderLayout(0, 0)); + + final JLabel xLabel = new JLabel(rb.getString("ENGINELOAD")); + SetFont.plain(xLabel); + xLabel.setHorizontalAlignment(SwingConstants.CENTER); + flkcTitlePanel.add(xLabel, BorderLayout.NORTH); + + final JLabel yLabel = new JLabel(rb.getString("ENGINESPEED")); + SetFont.plain(yLabel); + yLabel.setUI(new VerticalLabelUI(false)); + flkcTitlePanel.add(yLabel, BorderLayout.WEST); + + final JPanel flkcTablePanel = new JPanel(); + flkcTablePanel.setBorder( + new EtchedBorder(EtchedBorder.LOWERED, null, null)); + flkcTablePanel.setLayout(new BorderLayout(0, 0)); + + final FineLearningKnockCorrectionTableModel tableModel = + new FineLearningKnockCorrectionTableModel(); + tableModel.setColumnHeadings(flkcLoad); + tableModel.setRomHeadings(flkcRpm); + tableModel.setFlkcData(flkcData); + flkcTable = new JTable(tableModel); + setTableBehaviour(flkcTable); + flkcTablePanel.add( + formatTableHeader(flkcTable), + BorderLayout.PAGE_START); + if (flkcData.size() > 0) { + flkcTablePanel.add(flkcTable); + } + else { + flkcTablePanel.add(new JLabel( + rb.getString("FLKCNODATA"))); + } + + flkcTitlePanel.add(flkcTablePanel, BorderLayout.CENTER); + return flkcTitlePanel; + } + + private final void setTableBehaviour(JTable table) { + table.setBorder(null); + table.setColumnSelectionAllowed(false); + table.setRowSelectionAllowed(false); + table.setFont(new Font("Tahoma", Font.PLAIN, 11)); + table.setFillsViewportHeight(true); + table.setDefaultRenderer(Double.class, new LtvCellRenderer()); + table.setDefaultRenderer(String.class, new LtvCellRenderer()); + } + + private final JTableHeader formatTableHeader(JTable table) { + final JTableHeader th = table.getTableHeader(); + th.setReorderingAllowed(false); + th.setDefaultRenderer(new CentreRenderer(table)); + SetFont.bold(th, 11); + return th; + } + + private final JPanel buildSaveReultsPanel() { + + final JPanel controlPanel = new JPanel(); + final JButton toFile = new JButton(rb.getString("SAVETOFILE")); + toFile.setToolTipText(rb.getString("SAVETOFILETT")); + toFile.setMnemonic(KeyEvent.VK_F); + toFile.addActionListener(new ActionListener() { + @Override + public final void actionPerformed(ActionEvent actionEvent) { + saveTableText(); + } + }); + final JButton toImage = new JButton(rb.getString("SAVETOIMAGE")); + toImage.setToolTipText(rb.getString("SAVETOIMAGETT")); + toImage.setMnemonic(KeyEvent.VK_I); + toImage.addActionListener(new ActionListener() { + @Override + public final void actionPerformed(ActionEvent actionEvent) { + saveTableImage(); + } + }); + controlPanel.add(toFile); + controlPanel.add(toImage); + return controlPanel; + } + + private final void saveTableText() { + final String nowStr = String.format(DT_FORMAT, System.currentTimeMillis()); + final String fileName = String.format("%s%sromraiderLTV_%s.csv", + SettingsManager.getSettings().getLoggerOutputDirPath(), + File.separator, + nowStr); + try { + final File csvFile = new File(fileName); + final String EOL = System.getProperty("line.separator"); + final BufferedWriter bw = new BufferedWriter( + new FileWriter(csvFile)); + bw.write(rb.getString("DIALOGTITLE") + EOL); + Object result = 0; + int columnCount = vehicleInfoTable.getColumnCount(); + for (int i = 0; i < columnCount; i++ ) { + result = vehicleInfoTable.getTableHeader().getColumnModel(). + getColumn(i).getHeaderValue(); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL); + for (int i = 0; i < columnCount; i++ ) { + result = vehicleInfoTable.getValueAt(0, i); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL + EOL); + bw.write(rb.getString("AFLEARNING") + EOL); + columnCount = afLearningTable.getColumnCount(); + int rowCount = afLearningTable.getRowCount(); + for (int i = 0; i < columnCount; i++) { + result = afLearningTable.getTableHeader().getColumnModel(). + getColumn(i).getHeaderValue(); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL); + for (int i = 0; i < rowCount; i++) { + for (int j = 0; j < columnCount; j++) { + result = afLearningTable.getValueAt(i, j); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL); + } + bw.append(EOL); + bw.write(FLKC_NAME + EOL); + columnCount = flkcTable.getColumnCount(); + rowCount = flkcTable.getRowCount(); + for (int i = 0; i < columnCount; i++) { + result = flkcTable.getTableHeader().getColumnModel(). + getColumn(i).getHeaderValue(); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL); + for (int i = 0; i < rowCount; i++) { + for (int j = 0; j < columnCount; j++) { + result = flkcTable.getValueAt(i, j); + bw.append(result.toString()); + bw.append(COMMA); + } + bw.append(EOL); + } + bw.close(); + final String shortName = FormatFilename.getShortName(fileName); + showMessageDialog( + null, + MessageFormat.format( + rb.getString("TABLESAVED"), shortName), + rb.getString("SUCCESS"), + INFORMATION_MESSAGE); + } + catch (Exception e) { + showMessageDialog( + null, + MessageFormat.format( + rb.getString("TABLEFAILED"), fileName), + rb.getString("FAILED"), + ERROR_MESSAGE); + } + } + + private final void saveTableImage() { + final BufferedImage resultsImage = new BufferedImage( + contentPanel.getWidth(), + contentPanel.getHeight(), + BufferedImage.TYPE_INT_ARGB); + contentPanel.paint(resultsImage.createGraphics()); + final String nowStr = String.format(DT_FORMAT, System.currentTimeMillis()); + final String fileName = String.format("%s%sromraiderLTV_%s.png", + SettingsManager.getSettings().getLoggerOutputDirPath(), + File.separator, + nowStr); + final String shortName = FormatFilename.getShortName(fileName); + try { + final File imageFile = new File(fileName); + ImageIO.write( + resultsImage, + "png", + imageFile); + showMessageDialog( + null, + MessageFormat.format( + rb.getString("IMAGESAVED"), shortName), + rb.getString("SUCCESS"), + INFORMATION_MESSAGE); + } + catch (Exception e) { + showMessageDialog( + null, + MessageFormat.format( + rb.getString("IMAGEFAILED"), fileName), + rb.getString("FAILED"), + ERROR_MESSAGE); + } + } +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/tablemodels/ReadCodesTableModel.java b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/tablemodels/ReadCodesTableModel.java index 14018a144..af768bcc2 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/tablemodels/ReadCodesTableModel.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/tablemodels/ReadCodesTableModel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,13 +20,17 @@ package com.romraider.logger.ecu.ui.swing.tools.tablemodels; import java.util.ArrayList; +import java.util.ResourceBundle; import javax.swing.table.DefaultTableModel; import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.util.ResourceUtil; public final class ReadCodesTableModel extends DefaultTableModel { private static final long serialVersionUID = -4229633011594395331L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + ReadCodesTableModel.class.getName()); private ArrayList dtcSet; public final int getColumnCount() { @@ -35,9 +39,9 @@ public final int getColumnCount() { public final String getColumnName(int column) { switch (column) { - case 0: return "Diagnostic Code Name"; - case 1: return "Temporary"; - case 2: return "Memorized"; + case 0: return rb.getString("DTCNAME"); + case 1: return rb.getString("TEMPORARY"); + case 2: return rb.getString("MEMORIZED"); default: return ""; } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/tablemodels/renderers/LtvCellRenderer.java b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/tablemodels/renderers/LtvCellRenderer.java index 038d8dadb..d08ef15e9 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/tools/tablemodels/renderers/LtvCellRenderer.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/tools/tablemodels/renderers/LtvCellRenderer.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/vertical/VerticalLabelUI.java b/src/main/java/com/romraider/logger/ecu/ui/swing/vertical/VerticalLabelUI.java index 3438aa915..5495042c1 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/vertical/VerticalLabelUI.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/vertical/VerticalLabelUI.java @@ -43,7 +43,6 @@ public final class VerticalLabelUI extends BasicLabelUI { } public VerticalLabelUI(boolean clockwise) { - super(); this.clockwise = clockwise; } diff --git a/src/main/java/com/romraider/logger/ecu/ui/tab/TableFinder.java b/src/main/java/com/romraider/logger/ecu/ui/tab/TableFinder.java index 96467f454..048f0a193 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/tab/TableFinder.java +++ b/src/main/java/com/romraider/logger/ecu/ui/tab/TableFinder.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,13 +21,21 @@ import com.romraider.maps.Rom; import com.romraider.maps.Table; +import com.romraider.util.ResourceUtil; + +import java.text.MessageFormat; import java.util.List; +import java.util.ResourceBundle; public final class TableFinder { + private static final ResourceBundle rb = new ResourceUtil().getBundle( + TableFinder.class.getName()); public static Table findTableStartsWith(Rom rom, String name) { List
tables = rom.findTables("^" + name + ".*$"); - if (tables.isEmpty()) throw new IllegalStateException("No table found for name: \"" + name + "\""); - if (tables.size() > 1) throw new IllegalStateException("Multiple tables found for name: \"" + name + "\""); + if (tables.isEmpty()) throw new IllegalStateException( + MessageFormat.format(rb.getString("NOTABLENAME"), name)); + if (tables.size() > 1) throw new IllegalStateException( + MessageFormat.format(rb.getString("MULTITABLENAME"), name)); return tables.get(0); } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/tab/XYTrendline.java b/src/main/java/com/romraider/logger/ecu/ui/tab/XYTrendline.java index 17538a5a8..2cd3a621d 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/tab/XYTrendline.java +++ b/src/main/java/com/romraider/logger/ecu/ui/tab/XYTrendline.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,13 +25,19 @@ import org.jfree.data.xy.AbstractXYDataset; import org.jfree.data.xy.XYDataItem; import org.jfree.data.xy.XYSeries; + +import com.romraider.util.ResourceUtil; + import java.lang.reflect.UndeclaredThrowableException; import java.util.ArrayList; import java.util.List; +import java.util.ResourceBundle; public final class XYTrendline extends AbstractXYDataset { private static final long serialVersionUID = 1375705537694372443L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + XYTrendline.class.getName()); private List items = new ArrayList(); private double[] xVals = new double[0]; private double[] yPoly = new double[0]; @@ -82,13 +88,15 @@ public synchronized void update(int order) { } public synchronized double[] calculate(double[] x) { - if (polyfit == null) throw new IllegalStateException("Interpolation required"); + if (polyfit == null) throw new IllegalStateException( + rb.getString("INTERPREQD")); Polyval polyval = new Polyval(x, polyfit); return polyval.getYout(); } public synchronized Polyfit getPolyFit() { - if (polyfit == null) throw new IllegalStateException("Interpolation required"); + if (polyfit == null) throw new IllegalStateException( + rb.getString("INTERPREQD")); return polyfit; } diff --git a/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoChartPanel.java b/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoChartPanel.java index 5e272766c..4e5940824 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoChartPanel.java +++ b/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoChartPanel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,10 +19,14 @@ package com.romraider.logger.ecu.ui.tab.dyno; +import static com.romraider.Settings.COMMA; + import com.romraider.logger.ecu.ui.handler.graph.SpringUtilities; import com.romraider.logger.ecu.ui.tab.CircleDrawer; import com.romraider.logger.ecu.ui.tab.XYTrendline; +import com.romraider.util.ResourceUtil; +import static com.romraider.Settings.SEMICOLON; import static com.romraider.util.ParamChecker.checkNotNull; import jamlab.Polyfit; import static java.awt.Color.BLACK; @@ -53,20 +57,24 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Font; +import java.text.MessageFormat; +import java.util.ResourceBundle; public final class DynoChartPanel extends JPanel { private static final long serialVersionUID = -6577979878171615665L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DynoChartPanel.class.getName()); private static final Color DARK_GREY = new Color(80, 80, 80); private static final Color LIGHT_GREY = new Color(110, 110, 110); - private static final String START_PROMPT = "Accelerate using WOT when ready!!"; - private static final String ET_PROMPT_I = "Accelerate for 1/4 mile when ready!!"; - private static final String ET_PROMPT_M = "Accelerate for 402 meters when ready!!"; - private final XYSeries data = new XYSeries("Raw HP"); // series for HorsePower/RPM - private final XYSeries data1 = new XYSeries("Raw TQ"); // series for Torque/RPM - private final XYSeries logRpm = new XYSeries("Logger RPM"); // series for raw sample time/RPM + private static final String START_PROMPT = rb.getString("STARTPROMPT"); + private static final String ET_PROMPT_I = rb.getString("ETPROMPTI"); + private static final String ET_PROMPT_M = rb.getString("ETPROMPTM"); + private final XYSeries data = new XYSeries("Raw HP"); // series for HorsePower/RPM + private final XYSeries data1 = new XYSeries("Raw TQ"); // series for Torque/RPM + private final XYSeries logRpm = new XYSeries("Logger RPM"); // series for raw sample time/RPM private final XYTrendline rpmTrend = new XYTrendline(logRpm); - private final XYSeries hpRef = new XYSeries("HP Ref"); // series for reference HP/RPM - private final XYSeries tqRef = new XYSeries("TQ Ref"); // series for reference TQ/RPM + private final XYSeries hpRef = new XYSeries("HP Ref"); // series for reference HP/RPM + private final XYSeries tqRef = new XYSeries("TQ Ref"); // series for reference TQ/RPM private final String labelX; private String labelY1 = null; private String labelY2 = null; @@ -80,9 +88,9 @@ public final class DynoChartPanel extends JPanel { private XYAnnotation bestHp; private XYAnnotation bestTq; private final XYPointerAnnotation hpPointer = new XYPointerAnnotation( - "Max HP", 1, 1, 3.0 * Math.PI / 6.0); + rb.getString("MAXHP"), 1, 1, 3.0 * Math.PI / 6.0); private final XYPointerAnnotation tqPointer = new XYPointerAnnotation( - "Max TQ", 1, 1, 3.0 * Math.PI / 6.0); + rb.getString("MAXTQ"), 1, 1, 3.0 * Math.PI / 6.0); private final XYTextAnnotation refStat = new XYTextAnnotation(" ", 0, 0); public DynoChartPanel(String labelX, String labelY1, String labelY2) { @@ -119,11 +127,13 @@ public synchronized void setRefTrace(double x, double y1, double y2) { public void updateRefTrace(String[] line) { if (hpRef.getItemCount() > 0) { - refStat.setText("Reference: " + line[2] + " (" + - String.format("%1.2f", Double.parseDouble(line[3])) + "; " + - String.format("%1.2f", Double.parseDouble(line[4])) + "; " + - String.format("%1.2f", Double.parseDouble(line[5])) + "; " + - String.format("%1.2f", Double.parseDouble(line[6])) + ")"); + refStat.setText(MessageFormat.format( + rb.getString("REFERENCE"), + line[2], + Double.parseDouble(line[3]), + Double.parseDouble(line[4]), + Double.parseDouble(line[5]), + Double.parseDouble(line[6]))); refStat.setX(plot.getDomainAxis().getLowerBound() + 10); refStat.setY(hpAxis.getUpperBound()); plot.addAnnotation(refStat); @@ -135,7 +145,7 @@ public int getPwrTqCount() { } public String getPwrTq(int x) { - String dataSet = data.getX(x) + "," + data.getY(x) + "," + data1.getY(x); + String dataSet = data.getX(x) + COMMA + data.getY(x) + COMMA + data1.getY(x); return dataSet; } @@ -245,22 +255,28 @@ public void interpolate(double[] results, String[] resultStrings) { } public void updateEtResults(String carInfo, double[] etResults, String units) { - String s60Text = "60 ft"; - String s330Text = "330 ft"; - String s660Text = "1/2 track"; - String s1000Text = "1,000 ft"; - String s1320Text = "1/4 mile"; - String zTo60Text = "60 mph"; + String s60Text = rb.getString("S60TEXTI"); + String s330Text = rb.getString("S330TEXTI"); + String s660Text = rb.getString("S660TEXTI"); + String s1000Text = rb.getString("S1000TEXTI"); + String s1320Text = rb.getString("S1320TEXTI"); + String zTo60Text = rb.getString("ZTO60TEXTI"); if (units.equalsIgnoreCase("km/h")) { - s60Text = "18.3m"; - s330Text = "100m"; - s1000Text = "305m"; - s1320Text = "402m"; - zTo60Text = "97 km/h"; + s60Text = rb.getString("S60TEXTM"); + s330Text = rb.getString("S330TEXTM"); + s1000Text = rb.getString("S1000TEXTM"); + s1320Text = rb.getString("S1320TEXTM"); + zTo60Text = rb.getString("ZTO60TEXTM"); } - hpAxis.setLabel("Vehicle Speed (" + units + ")"); - String[] car = carInfo.split(";"); - car[0] = "LANE 1: " + car[0].substring(0, car[0].length() - 3) + " - ET: " + String.format("%1.3f", etResults[8]) + "\" / " + String.format("%1.2f", etResults[9]) + " " + units; + hpAxis.setLabel(MessageFormat.format( + rb.getString("HPAXISLBL"), units)); + String[] car = carInfo.split(SEMICOLON); + car[0] = MessageFormat.format( + rb.getString("CARTEXT"), + car[0].substring(0, car[0].length() - 3), + etResults[8], + etResults[9], + units); double ySpace = hpAxis.getUpperBound() / 25; double xMin = ((plot.getDomainAxis().getUpperBound() - plot.getDomainAxis().getLowerBound()) / 7) + plot.getDomainAxis().getLowerBound(); tqAxis.setRange(hpAxis.getLowerBound(), hpAxis.getUpperBound()); @@ -405,16 +421,16 @@ private void configurePlot(JFreeChart chart) { public void setET() { clear(); - plot.getDomainAxis().setLabel("Time (seconds)"); - hpAxis.setLabel("Vehicle Speed"); + plot.getDomainAxis().setLabel(rb.getString("ETXAXISLBL")); + hpAxis.setLabel(rb.getString("ETHPAXISLBL")); tqAxis.setLabel(" "); } public void setDyno() { clear(); - plot.getDomainAxis().setLabel("Engine Speed (RPM)"); - hpAxis.setLabel("Calculated Wheel Power"); - tqAxis.setLabel("Calculated Engine Torque"); + plot.getDomainAxis().setLabel(rb.getString("DYNOXAXISLBL")); + hpAxis.setLabel(rb.getString("DYNOHPAXISLBL")); + tqAxis.setLabel(rb.getString("DYNOTQAXISLBL")); } public void startPrompt(String select) { diff --git a/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoControlPanel.java b/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoControlPanel.java index d02c95c17..f9b1b08ec 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoControlPanel.java +++ b/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoControlPanel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,8 @@ package com.romraider.logger.ecu.ui.tab.dyno; +import static com.romraider.Settings.COMMA; +import static com.romraider.Settings.SEMICOLON; import static com.romraider.Version.CARS_DEFS_URL; import static com.romraider.logger.car.util.SpeedCalculator.calculateMph; import static com.romraider.logger.car.util.SpeedCalculator.calculateRpm; @@ -40,6 +42,7 @@ import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -47,10 +50,12 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.text.DecimalFormat; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - +import java.util.ResourceBundle; import javax.swing.ButtonGroup; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; @@ -58,6 +63,7 @@ import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JFileChooser; +import javax.swing.JFormattedTextField; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; @@ -85,43 +91,31 @@ import com.romraider.logger.ecu.definition.LoggerData; import com.romraider.logger.ecu.ui.DataRegistrationBroker; import com.romraider.net.BrowserControl; +import com.romraider.swing.util.NumberVerifier; +import com.romraider.swing.util.SelectionVerifier; +import com.romraider.util.NumberUtil; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; public final class DynoControlPanel extends JPanel { private static final long serialVersionUID = 3787020251963102201L; private static final Logger LOGGER = Logger.getLogger(DynoControlPanel.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DynoControlPanel.class.getName()); private static final String CARS_FILE = "cars_def.xml"; - private static final String MISSING_CAR_DEF = "Missing cars_def.xml"; + private static final String MISSING_CAR_DEF = rb.getString("MISSING"); private static final String ENGINE_SPEED = "P8"; private static final String VEHICLE_SPEED = "P9"; private static final String IAT = "P11"; private static final String THROTTLE_ANGLE = "P13"; + private static final String THROTTLE_VOLTS = "P19"; private static final String ATM = "P24"; private static final String MANUAL = "manual"; private static final String IMPERIAL = "Imperial"; private static final String METRIC = "Metric"; private static final String DYNO_MODE = "Dyno"; private static final String ET_MODE = "ET"; - private static final String CAR_MASS_TT = "Base mass of car from factory"; - private static final String DELTA_MASS_TT = "Mass of all occupants and accessories added"; - private static final String HUMIDITY_TT = "Current relative Humidity"; - private static final String TIRE_WIDTH_TT = "Tire width in millimeters"; - private static final String TIRE_ASPECT_TT = "Tire aspect ratio in percentage"; - private static final String WHEEL_SIZE_TT = "Wheel (rim) size in inches"; - private static final String CAR_SELECT_TT = "Select car, default is first in list"; - private static final String GEAR_SELECT_TT = "Select gear, default is 2nd for 4AT, 3rd for 5MT and 4th for 6MT"; - private static final String RPM_MIN_TT = "RPM min is updated after WOT"; - private static final String RPM_MAX_TT = "RPM max is updated after WOT"; - private static final String ELEVATION_TT = "Elevation is calculated from ECU ATM sensor"; - private static final String AMB_TEMP_TT = "Ambient Temperature is updated from IAT sensor"; - private static final String ORDER_TT = "Lower number provides more smoothing"; - private static final String RESET_TT = "This clears all recorded or file loaded data"; - private static final String RECORD_TT = "Press to acquire data, multiple sets of Dyno data can be acquired"; - private static final String DYNO_TT = "Use this mode to estimate Power & Torque"; - private static final String ET_TT = "Use this mode to measure trap times"; private static final String COLON = ":"; - private static final String COMMA = ","; - private static final String SEMICOLON = ";"; private static final String TAB = "\u0009"; private static final String RR_LOG_TIME = "Time"; private static final String COBB_AP_TIME = "Seconds"; @@ -163,6 +157,7 @@ public final class DynoControlPanel extends JPanel { private double reFauc; private double auc; private double aucStart; + private double tpsMin; private long fTime; private long sTime; private long eTime; @@ -172,7 +167,7 @@ public final class DynoControlPanel extends JPanel { private boolean wotSet; private String path; private String carInfo; - private String[] carTypeArr; + private String[] carTypeArr = {MISSING_CAR_DEF}; private String[] carMassArr; private String[] dragCoeffArr; private String[] rollCoeffArr; @@ -200,10 +195,10 @@ public final class DynoControlPanel extends JPanel { private final JTextField tireWidth = new JTextField("0", 4); private final JTextField tireAspect = new JTextField("0", 4); private final JTextField tireSize = new JTextField("0", 4); - private final JLabel elevLabel = new JLabel("Elevation (ft)"); - private final JLabel tempLabel = new JLabel("Air Temperature (\u00b0F)"); - private final JLabel deltaMassLabel = new JLabel("Delta Weight (lbs)"); - private final JLabel carMassLabel = new JLabel("Base Weight (lbs)"); + private final JLabel elevLabel = new JLabel(rb.getString("ELEVATION_I")); + private final JLabel tempLabel = new JLabel(rb.getString("AIRTEMP_I")); + private final JLabel deltaMassLabel = new JLabel(rb.getString("DELTAWEIGHT_I")); + private final JLabel carMassLabel = new JLabel(rb.getString("BASEWEIGHT_I")); // private static final String SI = "SI"; private String units = IMPERIAL; private String preUnits = IMPERIAL; @@ -215,6 +210,7 @@ public final class DynoControlPanel extends JPanel { private String iatLogUnits = "F"; private String atmLogUnits = "psi"; private String vsLogUnits = LOG_VS_I; + private String throttle_param = THROTTLE_ANGLE; private final double[] results = new double[5]; private final String[] resultStrings = new String[6]; // private String hpUnits = "hp(I)"; @@ -231,14 +227,16 @@ public final class DynoControlPanel extends JPanel { private final JComboBox orderComboBox = buildPolyOrderComboBox(); private final JComboBox carSelectBox = buildCarSelectComboBox(); private final JComboBox gearSelectBox = buildGearComboBox(); - private final JButton interpolateButton = new JButton("Recalculate"); - private final JToggleButton recordDataButton = new JToggleButton("Record Data"); + private final JButton interpolateButton = new JButton(rb.getString("RECALC")); + private final JToggleButton recordDataButton = new JToggleButton(rb.getString("RECORD")); private final JToggleButton recordButton = buildRecordDataButton(); private final JRadioButton dButton = new JRadioButton(DYNO_MODE); private final JRadioButton eButton = new JRadioButton(ET_MODE); - private final JRadioButton iButton = new JRadioButton(IMPERIAL); - private final JRadioButton mButton = new JRadioButton(METRIC); - private final JCheckBox loadFileCB = new JCheckBox("Load From File"); + private final JRadioButton iButton = new JRadioButton(rb.getString("IMPERIAL")); + private final JRadioButton mButton = new JRadioButton(rb.getString("METRIC")); + private final JCheckBox loadFileCB = new JCheckBox(rb.getString("LOADFILE")); + private final JComboBox tpsComboBox = new JComboBox(new Object[]{"%", "VDC"}); + public DynoControlPanel(Component parent, DataRegistrationBroker broker, ECUEditor ecuEditor, DynoChartPanel chartPanel) { checkNotNull(parent, broker, chartPanel); @@ -247,7 +245,6 @@ public DynoControlPanel(Component parent, DataRegistrationBroker broker, ECUEdit this.chartPanel = chartPanel; addControls(); } - private void calculateEnv() { if (units.equals(IMPERIAL)) { altitude = parseDouble(elevation) * 0.3048; // feet to meters @@ -512,7 +509,8 @@ private void updateET() { public boolean isValidET(long now, double vs) { try { - // LOGGER.trace("lastET: " + lastET + " now: " + now + " VS: " + vs); + //if (LOGGER.isTraceEnabled()) + // LOGGER.trace("lastET: " + lastET + " now: " + now + " VS: " + vs); if (vs > 0) { if (vsLogUnits.equals(LOG_VS_M)) vs = (vs / KPH_2_MPH); distance = distance + (vs * 5280 / 3600 * (now - lastET) / 1000); @@ -534,12 +532,12 @@ public boolean isValidET(long now, double vs) { } public boolean isValidData(double rpm, double ta) { - if (wotSet && (ta < 99)) { + if (wotSet && (ta < tpsMin)) { recordDataButton.setSelected(false); rpmMax.setText(String.format("%1.0f", rpm)); deregister(); } else { - if (ta > 98) { + if (ta > tpsMin) { if (!wotSet) rpmMin.setText(String.format("%1.0f", rpm)); wotSet = true; return true; @@ -555,9 +553,9 @@ public boolean isManual() { private void deregister() { if (isManual()) { - deregisterData(ENGINE_SPEED, THROTTLE_ANGLE); + deregisterData(ENGINE_SPEED, throttle_param); } else { - deregisterData(VEHICLE_SPEED, THROTTLE_ANGLE); + deregisterData(VEHICLE_SPEED, throttle_param); } registerData(IAT, ATM); getEnv = true; @@ -591,7 +589,7 @@ private void add(JPanel panel, GridBagLayout gridBagLayout, JComponent component private JPanel buildRadioPanel() { // JPanel panel = new JPanel(); - unitsPanel.setBorder(new TitledBorder("Measurement Units")); + unitsPanel.setBorder(new TitledBorder(rb.getString("MEASUREMENT"))); GridBagLayout gridBagLayout = new GridBagLayout(); unitsPanel.setLayout(gridBagLayout); @@ -602,7 +600,7 @@ private JPanel buildRadioPanel() { private JPanel buildModePanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Mode")); + panel.setBorder(new TitledBorder(rb.getString("MODE"))); GridBagLayout gridBagLayout = new GridBagLayout(); panel.setLayout(gridBagLayout); @@ -612,19 +610,19 @@ private JPanel buildModePanel() { } private JPanel buildInterpolatePanel() { - iPanel.setBorder(new TitledBorder("Recalculate")); + iPanel.setBorder(new TitledBorder(rb.getString("RECALC"))); GridBagLayout gridBagLayout = new GridBagLayout(); iPanel.setLayout(gridBagLayout); - addLabeledComponent(iPanel, gridBagLayout, "Smoothing Factor", orderComboBox, 0); + addLabeledComponent(iPanel, gridBagLayout, rb.getString("SMOOTHFAC"), orderComboBox, 0); addComponent(iPanel, gridBagLayout, buildInterpolateButton(orderComboBox), 2); - addMinMaxFilter(iPanel, gridBagLayout, "RPM Range", rpmMin, rpmMax, 4); + addMinMaxFilter(iPanel, gridBagLayout, rb.getString("RPMRANGE"), rpmMin, rpmMax, 4); add(iPanel, gridBagLayout, elevLabel, 0, 6, 3, HORIZONTAL); add(iPanel, gridBagLayout, elevation, 1, 7, 0, NONE); add(iPanel, gridBagLayout, tempLabel, 0, 8, 3, HORIZONTAL); add(iPanel, gridBagLayout, ambTemp, 1, 9, 0, NONE); - addLabeledComponent(iPanel, gridBagLayout, "Rel Humidity (%)", relHumid, 10); + addLabeledComponent(iPanel, gridBagLayout, rb.getString("HUMIDITY"), relHumid, 10); setSelectAllFieldText(rpmMin); setSelectAllFieldText(rpmMax); setSelectAllFieldText(elevation); @@ -634,7 +632,7 @@ private JPanel buildInterpolatePanel() { } private JPanel buildReferencePanel() { - refPanel.setBorder(new TitledBorder("Reference Trace")); + refPanel.setBorder(new TitledBorder(rb.getString("REFTRACE"))); GridBagLayout gridBagLayout = new GridBagLayout(); refPanel.setLayout(gridBagLayout); @@ -646,12 +644,12 @@ private JPanel buildReferencePanel() { } private JPanel buildEtPanel() { - etPanel.setBorder(new TitledBorder("Elapsed Time")); + etPanel.setBorder(new TitledBorder(rb.getString("ELAPSEDTIME"))); etPanel.setVisible(false); GridBagLayout gridBagLayout = new GridBagLayout(); etPanel.setLayout(gridBagLayout); - addLabeledComponent(etPanel, gridBagLayout, "Select Car", carSelectBox, 0); + addLabeledComponent(etPanel, gridBagLayout, rb.getString("SELECTCAR"), carSelectBox, 0); addComponent(etPanel, gridBagLayout, recordButton, 2); add(etPanel, gridBagLayout, buildSaveReferenceButton(), 1, 3, 1, NONE); @@ -666,24 +664,25 @@ private void addLabeledComponent(JPanel panel, GridBagLayout gridBagLayout, Stri private JPanel buildFilterPanel() { changeCars(0); setToolTips(); - filterPanel.setBorder(new TitledBorder("Dyno Settings")); + filterPanel.setBorder(new TitledBorder(rb.getString("DYNOSETTINGS"))); GridBagLayout gridBagLayout = new GridBagLayout(); filterPanel.setLayout(gridBagLayout); - add(filterPanel, gridBagLayout, new JLabel("Wheel (Width/Aspect-Diam.)"), 0, 15, 3, HORIZONTAL); - add(filterPanel, gridBagLayout, tireWidth, 0, 16, 1, NONE); - add(filterPanel, gridBagLayout, tireAspect, 1, 16, 1, NONE); - add(filterPanel, gridBagLayout, tireSize, 2, 16, 1, NONE); - addLabeledComponent(filterPanel, gridBagLayout, "Select Car", carSelectBox, 18); - addLabeledComponent(filterPanel, gridBagLayout, "Select Gear", gearSelectBox, 21); - add(filterPanel, gridBagLayout, deltaMassLabel, 0, 24, 3, HORIZONTAL); - add(filterPanel, gridBagLayout, deltaMass, 1, 25, 1, NONE); - add(filterPanel, gridBagLayout, carMassLabel, 0, 27, 3, HORIZONTAL); - add(filterPanel, gridBagLayout, carMass, 1, 28, 1, NONE); - addComponent(filterPanel, gridBagLayout, recordButton, 31); - addComponent(filterPanel, gridBagLayout, buildLoadFileCB(), 32); - addComponent(filterPanel, gridBagLayout, buildResetButton(), 33); + addLabeledComponent(filterPanel, gridBagLayout, rb.getString("MINTHROTTLE"), buildMinTpsField(), 14); + add(filterPanel, gridBagLayout, new JLabel(rb.getString("WHEELDIM")), 0, 16, 3, HORIZONTAL); + add(filterPanel, gridBagLayout, tireWidth, 0, 17, 1, NONE); + add(filterPanel, gridBagLayout, tireAspect, 1, 17, 1, NONE); + add(filterPanel, gridBagLayout, tireSize, 2, 17, 1, NONE); + addLabeledComponent(filterPanel, gridBagLayout, rb.getString("SELECTCAR"), carSelectBox, 19); + addLabeledComponent(filterPanel, gridBagLayout, rb.getString("SELECTGEAR"), gearSelectBox, 22); + add(filterPanel, gridBagLayout, deltaMassLabel, 0, 25, 3, HORIZONTAL); + add(filterPanel, gridBagLayout, deltaMass, 1, 26, 1, NONE); + add(filterPanel, gridBagLayout, carMassLabel, 0, 28, 3, HORIZONTAL); + add(filterPanel, gridBagLayout, carMass, 1, 29, 1, NONE); + addComponent(filterPanel, gridBagLayout, recordButton, 32); + addComponent(filterPanel, gridBagLayout, buildLoadFileCB(), 33); + addComponent(filterPanel, gridBagLayout, buildResetButton(), 34); // addLabeledComponent(panel, gridBagLayout, "Drag Coeff", dragCoeff, 33); // addLabeledComponent(panel, gridBagLayout, "Frontal Area", frontalArea, 36); // addLabeledComponent(panel, gridBagLayout, "Rolling Resist Coeff", rollCoeff, 39); @@ -692,30 +691,31 @@ private JPanel buildFilterPanel() { setSelectAllFieldText(tireSize); setSelectAllFieldText(deltaMass); setSelectAllFieldText(carMass); + gearSelectBox.setSelectedItem(getSettings().getSelectedGear()); return filterPanel; } private void setToolTips() { - relHumid.setToolTipText(HUMIDITY_TT); - carMass.setToolTipText(CAR_MASS_TT); - deltaMass.setToolTipText(DELTA_MASS_TT); - tireWidth.setToolTipText(TIRE_WIDTH_TT); - tireAspect.setToolTipText(TIRE_ASPECT_TT); - tireSize.setToolTipText(WHEEL_SIZE_TT); - carSelectBox.setToolTipText(CAR_SELECT_TT); - gearSelectBox.setToolTipText(GEAR_SELECT_TT); - rpmMin.setToolTipText(RPM_MIN_TT); - rpmMax.setToolTipText(RPM_MAX_TT); - elevation.setToolTipText(ELEVATION_TT); - ambTemp.setToolTipText(AMB_TEMP_TT); - orderComboBox.setToolTipText(ORDER_TT); - recordDataButton.setToolTipText(RECORD_TT); - dButton.setToolTipText(DYNO_TT); - eButton.setToolTipText(ET_TT); + relHumid.setToolTipText(applyProperty("HUMIDITY_TT")); + carMass.setToolTipText(applyProperty("CAR_MASS_TT")); + deltaMass.setToolTipText(applyProperty("DELTA_MASS_TT")); + tireWidth.setToolTipText(applyProperty("TIRE_WIDTH_TT")); + tireAspect.setToolTipText(applyProperty("TIRE_ASPECT_TT")); + tireSize.setToolTipText(applyProperty("WHEEL_SIZE_TT")); + carSelectBox.setToolTipText(applyProperty("CAR_SELECT_TT")); + gearSelectBox.setToolTipText(applyProperty("GEAR_SELECT_TT")); + rpmMin.setToolTipText(applyProperty("RPM_MIN_TT")); + rpmMax.setToolTipText(applyProperty("RPM_MAX_TT")); + elevation.setToolTipText(applyProperty("ELEVATION_TT")); + ambTemp.setToolTipText(applyProperty("AMB_TEMP_TT")); + orderComboBox.setToolTipText(applyProperty("ORDER_TT")); + recordDataButton.setToolTipText(applyProperty("RECORD_TT")); + dButton.setToolTipText(applyProperty("DYNO_TT")); + eButton.setToolTipText(applyProperty("ET_TT")); } private JButton buildResetButton() { - JButton resetButton = new JButton("Clear Data"); + JButton resetButton = new JButton(rb.getString("CLEARDATA")); resetButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -723,7 +723,7 @@ public void actionPerformed(ActionEvent actionEvent) { parent.repaint(); } }); - resetButton.setToolTipText(RESET_TT); + resetButton.setToolTipText(applyProperty("RESET_TT")); return resetButton; } @@ -738,21 +738,23 @@ public void actionPerformed(ActionEvent actionEvent) { loadFromFile(); } else { if (recordDataButton.isSelected()) { + System.out.println(tpsMin); + tpsComboBox.setSelectedItem(tpsComboBox.getSelectedItem()); chartPanel.clearGraph(); parent.repaint(); calculateEnv(); if (isManual()) { - registerData(ENGINE_SPEED, THROTTLE_ANGLE); + registerData(ENGINE_SPEED, throttle_param); } else { - registerData(VEHICLE_SPEED, THROTTLE_ANGLE); + registerData(VEHICLE_SPEED, throttle_param); } chartPanel.startPrompt("wot"); } else { recordDataButton.setSelected(false); if (isManual()) { - deregisterData(ENGINE_SPEED, THROTTLE_ANGLE); + deregisterData(ENGINE_SPEED, throttle_param); } else { - deregisterData(VEHICLE_SPEED, THROTTLE_ANGLE); + deregisterData(VEHICLE_SPEED, throttle_param); } chartPanel.clearPrompt(); } @@ -786,9 +788,9 @@ private JCheckBox buildLoadFileCB() { @Override public void actionPerformed(ActionEvent actionEvent) { if (loadFileCB.isSelected()) { - recordDataButton.setText("Read From File"); + recordDataButton.setText(rb.getString("READFF")); } else { - recordDataButton.setText("Record Data"); + recordDataButton.setText(rb.getString("RECORD")); } } @@ -808,11 +810,12 @@ private void buildModeButtons(JPanel panel) { dButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { + loadFileCB.setEnabled(true); chartPanel.setDyno(); if (loadFileCB.isSelected()) { - recordDataButton.setText("Load From File"); + recordDataButton.setText(rb.getString("LOADFF")); } else { - recordDataButton.setText("Record Data"); + recordDataButton.setText(rb.getString("RECORD")); } // etPanel.setVisible(false); // filterPanel.setVisible(true); @@ -827,8 +830,10 @@ public void actionPerformed(ActionEvent actionEvent) { eButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { + loadFileCB.setEnabled(false); + loadFileCB.setSelected(false); chartPanel.setET(); - recordDataButton.setText("Record ET"); + recordDataButton.setText(rb.getString("RECORDET")); // filterPanel.setVisible(false); unitsPanel.setVisible(false); iPanel.setVisible(false); @@ -911,10 +916,10 @@ private void buttonAction(JRadioButton button) { preUnits = IMPERIAL; elevUnits = "ft"; tempUnits = "\u00b0F"; - elevLabel.setText("Elevation (ft)"); - tempLabel.setText("Air Temperature (\u00b0F)"); - deltaMassLabel.setText("Delta Weight (lbs)"); - carMassLabel.setText("Base Weight (lbs)"); + elevLabel.setText(rb.getString("ELEVATION_I")); + tempLabel.setText(rb.getString("AIRTEMP_I")); + deltaMassLabel.setText(rb.getString("DELTAWEIGHT_I")); + carMassLabel.setText(rb.getString("BASEWEIGHT_I")); pressText = String.format("%1.2f", atm); pressUnits = "psi"; } @@ -937,10 +942,10 @@ private void buttonAction(JRadioButton button) { preUnits = METRIC; elevUnits = "m"; tempUnits = "\u00b0C"; - elevLabel.setText("Elevation (m)"); - tempLabel.setText("Air Temperature (\u00b0C)"); - deltaMassLabel.setText("Delta Weight (kg)"); - carMassLabel.setText("Base Weight (kg)"); + elevLabel.setText(rb.getString("ELEVATION_M")); + tempLabel.setText(rb.getString("AIRTEMP_M")); + deltaMassLabel.setText(rb.getString("DELTAWEIGHT_M")); + carMassLabel.setText(rb.getString("BASEWEIGHT_M")); pressText = String.format("%1.2f", atm); pressUnits = "kPa"; } @@ -950,7 +955,8 @@ private void buttonAction(JRadioButton button) { // ambTemp.setText(String.format("%1.1f", result)); // result = parseDouble(carMass) * 0.4536; // carMass.setText(String.format("%1.0f", result)); - // LOGGER.trace("units selcted: " + units + " result: " + result); + // if (LOGGER.isTraceEnabled()) + // LOGGER.trace("units selcted: " + units + " result: " + result); // result = parseDouble(deltaMass) * 0.4536; // deltaMass.setText(String.format("%1.0f", result)); // result = parseDouble(elevation) * 0.3048; @@ -1000,18 +1006,18 @@ private void loadFromFile() { int taCol = 0; double minRpm = 3500; double maxRpm = 0; - String delimiter = COMMA; + String delimiter = SEMICOLON; String line = inputStream.readLine(); String[] headers; - headers = line.split(COMMA); + headers = line.split(SEMICOLON); if (headers.length < 3) { headers = line.split(TAB); if (headers.length > 2) { delimiter = TAB; } else { - headers = line.split(SEMICOLON); - if (headers.length > 2) delimiter = SEMICOLON; + headers = line.split(COMMA); + if (headers.length > 2) delimiter = COMMA; } } for (int x = 0; x < headers.length; x++) { @@ -1033,22 +1039,30 @@ private void loadFromFile() { if (headers[x].contains(LOG_VS_I)) vsLogUnits = LOG_VS_I; if (headers[x].contains(LOG_VS_M)) vsLogUnits = LOG_VS_M; } - LOGGER.trace("DYNO log file conversions: Time Column: " + timeCol + "; Time X: " + timeMult + + if (LOGGER.isTraceEnabled()) + LOGGER.trace("DYNO log file conversions: Time Column: " + timeCol + "; Time X: " + timeMult + "; RPM Column: " + rpmCol + "; TA Column: " + taCol + "; VS Column: " + vsCol + "; VS units: " + vsLogUnits); while ((line = inputStream.readLine()) != null) { + + //Convert everything to . notation String[] values = line.split(delimiter); - if (Double.parseDouble(values[taCol]) > 98) { + + for(int i=0; i < values.length;i++) { + values[i] = values[i].replace(',', '.'); + } + + if (Double.parseDouble(values[taCol]) > tpsMin) { double logTime = 0; if (atrTime) { String[] timeStamp = values[timeCol].split(COLON); if (timeStamp.length == 3) { - logTime = ((Double.parseDouble(timeStamp[0]) * 3600) + + logTime = (Double.parseDouble(timeStamp[0]) * 3600) + (Double.parseDouble(timeStamp[1]) * 60) + - Double.parseDouble(timeStamp[2])) * timeMult; + Double.parseDouble(timeStamp[2]) * timeMult; } else { - logTime = ((Double.parseDouble(timeStamp[0]) * 60) + - Double.parseDouble(timeStamp[1])) * timeMult; + logTime = (Double.parseDouble(timeStamp[0]) * 60) + + Double.parseDouble(timeStamp[1]) * timeMult; } } else { logTime = Double.parseDouble(values[timeCol]) * timeMult; @@ -1066,7 +1080,8 @@ private void loadFromFile() { maxRpm = Math.max(maxRpm, calculateRpm(logRpm, rpm2mph, vsLogUnits)); } chartPanel.addRawData(logTime, logRpm); - LOGGER.trace("DYNO log file time: " + logTime + "; speed: " + logRpm); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("DYNO log file time: " + logTime + "; speed: " + logRpm); } } inputStream.close(); @@ -1075,6 +1090,9 @@ private void loadFromFile() { interpolateButton.doClick(); } catch (IOException e) { + e.printStackTrace(); + } + finally { if (inputStream != null) { try { inputStream.close(); @@ -1089,13 +1107,13 @@ private void loadFromFile() { } private JButton buildOpenReferenceButton() { - final JFileChooser openFile = new JFileChooser(); - if (path != null) openFile.setCurrentDirectory(new File(path)); - final JButton openButton = new JButton("Open"); + final JButton openButton = new JButton(rb.getString("OPEN")); openButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { + final JFileChooser openFile = new JFileChooser(); + if (path != null) openFile.setCurrentDirectory(new File(path)); int returnVal = openFile.showOpenDialog(openButton); if (returnVal == JFileChooser.APPROVE_OPTION) { @@ -1150,13 +1168,14 @@ public void actionPerformed(ActionEvent actionEvent) { } private JButton buildSaveReferenceButton() { - final JFileChooser openFile = new JFileChooser(); - if (path != null) openFile.setCurrentDirectory(new File(path)); - final JButton saveButton = new JButton("Save"); + final JButton saveButton = new JButton(rb.getString("SAVE")); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { + final JFileChooser openFile = new JFileChooser(); + if (path != null) openFile.setCurrentDirectory(new File(path)); + int returnVal = openFile.showSaveDialog(saveButton); if (returnVal == JFileChooser.APPROVE_OPTION) { @@ -1223,7 +1242,7 @@ public void actionPerformed(ActionEvent actionEvent) { } private JButton buildClearReferenceButton() { - final JButton clearButton = new JButton("Clear"); + final JButton clearButton = new JButton(rb.getString("CLEAR")); clearButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -1241,12 +1260,17 @@ public void actionPerformed(ActionEvent actionEvent) { private void registerData(String... ids) { for (String id : ids) { LoggerData data = findData(id); + if (data == null) { + final String msg = MessageFormat.format( + rb.getString("MISSINGID"), id); + notifyError(msg); + } EcuDataConvertor convertor = data.getSelectedConvertor(); String convertorUnits = convertor.getUnits(); if (id.equals(ATM)) atmLogUnits = convertorUnits; if (id.equals(IAT)) iatLogUnits = convertorUnits; if (id.equals(VEHICLE_SPEED)) vsLogUnits = convertorUnits; - if (data != null) broker.registerLoggerDataForLogging(data); + broker.registerLoggerDataForLogging(data); } } @@ -1257,6 +1281,12 @@ private void deregisterData(String... ids) { } } + /** + * Find the LoggerData item from the parameter ID string in the currently + * loaded parameter list. + * @param id - String of the parameter to find + * @return LoggerData item or null if ID is not found + */ private LoggerData findData(String id) { for (EcuParameter param : params) { if (id.equals(param.getId())) return param; @@ -1309,7 +1339,7 @@ public void actionPerformed(ActionEvent actionEvent) { calculateEnv(); updateChart(); } else { - showMessageDialog(parent, "Invalid PRM range specified.", "Error", ERROR_MESSAGE); + notifyError(rb.getString("INVALIDRPM")); } } } @@ -1323,6 +1353,73 @@ private JComboBox buildPolyOrderComboBox() { return orderComboBox; } + private JPanel buildMinTpsField() { + final JPanel tpsPanel = new JPanel(); + final JTextField minTpsField = new JFormattedTextField(new DecimalFormat("#.##")); + minTpsField.setText("0"); + minTpsField.setToolTipText(applyProperty("TPS_SELECT_TT")); + minTpsField.setColumns(6); + setSelectAllFieldText(minTpsField); + minTpsField.addFocusListener (new FocusListener () { + @Override + public void focusGained(FocusEvent e) { + } + + @Override + public void focusLost(FocusEvent e) { + if (!minTpsField.getText().isEmpty()) { + tpsMin = parseDouble(minTpsField); + LOGGER.info("DYNO TPS threshold set to: " + tpsMin); + } + } + }); + minTpsField.setInputVerifier(new NumberVerifier("Threshold")); + String thres = getSettings().getDynoThreshold(); + minTpsField.setText(thres); + + tpsMin = parseDouble(minTpsField); + tpsPanel.add(minTpsField); + + tpsComboBox.setToolTipText(applyProperty("TPS_MODE_TT")); + tpsComboBox.setSelectedItem(getSettings().getDynoThrottle()); + final SelectionVerifier verifier = new SelectionVerifier(); + tpsComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + tpsComboBox.setPopupVisible(false); + final String itemSel = (String) tpsComboBox.getSelectedItem(); + if ("%".equals(itemSel)) { + if (null == findData(THROTTLE_ANGLE)) { + disableRecordButton(); + notifyError(rb.getString("TANOSUPPORT")); + verifier.set(false); + } + else { + throttle_param = THROTTLE_ANGLE; + enableRecordButton(); + verifier.set(true); + } + } + else if ("VDC".equals(itemSel)) { + if (null == findData(THROTTLE_VOLTS)) { + disableRecordButton(); + notifyError(rb.getString("TVNOSUPPORT")); + verifier.set(false); + } + else { + throttle_param = THROTTLE_VOLTS; + enableRecordButton(); + verifier.set(true); + } + } + LOGGER.info("DYNO Throttle parameter set to: " + throttle_param); + } + }); + tpsComboBox.setInputVerifier(verifier); + tpsPanel.add(tpsComboBox); + return tpsPanel; + } + private boolean areNumbers(JTextField... textFields) { for (JTextField field : textFields) { if (!isNumber(field)) return false; @@ -1360,7 +1457,8 @@ private boolean isNumber(JTextField textField) { } private double parseDouble(JTextField field) { - return Double.parseDouble(field.getText().trim()); + String s = field.getText().trim().replace(',', '.'); + return Double.parseDouble(s); } public void setEcuParams(List params) { @@ -1378,13 +1476,13 @@ public void setExternalDatas(List externals) { private JComboBox buildCarSelectComboBox() { loadCars(); final JComboBox selectComboBox = new JComboBox(carTypeArr); + selectComboBox.setSelectedItem(getSettings().getSelectedCar()); selectComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { changeCars(selectComboBox.getSelectedIndex()); } }); - // carSelectBox.setSelectedItem("05 USDM OBXT WGN LTD 5MT"); return selectComboBox; } @@ -1408,6 +1506,26 @@ private void makeGearList() { } } + public void checkDynoDefs() { + if (carTypeArr[0].trim().equals(MISSING_CAR_DEF)){ + Object[] options = {"Yes", "No"}; + int answer = showOptionDialog(parent, + rb.getString("CDNOTFOUND"), + rb.getString("CONFIGURATION"), + DEFAULT_OPTION, WARNING_MESSAGE, + null, options, options[0]); + if (answer == 0) { + BrowserControl.displayURL(CARS_DEFS_URL); + } else { + final String msg = MessageFormat.format( + rb.getString("MISSINGCD"), MISSING_CAR_DEF); + showMessageDialog(parent, + msg, + rb.getString("NOTICE"), WARNING_MESSAGE); + } + } + } + private void changeCars(int index) { if (!carTypeArr[0].trim().equals(MISSING_CAR_DEF)) { iButton.doClick(); @@ -1440,33 +1558,25 @@ private void changeCars(int index) { private void loadCars() { try { - Settings settings = SettingsManager.getSettings(); File carDef = null; - final String SEPARATOR = System.getProperty("file.separator"); - final String loggerFilePath = settings.getLoggerDefinitionFilePath(); - if (loggerFilePath != null) { - final int index = loggerFilePath.lastIndexOf(SEPARATOR); - if (index > 0) { - final String path = loggerFilePath.substring(0, index + 1); - carDef = new File(path + CARS_FILE); - } - } - if (!carDef.exists()) { - final String profileFilePath = settings.getLoggerProfileFilePath(); - if (profileFilePath != null) { - final int index = profileFilePath.lastIndexOf(SEPARATOR); - if (index > 0) { - final String path = profileFilePath.substring(0, index + 1); - carDef = new File(path + CARS_FILE); - } - } - } - if (!carDef.exists()) { - carDef = new File(CARS_FILE); - } - if (!carDef.exists()) { - throw new FileNotFoundException(MISSING_CAR_DEF); + + //Look through some folders to find the car definition file + //Do NOT delete the "", this also searches through the local folder! + final String searchPaths[] = {getSettings().getLoggerDefinitionFilePath(), getSettings().getLoggerProfileFilePath(), ""}; + + for (String s : searchPaths) { + File f = new File(s); + File path_test = new File(f.getParent(), CARS_FILE); + + if(path_test.exists()) { + LOGGER.info("Loaded dyno definition file from " + path_test.getAbsolutePath()); + carDef = path_test; + break; + } } + + if(carDef == null) throw new FileNotFoundException(MISSING_CAR_DEF); + DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document carsDef = docBuilder.parse(carDef); @@ -1519,7 +1629,8 @@ private void loadCars() { gearsRatioArr[s][g] = grsValueList.item(0).getNodeValue().trim(); } } - // LOGGER.trace("Car: " + s + " Gear: " + g + " Ratio: " + gearsRatioArr[s][g]); + //if (LOGGER.isTraceEnabled()) + // LOGGER.trace("Car: " + s + " Gear: " + g + " Ratio: " + gearsRatioArr[s][g]); } break; case 1: @@ -1556,7 +1667,12 @@ private void loadCars() { } } catch (SAXParseException err) { - showMessageDialog(parent, "Parsing error" + ", line " + err.getLineNumber() + ", " + err.getSystemId() + ".\n" + err.getMessage(), "Error", ERROR_MESSAGE); + final String msg = MessageFormat.format( + rb.getString("PARSEERROR"), + err.getLineNumber(), + err.getSystemId(), + err.getMessage()); + notifyError(msg); LOGGER.error("DYNO ** Parsing error" + ", line " + err.getLineNumber() + ", uri " + err.getSystemId()); LOGGER.error(" " + err.getMessage()); } @@ -1565,18 +1681,9 @@ private void loadCars() { ((x == null) ? e : x).printStackTrace(); } catch (Throwable t) { // file not found - Object[] options = {"Yes", "No"}; - int answer = showOptionDialog(this, - "Cars definition file not found.\nGo online to download the latest definition file?", - "Configuration", DEFAULT_OPTION, WARNING_MESSAGE, null, options, options[0]); - if (answer == 0) { - BrowserControl.displayURL(CARS_DEFS_URL); - } else { - showMessageDialog(parent, MISSING_CAR_DEF + - " file from the installation or profiles or definitions directory.\nDyno feature will not be available until this file is present.", "Notice", WARNING_MESSAGE); - } carTypeArr = new String[]{MISSING_CAR_DEF}; - t.printStackTrace(); + LOGGER.warn("No " + CARS_FILE + " file found, possible missing DTD issue?"); + //t.printStackTrace(); } } @@ -1594,4 +1701,40 @@ public void focusGained(FocusEvent ev) { } comp.addFocusListener(allTextSelector); } + + private Settings getSettings() { + return SettingsManager.getSettings(); + } + + private void enableRecordButton() { + if (!recordDataButton.isEnabled()) { + recordDataButton.setEnabled(true); + } + } + + private void disableRecordButton() { + if (recordDataButton.isEnabled()) { + recordDataButton.setEnabled(false); + } + } + + private String applyProperty(String key) { + if (rb.containsKey(key)) { + return rb.getString(key); + } + return "null"; + } + + private void notifyError(final String msg) { + showMessageDialog(parent, + msg, + rb.getString("ERROR"), ERROR_MESSAGE); + } + + public void saveSettings() { + getSettings().setSelectedCar((String) carSelectBox.getSelectedItem()); + getSettings().setSelectedGear((String) gearSelectBox.getSelectedItem()); + getSettings().setDynoThreshold(NumberUtil.stringValue(tpsMin)); + getSettings().setDynoThrottle((String) tpsComboBox.getSelectedItem()); + } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoTab.java b/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoTab.java index 0a6619124..87fff8123 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoTab.java +++ b/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoTab.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,4 +42,6 @@ public interface DynoTab extends Tab { double calcRpm(double vs); int getSampleCount(); + + void saveSettings(); } diff --git a/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoTabImpl.java b/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoTabImpl.java index a84b5a78b..88a9ba956 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoTabImpl.java +++ b/src/main/java/com/romraider/logger/ecu/ui/tab/dyno/DynoTabImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ import java.awt.BorderLayout; import java.util.List; +import java.util.ResourceBundle; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -35,10 +36,16 @@ import com.romraider.logger.ecu.definition.EcuSwitch; import com.romraider.logger.ecu.definition.ExternalData; import com.romraider.logger.ecu.ui.DataRegistrationBroker; +import com.romraider.util.ResourceUtil; public final class DynoTabImpl extends JPanel implements DynoTab { private static final long serialVersionUID = 2787020251963102201L; - private final DynoChartPanel chartPanel = new DynoChartPanel("Engine Speed (RPM)", "Calculated Wheel Power", "Calculated Engine Torque"); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DynoTabImpl.class.getName()); + private final DynoChartPanel chartPanel = new DynoChartPanel( + rb.getString("XAXISLBL"), + rb.getString("HPAXISLBL"), + rb.getString("TQAXISLBL")); private final DynoControlPanel controlPanel; public DynoTabImpl(DataRegistrationBroker broker, ECUEditor ecuEditor) { @@ -49,6 +56,10 @@ public DynoTabImpl(DataRegistrationBroker broker, ECUEditor ecuEditor) { add(chartPanel, CENTER); } + public DynoControlPanel getDynoControlPanel() { + return controlPanel; + } + @Override public double calcRpm(double vs) { return controlPanel.calcRpm(vs); @@ -127,4 +138,9 @@ public void setExternalDatas(List external) { public JPanel getPanel() { return this; } + + @Override + public void saveSettings() { + controlPanel.saveSettings(); + } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.java b/src/main/java/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.java index 4ec57747f..51d240c6d 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.java +++ b/src/main/java/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,8 +37,10 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.DecimalFormat; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; +import java.util.ResourceBundle; import javax.swing.JButton; import javax.swing.JComponent; @@ -61,13 +63,17 @@ import com.romraider.maps.Rom; import com.romraider.maps.Table; import com.romraider.maps.Table2D; +import com.romraider.util.ResourceUtil; public final class InjectorControlPanel extends JPanel { /** * */ private static final long serialVersionUID = -3570410894599258706L; - private static final Logger LOGGER = Logger.getLogger(InjectorControlPanel.class); + private static final Logger LOGGER = Logger.getLogger( + InjectorControlPanel.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + InjectorControlPanel.class.getName()); private static final String COOLANT_TEMP = "P2"; private static final String ENGINE_SPEED = "P8"; private static final String INTAKE_AIR_TEMP = "P11"; @@ -82,7 +88,8 @@ public final class InjectorControlPanel extends JPanel { private static final String TIP_IN_THROTTLE_32 = "E54"; private static final String ENGINE_LOAD_16 = "E2"; private static final String ENGINE_LOAD_32 = "E32"; - private final JToggleButton recordDataButton = new JToggleButton("Record Data"); + private final JToggleButton recordDataButton = new JToggleButton( + rb.getString("RECORDDATA")); private final JTextField mafvMin = new JTextField("1.20", 3); private final JTextField mafvMax = new JTextField("2.60", 3); private final JTextField afrMin = new JTextField("13.0", 3); @@ -106,7 +113,9 @@ public final class InjectorControlPanel extends JPanel { private List switches; private List externals; - public InjectorControlPanel(Component parent, DataRegistrationBroker broker, ECUEditor ecuEditor, LoggerChartPanel chartPanel) { + public InjectorControlPanel(Component parent, + DataRegistrationBroker broker, ECUEditor ecuEditor, + LoggerChartPanel chartPanel) { checkNotNull(parent, broker, chartPanel); this.broker = broker; this.parent = parent; @@ -116,11 +125,11 @@ public InjectorControlPanel(Component parent, DataRegistrationBroker broker, ECU } public double getFuelStoichAfr() { - return getProperty(fuelStoichAfr, "Fuel Stoich. AFR"); + return getProperty(fuelStoichAfr, rb.getString("FUELAFR")); } public double getFuelDensity() { - return getProperty(fuelDensity, "Fuel Density"); + return getProperty(fuelDensity, rb.getString("FUELDENSITY")); } public boolean isRecordData() { @@ -132,31 +141,31 @@ public boolean isValidClOl(double value) { } public boolean isValidAfr(double value) { - return checkInRange("AFR", afrMin, afrMax, value); + return checkInRange(rb.getString("AFR"), afrMin, afrMax, value); } public boolean isValidRpm(double value) { - return checkInRange("RPM", rpmMin, rpmMax, value); + return checkInRange(rb.getString("RPM"), rpmMin, rpmMax, value); } public boolean isValidMaf(double value) { - return checkInRange("MAF", mafMin, mafMax, value); + return checkInRange(rb.getString("MAF"), mafMin, mafMax, value); } public boolean isValidMafv(double value) { - return checkInRange("MAFv", mafvMin, mafvMax, value); + return checkInRange(rb.getString("MAFV"), mafvMin, mafvMax, value); } public boolean isValidCoolantTemp(double value) { - return checkGreaterThan("Coolant Temp.", coolantMin, value); + return checkGreaterThan(rb.getString("ECT"), coolantMin, value); } public boolean isValidIntakeAirTemp(double value) { - return checkLessThan("Intake Air Temp.", iatMax, value); + return checkLessThan(rb.getString("IAT"), iatMax, value); } public boolean isValidMafvChange(double value) { - return checkLessThan("dMAFv/dt", mafvChangeMax, value); + return checkLessThan(rb.getString("DMAFVDT"), mafvChangeMax, value); } public boolean isValidTipInThrottle(double value) { @@ -165,16 +174,21 @@ public boolean isValidTipInThrottle(double value) { private double getProperty(JTextField field, String name) { if (isNumber(field)) return parseDouble(field); - showMessageDialog(parent, "Invalid " + name + " value specified.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, MessageFormat.format( + rb.getString("INVALIDVALUE"), name), + rb.getString("ERROR"), ERROR_MESSAGE); recordDataButton.setSelected(false); return 0.0; } - private boolean checkInRange(String name, JTextField min, JTextField max, double value) { + private boolean checkInRange(String name, JTextField min, + JTextField max, double value) { if (isValidRange(min, max)) { return inRange(value, min, max); } else { - showMessageDialog(parent, "Invalid " + name + " range specified.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, MessageFormat.format( + rb.getString("INVALIDRANGE"), name), + rb.getString("ERROR"), ERROR_MESSAGE); recordDataButton.setSelected(false); return false; } @@ -184,7 +198,9 @@ private boolean checkGreaterThan(String name, JTextField min, double value) { if (isNumber(min)) { return value >= parseDouble(min); } else { - showMessageDialog(parent, "Invalid " + name + " specified.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, MessageFormat.format( + rb.getString("INVALIDMINMAX"), name), + rb.getString("ERROR"), ERROR_MESSAGE); recordDataButton.setSelected(false); return false; } @@ -194,7 +210,9 @@ private boolean checkLessThan(String name, JTextField max, double value) { if (isNumber(max)) { return value <= parseDouble(max); } else { - showMessageDialog(parent, "Invalid " + name + " specified.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, MessageFormat.format( + rb.getString("INVALIDMINMAX"), name), + rb.getString("ERROR"), ERROR_MESSAGE); recordDataButton.setSelected(false); return false; } @@ -202,20 +220,18 @@ private boolean checkLessThan(String name, JTextField max, double value) { private void addControls() { JPanel panel = new JPanel(); - GridBagLayout gridBagLayout = new GridBagLayout(); panel.setLayout(gridBagLayout); - add(panel, gridBagLayout, buildFuelPropertiesPanel(), 0, 0, 1, HORIZONTAL); add(panel, gridBagLayout, buildFilterPanel(), 0, 1, 1, HORIZONTAL); add(panel, gridBagLayout, buildInterpolatePanel(), 0, 2, 1, HORIZONTAL); add(panel, gridBagLayout, buildUpdateInjectorPanel(), 0, 3, 1, HORIZONTAL); add(panel, gridBagLayout, buildResetPanel(), 0, 4, 1, HORIZONTAL); - add(panel); } - private void add(JPanel panel, GridBagLayout gridBagLayout, JComponent component, int x, int y, int spanX, int fillType) { + private void add(JPanel panel, GridBagLayout gridBagLayout, + JComponent component, int x, int y, int spanX, int fillType) { GridBagConstraints constraints = buildBaseConstraints(); updateConstraints(constraints, x, y, spanX, 1, 1, 1, fillType); gridBagLayout.setConstraints(component, constraints); @@ -224,75 +240,72 @@ private void add(JPanel panel, GridBagLayout gridBagLayout, JComponent component private JPanel buildResetPanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Reset")); + panel.setBorder(new TitledBorder(rb.getString("RESET"))); panel.add(buildResetButton()); return panel; } private JPanel buildInterpolatePanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Interpolate")); - + panel.setBorder(new TitledBorder(rb.getString("INTERPOLATE"))); GridBagLayout gridBagLayout = new GridBagLayout(); panel.setLayout(gridBagLayout); - addComponent(panel, gridBagLayout, buildInterpolateButton(), 2); - return panel; } private JPanel buildUpdateInjectorPanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Update Injector")); - + panel.setBorder(new TitledBorder(rb.getString("UPDATEINJ"))); GridBagLayout gridBagLayout = new GridBagLayout(); panel.setLayout(gridBagLayout); - flowScaling.setEditable(false); latencyOffset.setEditable(false); - - addLabeledComponent(panel, gridBagLayout, "Flow Scaling (cc/min)", flowScaling, 0); + addLabeledComponent(panel, gridBagLayout, rb.getString("FLOWSCALING"), + flowScaling, 0); addComponent(panel, gridBagLayout, buildUpdateInjectorScalerButton(), 2); - - addLabeledComponent(panel, gridBagLayout, "Latency Offset (ms)", latencyOffset, 3); + addLabeledComponent(panel, gridBagLayout, rb.getString("LATENCYOFFSET"), + latencyOffset, 3); addComponent(panel, gridBagLayout, buildUpdateInjectorLatencyButton(), 5); - return panel; } - private void addLabeledComponent(JPanel panel, GridBagLayout gridBagLayout, String name, JComponent component, int y) { + private void addLabeledComponent(JPanel panel, GridBagLayout gridBagLayout, + String name, JComponent component, int y) { add(panel, gridBagLayout, new JLabel(name), 0, y, 3, HORIZONTAL); add(panel, gridBagLayout, component, 0, y + 1, 3, NONE); } private JPanel buildFuelPropertiesPanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Fuel Properties")); - + panel.setBorder(new TitledBorder(rb.getString("FUELPROPERTIES"))); GridBagLayout gridBagLayout = new GridBagLayout(); panel.setLayout(gridBagLayout); - - addLabeledComponent(panel, gridBagLayout, "Stoich. AFR", fuelStoichAfr, 0); - addLabeledComponent(panel, gridBagLayout, "Density (kg/m3)", fuelDensity, 3); - + addLabeledComponent(panel, gridBagLayout, + rb.getString("STOICHAFR"), fuelStoichAfr, 0); + addLabeledComponent(panel, gridBagLayout, + rb.getString("DENSITY"), fuelDensity, 3); return panel; } private JPanel buildFilterPanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Filter Data")); - + panel.setBorder(new TitledBorder(rb.getString("FILTERDATA"))); GridBagLayout gridBagLayout = new GridBagLayout(); panel.setLayout(gridBagLayout); - - addMinMaxFilter(panel, gridBagLayout, "AFR Range", afrMin, afrMax, 0); - addMinMaxFilter(panel, gridBagLayout, "RPM Range", rpmMin, rpmMax, 3); - addMinMaxFilter(panel, gridBagLayout, "MAF Range (g/s)", mafMin, mafMax, 6); - addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 9); - addLabeledComponent(panel, gridBagLayout, "Max. Intake Temp.", iatMax, 12); - addLabeledComponent(panel, gridBagLayout, "Max. dMAFv/dt (V/s)", mafvChangeMax, 15); + addMinMaxFilter(panel, gridBagLayout, + rb.getString("AFRRANGE"), afrMin, afrMax, 0); + addMinMaxFilter(panel, gridBagLayout, + rb.getString("RPMRANGE"), rpmMin, rpmMax, 3); + addMinMaxFilter(panel, gridBagLayout, + rb.getString("MAFRANGE"), mafMin, mafMax, 6); + addLabeledComponent(panel, gridBagLayout, + rb.getString("MINECT"), coolantMin, 9); + addLabeledComponent(panel, gridBagLayout, + rb.getString("MAXIAT"), iatMax, 12); + addLabeledComponent(panel, gridBagLayout, + rb.getString("MAXDELTA"), mafvChangeMax, 15); addComponent(panel, gridBagLayout, buildRecordDataButton(), 18); - return panel; } @@ -301,9 +314,17 @@ private JToggleButton buildRecordDataButton() { @Override public void actionPerformed(ActionEvent actionEvent) { if (recordDataButton.isSelected()) { - registerData(COOLANT_TEMP, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32, PULSE_WIDTH_16, PULSE_WIDTH_32, ENGINE_LOAD_16, ENGINE_LOAD_32); + registerData(COOLANT_TEMP, ENGINE_SPEED, INTAKE_AIR_TEMP, + MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, + CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32, + PULSE_WIDTH_16, PULSE_WIDTH_32, ENGINE_LOAD_16, + ENGINE_LOAD_32); } else { - deregisterData(COOLANT_TEMP, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32, PULSE_WIDTH_16, PULSE_WIDTH_32, ENGINE_LOAD_16, ENGINE_LOAD_32); + deregisterData(COOLANT_TEMP, ENGINE_SPEED, INTAKE_AIR_TEMP, + MASS_AIR_FLOW, MASS_AIR_FLOW_V, AFR, CL_OL_16, + CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32, + PULSE_WIDTH_16, PULSE_WIDTH_32, ENGINE_LOAD_16, + ENGINE_LOAD_32); } } }); @@ -338,11 +359,13 @@ private LoggerData findData(String id) { return null; } - private void addComponent(JPanel panel, GridBagLayout gridBagLayout, JComponent component, int y) { + private void addComponent(JPanel panel, GridBagLayout gridBagLayout, + JComponent component, int y) { add(panel, gridBagLayout, component, 0, y, 3, HORIZONTAL); } - private void addMinMaxFilter(JPanel panel, GridBagLayout gridBagLayout, String name, JTextField min, JTextField max, int y) { + private void addMinMaxFilter(JPanel panel, GridBagLayout gridBagLayout, + String name, JTextField min, JTextField max, int y) { add(panel, gridBagLayout, new JLabel(name), 0, y, 3, HORIZONTAL); y += 1; add(panel, gridBagLayout, min, 0, y, 1, NONE); @@ -357,7 +380,9 @@ private GridBagConstraints buildBaseConstraints() { return constraints; } - private void updateConstraints(GridBagConstraints constraints, int gridx, int gridy, int gridwidth, int gridheight, int weightx, int weighty, int fill) { + private void updateConstraints(GridBagConstraints constraints, int gridx, + int gridy, int gridwidth, int gridheight, int weightx, int weighty, + int fill) { constraints.gridx = gridx; constraints.gridy = gridy; constraints.gridwidth = gridwidth; @@ -368,7 +393,7 @@ private void updateConstraints(GridBagConstraints constraints, int gridx, int gr } private JButton buildResetButton() { - JButton resetButton = new JButton("Reset Data"); + JButton resetButton = new JButton(rb.getString("RESETDATA")); resetButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -380,7 +405,7 @@ public void actionPerformed(ActionEvent actionEvent) { } private JButton buildInterpolateButton() { - JButton interpolateButton = new JButton("Interpolate"); + JButton interpolateButton = new JButton(rb.getString("INTERPOLATE")); interpolateButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -398,12 +423,13 @@ public void actionPerformed(ActionEvent actionEvent) { } private JButton buildUpdateInjectorScalerButton() { - final JButton updateButton = new JButton("Update Scaling"); + final JButton updateButton = new JButton(rb.getString("UPDATESCALING")); updateButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { try { - if (showUpdateTableConfirmation("Injector Flow Scaling") == OK_OPTION) { + if (showUpdateTableConfirmation( + rb.getString("INJFLOWSCALING")) == OK_OPTION) { Table2D table = getInjectorFlowTable(ecuEditor); if (table != null) { DataCell[] cells = table.getData(); @@ -412,16 +438,24 @@ public void actionPerformed(ActionEvent actionEvent) { String value = flowScaling.getText().trim(); cells[0].setRealValue(value); } else { - showMessageDialog(parent, "Invalid Injector Flow Scaling value.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, + rb.getString("INVALIDSCALING"), + rb.getString("ERROR"), ERROR_MESSAGE); } } } else { - showMessageDialog(parent, "Injector Flow Scaling table not found.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, + rb.getString("INJTABLENOTFND"), + rb.getString("ERROR"), ERROR_MESSAGE); } } } catch (Exception e) { - String msg = e.getMessage() != null && e.getMessage().length() > 0 ? e.getMessage() : "Unknown"; - showMessageDialog(parent, "Error: " + msg, "Error", ERROR_MESSAGE); + String msg = e.getMessage() != null + && e.getMessage().length() > 0 + ? e.getMessage() : rb.getString("UNKNOWN"); + showMessageDialog(parent, MessageFormat.format( + rb.getString("ERRORMSG"), msg), + rb.getString("ERROR"), ERROR_MESSAGE); } } }); @@ -429,30 +463,39 @@ public void actionPerformed(ActionEvent actionEvent) { } private JButton buildUpdateInjectorLatencyButton() { - final JButton updateButton = new JButton("Update Latency"); + final JButton updateButton = new JButton(rb.getString("UPDATELAT")); updateButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { try { - if (showUpdateTableConfirmation("Injector Latency") == OK_OPTION) { + if (showUpdateTableConfirmation(rb.getString("INJLAT")) == OK_OPTION) { Table2D table = getInjectorLatencyTable(ecuEditor); if (table != null) { DataCell[] cells = table.getData(); if (isNumber(latencyOffset)) { for (DataCell cell : cells) { - double newLatency = cell.getRealValue() + parseDouble(latencyOffset); + double newLatency = cell.getRealValue() + + parseDouble(latencyOffset); cell.setRealValue("" + newLatency); } } else { - showMessageDialog(parent, "Invalid Injector Latency Offset value.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, + rb.getString("INVALIFINJOFF"), + rb.getString("ERROR"), ERROR_MESSAGE); } } else { - showMessageDialog(parent, "Error finding Injector Latency table.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, + rb.getString("LATTBLNOTFND"), + rb.getString("ERROR"), ERROR_MESSAGE); } } } catch (Exception e) { - String msg = e.getMessage() != null && e.getMessage().length() > 0 ? e.getMessage() : "Unknown"; - showMessageDialog(parent, "Error: " + msg, "Error", ERROR_MESSAGE); + String msg = e.getMessage() != null + && e.getMessage().length() > 0 + ? e.getMessage() : rb.getString("UNKNOWN"); + showMessageDialog(parent, MessageFormat.format( + rb.getString("ERRORMSG"), msg), + rb.getString("ERROR"), ERROR_MESSAGE); } } }); @@ -492,7 +535,9 @@ private double parseDouble(JTextField field) { } private int showUpdateTableConfirmation(String table) { - return showConfirmDialog(parent, "Update " + table + "?", "Confirm Update", YES_NO_OPTION, WARNING_MESSAGE); + return showConfirmDialog(parent, MessageFormat.format( + rb.getString("UPDATETABLE"), table), + rb.getString("CONFIRM"), YES_NO_OPTION, WARNING_MESSAGE); } private Table2D getInjectorFlowTable(ECUEditor ecuEditor) { diff --git a/src/main/java/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.java b/src/main/java/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.java index f79c4a62a..d186d2925 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.java +++ b/src/main/java/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,8 @@ import com.romraider.logger.ecu.definition.ExternalData; import com.romraider.logger.ecu.ui.DataRegistrationBroker; import com.romraider.logger.ecu.ui.tab.LoggerChartPanel; +import com.romraider.util.ResourceUtil; + import static java.awt.BorderLayout.CENTER; import static java.awt.BorderLayout.WEST; import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER; @@ -33,16 +35,22 @@ import javax.swing.JScrollPane; import java.awt.BorderLayout; import java.util.List; +import java.util.ResourceBundle; public final class InjectorTabImpl extends JPanel implements InjectorTab { private static final long serialVersionUID = 5365322624406058883L; - private final LoggerChartPanel chartPanel = new LoggerChartPanel("Pulse Width (ms)", "Fuel per Combustion Event (cc)"); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + InjectorTabImpl.class.getName()); + private final LoggerChartPanel chartPanel = new LoggerChartPanel( + rb.getString("PWMS"), rb.getString("FPCE")); private final InjectorControlPanel controlPanel; public InjectorTabImpl(DataRegistrationBroker broker, ECUEditor ecuEditor) { super(new BorderLayout(2, 2)); - controlPanel = new InjectorControlPanel(this, broker, ecuEditor, chartPanel); - JScrollPane scrollPane = new JScrollPane(controlPanel, VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER); + controlPanel = new InjectorControlPanel(this, broker, ecuEditor, + chartPanel); + JScrollPane scrollPane = new JScrollPane(controlPanel, + VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER); add(scrollPane, WEST); add(chartPanel, CENTER); } @@ -110,5 +118,4 @@ public void setExternalDatas(List external) { public JPanel getPanel() { return this; } - } \ No newline at end of file diff --git a/src/main/java/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.java b/src/main/java/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.java index 5adee31b9..76ab19adc 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.java +++ b/src/main/java/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,8 +36,10 @@ import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; +import java.util.ResourceBundle; import javax.swing.JButton; import javax.swing.JComboBox; @@ -62,10 +64,13 @@ import com.romraider.maps.Rom; import com.romraider.maps.Table; import com.romraider.maps.Table2D; +import com.romraider.util.ResourceUtil; public final class MafControlPanel extends JPanel { private static final long serialVersionUID = 5787020251107365950L; private static final Logger LOGGER = Logger.getLogger(MafControlPanel.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + MafControlPanel.class.getName()); private static final String COOLANT_TEMP = "P2"; private static final String AF_CORRECTION_1 = "P3"; private static final String AF_LEARNING_1 = "P4"; @@ -78,7 +83,8 @@ public final class MafControlPanel extends JPanel { private static final String CL_OL_32 = "E33"; private static final String TIP_IN_THROTTLE_16 = "E23"; private static final String TIP_IN_THROTTLE_32 = "E54"; - private final JToggleButton recordDataButton = new JToggleButton("Record Data"); + private final JToggleButton recordDataButton = new JToggleButton( + rb.getString("RECORDDATA")); private final JTextField mafvMin = new JTextField("1.20", 3); private final JTextField mafvMax = new JTextField("2.60", 3); private final JTextField afrMin = new JTextField("13.0", 3); @@ -99,7 +105,8 @@ public final class MafControlPanel extends JPanel { private List params = new ArrayList(); private List switches = new ArrayList(); - public MafControlPanel(Component parent, DataRegistrationBroker broker, ECUEditor ecuEditor, LoggerChartPanel chartPanel) { + public MafControlPanel(Component parent, DataRegistrationBroker broker, + ECUEditor ecuEditor, LoggerChartPanel chartPanel) { checkNotNull(parent, broker, chartPanel); this.parent = parent; this.broker = broker; @@ -117,31 +124,31 @@ public boolean isValidClOl(double value) { } public boolean isValidAfr(double value) { - return checkInRange("AFR", afrMin, afrMax, value); + return checkInRange(rb.getString("AFR"), afrMin, afrMax, value); } public boolean isValidRpm(double value) { - return checkInRange("RPM", rpmMin, rpmMax, value); + return checkInRange(rb.getString("RPM"), rpmMin, rpmMax, value); } public boolean isValidMaf(double value) { - return checkInRange("MAF", mafMin, mafMax, value); + return checkInRange(rb.getString("MAF"), mafMin, mafMax, value); } public boolean isValidMafv(double value) { - return checkInRange("MAFv", mafvMin, mafvMax, value); + return checkInRange(rb.getString("MAFV"), mafvMin, mafvMax, value); } public boolean isValidCoolantTemp(double value) { - return checkGreaterThan("Coolant Temp.", coolantMin, value); + return checkGreaterThan(rb.getString("ECT"), coolantMin, value); } public boolean isValidIntakeAirTemp(double value) { - return checkLessThan("Intake Air Temp.", iatMax, value); + return checkLessThan(rb.getString("IAT"), iatMax, value); } public boolean isValidMafvChange(double value) { - return checkLessThan("dMAFv/dt", mafvChangeMax, value); + return checkLessThan(rb.getString("DMAFVDT"), mafvChangeMax, value); } public boolean isValidTipInThrottle(double value) { @@ -152,7 +159,9 @@ private boolean checkInRange(String name, JTextField min, JTextField max, double if (isValidRange(min, max)) { return inRange(value, min, max); } else { - showMessageDialog(parent, "Invalid " + name + " range specified.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, MessageFormat.format( + rb.getString("INVALIDRANGE"), name), + rb.getString("ERROR"), ERROR_MESSAGE); recordDataButton.setSelected(false); return false; } @@ -162,7 +171,9 @@ private boolean checkGreaterThan(String name, JTextField min, double value) { if (isNumber(min)) { return value >= parseDouble(min); } else { - showMessageDialog(parent, "Invalid " + name + " specified.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, MessageFormat.format( + rb.getString("INVALIDMINMAX"), name), + rb.getString("ERROR"), ERROR_MESSAGE); recordDataButton.setSelected(false); return false; } @@ -172,7 +183,9 @@ private boolean checkLessThan(String name, JTextField max, double value) { if (isNumber(max)) { return value <= parseDouble(max); } else { - showMessageDialog(parent, "Invalid " + name + " specified.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, MessageFormat.format( + rb.getString("INVALIDMINMAX"), name), + rb.getString("ERROR"), ERROR_MESSAGE); recordDataButton.setSelected(false); return false; } @@ -207,26 +220,27 @@ private void add(JPanel panel, GridBagLayout gridBagLayout, JComponent component private JPanel buildAfrSourcePanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("AFR Source")); + panel.setBorder(new TitledBorder(rb.getString("AFRSRC"))); panel.add(afrSourceList); return panel; } private JPanel buildResetPanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Reset")); + panel.setBorder(new TitledBorder(rb.getString("RESET"))); panel.add(buildResetButton()); return panel; } private JPanel buildUpdateMafPanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Update MAF")); + panel.setBorder(new TitledBorder(rb.getString("UPDATEMAF"))); GridBagLayout gridBagLayout = new GridBagLayout(); panel.setLayout(gridBagLayout); - addMinMaxFilter(panel, gridBagLayout, "MAFv Range", mafvMin, mafvMax, 0); + addMinMaxFilter(panel, gridBagLayout, rb.getString("MAFVRANGE"), + mafvMin, mafvMax, 0); addComponent(panel, gridBagLayout, buildUpdateMafButton(), 3); return panel; @@ -234,36 +248,38 @@ private JPanel buildUpdateMafPanel() { private JPanel buildInterpolatePanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Interpolate")); + panel.setBorder(new TitledBorder(rb.getString("INTERPOLATE"))); GridBagLayout gridBagLayout = new GridBagLayout(); panel.setLayout(gridBagLayout); JComboBox orderComboBox = buildPolyOrderComboBox(); - addLabeledComponent(panel, gridBagLayout, "Poly. order", orderComboBox, 0); + addLabeledComponent(panel, gridBagLayout, rb.getString("POLYORDER"), + orderComboBox, 0); addComponent(panel, gridBagLayout, buildInterpolateButton(orderComboBox), 2); return panel; } - private void addLabeledComponent(JPanel panel, GridBagLayout gridBagLayout, String name, JComponent component, int y) { + private void addLabeledComponent(JPanel panel, GridBagLayout gridBagLayout, + String name, JComponent component, int y) { add(panel, gridBagLayout, new JLabel(name), 0, y, 3, HORIZONTAL); add(panel, gridBagLayout, component, 0, y + 1, 3, NONE); } private JPanel buildFilterPanel() { JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Filter Data")); + panel.setBorder(new TitledBorder(rb.getString("FILTERDATA"))); GridBagLayout gridBagLayout = new GridBagLayout(); panel.setLayout(gridBagLayout); - addMinMaxFilter(panel, gridBagLayout, "AFR Range", afrMin, afrMax, 0); - addMinMaxFilter(panel, gridBagLayout, "RPM Range", rpmMin, rpmMax, 3); - addMinMaxFilter(panel, gridBagLayout, "MAF Range (g/s)", mafMin, mafMax, 6); - addLabeledComponent(panel, gridBagLayout, "Min. Coolant Temp.", coolantMin, 9); - addLabeledComponent(panel, gridBagLayout, "Max. Intake Temp.", iatMax, 12); - addLabeledComponent(panel, gridBagLayout, "Max. dMAFv/dt (V/s)", mafvChangeMax, 15); + addMinMaxFilter(panel, gridBagLayout, rb.getString("AFRRANGE"), afrMin, afrMax, 0); + addMinMaxFilter(panel, gridBagLayout, rb.getString("RPMRANGE"), rpmMin, rpmMax, 3); + addMinMaxFilter(panel, gridBagLayout, rb.getString("MAFRANGE"), mafMin, mafMax, 6); + addLabeledComponent(panel, gridBagLayout, rb.getString("MINECT"), coolantMin, 9); + addLabeledComponent(panel, gridBagLayout, rb.getString("MAXIAT"), iatMax, 12); + addLabeledComponent(panel, gridBagLayout, rb.getString("MAXDELTA"), mafvChangeMax, 15); addComponent(panel, gridBagLayout, buildRecordDataButton(), 18); return panel; @@ -276,10 +292,16 @@ public void actionPerformed(ActionEvent actionEvent) { if (recordDataButton.isSelected()) { // afrSourceList.setEnabled(false); // registerAfr(); - registerData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32); + registerData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, + ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, + MASS_AIR_FLOW_V, CL_OL_16, CL_OL_32, + TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32); } else { // deregisterAfr(); - deregisterData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, MASS_AIR_FLOW_V, CL_OL_16, CL_OL_32, TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32); + deregisterData(COOLANT_TEMP, AF_CORRECTION_1, AF_LEARNING_1, + ENGINE_SPEED, INTAKE_AIR_TEMP, MASS_AIR_FLOW, + MASS_AIR_FLOW_V, CL_OL_16, CL_OL_32, + TIP_IN_THROTTLE_16, TIP_IN_THROTTLE_32); // afrSourceList.setEnabled(true); } } @@ -370,7 +392,7 @@ private void updateAfrSourceList() { } private JButton buildResetButton() { - JButton resetButton = new JButton("Reset Data"); + JButton resetButton = new JButton(rb.getString("RESETDATA")); resetButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -382,7 +404,7 @@ public void actionPerformed(ActionEvent actionEvent) { } private JButton buildInterpolateButton(final JComboBox orderComboBox) { - JButton interpolateButton = new JButton("Interpolate"); + JButton interpolateButton = new JButton(rb.getString("INTERPOLATE")); interpolateButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -400,7 +422,7 @@ private JComboBox buildPolyOrderComboBox() { } private JButton buildUpdateMafButton() { - final JButton updateMafButton = new JButton("Update MAF"); + final JButton updateMafButton = new JButton(rb.getString("UPDATEMAF")); updateMafButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -425,15 +447,21 @@ public void actionPerformed(ActionEvent actionEvent) { } } } else { - showMessageDialog(parent, "Invalid MAFv range specified.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, + rb.getString("INVALIDMAFRANGE"), + rb.getString("ERROR"), ERROR_MESSAGE); } } else { - showMessageDialog(parent, "Error finding MAF Sensor Scaling table.", "Error", ERROR_MESSAGE); + showMessageDialog(parent, + rb.getString("MAFTBLNOTFND"), + rb.getString("ERROR"), ERROR_MESSAGE); } } } catch (Exception e) { String msg = e.getMessage() != null && e.getMessage().length() > 0 ? e.getMessage() : "Unknown"; - showMessageDialog(parent, "Error: " + msg, "Error", ERROR_MESSAGE); + showMessageDialog(parent, MessageFormat.format( + rb.getString("ERRORMSG"), msg), + rb.getString("ERROR"), ERROR_MESSAGE); } } }); @@ -473,7 +501,9 @@ private double parseDouble(JTextField field) { } private int showUpdateMafConfirmation() { - return showConfirmDialog(parent, "Update MAF Sensor Scaling table?", "Confirm Update", YES_NO_OPTION, WARNING_MESSAGE); + return showConfirmDialog(parent, + rb.getString("UPDATETABLE"), + rb.getString("CONFIRM"), YES_NO_OPTION, WARNING_MESSAGE); } private Table2D getMafTable(ECUEditor ecuEditor) { diff --git a/src/main/java/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.java b/src/main/java/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.java index 8b1bdce21..88e907fd9 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.java +++ b/src/main/java/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,8 @@ import com.romraider.logger.ecu.definition.ExternalData; import com.romraider.logger.ecu.ui.DataRegistrationBroker; import com.romraider.logger.ecu.ui.tab.LoggerChartPanel; +import com.romraider.util.ResourceUtil; + import static java.awt.BorderLayout.CENTER; import static java.awt.BorderLayout.WEST; import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER; @@ -33,16 +35,21 @@ import javax.swing.JScrollPane; import java.awt.BorderLayout; import java.util.List; +import java.util.ResourceBundle; public final class MafTabImpl extends JPanel implements MafTab { private static final long serialVersionUID = -6978027421649432740L; - private final LoggerChartPanel chartPanel = new LoggerChartPanel("MAF (v)", "Total Correction (%)"); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + MafTabImpl.class.getName()); + private final LoggerChartPanel chartPanel = new LoggerChartPanel( + rb.getString("MAFV"), rb.getString("TOTALCORR")); private final MafControlPanel controlPanel; public MafTabImpl(DataRegistrationBroker broker, ECUEditor ecuEditor) { super(new BorderLayout(2, 2)); controlPanel = new MafControlPanel(this, broker, ecuEditor, chartPanel); - JScrollPane scrollPane = new JScrollPane(controlPanel, VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER); + JScrollPane scrollPane = new JScrollPane(controlPanel, + VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER); add(scrollPane, WEST); add(chartPanel, CENTER); } diff --git a/src/main/java/com/romraider/logger/external/aem/io/AemRunner.java b/src/main/java/com/romraider/logger/external/aem/io/AemRunner.java index 0e2d788f3..afe92901c 100644 --- a/src/main/java/com/romraider/logger/external/aem/io/AemRunner.java +++ b/src/main/java/com/romraider/logger/external/aem/io/AemRunner.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,11 +39,13 @@ public AemRunner(String port, AemDataItem dataItem) { this.dataItem = dataItem; } + @Override public void run() { try { while (!stop) { final String response = connection.readLine(); - LOGGER.trace("AEM UEGO AFR Response: " + response); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("AEM UEGO AFR Response: " + response); if (!isNullOrEmpty(response)) dataItem.setData(parseDouble(response)); } connection.close(); @@ -54,6 +56,7 @@ public void run() { } } + @Override public void stop() { stop = true; } diff --git a/src/main/java/com/romraider/logger/external/aem/plugin/AemDataSource.java b/src/main/java/com/romraider/logger/external/aem/plugin/AemDataSource.java index 2e4594a91..464cbf1fc 100644 --- a/src/main/java/com/romraider/logger/external/aem/plugin/AemDataSource.java +++ b/src/main/java/com/romraider/logger/external/aem/plugin/AemDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ import static java.util.Arrays.asList; import java.util.List; +import java.util.Properties; import javax.swing.Action; @@ -72,6 +73,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new AemRunner(port, dataItem); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/aem/xwifi/io/AemRunner.java b/src/main/java/com/romraider/logger/external/aem/xwifi/io/AemRunner.java index 669f6b358..6583a4771 100644 --- a/src/main/java/com/romraider/logger/external/aem/xwifi/io/AemRunner.java +++ b/src/main/java/com/romraider/logger/external/aem/xwifi/io/AemRunner.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ package com.romraider.logger.external.aem.xwifi.io; +import static com.romraider.Settings.COMMA; import com.romraider.io.connection.ConnectionProperties; import com.romraider.io.serial.connection.SerialConnection; import com.romraider.io.serial.connection.SerialConnectionImpl; @@ -42,13 +43,15 @@ public AemRunner(final String port, final Map dataIt this.dataItems = dataItems; } + @Override public void run() { try { while (!stop) { final String response = connection.readLine(); if (isNullOrEmpty(response)) continue; - LOGGER.trace("AEM X-Wifi Response: " + response); - final String[] values = response.split(","); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("AEM X-Wifi Response: " + response); + final String[] values = response.split(COMMA); for (int i = 0; i < values.length; i++) { final AemDataItem dataItem = dataItems.get(AemSensorType.valueOf(i)); if (dataItem != null) dataItem.setData(parseDouble(values[i])); @@ -62,6 +65,7 @@ public void run() { } } + @Override public void stop() { stop = true; } diff --git a/src/main/java/com/romraider/logger/external/aem/xwifi/plugin/AemDataSource.java b/src/main/java/com/romraider/logger/external/aem/xwifi/plugin/AemDataSource.java index d310b0b49..f8641948e 100644 --- a/src/main/java/com/romraider/logger/external/aem/xwifi/plugin/AemDataSource.java +++ b/src/main/java/com/romraider/logger/external/aem/xwifi/plugin/AemDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,6 +39,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; import javax.swing.Action; @@ -87,6 +88,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new AemRunner(port, dataItems); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/aem2/io/AemRunner.java b/src/main/java/com/romraider/logger/external/aem2/io/AemRunner.java index 703585de5..f455cff96 100644 --- a/src/main/java/com/romraider/logger/external/aem2/io/AemRunner.java +++ b/src/main/java/com/romraider/logger/external/aem2/io/AemRunner.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,11 +40,13 @@ public AemRunner(String port, AemDataItem dataItem) { this.dataItem = dataItem; } + @Override public void run() { try { while (!stop) { final String response = connection.readLine(); - LOGGER.trace("AEM UEGO Lambda Response: " + response); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("AEM UEGO Lambda Response: " + response); if (!isNullOrEmpty(response)) dataItem.setData(parseString(response)); } connection.close(); @@ -55,6 +57,7 @@ public void run() { } } + @Override public void stop() { stop = true; } diff --git a/src/main/java/com/romraider/logger/external/aem2/plugin/AemDataSource.java b/src/main/java/com/romraider/logger/external/aem2/plugin/AemDataSource.java index 3fcdeb9ea..b398d1f9c 100644 --- a/src/main/java/com/romraider/logger/external/aem2/plugin/AemDataSource.java +++ b/src/main/java/com/romraider/logger/external/aem2/plugin/AemDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ import static java.util.Arrays.asList; import java.util.List; +import java.util.Properties; import javax.swing.Action; @@ -72,6 +73,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new AemRunner(port, dataItem); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/apsx/io/ApsxRunner.java b/src/main/java/com/romraider/logger/external/apsx/io/ApsxRunner.java new file mode 100644 index 000000000..e3c229311 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/apsx/io/ApsxRunner.java @@ -0,0 +1,63 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.apsx.io; + +import static org.apache.log4j.Logger.getLogger; + +import org.apache.log4j.Logger; + +import com.romraider.io.connection.ConnectionProperties; +import com.romraider.io.serial.connection.SerialConnection; +import com.romraider.io.serial.connection.SerialConnectionImpl; +import com.romraider.logger.external.apsx.plugin.ApsxDataItem; +import com.romraider.logger.external.core.Stoppable; + +public final class ApsxRunner implements Stoppable { + private static final Logger LOGGER = getLogger(ApsxRunner.class); + private final SerialConnection connection; + private final ApsxDataItem dataItem; + private boolean stop; + + public ApsxRunner(String port, ApsxDataItem dataItem, ConnectionProperties properties) { + this.connection = new SerialConnectionImpl(port, properties); + this.dataItem = dataItem; + } + + @Override + public void run() { + try { + while (!stop) { + final int response = connection.read(); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("APSX AFR Response: " + response); + if (response != -1) dataItem.setData(response / 10.0); + } + } catch (Throwable t) { + LOGGER.error("Error occurred", t); + } finally { + connection.close(); + } + } + + @Override + public void stop() { + stop = true; + } +} diff --git a/src/main/java/com/romraider/logger/external/apsx/plugin/ApsxDataItem.java b/src/main/java/com/romraider/logger/external/apsx/plugin/ApsxDataItem.java new file mode 100644 index 000000000..8f01a3745 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/apsx/plugin/ApsxDataItem.java @@ -0,0 +1,58 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.apsx.plugin; + +import static com.romraider.logger.external.core.ExternalDataConvertorLoader.loadConvertors; + +import com.romraider.logger.ecu.definition.EcuDataConvertor; +import com.romraider.logger.external.core.DataListener; +import com.romraider.logger.external.core.ExternalDataItem; +import com.romraider.logger.external.core.ExternalSensorConversions; + +public final class ApsxDataItem implements ExternalDataItem, DataListener { + private EcuDataConvertor[] convertors; + private double data; + + public ApsxDataItem(ExternalSensorConversions... convertorList) { + super(); + convertors = new EcuDataConvertor[convertorList.length]; + convertors = loadConvertors(this, convertors, convertorList); + } + + public String getName() { + return "APSX Wideband AFR"; + } + + public String getDescription() { + return "APSX Wideband data"; + } + + public double getData() { + return data; + } + + public void setData(double data) { + this.data = data; + } + + public EcuDataConvertor[] getConvertors() { + return convertors; + } +} diff --git a/src/main/java/com/romraider/logger/external/apsx/plugin/ApsxDataSource.java b/src/main/java/com/romraider/logger/external/apsx/plugin/ApsxDataSource.java new file mode 100644 index 000000000..17990eff9 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/apsx/plugin/ApsxDataSource.java @@ -0,0 +1,96 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.apsx.plugin; + +import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_146; +import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_147; +import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_155; +import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_172; +import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_34; +import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_64; +import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_90; +import static com.romraider.logger.external.core.SensorConversionsAFR.LAMBDA; +import static com.romraider.util.ThreadUtil.runAsDaemon; +import static java.util.Arrays.asList; + +import java.util.List; +import java.util.Properties; + +import javax.swing.Action; + +import com.romraider.io.connection.SerialConnectionProperties; +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.external.apsx.io.ApsxRunner; +import com.romraider.logger.external.core.ExternalDataItem; +import com.romraider.logger.external.core.ExternalDataSource; + +public final class ApsxDataSource implements ExternalDataSource { + private SerialConnectionProperties connectionProperties; + private ApsxDataItem dataItem = new ApsxDataItem(AFR_147, LAMBDA, AFR_90, AFR_146, AFR_64, AFR_155, AFR_172, AFR_34); + private ApsxRunner runner; + private String port; + + public String getId() { + return getClass().getName(); + } + + public String getName() { + return "APSX D1|D2 WBO2"; + } + + public String getVersion() { + return "0.01"; + } + + public List getDataItems() { + return asList(dataItem); + } + + public Action getMenuAction(EcuLogger logger) { + return null; + } + + public void setPort(String port) { + this.port = port; + } + + public String getPort() { + return port; + } + + public void setProperties(Properties properties) { + connectionProperties = new SerialConnectionProperties( + Integer.parseInt(properties.getProperty("datasource.baudrate")), + Integer.parseInt(properties.getProperty("datasource.databits")), + Integer.parseInt(properties.getProperty("datasource.stopbits")), + Integer.parseInt(properties.getProperty("datasource.parity")), + 2000, 500 + ); + } + + public void connect() { + runner = new ApsxRunner(port, dataItem, connectionProperties); + runAsDaemon(runner); + } + + public void disconnect() { + if (runner != null) runner.stop(); + } +} diff --git a/src/main/java/com/romraider/logger/external/core/ExternalDataSource.java b/src/main/java/com/romraider/logger/external/core/ExternalDataSource.java index 3cb0566df..78dfd272d 100644 --- a/src/main/java/com/romraider/logger/external/core/ExternalDataSource.java +++ b/src/main/java/com/romraider/logger/external/core/ExternalDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ import com.romraider.logger.ecu.EcuLogger; import javax.swing.Action; import java.util.List; +import java.util.Properties; public interface ExternalDataSource { String getId(); @@ -38,6 +39,8 @@ public interface ExternalDataSource { String getPort(); + void setProperties(Properties properties); + public void connect(); public void disconnect(); diff --git a/src/main/java/com/romraider/logger/external/core/ExternalDataSourceLoaderImpl.java b/src/main/java/com/romraider/logger/external/core/ExternalDataSourceLoaderImpl.java index 3bd661077..10cb80f89 100644 --- a/src/main/java/com/romraider/logger/external/core/ExternalDataSourceLoaderImpl.java +++ b/src/main/java/com/romraider/logger/external/core/ExternalDataSourceLoaderImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,8 @@ import com.romraider.logger.ecu.definition.plugin.PluginFilenameFilter; import com.romraider.logger.ecu.exception.ConfigurationException; +import com.romraider.logger.ecu.exception.PluginNotInstalledException; + import static com.romraider.util.ParamChecker.isNullOrEmpty; import org.apache.log4j.Logger; import java.io.File; @@ -38,7 +40,6 @@ public void loadExternalDataSources(Map loggerPluginPorts) { try { File pluginsDir = new File("./plugins"); if (pluginsDir.exists() && pluginsDir.isDirectory()) { -// externalDataSources = new ArrayList(); File[] pluginPropertyFiles = pluginsDir.listFiles(new PluginFilenameFilter()); for (File pluginPropertyFile : pluginPropertyFiles) { Properties pluginProps = new Properties(); @@ -50,12 +51,16 @@ public void loadExternalDataSources(Map loggerPluginPorts) { try { Class dataSourceClass = getClass().getClassLoader().loadClass(datasourceClassName); if (dataSourceClass != null && ExternalDataSource.class.isAssignableFrom(dataSourceClass)) { - ExternalDataSource dataSource = dataSource(dataSourceClass, loggerPluginPorts); + ExternalDataSource dataSource = dataSource(dataSourceClass, loggerPluginPorts, pluginProps); ExternalDataSource managedDataSource = new GenericDataSourceManager(dataSource); externalDataSources.add(managedDataSource); LOGGER.info("Plugin loaded: " + dataSource.getName() + " v" + dataSource.getVersion()); } - } catch (Throwable t) { + } + catch (PluginNotInstalledException e) { + LOGGER.warn(e.getMessage()); + } + catch (Throwable t) { LOGGER.error("Error loading external datasource: " + datasourceClassName + ", specified in: " + pluginPropertyFile.getAbsolutePath(), t); } @@ -70,12 +75,17 @@ public void loadExternalDataSources(Map loggerPluginPorts) { } } - private ExternalDataSource dataSource(Class dataSourceClass, Map loggerPluginPorts) throws Exception { + private ExternalDataSource dataSource( + Class dataSourceClass, + Map loggerPluginPorts, + Properties pluginProps) throws Exception { + ExternalDataSource dataSource = (ExternalDataSource) dataSourceClass.newInstance(); if (loggerPluginPorts != null) { String port = loggerPluginPorts.get(dataSource.getId()); if (port != null && port.trim().length() > 0) dataSource.setPort(port); } + dataSource.setProperties(pluginProps); return dataSource; } diff --git a/src/main/java/com/romraider/logger/external/core/GenericDataSourceConnector.java b/src/main/java/com/romraider/logger/external/core/GenericDataSourceConnector.java index 2bb93a90b..0b14e570f 100644 --- a/src/main/java/com/romraider/logger/external/core/GenericDataSourceConnector.java +++ b/src/main/java/com/romraider/logger/external/core/GenericDataSourceConnector.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +36,8 @@ public GenericDataSourceConnector(ExternalDataSource dataSource) { public void run() { LOGGER.info(dataSource.getName() + ": connecting..."); + Thread.currentThread().setName(dataSource.getName()); + while (!stop) { try { dataSource.connect(); diff --git a/src/main/java/com/romraider/logger/external/core/GenericDataSourceManager.java b/src/main/java/com/romraider/logger/external/core/GenericDataSourceManager.java index 8a824ec6c..529d06bf2 100644 --- a/src/main/java/com/romraider/logger/external/core/GenericDataSourceManager.java +++ b/src/main/java/com/romraider/logger/external/core/GenericDataSourceManager.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ import javax.swing.Action; import java.util.ArrayList; import java.util.List; +import java.util.Properties; public final class GenericDataSourceManager implements ExternalDataSource { private static final Logger LOGGER = getLogger(GenericDataSourceManager.class); @@ -40,27 +41,33 @@ public GenericDataSourceManager(ExternalDataSource dataSource) { this.dataSource = dataSource; } + @Override public String getId() { return dataSource.getId(); } + @Override public String getName() { return dataSource.getName(); } + @Override public String getVersion() { return dataSource.getVersion(); } + @Override public List getDataItems() { return dataSource.getDataItems(); } + @Override public Action getMenuAction(EcuLogger logger) { Action action = dataSource.getMenuAction(logger); return action == null ? new GenericPluginMenuAction(logger, this) : action; } + @Override public synchronized void setPort(String port) { if (port == null || port.length() == 0) return; if (port.equals(getPort())) return; @@ -69,19 +76,28 @@ public synchronized void setPort(String port) { dataSource.setPort(port); } + @Override public String getPort() { return dataSource.getPort(); } + @Override + public void setProperties(Properties properties) { + } + + @Override public synchronized void connect() { if (connectCount++ == 0) doConnect(); - LOGGER.trace("Connect count [" + dataSource.getName() + "]: " + connectCount); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Connect count [" + dataSource.getName() + "]: " + connectCount); } + @Override public synchronized void disconnect() { if (connectCount-- == 1) doDisconnect(); if (connectCount < 0) connectCount = 0; - LOGGER.trace("Connect count [" + dataSource.getName() + "]: " + connectCount); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Connect count [" + dataSource.getName() + "]: " + connectCount); } private void doConnect() { @@ -91,7 +107,6 @@ private void doConnect() { } private void doDisconnect() { - if (dataSource.getPort() == null) return; try { String message = String.format("%s: disconnecting port %s", dataSource.getName(), dataSource.getPort()); diff --git a/src/main/java/com/romraider/logger/external/core/SensorConversionsOther.java b/src/main/java/com/romraider/logger/external/core/SensorConversionsOther.java index c072d7065..35f77fefc 100644 --- a/src/main/java/com/romraider/logger/external/core/SensorConversionsOther.java +++ b/src/main/java/com/romraider/logger/external/core/SensorConversionsOther.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,6 +69,7 @@ public enum SensorConversionsOther implements ExternalSensorConversions { MAF_GS ("g/sec", "x", "0.00", new GaugeMinMax(0,400,50)), MAF_GS2LB ("lb/min", "x/7.54", "0.00", new GaugeMinMax(0,50,5)), PERCENT ("%", "x", "0.0", new GaugeMinMax(0,100,10)), + ENGINE_RPM ("rpm", "x", "0", new GaugeMinMax(0,15000,1500)), VOLTS_5DC("VDC", "x", "0.0", new GaugeMinMax(0,5,0.5)), VOLTS_12DC("VDC", "x", "0.0", new GaugeMinMax(0,15,1.5)); diff --git a/src/main/java/com/romraider/logger/external/ecotrons/io/AlmChecksumCalculator.java b/src/main/java/com/romraider/logger/external/ecotrons/io/AlmChecksumCalculator.java new file mode 100644 index 000000000..6ca58ed2f --- /dev/null +++ b/src/main/java/com/romraider/logger/external/ecotrons/io/AlmChecksumCalculator.java @@ -0,0 +1,38 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.ecotrons.io; + +import java.util.List; + + +public final class AlmChecksumCalculator { + + private AlmChecksumCalculator() { + throw new UnsupportedOperationException(); + } + + public static byte calculateChecksum(List bytes) { + int cs = 0; + for (int i = 0; i < bytes.size() - 1; i++) { + cs += bytes.get(i); + } + return (byte) cs; + } +} diff --git a/src/main/java/com/romraider/logger/external/ecotrons/io/AlmConnection.java b/src/main/java/com/romraider/logger/external/ecotrons/io/AlmConnection.java new file mode 100644 index 000000000..7800377b8 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/ecotrons/io/AlmConnection.java @@ -0,0 +1,30 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.ecotrons.io; + +public interface AlmConnection { + byte readByte(); + + void readBytes(byte[] bytes); + + void write(byte[] bytes); + + void close(); +} diff --git a/src/main/java/com/romraider/logger/external/ecotrons/io/AlmConnectionProperties.java b/src/main/java/com/romraider/logger/external/ecotrons/io/AlmConnectionProperties.java new file mode 100644 index 000000000..f0b316e91 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/ecotrons/io/AlmConnectionProperties.java @@ -0,0 +1,68 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.ecotrons.io; + +import com.romraider.io.connection.ConnectionProperties; + +public final class AlmConnectionProperties implements ConnectionProperties { + public int getBaudRate() { + return 115200; + } + + public void setBaudRate(int b) { + + } + + public int getDataBits() { + return 8; + } + + public int getStopBits() { + return 1; + } + + public int getParity() { + return 0; + } + + public int getConnectTimeout() { + return 2000; + } + + public int getSendTimeout() { + return 500; + } + + @Override + public String toString() { + final String properties = String.format( + "%s[baudRate=%d, dataBits=%d, stopBits=%d, parity=%d, " + + "connectTimeout=%d, sendTimeout=%d]", + getClass().getSimpleName(), + getBaudRate(), + getDataBits(), + getStopBits(), + getParity(), + getConnectTimeout(), + getSendTimeout() + ); + return properties; + } +} diff --git a/src/main/java/com/romraider/logger/external/ecotrons/io/AlmRunner.java b/src/main/java/com/romraider/logger/external/ecotrons/io/AlmRunner.java new file mode 100644 index 000000000..ee3640bd8 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/ecotrons/io/AlmRunner.java @@ -0,0 +1,182 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.ecotrons.io; + +import static com.romraider.util.ByteUtil.byteListToBytes; +import static com.romraider.util.HexUtil.asHex; +import static org.apache.log4j.Logger.getLogger; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import com.romraider.logger.external.core.Stoppable; +import com.romraider.logger.external.ecotrons.plugin.AlmDataItem; +import com.romraider.logger.external.ecotrons.plugin.AlmDataProcessor; +import com.romraider.logger.external.ecotrons.plugin.AlmSensorType; + +public final class AlmRunner implements Stoppable { + private static final Logger LOGGER = getLogger(AlmRunner.class); + private static final byte[] CONNECT_CMD = { + (byte) 0x80, (byte) 0x8F, (byte) 0xEA, 0x03, (byte) 0x9C, 0x01, 0x00, (byte) 0x99}; + private static final byte[] START_CMD = { + (byte) 0x80, (byte) 0x8F, (byte) 0xEA, 0x03, (byte) 0x9C, 0x0D, 0x00, (byte) 0xA5}; + private static final byte[] STOP_CMD = { + (byte) 0x80, (byte) 0x8F, (byte) 0xEA, 0x03, (byte) 0x9C, 0x09, 0x00, (byte) 0xA5}; + private final AlmConnection connection; + private final Map dataItems; + private boolean stop; + private boolean init = true; + private boolean error; + private int stage; + + public AlmRunner(String port, Map dataItems) { + connection = new AlmSerialConnection(port); + this.dataItems = dataItems; + } + + @Override + public void run() { + try { + int length = 0; + boolean packetStarted = false; + final List buffer = new ArrayList(64); + while (!stop) { + if (stage == 0 && init) { + connection.write(CONNECT_CMD); + init = false; + } + if (stage == 1 && init) { + connection.write(START_CMD); + init = false; + } + byte b = connection.readByte(); + if (b == (byte) 0x8F + && buffer.size() >= 1 + && buffer.get(buffer.size() - 1) == (byte) 0x80) { + packetStarted = false; + buffer.add(b); + } + else if (b == (byte) 0xEA + && buffer.size() >= 2 + && buffer.get(buffer.size() - 1) == (byte) 0x8F + && buffer.get(buffer.size() - 2) == (byte) 0x80) { + packetStarted = true; + error = false; + buffer.add(b); + } + else if (packetStarted && length == 0) { + buffer.add(b); + length = b; + final byte[] bytes = new byte[length + 1]; + connection.readBytes(bytes); + for (byte data : bytes) { + buffer.add(data); + } + } + else if (error && (b != (byte) 0x80)) { + buffer.clear(); + } + else { + buffer.add(b); + } + + if (buffer.size() == (length + 5)) { + final byte cs = AlmChecksumCalculator.calculateChecksum(buffer); + if (cs == buffer.get(buffer.size() - 1)) { + if (stage == 0) { + if (buffer.get(4) == (byte) 0xE5 + && buffer.get(5) == (byte) 0x01) { + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format( + "Stage:%d, ALM Connect response:%s", + stage, asHex(toArray(buffer)))); + stage = 1; + error = false; + init = true; + } + else { + error = true; + init = false; + } + } + else if (stage > 0) { + if (buffer.get(4) == (byte) 0xE5 + && buffer.get(5) == (byte) 0x0D) { + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format( + "Stage:%d, ALM measuring response:%s", + stage, asHex(toArray(buffer)))); + stage = 2; + error = false; + init = true; + AlmDataProcessor.parseResponse(dataItems, buffer); + } + else { + error = true; + init = false; + } + } + } + else { + error = true; + LOGGER.error(String.format( + "Stage:%d, ALM checksum failure:%s, expected:%02X", + stage, asHex(toArray(buffer)), cs)); + } + buffer.clear(); + packetStarted = false; + length = 0; + } + } + } + catch (Throwable t) { + LOGGER.error("Error occurred", t); + } + finally { + if (stage == 2) { + error = false; + init = true; + stage = 0; + connection.write(STOP_CMD); + final byte[] response = new byte[8]; + connection.readBytes(response); + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format( + "Stage:%d, ALM stop response:%s", + stage, asHex(response))); + } + connection.close(); + } + } + + @Override + public void stop() { + stop = true; + } + + private byte[] toArray(List buffer) { + final byte[] response = new byte[buffer.size()]; + byteListToBytes(buffer, response); + return response; + } +} diff --git a/src/main/java/com/romraider/logger/external/ecotrons/io/AlmSerialConnection.java b/src/main/java/com/romraider/logger/external/ecotrons/io/AlmSerialConnection.java new file mode 100644 index 000000000..27ff1c418 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/ecotrons/io/AlmSerialConnection.java @@ -0,0 +1,69 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.ecotrons.io; + +import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; + +import com.romraider.io.connection.ConnectionProperties; +import com.romraider.io.serial.connection.SerialConnection; +import com.romraider.io.serial.connection.SerialConnectionImpl; +import com.romraider.logger.ecu.exception.SerialCommunicationException; + +public final class AlmSerialConnection implements AlmConnection { + private final SerialConnection connection; + + public AlmSerialConnection(String port) { + checkNotNullOrEmpty(port, "port"); + connection = serialConnection(port); +// connection = new TestAlmConnection(); + } + + public byte readByte() { + return (byte) connection.read(); + } + + public void readBytes(byte[] bytes) { + try { + connection.read(bytes); + } catch (Exception e) { + close(); + throw new SerialCommunicationException(e); + } + } + + public void write(byte[] bytes) { + try { + connection.write(bytes); + } catch (Exception e) { + close(); + throw new SerialCommunicationException(e); + } + } + + public void close() { + connection.close(); + } + + private SerialConnectionImpl serialConnection(String port) { + final ConnectionProperties connectionProperties = + new AlmConnectionProperties(); + return new SerialConnectionImpl(port, connectionProperties); + } +} diff --git a/src/main/java/com/romraider/logger/external/ecotrons/io/TestAlmConnection.java b/src/main/java/com/romraider/logger/external/ecotrons/io/TestAlmConnection.java new file mode 100644 index 000000000..2fc64ac47 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/ecotrons/io/TestAlmConnection.java @@ -0,0 +1,348 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.ecotrons.io; + +import com.romraider.io.serial.connection.SerialConnection; +import static com.romraider.util.ThreadUtil.sleep; + +public final class TestAlmConnection implements SerialConnection { + private static final byte[] CONNECT_REPLY = { + (byte)0x80,(byte)0x8F,(byte)0xEA,0x32,(byte)0xE5,0x01,0x02,0x00, + (byte)0x93,0x00,(byte)0x93,0x00,0x00,0x00,0x32,0x04,0x00,0x00, + (byte)0x98,0x00,0x00,0x00,0x32,0x04,0x00,0x00,(byte)0xC8,0x01,0x00,0x00, + 0x08,0x04,0x03,0x03,0x02,0x03,0x01,0x00,0x00,0x4A,0x03,0x2E,0x00,0x01, + 0x00,0x01,0x00,(byte)0xCC,0x00,0x00,0x03,(byte)0xE8,0x07,(byte)0xD0,0x29}; + private static final byte[] STOP_REPLY = { + (byte) 0x80, (byte) 0x8F, (byte) 0xEA, 0x03, (byte) 0xE5, 0x09, 0x00, (byte) 0xA1}; + private int index; + private byte[] data; + private byte[] result = new byte[1]; + + public void write(byte[] bytes) { + if (bytes[4] == (byte) 0x9C) { + if (bytes[5] == (byte) 0x01) { + data = CONNECT_REPLY; + } + if (bytes[5] == (byte) 0x0D) { + data = getStart(); + } + if (bytes[5] == (byte) 0x09) { + data = STOP_REPLY; + } + index = 0; + } + } + + public int available() { + return 1; + } + + public void read(byte[] bytes) { + if (bytes.length == 1) { + bytes[0] = data[index++]; + } + else { + System.arraycopy(data, index, bytes, 0, bytes.length); + index += bytes.length; + } + if (index >= data.length) index = 0; + sleep(10); + } + + public byte[] readAvailable() { + throw new UnsupportedOperationException(); + } + + public void readStaleData() { + throw new UnsupportedOperationException(); + } + + public String readLine() { + throw new UnsupportedOperationException(); + } + + public int read() { + read(result); + return result[0]; + } + + public void close() { + index = 0; + } + + public void sendBreak(int duration) { + } + + private final byte[] getStart() { + return new byte[] { + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0B,0x21,(byte)0xAA,0x78,0x00,0x00,0x53,(byte)0xB9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xBE,(byte)0xAA,0x78,0x00,0x00,0x53,(byte)0x86,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x84, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x14,(byte)0xE5,0x0D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xAA,0x77,0x00,0x00,0x53,(byte)0xA9,0x00,0x00,0x1C, + (byte)0x80,(byte)0xC8,(byte)0x01,0x00,0x00, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xC9,(byte)0xAA,0x78,0x00,0x00,0x53,(byte)0x9F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xAD, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xFB,0x0B,0x0B,(byte)0xAA,0x78,0x00,0x00,0x53,(byte)0xA4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF6, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0B,0x16,(byte)0xAA,0x78,0x00,0x00,0x53,(byte)0x8A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xDE, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xC9,(byte)0xAA,0x7F,0x00,0x00,0x53,(byte)0x8A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x9A, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xC9,(byte)0xAA,0x7F,0x00,0x00,0x53,(byte)0xAD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC0, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xEA,(byte)0xAA,0x7F,0x00,0x00,0x53,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA6, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xDF,(byte)0xAA,0x7F,0x00,0x00,0x53,(byte)0x8A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xAD, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xD4,(byte)0xAA,0x7F,0x00,0x00,0x53,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x94, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xC9,(byte)0xAA,(byte)0x8A,0x00,0x00,0x53,(byte)0xAD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC5, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xEA,(byte)0xAA,(byte)0x8A,0x00,0x00,0x53,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xB7, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF0,0x0A,(byte)0xD4,(byte)0xAA,(byte)0x8A,0x00,0x00,0x53,(byte)0xBE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xDF, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xFC,0x0A,(byte)0xEA,(byte)0xAA,(byte)0x8A,0x00,0x00,0x53,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xBB, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xBE,(byte)0xAA,(byte)0x8A,0x00,0x00,0x53,(byte)0xD0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE5, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xDF,(byte)0xAA,(byte)0x90,0x00,0x00,0x53,(byte)0xA4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xDC, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xD4,(byte)0xAA,(byte)0x90,0x00,0x00,0x53,(byte)0xBE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE7, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xDF,(byte)0xAA,(byte)0x90,0x00,0x00,0x53,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xAB, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xBE,(byte)0xAA,(byte)0x90,0x00,0x00,0x53,(byte)0xAD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC1, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xDF,(byte)0xAA,(byte)0x90,0x00,0x00,0x53,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xAC, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xC9,(byte)0xAA,(byte)0x95,0x00,0x00,0x53,(byte)0xB6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE0, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xC9,(byte)0xAA,(byte)0x95,0x00,0x00,0x53,(byte)0xA4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC7, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xD4,(byte)0xAA,(byte)0x95,0x00,0x00,0x53,(byte)0xC7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF5, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xD4,(byte)0xAA,(byte)0x95,0x00,0x00,0x53,(byte)0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xAE, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xC9,(byte)0xAA,(byte)0x95,0x00,0x00,0x53,(byte)0xB6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xDF, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF4,0x0A,(byte)0xEA,(byte)0xAA,(byte)0x9E,0x00,0x00,0x53,(byte)0x86,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xD5, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3E,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xFB,0x0B,0x0B,(byte)0xAF,(byte)0x8C,0x00,0x00,0x4F,0x6A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xD1, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x3D,0x1C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x8C,0x00,0x00,0x4D,(byte)0xFA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xB9, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x37,0x6A,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x81,0x00,0x00,0x4C,(byte)0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x2C,(byte)0xA8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xBE,(byte)0xAF,(byte)0x81,0x00,0x00,0x4B,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x24,0x6B,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x81,0x00,0x00,0x49,(byte)0x9C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x87, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x1D,(byte)0xF9,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xEA,(byte)0xAF,(byte)0x81,0x00,0x00,0x47,(byte)0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x88, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x1B,0x22,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x81,0x00,0x00,0x46,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF8, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x18,(byte)0xA8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xDF,(byte)0xAF,(byte)0xA3,0x00,0x00,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4E, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x15,0x50,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xDF,(byte)0xAF,(byte)0xA3,0x00,0x00,0x43,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x12,0x68,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xA3,0x00,0x00,0x40,(byte)0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xD0, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x10,(byte)0xB9,0x00,0x00,0x00,0x00,0x0C,(byte)0xF4,0x0A,(byte)0xD4,(byte)0xAF,(byte)0xA3,0x00,0x00,0x3F,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x0F,0x5C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xD4,(byte)0xAF,(byte)0xA3,0x00,0x00,0x3D,0x4D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2F, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x0E,0x7C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xB3,(byte)0xAF,(byte)0x9E,0x00,0x00,0x3B,(byte)0xB1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x90, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x0D,0x6B,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xB3,(byte)0xAF,(byte)0x9E,0x00,0x00,0x39,(byte)0xBC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x88, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x0C,(byte)0xAA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x9E,0x00,0x00,0x38,0x59,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x0B,(byte)0xBD,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xBE,(byte)0xAF,(byte)0x9E,0x00,0x00,0x36,(byte)0xA6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC9, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x0A,(byte)0xFB,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x9E,0x00,0x00,0x34,(byte)0x9B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x0A,(byte)0x9C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xBE,(byte)0xAF,(byte)0xC8,0x00,0x00,0x33,(byte)0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC2, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x09,(byte)0xFA,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xDF,(byte)0xAF,(byte)0xC8,0x00,0x00,0x31,(byte)0xDD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x84, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x09,0x3B,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xC8,0x00,0x00,0x2F,(byte)0xB1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x80, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x08,(byte)0xE9,0x00,0x00,0x00,0x00,0x0C,(byte)0xEF,0x0A,(byte)0xD4,(byte)0xAF,(byte)0xC8,0x00,0x00,0x2E,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x8E, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x08,(byte)0xA9,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xDF,(byte)0xAF,(byte)0xC8,0x00,0x00,0x2C,(byte)0xCD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x08,0x53,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xEA,(byte)0xAF,(byte)0xDE,0x00,0x00,0x2B,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2F, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x07,(byte)0xEB,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xBE,(byte)0xAF,(byte)0xDE,0x00,0x00,0x29,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x8F, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x07,(byte)0xA8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xDF,(byte)0xAF,(byte)0xDE,0x00,0x00,0x27,(byte)0x9B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF5, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x07,0x6D,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xDF,(byte)0xAF,(byte)0xDE,0x00,0x00,0x26,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x07,0x2D,0x00,0x00,0x00,0x00,0x0C,(byte)0xF0,0x0A,(byte)0xC9,(byte)0xB0,0x06,0x00,0x00,0x24,(byte)0xC4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xAE, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x06,(byte)0xD3,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xC9,(byte)0xB0,0x06,0x00,0x00,0x22,(byte)0xB3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x06,(byte)0xA3,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xC9,(byte)0xB0,0x06,0x00,0x00,0x21,(byte)0x95,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF2, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x06,0x61,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xB0,0x06,0x00,0x00,0x1F,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x9A, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x06,0x2C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xDF,(byte)0xB0,0x06,0x00,0x00,0x1D,(byte)0xA4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x9C, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x06,0x08,0x00,0x00,0x00,0x00,0x0C,(byte)0xFE,0x0A,(byte)0xA8,(byte)0xB0,0x06,0x00,0x00,0x1C,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,(byte)0xCC,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0B,0x0B,(byte)0xAF,(byte)0xFA,0x00,0x00,0x1A,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFC, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,(byte)0xA4,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xDF,(byte)0xAF,(byte)0xFA,0x00,0x00,0x18,(byte)0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,(byte)0x89,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xFA,0x00,0x00,0x17,(byte)0xDF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xFA,0x00,0x00,0x16,(byte)0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x63,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xD4,(byte)0xAF,(byte)0xFA,0x00,0x00,0x16,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x4F,0x00,0x00,0x00,0x00,0x0C,(byte)0xF4,0x0A,(byte)0xDF,(byte)0xB0,0x17,0x00,0x00,0x15,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x42,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xC9,(byte)0xB0,0x17,0x00,0x00,0x14,(byte)0x92,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x99, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x33,0x00,0x00,0x00,0x00,0x0C,(byte)0xFB,0x0A,(byte)0xC9,(byte)0xB0,0x17,0x00,0x00,0x13,(byte)0xDA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xD3, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x16,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0B,0x00,(byte)0xB0,0x17,0x00,0x00,0x12,(byte)0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x8B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x09,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xD4,(byte)0xB0,0x17,0x00,0x00,0x11,(byte)0xDE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xB3, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xF7,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xC9,(byte)0xB0,0x18,0x00,0x00,0x10,(byte)0xEF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA5, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xE7,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xC9,(byte)0xB0,0x18,0x00,0x00,0x10,0x17,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xBB, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xDF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xF5,(byte)0xB0,0x18,0x00,0x00,0x0F,(byte)0xAA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xCF,0x00,0x00,0x00,0x00,0x0C,(byte)0xFB,0x0A,(byte)0xC9,(byte)0xB0,0x18,0x00,0x00,0x0E,(byte)0xDD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xBF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xD4,(byte)0xB0,0x18,0x00,0x00,0x0E,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x86, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xB0,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xEA,(byte)0xB0,0x18,0x00,0x00,0x0D,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xCE, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0x9F,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xC9,(byte)0xB0,0x18,0x00,0x00,0x0C,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xBB, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0x90,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xC9,(byte)0xB0,0x18,0x00,0x00,0x0B,(byte)0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC5, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0x85,0x00,0x00,0x00,0x00,0x0C,(byte)0xF0,0x0A,(byte)0xC9,(byte)0xB0,0x18,0x00,0x00,0x0A,(byte)0xD3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x7A,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xC9,(byte)0xB0,0x18,0x00,0x00,0x0A,0x25,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x69,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xF5,(byte)0xAF,(byte)0xFD,0x00,0x00,0x09,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x45, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x61,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xB3,(byte)0xAF,(byte)0xFD,0x00,0x00,0x08,(byte)0x91,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x54,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xFD,0x00,0x00,0x07,(byte)0xB5,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA1, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x46,0x00,0x00,0x00,0x00,0x0C,(byte)0xFB,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xFD,0x00,0x00,0x06,(byte)0xDA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xBD, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x40,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xB3,(byte)0xAF,(byte)0xFD,0x00,0x00,0x06,0x6B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2E, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x35,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xC9,(byte)0xB0,0x05,0x00,0x00,0x05,(byte)0xB1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x81, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x2E,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xC9,(byte)0xB0,0x05,0x00,0x00,0x05,0x2D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFC, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x24,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xC9,(byte)0xB0,0x05,0x00,0x00,0x04,0x7D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x20,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xA8,(byte)0xB0,0x05,0x00,0x00,0x04,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xDA, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x1A,0x00,0x00,0x00,0x00,0x0C,(byte)0xF0,0x0A,(byte)0xC9,(byte)0xB0,0x05,0x00,0x00,0x03,(byte)0xCE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x80, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x0F,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xD3,0x00,0x00,0x03,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x0B,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xD4,(byte)0xAF,(byte)0xD3,0x00,0x00,0x02,(byte)0xBA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x37, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x04,0x00,0x00,0x00,0x00,0x0C,(byte)0xF0,0x0A,(byte)0xDF,(byte)0xAF,(byte)0xD3,0x00,0x00,0x02,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xB3, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x04,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0B,0x21,(byte)0xAF,(byte)0xD3,0x00,0x00,0x02,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFC, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xF8,0x00,0x00,0x00,0x00,0x0C,(byte)0xFC,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xD3,0x00,0x00,0x01,0x57,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xBD, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xF4,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xEA,(byte)0xAF,(byte)0xA4,0x00,0x00,0x00,(byte)0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xF3,0x00,0x00,0x00,0x00,0x0C,(byte)0xFD,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xA4,0x00,0x00,0x00,(byte)0xE8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1A, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xE9,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xD4,(byte)0xAF,(byte)0xA4,0x00,0x00,0x00,0x37,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xE5,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xA4,0x00,0x00,(byte)0xFF,(byte)0xCD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE8, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xE5,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xA4,0x00,0x00,(byte)0xFF,(byte)0xCD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE4, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xE1,0x00,0x00,0x00,0x00,0x0C,(byte)0xFC,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x8A,0x00,0x00,(byte)0xFF,0x68,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDE,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x8A,0x00,0x00,(byte)0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDB,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x8A,0x00,0x00,(byte)0xFE,(byte)0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC9, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xBE,(byte)0xAF,(byte)0x8A,0x00,0x00,(byte)0xFE,0x4D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x37, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xDF,(byte)0xAF,(byte)0x8A,0x00,0x00,(byte)0xFE,(byte)0x9F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA8, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xD4,(byte)0xAF,0x69,0x00,0x00,(byte)0xFE,(byte)0x8A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xDF,(byte)0xAF,0x69,0x00,0x00,(byte)0xFE,(byte)0x8A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xA8,(byte)0xAF,0x69,0x00,0x00,(byte)0xFE,(byte)0x9F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xC9,(byte)0xAF,0x69,0x00,0x00,(byte)0xFE,0x4D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xD4,(byte)0xAF,0x69,0x00,0x00,(byte)0xFE,0x4D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD9,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xDF,(byte)0xAF,0x39,0x00,0x00,(byte)0xFE,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x23, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xDF,(byte)0xAF,0x39,0x00,0x00,(byte)0xFE,(byte)0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD5,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xD4,(byte)0xAF,0x39,0x00,0x00,(byte)0xFD,(byte)0xFD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA6, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD7,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xBE,(byte)0xAF,0x39,0x00,0x00,(byte)0xFE,0x3A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xD1, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD3,0x00,0x00,0x00,0x00,0x0C,(byte)0xF4,0x0A,(byte)0xDF,(byte)0xAF,0x39,0x00,0x00,(byte)0xFD,(byte)0xCA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD4,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xDF,(byte)0xAF,0x1F,0x00,0x00,(byte)0xFD,(byte)0xE8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD0,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xBE,(byte)0xAF,0x1F,0x00,0x00,(byte)0xFD,(byte)0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF9, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF0,0x0A,(byte)0xC9,(byte)0xAF,0x1F,0x00,0x00,(byte)0xFD,0x6F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE8, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCF,0x00,0x00,0x00,0x00,0x0C,(byte)0xEF,0x0A,(byte)0xD4,(byte)0xAF,0x1F,0x00,0x00,(byte)0xFD,0x6F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF2, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xBE,(byte)0xAF,0x1F,0x00,0x00,(byte)0xFD,0x6F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE6, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCC,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0B,0x0B,(byte)0xAF,0x2D,0x00,0x00,(byte)0xFD,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFF, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCE,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xC9,(byte)0xAF,0x2D,0x00,0x00,(byte)0xFD,0x5B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE6, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCE,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xDF,(byte)0xAF,0x2D,0x00,0x00,(byte)0xFD,0x5B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFC, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xEA,(byte)0xAF,0x2D,0x00,0x00,(byte)0xFD,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xAF, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCE,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xD4,(byte)0xAF,0x2D,0x00,0x00,(byte)0xFD,0x5B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xEF, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xDF,(byte)0xAF,0x28,0x00,0x00,(byte)0xFD,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x9F, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCD,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xEA,(byte)0xAF,0x28,0x00,0x00,(byte)0xFD,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xEA, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xC9,(byte)0xAF,0x28,0x00,0x00,(byte)0xFD,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x8E, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xAF,0x28,0x00,0x00,(byte)0xFD,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x8D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xBE,(byte)0xAF,0x28,0x00,0x00,(byte)0xFD,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x85, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCB,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xDF,(byte)0xAF,0x37,0x00,0x00,(byte)0xFD,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC4, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xC9,0x00,0x00,0x00,0x00,0x0C,(byte)0xFB,0x0A,(byte)0xD4,(byte)0xAF,0x37,0x00,0x00,(byte)0xFC,(byte)0xF6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x96, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCC,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xC9,(byte)0xAF,0x37,0x00,0x00,(byte)0xFD,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC8, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xBE,(byte)0xAF,0x37,0x00,0x00,(byte)0xFD,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x8D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCD,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xC9,(byte)0xAF,0x37,0x00,0x00,(byte)0xFD,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xDC, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xDF,(byte)0xAF,0x43,0x00,0x00,(byte)0xFD,0x6F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xBE,(byte)0xAF,0x43,0x00,0x00,(byte)0xFD,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x9F, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCB,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0B,0x0B,(byte)0xAF,0x43,0x00,0x00,(byte)0xFD,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xBE,(byte)0xAF,0x43,0x00,0x00,(byte)0xFD,0x6F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xB3,(byte)0xAF,0x43,0x00,0x00,(byte)0xFD,0x6F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFC, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xCF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0B,0x16,(byte)0xAF,0x4D,0x00,0x00,(byte)0xFD,0x6F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x69, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD3,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xC9,(byte)0xAF,0x4D,0x00,0x00,(byte)0xFD,(byte)0xCA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD2,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xB3,(byte)0xAF,0x4D,0x00,0x00,(byte)0xFD,(byte)0xAC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD3,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xAF,0x4D,0x00,0x00,(byte)0xFD,(byte)0xCA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD3,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xF5,(byte)0xAF,0x4D,0x00,0x00,(byte)0xFD,(byte)0xCA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA3, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD3,0x00,0x00,0x00,0x00,0x0C,(byte)0xEF,0x0A,(byte)0xDF,(byte)0xAF,0x4A,0x00,0x00,(byte)0xFD,(byte)0xCA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x87, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD5,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xDF,(byte)0xAF,0x4A,0x00,0x00,(byte)0xFE,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xCA, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xD4,(byte)0xAF,0x4A,0x00,0x00,(byte)0xFE,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xD7,0x00,0x00,0x00,0x00,0x0C,(byte)0xF0,0x0A,(byte)0xC9,(byte)0xAF,0x4A,0x00,0x00,(byte)0xFE,0x3A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE7, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xB3,(byte)0xAF,0x4A,0x00,0x00,(byte)0xFE,(byte)0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF0,0x0A,(byte)0xC9,(byte)0xAF,0x6B,0x00,0x00,(byte)0xFE,(byte)0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x65, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xEA,(byte)0xAF,0x6B,0x00,0x00,(byte)0xFE,(byte)0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x87, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xDF,(byte)0xAF,0x6B,0x00,0x00,(byte)0xFE,(byte)0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x83, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDD,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xBE,(byte)0xAF,0x6B,0x00,0x00,(byte)0xFE,(byte)0xFA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xCB, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDD,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xEA,(byte)0xAF,0x6B,0x00,0x00,(byte)0xFE,(byte)0xFA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF1, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDD,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xBE,(byte)0xAF,0x7E,0x00,0x00,(byte)0xFE,(byte)0xFA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xDD, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xDF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xC9,(byte)0xAF,0x7E,0x00,0x00,(byte)0xFF,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xE1,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xD4,(byte)0xAF,0x7E,0x00,0x00,(byte)0xFF,0x5F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x58, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xE2,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xD4,(byte)0xAF,0x7E,0x00,0x00,(byte)0xFF,(byte)0x86,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x87, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xE4,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xD4,(byte)0xAF,0x7E,0x00,0x00,(byte)0xFF,(byte)0xC3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC2, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xE8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0B,0x21,(byte)0xAF,(byte)0x99,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x84, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xED,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x99,0x00,0x00,0x00,(byte)0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA8, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xEA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xEA,(byte)0xAF,(byte)0x99,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xED,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x99,0x00,0x00,0x00,(byte)0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA7, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xF3,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x99,0x00,0x00,0x00,(byte)0xF3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xF8,0x00,0x00,0x00,0x00,0x0C,(byte)0xEF,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x99,0x00,0x00,0x01,0x57,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xF4,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xDF,(byte)0xAF,(byte)0x99,0x00,0x00,0x00,(byte)0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x39, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xFA,0x00,0x00,0x00,0x00,0x0C,(byte)0xFB,0x0B,0x0B,(byte)0xAF,(byte)0x99,0x00,0x00,0x01,(byte)0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF3, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xFD,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xBE,(byte)0xAF,(byte)0x99,0x00,0x00,0x01,(byte)0xAF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xCF, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xFA,0x00,0x00,0x00,0x00,0x0C,(byte)0xF0,0x0A,(byte)0xEA,(byte)0xAF,(byte)0x99,0x00,0x00,0x01,(byte)0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC6, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xFE,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xBE,(byte)0xAF,(byte)0x87,0x00,0x00,0x01,(byte)0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xD8, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x03,(byte)0xFF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x87,0x00,0x00,0x01,(byte)0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF7, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x02,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xDF,(byte)0xAF,(byte)0x87,0x00,0x00,0x02,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x39, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x04,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x87,0x00,0x00,0x02,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x08,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xEA,(byte)0xAF,(byte)0x87,0x00,0x00,0x02,(byte)0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xCB, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x08,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xB3,(byte)0xAF,(byte)0x90,0x00,0x00,0x02,(byte)0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x9D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x0A,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x90,0x00,0x00,0x02,(byte)0xA4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xD9, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x0E,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x90,0x00,0x00,0x02,(byte)0xFD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x13,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x90,0x00,0x00,0x03,0x4A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x93, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x15,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x90,0x00,0x00,0x03,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xBA, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x13,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xDF,(byte)0xAF,(byte)0x83,0x00,0x00,0x03,0x4A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x8E, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x1B,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x83,0x00,0x00,0x03,(byte)0xE3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x1C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x83,0x00,0x00,0x03,(byte)0xF9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x1E,0x00,0x00,0x00,0x00,0x0C,(byte)0xF0,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x83,0x00,0x00,0x04,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x20,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x83,0x00,0x00,0x04,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x85, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x24,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xD4,(byte)0xAF,(byte)0xA1,0x00,0x00,0x04,(byte)0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xF2, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x2C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xA1,0x00,0x00,0x05,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x2E,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xA1,0x00,0x00,0x05,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA0, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x32,0x00,0x00,0x00,0x00,0x0C,(byte)0xF9,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xA1,0x00,0x00,0x05,0x7A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xEA, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x31,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xDF,(byte)0xAF,(byte)0xA1,0x00,0x00,0x05,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE3, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x34,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xDF,(byte)0xAF,(byte)0x98,0x00,0x00,0x05,(byte)0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x37,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0B,0x0B,(byte)0xAF,(byte)0x98,0x00,0x00,0x05,(byte)0xC7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x3C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF4,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x98,0x00,0x00,0x06,0x29,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x96, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x43,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xDF,(byte)0xAF,(byte)0x98,0x00,0x00,0x06,(byte)0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x46,0x00,0x00,0x00,0x00,0x0C,(byte)0xF4,0x0A,(byte)0xEA,(byte)0xAF,(byte)0x98,0x00,0x00,0x06,(byte)0xDA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x46,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xDF,(byte)0xAF,(byte)0xA6,0x00,0x00,0x06,(byte)0xDA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x4A,0x00,0x00,0x00,0x00,0x0C,(byte)0xF4,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xA6,0x00,0x00,0x07,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA6, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x52,0x00,0x00,0x00,0x00,0x0C,(byte)0xFB,0x0A,(byte)0xF5,(byte)0xAF,(byte)0xA6,0x00,0x00,0x07,(byte)0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x65, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x54,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xAF,(byte)0xA6,0x00,0x00,0x07,(byte)0xB5,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x55,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xD4,(byte)0xAF,(byte)0xA6,0x00,0x00,0x07,(byte)0xCB,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x5C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xDF,(byte)0xAF,(byte)0x98,0x00,0x00,0x08,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE6, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x60,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0B,0x21,(byte)0xAF,(byte)0x98,0x00,0x00,0x08,0x7B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x62,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xBE,(byte)0xAF,(byte)0x98,0x00,0x00,0x08,(byte)0x9C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x23, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x6A,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x98,0x00,0x00,0x09,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC1, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x67,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xEA,(byte)0xAF,(byte)0x98,0x00,0x00,0x08,(byte)0xF5,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xB2, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x6E,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xDF,(byte)0xAF,(byte)0x85,0x00,0x00,0x09,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x75,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xD4,(byte)0xAF,(byte)0x85,0x00,0x00,0x09,(byte)0xCE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x7C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xBE,(byte)0xAF,(byte)0x85,0x00,0x00,0x0A,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xD2, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x7C,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xA8,(byte)0xAF,(byte)0x85,0x00,0x00,0x0A,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xBE, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,0x7E,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0B,0x16,(byte)0xAF,(byte)0x85,0x00,0x00,0x0A,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0x83,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xAF,0x6D,0x00,0x00,0x0A,(byte)0xB3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0x84,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xD4,(byte)0xAF,0x6D,0x00,0x00,0x0A,(byte)0xC9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0x91,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xBE,(byte)0xAF,0x6D,0x00,0x00,0x0B,(byte)0x8C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0x8C,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xA8,(byte)0xAF,0x6D,0x00,0x00,0x0B,0x4B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xBE, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0x97,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xAF,0x6D,0x00,0x00,0x0B,(byte)0xEF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x93, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0x97,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xDF,(byte)0xAF,0x6C,0x00,0x00,0x0B,(byte)0xEF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA8, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0x9F,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xC9,(byte)0xAF,0x6C,0x00,0x00,0x0C,0x5B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xA4,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xC9,(byte)0xAF,0x6C,0x00,0x00,0x0C,(byte)0x9D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xA8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0B,0x16,(byte)0xAF,0x6C,0x00,0x00,0x0C,(byte)0xDD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE0, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xAF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xBE,(byte)0xAF,0x6C,0x00,0x00,0x0D,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE8, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xB2,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0B,0x0B,(byte)0xAF,0x70,0x00,0x00,0x0D,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x69, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xB7,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xDF,(byte)0xAF,0x70,0x00,0x00,0x0D,(byte)0xA1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xBE,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xD4,(byte)0xAF,0x70,0x00,0x00,0x0D,(byte)0xF9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xD4, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xC8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xDF,(byte)0xAF,0x70,0x00,0x00,0x0E,0x7B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xC8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xD4,(byte)0xAF,0x70,0x00,0x00,0x0E,0x7B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xCB,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0B,0x16,(byte)0xAF,(byte)0x83,0x00,0x00,0x0E,(byte)0xA7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE6, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xD0,0x00,0x00,0x00,0x00,0x0C,(byte)0xFB,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x83,0x00,0x00,0x0E,(byte)0xE7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE2, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xD6,0x00,0x00,0x00,0x00,0x0C,(byte)0xF1,0x0A,(byte)0xC9,(byte)0xAF,(byte)0x83,0x00,0x00,0x0F,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2B, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xDC,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xDF,(byte)0xAF,(byte)0x83,0x00,0x00,0x0F,(byte)0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA1, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xE3,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xDF,(byte)0xAF,(byte)0x83,0x00,0x00,0x0F,(byte)0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFF, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xE6,0x00,0x00,0x00,0x00,0x0C,(byte)0xEE,0x0A,(byte)0xC9,(byte)0xAF,0x6D,0x00,0x00,0x10,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFC, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xEE,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xB3,(byte)0xAF,0x6D,0x00,0x00,0x10,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xF5,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xBE,(byte)0xAF,0x6D,0x00,0x00,0x10,(byte)0xCF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xCF, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xF0,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xEA,(byte)0xAF,0x6D,0x00,0x00,0x10,(byte)0x8E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xB0, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xFF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xD4,(byte)0xAF,0x6D,0x00,0x00,0x11,0x5B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7A, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xF8,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xDF,(byte)0xAF,0x74,0x00,0x00,0x10,(byte)0xFA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x04,(byte)0xFF,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xEA,(byte)0xAF,0x74,0x00,0x00,0x11,0x5B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x94, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x09,0x00,0x00,0x00,0x00,0x0C,(byte)0xF7,0x0A,(byte)0xBE,(byte)0xAF,0x74,0x00,0x00,0x11,(byte)0xD3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xED, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x09,0x00,0x00,0x00,0x00,0x0C,(byte)0xFA,0x0A,(byte)0xC9,(byte)0xAF,0x74,0x00,0x00,0x11,(byte)0xD3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFB, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x0F,0x00,0x00,0x00,0x00,0x0C,(byte)0xFB,0x0A,(byte)0xD4,(byte)0xAF,0x74,0x00,0x00,0x12,0x29,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x10,0x00,0x00,0x00,0x00,0x0C,(byte)0xF3,0x0A,(byte)0xDF,(byte)0xAF,0x6F,0x00,0x00,0x12,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x20,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xAF,0x6F,0x00,0x00,0x12,(byte)0xF7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2E, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x21,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xC9,(byte)0xAF,0x6F,0x00,0x00,0x13,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x21,0x00,0x00,0x00,0x00,0x0C,(byte)0xF8,0x0A,(byte)0xDF,(byte)0xAF,0x6F,0x00,0x00,0x13,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5D, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x23,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xF5,(byte)0xAF,0x6F,0x00,0x00,0x13,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x8A, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x2B,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xBE,(byte)0xAF,0x61,0x00,0x00,0x13,0x79,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0x9F, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x2E,0x00,0x00,0x00,0x00,0x0C,(byte)0xFC,0x0A,(byte)0xC9,(byte)0xAF,0x61,0x00,0x00,0x13,(byte)0xA4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xE2, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x39,0x00,0x00,0x00,0x00,0x0C,(byte)0xF5,0x0A,(byte)0xD4,(byte)0xAF,0x61,0x00,0x00,0x14,0x26,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x42,0x00,0x00,0x00,0x00,0x0C,(byte)0xF2,0x0A,(byte)0xB3,(byte)0xAF,0x61,0x00,0x00,0x14,(byte)0x92,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xC5, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x48,0x00,0x00,0x00,0x00,0x0C,(byte)0xF6,0x0A,(byte)0xC9,(byte)0xAF,0x61,0x00,0x00,0x14,(byte)0xD4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27, + (byte)0x80,(byte)0x8F,(byte)0xEA,0x22,(byte)0xE5,0x0D,0x05,0x4A,0x00,0x00,0x00,0x00,0x0C,(byte)0xFC,0x0A,(byte)0xBE,(byte)0xAF,0x54,0x00,0x00,0x14,(byte)0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x37 + }; + } +} diff --git a/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmDataItem.java b/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmDataItem.java new file mode 100644 index 000000000..08d9c44c2 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmDataItem.java @@ -0,0 +1,60 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.ecotrons.plugin; + +import static com.romraider.logger.external.core.ExternalDataConvertorLoader.loadConvertors; + +import com.romraider.logger.ecu.definition.EcuDataConvertor; +import com.romraider.logger.external.core.DataListener; +import com.romraider.logger.external.core.ExternalDataItem; +import com.romraider.logger.external.core.ExternalSensorConversions; + +public final class AlmDataItem implements ExternalDataItem, DataListener { + private EcuDataConvertor[] convertors; + private final String name; + private double data; + + public AlmDataItem(String name, ExternalSensorConversions... convertorList) { + super(); + this.name = name; + convertors = new EcuDataConvertor[convertorList.length]; + convertors = loadConvertors(this, convertors, convertorList); + } + + public String getName() { + return "ECOTRONS ALM " + name; + } + + public String getDescription() { + return "ECOTRONS ALM " + name + " data"; + } + + public double getData() { + return data; + } + + public void setData(double data) { + this.data = data; + } + + public EcuDataConvertor[] getConvertors() { + return convertors; + } +} diff --git a/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmDataProcessor.java b/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmDataProcessor.java new file mode 100644 index 000000000..7dd07ec87 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmDataProcessor.java @@ -0,0 +1,94 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.ecotrons.plugin; + +import static com.romraider.util.ByteUtil.asSignedInt; +import static com.romraider.util.ByteUtil.asUnsignedInt; +import static com.romraider.util.ByteUtil.byteListToBytes; + +import java.util.List; +import java.util.Map; + + +public final class AlmDataProcessor { + + private AlmDataProcessor() {} + + public final static void parseResponse( + Map dataItems, + List buffer) { + + final byte[] response = new byte[buffer.size()]; + byteListToBytes(buffer, response); + for (AlmSensorType sensor : dataItems.keySet()) { + int value = 0; + byte[] bytes = new byte[2]; + switch (sensor) { + case AFR1: + System.arraycopy(response, 6, bytes, 0, bytes.length); + value = asUnsignedInt(bytes); + dataItems.get(sensor).setData(value * 0.001); + break; + case AFR2: + System.arraycopy(response, 8, bytes, 0, bytes.length); + value = asUnsignedInt(bytes); + dataItems.get(sensor).setData(value * 0.001); + break; + case RPM: + System.arraycopy(response, 10, bytes, 0, bytes.length); + value = asUnsignedInt(bytes); + dataItems.get(sensor).setData(value * 40); + break; + case VDC1: + System.arraycopy(response, 12, bytes, 0, bytes.length); + value = asUnsignedInt(bytes); + dataItems.get(sensor).setData(value * 5 / 1024); + break; + case VDC2: + System.arraycopy(response, 14, bytes, 0, bytes.length); + value = asUnsignedInt(bytes); + dataItems.get(sensor).setData(value * 5 / 1024); + break; + case TEMP1: + System.arraycopy(response, 16, bytes, 0, bytes.length); + value = asUnsignedInt(bytes); + dataItems.get(sensor).setData(value * 0.023438 - 273); + break; + case TEMP2: + System.arraycopy(response, 18, bytes, 0, bytes.length); + value = asUnsignedInt(bytes); + dataItems.get(sensor).setData(value * 0.023438 - 273); + break; + case O21: + System.arraycopy(response, 20, bytes, 0, bytes.length); + value = asSignedInt(bytes); + dataItems.get(sensor).setData(value * 0.001); + break; + case O22: + System.arraycopy(response, 22, bytes, 0, bytes.length); + value = asSignedInt(bytes); + dataItems.get(sensor).setData(value * 0.001); + break; + default: + break; + } + } + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmDataSource.java b/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmDataSource.java new file mode 100644 index 000000000..2918a41c5 --- /dev/null +++ b/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmDataSource.java @@ -0,0 +1,116 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.ecotrons.plugin; + +import static com.romraider.logger.external.core.SensorConversionsLambda.AFR_146; +import static com.romraider.logger.external.core.SensorConversionsLambda.AFR_147; +import static com.romraider.logger.external.core.SensorConversionsLambda.AFR_155; +import static com.romraider.logger.external.core.SensorConversionsLambda.AFR_172; +import static com.romraider.logger.external.core.SensorConversionsLambda.AFR_34; +import static com.romraider.logger.external.core.SensorConversionsLambda.AFR_64; +import static com.romraider.logger.external.core.SensorConversionsLambda.AFR_90; +import static com.romraider.logger.external.core.SensorConversionsLambda.LAMBDA; +import static com.romraider.logger.external.core.SensorConversionsOther.ENGINE_RPM; +import static com.romraider.logger.external.core.SensorConversionsOther.EXHAUST_DEG_C; +import static com.romraider.logger.external.core.SensorConversionsOther.EXHAUST_DEG_C2F; +import static com.romraider.logger.external.core.SensorConversionsOther.PERCENT; +import static com.romraider.logger.external.core.SensorConversionsOther.VOLTS_5DC; +import static com.romraider.logger.external.ecotrons.plugin.AlmSensorType.AFR1; +import static com.romraider.logger.external.ecotrons.plugin.AlmSensorType.AFR2; +import static com.romraider.logger.external.ecotrons.plugin.AlmSensorType.O21; +import static com.romraider.logger.external.ecotrons.plugin.AlmSensorType.O22; +import static com.romraider.logger.external.ecotrons.plugin.AlmSensorType.RPM; +import static com.romraider.logger.external.ecotrons.plugin.AlmSensorType.TEMP1; +import static com.romraider.logger.external.ecotrons.plugin.AlmSensorType.TEMP2; +import static com.romraider.logger.external.ecotrons.plugin.AlmSensorType.VDC1; +import static com.romraider.logger.external.ecotrons.plugin.AlmSensorType.VDC2; +import static com.romraider.util.ThreadUtil.runAsDaemon; +import static java.util.Collections.unmodifiableList; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.swing.Action; + +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.external.core.ExternalDataItem; +import com.romraider.logger.external.core.ExternalDataSource; +import com.romraider.logger.external.ecotrons.io.AlmRunner; + +public final class AlmDataSource implements ExternalDataSource { + private final Map dataItems = new HashMap(); + private AlmRunner runner; + private String port; + + { + dataItems.put(AFR1, new AlmDataItem("lambda 1", AFR_147, LAMBDA, AFR_90, AFR_146, AFR_64, AFR_155, AFR_172, AFR_34)); + dataItems.put(AFR2, new AlmDataItem("lambda 2", AFR_147, LAMBDA, AFR_90, AFR_146, AFR_64, AFR_155, AFR_172, AFR_34)); + dataItems.put(RPM, new AlmDataItem("RPM", ENGINE_RPM)); + dataItems.put(TEMP1, new AlmDataItem("Temperature 1", EXHAUST_DEG_C, EXHAUST_DEG_C2F)); + dataItems.put(TEMP2, new AlmDataItem("Temperature 2", EXHAUST_DEG_C, EXHAUST_DEG_C2F)); + dataItems.put(VDC1, new AlmDataItem("VDC 1", VOLTS_5DC)); + dataItems.put(VDC2, new AlmDataItem("VDC 2", VOLTS_5DC)); + dataItems.put(O21, new AlmDataItem("O2 Concentration 1", PERCENT)); + dataItems.put(O22, new AlmDataItem("O2 Concentration 2", PERCENT)); + } + + public String getId() { + return getClass().getName(); + } + + public String getName() { + return "ECOTRONS Accurate Lambda Meter"; + } + + public String getVersion() { + return "0.01"; + } + + public List getDataItems() { + return unmodifiableList(new ArrayList(dataItems.values())); + } + + public Action getMenuAction(EcuLogger logger) { + return null; + } + + public void setPort(String port) { + this.port = port; + } + + public String getPort() { + return port; + } + + public void setProperties(Properties properties) { + } + + public void connect() { + runner = new AlmRunner(port, dataItems); + runAsDaemon(runner); + } + + public void disconnect() { + if (runner != null) runner.stop(); + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmSensorType.java b/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmSensorType.java new file mode 100644 index 000000000..400a14c8e --- /dev/null +++ b/src/main/java/com/romraider/logger/external/ecotrons/plugin/AlmSensorType.java @@ -0,0 +1,33 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.external.ecotrons.plugin; + +public enum AlmSensorType { + AFR1, + AFR2, + RPM, + VDC1, + VDC2, + TEMP1, + TEMP2, + O21, + O22, + UNKNOWN; +} diff --git a/src/main/java/com/romraider/logger/external/fourteenpoint7/io/NawConnectionImpl.java b/src/main/java/com/romraider/logger/external/fourteenpoint7/io/NawConnectionImpl.java index e41ae952c..fd3eebc78 100644 --- a/src/main/java/com/romraider/logger/external/fourteenpoint7/io/NawConnectionImpl.java +++ b/src/main/java/com/romraider/logger/external/fourteenpoint7/io/NawConnectionImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,11 +37,13 @@ public NawConnectionImpl(String port) { connection = serialConnection(port); } + @Override public byte[] readBytes() { try { byte[] bytes = new byte[9]; connection.read(bytes); - LOGGER.trace("NAW_7S Response: " + asHex(bytes)); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("NAW_7S Response: " + asHex(bytes)); return bytes; } catch (Exception e) { close(); @@ -49,6 +51,7 @@ public byte[] readBytes() { } } + @Override public void write(byte[] bytes) { try { connection.write(bytes); @@ -58,6 +61,7 @@ public void write(byte[] bytes) { } } + @Override public void close() { connection.close(); } diff --git a/src/main/java/com/romraider/logger/external/fourteenpoint7/plugin/NawConvertorImpl.java b/src/main/java/com/romraider/logger/external/fourteenpoint7/plugin/NawConvertorImpl.java index a43af8c1e..de0e60576 100644 --- a/src/main/java/com/romraider/logger/external/fourteenpoint7/plugin/NawConvertorImpl.java +++ b/src/main/java/com/romraider/logger/external/fourteenpoint7/plugin/NawConvertorImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,6 +60,7 @@ public final class NawConvertorImpl implements NawConvertor { private static final Logger LOGGER = getLogger(NawConvertorImpl.class); + @Override public double convert(byte[] bytes) { int temp = 0; double lambda = 0.0; @@ -79,14 +80,15 @@ public double convert(byte[] bytes) { } else { // Rich lambda = ((0.00003453 * unCalIp * unCalIp) - (0.00159 * unCalIp) + 0.6368); } - temp = (0x000000FF & ((int) bytes[8])); // convert signed byte to unsigned byte + temp = (0x000000FF & (bytes[8])); // convert signed byte to unsigned byte if (temp < 11) { // check sensor temperature range for valid reading lambda = 99.99; // sensor too hot } else if (temp > 19) { lambda = -99.99; // sensor too cold } temp = 1500 / temp; // temperature in percent, 100% is best - LOGGER.trace("Converting NAW_7S response: " + asHex(bytes) + " --> Ip:" + unCalIp + " --> temp:" + temp + "% --> lambda:" + lambda); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Converting NAW_7S response: " + asHex(bytes) + " --> Ip:" + unCalIp + " --> temp:" + temp + "% --> lambda:" + lambda); return lambda; } } diff --git a/src/main/java/com/romraider/logger/external/fourteenpoint7/plugin/NawDataSource.java b/src/main/java/com/romraider/logger/external/fourteenpoint7/plugin/NawDataSource.java index 6f779626c..a4e0b7ffd 100644 --- a/src/main/java/com/romraider/logger/external/fourteenpoint7/plugin/NawDataSource.java +++ b/src/main/java/com/romraider/logger/external/fourteenpoint7/plugin/NawDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ import static java.util.Arrays.asList; import java.util.List; +import java.util.Properties; import javax.swing.Action; @@ -72,6 +73,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new NawRunner(port, dataItem); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSConnector.java b/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSConnector.java index 181e41406..992bfaef3 100644 --- a/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSConnector.java +++ b/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSConnector.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,11 +22,15 @@ import static com.romraider.logger.external.innovate.generic.mts.io.MTSFactory.createMTS; import static org.apache.log4j.Logger.getLogger; -import java.util.HashSet; -import java.util.Set; +import java.util.HashMap; +//import java.util.HashSet; +import java.util.Map; +//import java.util.Set; import org.apache.log4j.Logger; +import com.romraider.logger.external.innovate.lm2.mts.plugin.Lm2MtsDataItem; + public final class MTSConnector { private static final Logger LOGGER = getLogger(MTSConnector.class); @@ -35,7 +39,7 @@ public final class MTSConnector { { createMts(); } - + /** * MTS Connector is a set of methods to create the MTS connection, * retrieve a set of available ports and the sensor inputs available @@ -56,11 +60,11 @@ public MTSConnector(int mtsPort) { public MTS getMts() { return mts; } - + public int[] getMtsPorts() { return ports; } - + public void usePort(int mtsPort) { mts(mtsPort); } @@ -70,15 +74,9 @@ public void dispose() { mts.dispose(); } - private void createMts() { - // create mts interface - try { - mts = createMTS(); - mts.disconnect(); - } - catch (com4j.ExecutionException e) { - LOGGER.error("COM4J error creating MTS interface: " + e); - } + private void createMts() throws com4j.ComException{ + mts = createMTS(); + mts.disconnect(); } private void setMtsPorts() { @@ -102,7 +100,7 @@ private void setMtsPorts() { throw t; } } - + public void mts(int mtsPort) { // bail out early if we know specified mts port is invalid if (mtsPort < 0) throw new IllegalArgumentException("Bad Innovate MTS port: " + mtsPort); @@ -110,7 +108,7 @@ public void mts(int mtsPort) { try { int portCount = mts.portCount(); if (portCount <= 0) throw new IllegalStateException("No Innovate MTS ports found"); - + // select the specified port mts.currentPort(mtsPort); String portName = mts.portName(); @@ -123,8 +121,11 @@ public void mts(int mtsPort) { } } - public Set getSensors() { - Set sensors = new HashSet(); + public Map getSensors() { +// Set sensors = new HashSet(); + final Map dataItems = + new HashMap(); + try { // attempt to connect to the specified device mts.connect(); @@ -138,16 +139,28 @@ public Set getSensors() { for (int i = 0; i < inputCount; i++) { // report each input found mts.currentInput(i); - MTSSensor sensor = new MTSSensor(); - sensor.setInputNumber(i); - sensor.setInputName(mts.inputName()); - sensor.setDeviceName(mts.inputDeviceName()); - sensor.setDeviceChannel(mts.inputDeviceChannel()); - sensor.setUnits(mts.inputUnit()); - sensor.setMinValue(mts.inputMinValue()); - sensor.setMaxValue(mts.inputMaxValue()); - sensors.add(sensor); - LOGGER.debug(String.format( +// MTSSensor sensor = new MTSSensor(); +// sensor.setInputNumber(i); +// sensor.setInputName(mts.inputName()); +// sensor.setDeviceName(mts.inputDeviceName()); +// sensor.setDeviceChannel(mts.inputDeviceChannel()); +// sensor.setUnits(mts.inputUnit()); +// sensor.setMinValue(mts.inputMinValue()); +// sensor.setMaxValue(mts.inputMaxValue()); +// sensor.setMultiplier(mts.inputAFRMultiplier()); +// sensors.add(sensor); + dataItems.put( + i, + new Lm2MtsDataItem( + mts.inputDeviceName(), + mts.inputDeviceChannel(), + mts.inputUnit(), + mts.inputMinValue(), + mts.inputMaxValue(), + mts.inputAFRMultiplier() + )); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(String.format( "Innovate MTS: InputNo: %02d, InputName: %s, InputType: %d, DeviceName: %s, DeviceType: %d, DeviceChannel: %d, Units: %s, Multiplier: %f, MinValue: %f, MaxValue: %f", i, mts.inputName(), mts.inputType(), mts.inputDeviceName(), mts.inputDeviceType(), mts.inputDeviceChannel(), mts.inputUnit(), mts.inputAFRMultiplier(), mts.inputMinValue(), mts.inputMaxValue())); } @@ -162,6 +175,6 @@ public Set getSensors() { } finally { } - return sensors; + return dataItems; } } \ No newline at end of file diff --git a/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSRunner.java b/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSRunner.java index f10a0e77d..3ef19e8b9 100644 --- a/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSRunner.java +++ b/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSRunner.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,28 +35,35 @@ import com.romraider.logger.external.core.Stoppable; import com.romraider.logger.external.innovate.lm2.mts.plugin.Lm2MtsDataItem; -// import com4j.EventCookie; +import com4j.EventCookie; public final class MTSRunner implements MTSEvents, Stoppable { private static final Logger LOGGER = getLogger(MTSRunner.class); private final Map dataItems; -// private EventCookie connectionEventCookie; + private EventCookie connectionEventCookie; private final MTS mts; private boolean running; private boolean stop; + private boolean pollMode; /** * MTSRunner contains the work-horse methods to process the MTS stream * data and update the appropriate sensor result. Once started this class - * reads data at a set interval from the MTS stream. - * Events processing appears to be problematic via COM4J and therefore not used. + * listens to NewData Events. + * If Event processing appears problematic set the pollmode option to true + * in the lm2_mts.plugin file to enable reading data from the MTS stream + * rather than waiting for NewData events. */ - public MTSRunner(int mtsPort, Map dataItems) { + public MTSRunner(int mtsPort, Map dataItems, + boolean pollMode) { MTSConnector connection = new MTSConnector(mtsPort); this.mts = connection.getMts(); this.dataItems = dataItems; + this.pollMode = pollMode; } + @Override public void run() { running = true; try { @@ -68,6 +75,7 @@ public void run() { } } + @Override public void stop() { stop = true; // wait for it to stop running so mts can disconnect/dispose... timeout after 5secs @@ -78,14 +86,14 @@ public void stop() { private void doRun() { try { // attempt to connect to the specified device -// connectionEventCookie = mts.advise(MTSEvents.class, this); + connectionEventCookie = mts.advise(MTSEvents.class, this); mts.connect(); try { if (mts.inputCount() > 0) { while (!stop) { - readData(); - sleep(12L); + if (pollMode) readData(); + sleep(40L); } } else { @@ -97,14 +105,17 @@ private void doRun() { } } finally { - //connectionEventCookie.close(); + connectionEventCookie.close(); mts.dispose(); } } + @Override public void connectionEvent(int result) { if (result == 0) { mts.startData(); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Innovate MTS connection success, pollmode:" + pollMode); } else if (result == -1) { throw new IllegalStateException("No Innovate MTS Data detected"); @@ -113,79 +124,99 @@ else if (result == -1) { throw new IllegalStateException("Innovate MTS Connect Error: " + result); } } - + + @Override public void connectionError() { - mts.disconnect(); + stop(); throw new IllegalStateException("Innovate MTS Connection Timeout"); } + @Override public void newData() { - LOGGER.debug("Innovate MTS newData"); - //readData(); + if(!pollMode) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Innovate MTS newData event"); + readData(); + } } - + public void readData() { - for (int i = 0; i < mts.inputCount(); i++) { - float data = 0f; - - // select the input - mts.currentInput(i); - int type = mts.inputType(); - int function = mts.inputFunction(); - int sample = mts.inputSample(); - LOGGER.trace("Innovate MTS input = " + i + ", type = " + type + ", function = " + function + ", sample = " + sample); - - // 5V channel - // Determine the range between min and max, - // calculate what percentage of that our sample represents, - // shift back to match our offset from 0.0 for min - if (type == MTS_TYPE_VDC.getType()) { - if (function == MTS_FUNC_NOTLAMBDA.getFunction()) { - float min = mts.inputMinValue(); - float max = mts.inputMaxValue(); - data = ((max - min) * ((float) sample / 1024f)) + min; - } - else { - // this will report other functions, such as ERROR states - // as a negative constant value - data = (float)function * -1f; + Lm2MtsDataItem dataItem; + int type; + int function; + int sample; + float data = 0.0f; + float min; + float max; + float multiplier; + try { + for (int i = 0; i < mts.inputCount(); i++) { + // select the input + dataItem = dataItems.get(i); + mts.currentInput(i); + type = mts.inputType(); + function = mts.inputFunction(); + sample = mts.inputSample(); + + // 5V channel + // Determine the range between min and max, + // calculate what percentage of that our sample represents, + // shift back to match our offset from 0.0 for min + if (type == MTS_TYPE_VDC.getType()) { + if (function == MTS_FUNC_NOTLAMBDA.getFunction()) { + min = dataItem.getMinValue(); + max = dataItem.getMaxValue(); + data = ((max - min) * (sample / 1024f)) + min; + } + else { + // this will report other functions, such as ERROR states + // as a negative constant value + data = function * -1f; + } } - } - // AFR - // Take each sample step as .001 Lambda, - // add 0.5 (so our range is 0.5 to 1.523 for our 1024 steps), - // then multiply by the AFR multiplier - if (type == MTS_TYPE_AFR.getType()) { - if (function == MTS_FUNC_LAMBDA.getFunction()) { - float multiplier = mts.inputAFRMultiplier(); - data = ((float) sample / 1000f + 0.5f) * multiplier; - } - else if (function == MTS_FUNC_O2.getFunction()) { - data = ((float) sample / 10f); - } - else { - // this will report other functions, such as ERROR states - // as a negative constant value - data = (float)function * -1f; + // AFR + // Take each sample step as .001 Lambda, + // add 0.5 (so our range is 0.5 to 1.523 for our 1024 steps), + // then multiply by the AFR multiplier + if (type == MTS_TYPE_AFR.getType()) { + if (function == MTS_FUNC_LAMBDA.getFunction()) { + multiplier = dataItem.getMultiplier(); + data = (sample / 1000f + 0.5f) * multiplier; + } + else if (function == MTS_FUNC_O2.getFunction()) { + data = (sample / 10f); + } + else { + // this will report other functions, such as ERROR states + // as a negative constant value + data = function * -1f; + } } - } - // LAMBDA - // Identical to AFR, except we do not multiply for AFR. - if (type == MTS_TYPE_LAMBDA.getType()) { - if (function == MTS_FUNC_LAMBDA.getFunction()) { - data = (float) sample / 1000f + 0.5f; - } - else { - // this will report other functions, such as ERROR states - // as a negative constant value - data = (float)function * -1f; + // LAMBDA + // Identical to AFR, except we do not multiply for AFR. + if (type == MTS_TYPE_LAMBDA.getType()) { + if (function == MTS_FUNC_LAMBDA.getFunction()) { + data = sample / 1000f + 0.5f; + } + else { + // this will report other functions, such as ERROR states + // as a negative constant value + data = function * -1f; + } } + // set data for this sensor based on inputNumber + if (dataItem != null) dataItem.setData(data); + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format( + "Innovate MTS input: %d, type: %d, function: %d, sample: %d, result: %f", + i, type, function, sample, data)); } - // set data for this sensor based on inputNumber - Lm2MtsDataItem dataItem = dataItems.get(i); - if (dataItem != null) dataItem.setData(data); + } + catch (Exception e) { + LOGGER.error(String.format( + "Innovate MTS read data error: %s", e.toString())); } } } diff --git a/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSSensor.java b/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSSensor.java deleted file mode 100644 index bfbdac861..000000000 --- a/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/MTSSensor.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.logger.external.innovate.generic.mts.io; - -public class MTSSensor { - private int inputNumber = 0; - private String inputName = ""; - private String deviceName = ""; - private int deviceChannel = 0; - private String units = ""; - private float minValue = 0f; - private float maxValue = 0f; - - /** - * MTSSensor contains all the relevant information about a sensor as - * reported from information gathered from the MTS stream. A MTSSensor is - * created for each input found in the MTS stream. - */ - public MTSSensor() { - } - - public int getInputNumber() { - return inputNumber; - } - - public void setInputNumber(int input) { - inputNumber = input; - } - - public String getInputName() { - return inputName; - } - - public void setInputName(String name) { - inputName = name; - } - - public String getDeviceName() { - return deviceName; - } - - public void setDeviceName(String name) { - deviceName = name; - } - - public int getDeviceChannel() { - return deviceChannel; - } - - public void setDeviceChannel(int channel) { - deviceChannel = channel; - } - - public String getUnits() { - return units; - } - - public void setUnits(String unit) { - units = unit; - } - - public float getMinValue() { - return minValue; - } - - public void setMinValue(float value) { - minValue = value; - } - - public float getMaxValue() { - return maxValue; - } - - public void setMaxValue(float value) { - maxValue = value; - } -} diff --git a/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/Test.java b/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/Test.java index aa4f3681d..300b52965 100644 --- a/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/Test.java +++ b/src/main/java/com/romraider/logger/external/innovate/generic/mts/io/Test.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2014 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -103,7 +103,7 @@ public void Run() throws InterruptedException { // mts.currentInput(0); mts.currentPort(0); mts.connect(); - mts.startData(); +// mts.startData(); // notes: // the inputFunction() method retrieves the meaning of the sample - this can be lambda/AFR, @@ -128,7 +128,8 @@ public void Run() throws InterruptedException { // retrieve 10 samples // getSamples(10); - waitFor(60000); + System.out.println("Listening for 3600 seconds."); + waitFor(3600000); // dispose of the event handler instance connectionEventCookie.close(); @@ -145,11 +146,31 @@ public void Run() throws InterruptedException { // see the SDK doc for explanation of error codes public void connectionEvent(int result) { - System.out.printf("connectionEvent raised. result = %d%n", result); + // Triggered in response to every Connect() call + // Includes an integer result code: + // 0 = success + // -1 no data read, + // < -1 = unspecified internal error + if (result == 0) { + mts.startData(); + System.out.printf("Innovate MTS connection success: %d%n", result); + } + else if (result == -1) { + System.out.printf("No Innovate MTS Data detected: %d%n", result); + } + else { + System.out.printf("Innovate MTS Connect Error: %d%n", result); + } } public void connectionError() { - // occurs when there is an error in the data stream (i.e. I assume connection lost, protocol error) + // Triggered in response to a data timeout on + // the MTS connection - Application should expect + // no more data, but must still call Disconnect() + System.out.printf("connectionError raised, shutting down.%n"); + connectionEventCookie.close(); + mts.disconnect(); + mts.dispose(); } public void newData() { @@ -165,8 +186,8 @@ public void newData() { // float multiplier = mts.inputAFRMultiplier(); // int sampleMeaning = mts.inputFunction(); String str = String.format( - "%d, InputNo: %02d, InputName: %s, InputType: %d, DeviceName: %s, DeviceType: %d, DeviceChannel: %d, Units: %s, Multiplier: %f, MinValue: %f, MaxValue: %f, Sample: %f, Data: %f", - count, i, mts.inputName(), mts.inputType(), mts.inputDeviceName(), mts.inputDeviceType(), mts.inputDeviceChannel(), mts.inputUnit(), mts.inputAFRMultiplier(), mts.inputMinValue(), mts.inputMaxValue(), sample, data); + "%d, %d, InputNo: %02d, InputName: %s, InputType: %d, DeviceName: %s, DeviceType: %d, DeviceChannel: %d, Units: %s, Multiplier: %f, MinValue: %f, MaxValue: %f, Sample: %f, Data: %f", + count, System.currentTimeMillis(), i, mts.inputName(), mts.inputType(), mts.inputDeviceName(), mts.inputDeviceType(), mts.inputDeviceChannel(), mts.inputUnit(), mts.inputAFRMultiplier(), mts.inputMinValue(), mts.inputMaxValue(), sample, data); System.out.printf("%s%n", str); // System.out.printf("newData raised for Input: %02d, Function: %d, Data: %f,\tMultiplier: %f%n", i, sampleMeaning, data, multiplier); diff --git a/src/main/java/com/romraider/logger/external/innovate/generic/serial/io/InnovateRunner.java b/src/main/java/com/romraider/logger/external/innovate/generic/serial/io/InnovateRunner.java index e4f50f791..a3efbf0df 100644 --- a/src/main/java/com/romraider/logger/external/innovate/generic/serial/io/InnovateRunner.java +++ b/src/main/java/com/romraider/logger/external/innovate/generic/serial/io/InnovateRunner.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,6 +50,7 @@ public InnovateRunner(String port, DataListener listener) { this.listener = listener; } + @Override public void run() { try { while (!stop) { @@ -60,10 +61,12 @@ public void run() { int numWords = numWords(b0, b1); byte[] bytes = new byte[numWords * 2]; connection.read(bytes); - LOGGER.trace("Innovate response: " + packet(b0, b1, bytes)); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Innovate response: " + packet(b0, b1, bytes)); process(bytes); } else { - LOGGER.trace("Innovate discarded: " + asHex(b1)); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Innovate discarded: " + asHex(b1)); } } else if (isLm1HighByte(b0)) { byte b1 = nextByte(); @@ -74,13 +77,16 @@ public void run() { bytes[0] = b0; bytes[1] = b1; arraycopy(rest, 0, bytes, 2, rest.length); - LOGGER.trace("Innovate response: " + asHex(bytes)); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Innovate response: " + asHex(bytes)); process(bytes); } else { - LOGGER.trace("Innovate discarded: " + asHex(b1)); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Innovate discarded: " + asHex(b1)); } } else { - LOGGER.trace("Innovate discarded: " + asHex(b0)); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Innovate discarded: " + asHex(b0)); } } connection.close(); @@ -91,6 +97,7 @@ public void run() { } } + @Override public void stop() { stop = true; } @@ -102,7 +109,8 @@ private void process(byte[] bytes) { listener.setData(error); } else if (isOk(bytes)) { double afr = getAfr(bytes); - LOGGER.trace("Innovate AFR: " + afr); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Innovate AFR: " + afr); listener.setData(afr > MAX_AFR ? MAX_AFR : afr); } } diff --git a/src/main/java/com/romraider/logger/external/innovate/generic/serial/plugin/InnovateDataSource.java b/src/main/java/com/romraider/logger/external/innovate/generic/serial/plugin/InnovateDataSource.java index dedce986d..be6aca92f 100644 --- a/src/main/java/com/romraider/logger/external/innovate/generic/serial/plugin/InnovateDataSource.java +++ b/src/main/java/com/romraider/logger/external/innovate/generic/serial/plugin/InnovateDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ import static java.util.Arrays.asList; import java.util.List; +import java.util.Properties; import javax.swing.Action; @@ -72,6 +73,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new InnovateRunner(port, dataItem); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsDataItem.java b/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsDataItem.java index 59476e1f5..fc3aca836 100644 --- a/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsDataItem.java +++ b/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsDataItem.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2014 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,12 +31,18 @@ public final class Lm2MtsDataItem implements ExternalDataItem, DataListener { private int channel; private double data; private String units; + private float minValue; + private float maxValue; + private float multiplier; - public Lm2MtsDataItem(String name, int channel, String units, float minValue, float maxValue) { + public Lm2MtsDataItem(String name, int channel, String units, float minValue, float maxValue, float multiplier) { super(); this.name = name; this.channel = channel; this.units = units; + this.minValue = minValue; + this.maxValue = maxValue; + this.multiplier = multiplier; float step = (Math.abs(maxValue) + Math.abs(minValue)) / 10f; if (step > 0.5f) { step = (float) Math.round(step); @@ -67,6 +73,18 @@ public String getUnits() { return units; } + public float getMinValue() { + return minValue; + } + + public float getMaxValue() { + return maxValue; + } + + public float getMultiplier() { + return multiplier; + } + public void setData(double data) { this.data = data; } diff --git a/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsDataSource.java b/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsDataSource.java index 7bfd4f2b0..971942fba 100644 --- a/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsDataSource.java +++ b/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,25 +28,27 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; +import java.util.Properties; +//import java.util.Set; import javax.swing.Action; import org.apache.log4j.Logger; import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.ecu.exception.PluginNotInstalledException; import com.romraider.logger.external.core.ExternalDataItem; import com.romraider.logger.external.core.ExternalDataSource; -import com.romraider.logger.external.innovate.generic.mts.io.MTSSensor; +//import com.romraider.logger.external.innovate.generic.mts.io.MTSSensor; import com.romraider.logger.external.innovate.generic.mts.io.MTSConnector; import com.romraider.logger.external.innovate.generic.mts.io.MTSRunner; - public final class Lm2MtsDataSource implements ExternalDataSource { private static final Logger LOGGER = getLogger(Lm2MtsDataSource.class); - private final Map dataItems = new HashMap(); + private Map dataItems = new HashMap(); private MTSRunner runner; private int mtsPort = -1; + private boolean pollMode; /** * The Lm2MtsDataSource class is called when the Logger starts up and the @@ -57,32 +59,21 @@ public final class Lm2MtsDataSource implements ExternalDataSource { * one stream can be processed. */ { - final MTSConnector connector = new MTSConnector(); - int[] ports = connector.getMtsPorts(); - if (ports != null) { - for (int i = 0; i < ports.length; i++) { - connector.usePort(i); - Set sensors = connector.getSensors(); - if (sensors.isEmpty()) - continue; - dataItems.put(0, new Lm2MtsDataItem("LM-2", 0, "AFR", 9, 20)); // a default entry - for (MTSSensor sensor : sensors) { - dataItems.put( - sensor.getInputNumber(), - new Lm2MtsDataItem( - sensor.getDeviceName(), - sensor.getDeviceChannel(), - sensor.getUnits(), - sensor.getMinValue(), - sensor.getMaxValue() - )); - } - } - } - else { - throw new IllegalStateException("Innovate LogWorks MTS control does not appear to be installed on this computer"); - } - connector.dispose(); + try { + final MTSConnector connector = new MTSConnector(); + int[] ports = connector.getMtsPorts(); + if (ports != null) { + for (int i = 0; i < ports.length; i++) { + connector.usePort(i); + dataItems = connector.getSensors(); + } + } + + connector.dispose(); + } + catch(com4j.ExecutionException e) { + throw new PluginNotInstalledException("Innovate LogWorks MTS control does not appear to be installed on this computer"); + } } public String getId() { @@ -94,7 +85,7 @@ public String getName() { } public String getVersion() { - return "0.04"; + return "0.06"; } public List getDataItems() { @@ -113,8 +104,13 @@ public String getPort() { return "" + mtsPort; } + public void setProperties(Properties properties) { + final String pollMode = properties.getProperty("datasource.pollmode"); + this.pollMode = Boolean.parseBoolean(pollMode); + } + public void connect() { - runner = new MTSRunner(mtsPort, dataItems); + runner = new MTSRunner(mtsPort, dataItems, pollMode); runAsDaemon(runner); } diff --git a/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsPluginMenuAction.java b/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsPluginMenuAction.java index 2797c47d5..504353644 100644 --- a/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsPluginMenuAction.java +++ b/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsPluginMenuAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ import static javax.swing.JOptionPane.QUESTION_MESSAGE; import static javax.swing.JOptionPane.showInputDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; public final class Lm2MtsPluginMenuAction extends AbstractAction { private final ExternalDataSource dataSource; @@ -39,8 +40,9 @@ public Lm2MtsPluginMenuAction(EcuLogger logger, ExternalDataSource dataSource) { public void actionPerformed(ActionEvent actionEvent) { String port = (String) showInputDialog( logger, - "Select MTS port:", - dataSource.getName() + " Plugin Settings", + rb.getString("LPMAPORT"), + MessageFormat.format( + rb.getString("LPMAPORTTITLE"), dataSource.getName()), QUESTION_MESSAGE, null, getPorts(), @@ -59,14 +61,14 @@ private String[] getPorts() { mts.disconnect(); int portCount = mts.portCount(); results = new String[portCount]; - results[0] = "-1 - [ no ports found ]"; + results[0] = rb.getString("LPMANOPORTS"); for (int i = 0; i < portCount; i++) { mts.currentPort(i); String name = mts.portName(); mts.connect(); int inputs = mts.inputCount(); - String result = String.format( - "%d - [ %s: %d sesnors ]", + String result = MessageFormat.format( + rb.getString("LPMAPORTS"), i, name, inputs); results[i] = result; mts.disconnect(); diff --git a/src/main/java/com/romraider/logger/external/mrf/io/MrfRunner.java b/src/main/java/com/romraider/logger/external/mrf/io/MrfRunner.java index a6543dc23..c055544b1 100644 --- a/src/main/java/com/romraider/logger/external/mrf/io/MrfRunner.java +++ b/src/main/java/com/romraider/logger/external/mrf/io/MrfRunner.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ package com.romraider.logger.external.mrf.io; +import static com.romraider.Settings.COMMA; import com.romraider.io.connection.ConnectionProperties; import com.romraider.io.serial.connection.SerialConnection; import com.romraider.io.serial.connection.SerialConnectionImpl; @@ -42,13 +43,15 @@ public MrfRunner(String port, Map dataItems) { this.dataItems = dataItems; } + @Override public void run() { try { while (!stop) { String response = connection.readLine(); if (isNullOrEmpty(response)) continue; - LOGGER.trace("MRF Stealth Gauge Response: " + response); - String[] values = response.split(","); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("MRF Stealth Gauge Response: " + response); + String[] values = response.split(COMMA); for (int i = 0; i < values.length; i++) { MrfDataItem dataItem = dataItems.get(MrfSensorType.valueOf(i)); if (dataItem != null) dataItem.setData(parseDouble(values[i])); @@ -62,6 +65,7 @@ public void run() { } } + @Override public void stop() { stop = true; } diff --git a/src/main/java/com/romraider/logger/external/mrf/plugin/MrfDataItem.java b/src/main/java/com/romraider/logger/external/mrf/plugin/MrfDataItem.java index 8ebdfed48..e696482db 100644 --- a/src/main/java/com/romraider/logger/external/mrf/plugin/MrfDataItem.java +++ b/src/main/java/com/romraider/logger/external/mrf/plugin/MrfDataItem.java @@ -32,7 +32,6 @@ public final class MrfDataItem implements ExternalDataItem, DataListener { private double data; public MrfDataItem(String name, ExternalSensorConversions... convertorList) { - super(); this.name = name; convertors = new EcuDataConvertor[convertorList.length]; convertors = loadConvertors(this, convertors, convertorList); diff --git a/src/main/java/com/romraider/logger/external/mrf/plugin/MrfDataSource.java b/src/main/java/com/romraider/logger/external/mrf/plugin/MrfDataSource.java index 6342deda8..d251ac9ce 100644 --- a/src/main/java/com/romraider/logger/external/mrf/plugin/MrfDataSource.java +++ b/src/main/java/com/romraider/logger/external/mrf/plugin/MrfDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,6 +56,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; import javax.swing.Action; @@ -107,6 +108,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new MrfRunner(port, dataItems); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/phidget/interfacekit/io/IntfKitRunner.java b/src/main/java/com/romraider/logger/external/phidget/interfacekit/io/IntfKitRunner.java index 797371b4c..73b423320 100644 --- a/src/main/java/com/romraider/logger/external/phidget/interfacekit/io/IntfKitRunner.java +++ b/src/main/java/com/romraider/logger/external/phidget/interfacekit/io/IntfKitRunner.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,6 +65,7 @@ public IntfKitRunner( * @throws PhidgetException * @see IntfKitSensorChangeListener */ + @Override public void run() { try { while (!stop) { @@ -82,6 +83,7 @@ public void run() { * This method is used stop the reading of the PhidgetInterfaceKits data * and close the connections to the devices. */ + @Override public void stop() { stop = true; } @@ -96,13 +98,13 @@ public void stop() { public void updateDataItem(final int serial, final int sensor, final int value) { if (serial != -1) { final String inputName = String.format("%d:%d", serial, sensor); - dataItems.get(inputName).setData((double) value); - final String result = String.format( - "Phidget InterfaceKit sensor %s event - raw value: %d", - inputName, - sensor, - value); - LOGGER.trace(result); + dataItems.get(inputName).setData(value); + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format( + "Phidget InterfaceKit sensor %s event - raw value: %d", + inputName, + sensor, + value)); } else { LOGGER.error("Phidget InterfaceKit dataitem update error"); diff --git a/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitConvertorPanel.java b/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitConvertorPanel.java index d6f5df0b7..89f00f5ce 100644 --- a/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitConvertorPanel.java +++ b/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitConvertorPanel.java @@ -1,3 +1,22 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + package com.romraider.logger.external.phidget.interfacekit.plugin; import java.awt.BorderLayout; @@ -9,6 +28,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.List; +import java.util.ResourceBundle; import javax.swing.JButton; import javax.swing.JDialog; @@ -20,6 +40,7 @@ import com.romraider.logger.ecu.EcuLogger; import com.romraider.logger.ecu.ui.swing.tools.tablemodels.renderers.CentreRenderer; +import com.romraider.util.ResourceUtil; /** * Display dialog to allow the user to custom define each Phidget InterfaceKit @@ -27,6 +48,8 @@ */ public class IntfKitConvertorPanel extends JDialog { private static final long serialVersionUID = -4785866140260703021L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + IntfKitConvertorPanel.class.getName()); private final int IK_WIDTH = 600; private final int IK_HEIGHT = 300; private JTable table; @@ -41,7 +64,7 @@ public IntfKitConvertorPanel( EcuLogger logger, List> ikData) { super(logger, true); - setTitle("Phidget InterfaceKit User Defined Convertors"); + setTitle(rb.getString("TITLE")); setBounds( (logger.getWidth() > IK_WIDTH) ? logger.getX() + (logger.getWidth() - IK_WIDTH) / 2 : 0, @@ -63,26 +86,25 @@ public final String getToolTipText(MouseEvent e) { final int column = convertColumnIndexToModel(colIndex); switch (column) { case 0: - tip = "Sensor module serial number and input number"; + tip = rb.getString("TIP0"); break; case 1: - tip = "Equation used to convert raw data to real value"; + tip = rb.getString("TIP1"); break; case 2: - tip = "Format of real value for display and logging"; + tip = rb.getString("TIP2"); break; case 3: - tip = "Units of measure of the real value"; + tip = rb.getString("TIP3"); break; case 4: - tip = "Minimum real value expected"; + tip = rb.getString("TIP4"); break; case 5: - tip = "Maximum real value expected"; + tip = rb.getString("TIP5"); break; case 6: - tip = "Tick mark step for Gauge Tab display, " + - "typically (max-min)/10"; + tip = rb.getString("TIP6"); break; default: tip = super.getToolTipText(e); @@ -98,8 +120,8 @@ public final String getToolTipText(MouseEvent e) { buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); - final JButton saveButton = new JButton("Save"); - saveButton.setToolTipText("Save convertor settings"); + final JButton saveButton = new JButton(rb.getString("SAVE")); + saveButton.setToolTipText(rb.getString("SAVESETTINGS")); saveButton.setMnemonic(KeyEvent.VK_S); saveButton.addActionListener(new ActionListener() { public final void actionPerformed(ActionEvent actionEvent) { @@ -108,8 +130,8 @@ public final void actionPerformed(ActionEvent actionEvent) { }); buttonPane.add(saveButton); - final JButton cancelButton = new JButton("Cancel"); - cancelButton.setToolTipText("Cancel without saving changes"); + final JButton cancelButton = new JButton(rb.getString("CANCEL")); + cancelButton.setToolTipText(rb.getString("CANCELSAVE")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { table = null; @@ -164,7 +186,6 @@ private final void setTableBehaviour(JTable table) { else if (i == 1) { column.setPreferredWidth(150); } - else { column.setPreferredWidth(50); } diff --git a/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitDataSource.java b/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitDataSource.java index 5139ed399..6f541afe7 100644 --- a/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitDataSource.java +++ b/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.Set; import javax.swing.Action; @@ -94,6 +95,9 @@ public Action getMenuAction(final EcuLogger logger) { return new IntfKitPluginMenuAction(logger); } + public void setProperties(Properties properties) { + } + public void connect() { runner = new IntfKitRunner(kits, dataItems); ThreadUtil.runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitPluginMenuAction.java b/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitPluginMenuAction.java index 46b9ae64e..792256ae6 100644 --- a/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitPluginMenuAction.java +++ b/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitPluginMenuAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -145,11 +145,8 @@ private final void saveChanges(JTable table) { SettingsManager.getSettings().setPhidgetSensors(phidgets); JOptionPane.showMessageDialog( logger, - "Un-select each updated External Phidget data item on each Data,\n" + - "Graph and Dashboard Logger tabs to complete the update.\n\n" + - "Logging profiles using the old Phidget settings must be loaded\n" + - "and re-saved with the new settings.", - "Phidget InterfaceKit Settings Applied", - JOptionPane.INFORMATION_MESSAGE); + rb.getString("IPMAMSG"), + rb.getString("IPMAMSGTITLE"), + JOptionPane.INFORMATION_MESSAGE); } } diff --git a/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitTableModel.java b/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitTableModel.java index 6aa4c6b0f..be4b1f377 100644 --- a/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitTableModel.java +++ b/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitTableModel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,18 +20,30 @@ package com.romraider.logger.external.phidget.interfacekit.plugin; import java.util.List; +import java.util.ResourceBundle; import javax.swing.table.DefaultTableModel; +import com.romraider.util.ResourceUtil; + /** * PhidgetInterfaceKit Table Model used to populate user defined convertor * dialog. */ public final class IntfKitTableModel extends DefaultTableModel { private static final long serialVersionUID = -1733139047249681709L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + IntfKitTableModel.class.getName()); private List> ikData; private String[] columnNames = new String[]{ - "Sensor serial:input Number","Expression","Format","Units","Min", "Max", "Step"}; + rb.getString("SENSORID"), + rb.getString("EXPR"), + rb.getString("FORMAT"), + rb.getString("UNITS"), + rb.getString("MIN"), + rb.getString("MAX"), + rb.getString("STEP") + }; @Override public final int getColumnCount() { diff --git a/src/main/java/com/romraider/logger/external/plx/io/PlxParserImpl.java b/src/main/java/com/romraider/logger/external/plx/io/PlxParserImpl.java index 398e1546d..1b49c4f17 100644 --- a/src/main/java/com/romraider/logger/external/plx/io/PlxParserImpl.java +++ b/src/main/java/com/romraider/logger/external/plx/io/PlxParserImpl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,6 +40,7 @@ public final class PlxParserImpl implements PlxParser { private int partialValue; private byte instance; + @Override public PlxResponse pushByte(byte b) { if (b == (byte) 0x80) { state = EXPECTING_FIRST_HALF_OF_SENSOR_TYPE; @@ -64,7 +65,8 @@ public PlxResponse pushByte(byte b) { int value = (partialValue << 6) | b; sensorType = valueOf(value); if (PlxSensorType.UNKNOWN == sensorType) { - LOGGER.trace(String.format( + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format( "PLX sensor address: %d, unknown sensor type", value)); } break; @@ -82,10 +84,11 @@ public PlxResponse pushByte(byte b) { case EXPECTING_SECOND_HALF_OF_VALUE: state = EXPECTING_FIRST_HALF_OF_SENSOR_TYPE; int rawValue = (partialValue << 6) | b; - LOGGER.trace(String.format( + if (LOGGER.isTraceEnabled()) + LOGGER.trace(String.format( "PLX sensor: %s instance: %d, value: %d", sensorType, instance, rawValue)); - return new PlxResponse(sensorType, instance, rawValue); + return new PlxResponse(sensorType, instance, rawValue); } return null; } diff --git a/src/main/java/com/romraider/logger/external/plx/plugin/PlxDataSource.java b/src/main/java/com/romraider/logger/external/plx/plugin/PlxDataSource.java index a69db9811..afb1ffc26 100644 --- a/src/main/java/com/romraider/logger/external/plx/plugin/PlxDataSource.java +++ b/src/main/java/com/romraider/logger/external/plx/plugin/PlxDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -92,6 +92,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; import javax.swing.Action; @@ -159,6 +160,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new PlxRunner(port, dataItems); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/te/io/TERunner.java b/src/main/java/com/romraider/logger/external/te/io/TERunner.java index e3e2b6994..8f9baaabe 100644 --- a/src/main/java/com/romraider/logger/external/te/io/TERunner.java +++ b/src/main/java/com/romraider/logger/external/te/io/TERunner.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,12 +46,13 @@ public final class TERunner implements Stoppable { private byte byteSum; private int sequenceNo; private int lastSequenceNo = -1; - + public TERunner(String port, Map dataItems) { this.connection = new TEConnectionImpl(port); this.dataItems = dataItems; } + @Override public void run() { try { boolean packetStarted = false; @@ -80,9 +81,10 @@ else if (packetStarted && buffer.size() <= 28) { byteSum = (byte) ~byteSum; // 1's complement of sum break; case 28: - LOGGER.trace("Tech Edge (data 2.0): LastSeq:" + lastSequenceNo + " seq:" + sequenceNo + " data:" + buffer); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Tech Edge (data 2.0): LastSeq:" + lastSequenceNo + " seq:" + sequenceNo + " data:" + buffer); if (byteSum != b) { - LOGGER.error("Tech Edge (data 2.0): CheckSum Failed, calculated:" + byteSum + ", received:" + b); + LOGGER.error("Tech Edge (data 2.0): CheckSum Failed, calculated:" + byteSum + ", received:" + b); } if (lastSequenceNo == -1) { lastSequenceNo = sequenceNo; @@ -181,6 +183,7 @@ else if (packetStarted && buffer.size() <= 28) { } } + @Override public void stop() { stop = true; } diff --git a/src/main/java/com/romraider/logger/external/te/plugin/TEDataSource.java b/src/main/java/com/romraider/logger/external/te/plugin/TEDataSource.java index de1fdd719..61ad19ec7 100644 --- a/src/main/java/com/romraider/logger/external/te/plugin/TEDataSource.java +++ b/src/main/java/com/romraider/logger/external/te/plugin/TEDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,6 +47,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; import javax.swing.Action; @@ -101,6 +102,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new TERunner(port, dataItems); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/txs/io/TxsRunner.java b/src/main/java/com/romraider/logger/external/txs/io/TxsRunner.java index f4813408a..d249b83ef 100644 --- a/src/main/java/com/romraider/logger/external/txs/io/TxsRunner.java +++ b/src/main/java/com/romraider/logger/external/txs/io/TxsRunner.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,21 +33,21 @@ import com.romraider.logger.external.txs.plugin.TxsDataItem; public final class TxsRunner implements Stoppable{ - + private static final Logger LOGGER = getLogger(TxsRunner.class); private static final ConnectionProperties CONNECTION_PROPS = new TxsConnectionProperties(); private static final String WHITESPACE_REGEX = "\\s+"; private static final String SPLIT_DELIMITER = " "; private static final byte[] EXIT = new byte[]{24}; - + private final ArrayList dataItems; private final SerialConnection connection; - + private boolean stop; private String txsLogger; private String txsDevice; - + public TxsRunner( String port, ArrayList dataItems, @@ -55,127 +55,140 @@ public TxsRunner( String device) { this.connection = new SerialConnectionImpl(port, CONNECTION_PROPS); this.dataItems = dataItems; - this.txsLogger = logger; + this.txsLogger = logger; this.txsDevice = device; } - + public TxsRunner(ArrayList dataItems) { - this.connection = null; - this.dataItems = dataItems; + this.connection = null; + this.dataItems = dataItems; } + @Override public void run() { try { - - LOGGER.trace("TXS Runner Begin."); - + + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS Runner Begin."); + //Convert string into bytes[] byte[] device = txsDevice.getBytes(); - byte[] logger = this.txsLogger.getBytes(); + byte[] logger = this.txsLogger.getBytes(); - LOGGER.trace("TXS Runner Send Exit to Main Screen."); - - //Exit to main screen + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS Runner Send Exit to Main Screen."); + + //Exit to main screen connection.write(EXIT); - - LOGGER.trace("TXS Runner Sleep 250 ms to exit to main."); + + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS Runner Sleep 250 ms to exit to main."); //wait for exit to complete. Thread.sleep(250L); - - LOGGER.trace("TXS Runner Readline 1."); + + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS Runner Readline 1."); String response = connection.readLine(); - + if(response != null && response.trim().isEmpty() == false) { - LOGGER.trace("TXS Runner Readline 1 Response: "+ response); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS Runner Readline 1 Response: "+ response); } - - LOGGER.trace("TXS Runner Switching to Device. " + txsDevice); + + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS Runner Switching to Device. " + txsDevice); //Send command to switch device: utec / tuner. connection.write(device); - + //Read and Trace response switching device. response = connection.readLine(); - + if(response != null && response.trim().isEmpty() == false) { - LOGGER.trace("TXS Runner Readline 2 Response: "+ response); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS Runner Readline 2 Response: "+ response); } - - LOGGER.trace("TXS Runner Start Logger."); - + + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS Runner Start Logger."); + //Start device logger connection.write(logger); - + while (!stop) { //Get Response from TXS Device response = connection.readLine(); connection.write(logger); - + //Continue if no data was received. if (isNullOrEmpty(response)) { continue; } - + //Trace response - LOGGER.trace("TXS Runner Response: " + response); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS Runner Response: " + response); //Split Values for parsing - String[] values = SplitUtecString(response); + String[] values = SplitUtecString(response); //Set Data Item Values SetDataItemValues(values); } connection.close(); - } + } catch (Throwable t) { LOGGER.error("Error occurred", t); - } + } finally { connection.close(); } } + @Override public void stop() { stop = true; } - + String[] SplitUtecString(String value) { try { value = value.trim(); value = value.replaceAll(WHITESPACE_REGEX, SPLIT_DELIMITER); String[] utecArray = value.split(SPLIT_DELIMITER); - return utecArray; + return utecArray; } catch (Exception e) { return new String[]{}; } } - + void SetDataItemValues(String[] values) { - for (TxsDataItem dataItem : dataItems) - { - if(dataItem != null) - { - //Set value to dataItem - if(values.length <= dataItem.getItemIndex()) - { - LOGGER.trace("TXS DataItem: " + dataItem.getName() + " Index requested: " + dataItem.getItemIndex() + " TXS data size: " + values.length); - dataItem.setData(0); - } - else - { - LOGGER.trace("TXS Setting DataItem: " + dataItem.getName()); - dataItem.setData(parseDouble(values[dataItem.getItemIndex()])); - } - } - } + for (TxsDataItem dataItem : dataItems) + { + if(dataItem != null) + { + //Set value to dataItem + if(values.length <= dataItem.getItemIndex()) + { + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS DataItem: " + dataItem.getName() + " Index requested: " + dataItem.getItemIndex() + " TXS data size: " + values.length); + dataItem.setData(0); + } + else + { + if (LOGGER.isTraceEnabled()) + LOGGER.trace("TXS Setting DataItem: " + dataItem.getName()); + dataItem.setData(parseDouble(values[dataItem.getItemIndex()])); + } + } + } } - + private double parseDouble(String value) { - try { + try { //try to parse value. return Double.parseDouble(value); - } + } catch (Exception e) { //return 0 if value could not be parsed. return 0.0; diff --git a/src/main/java/com/romraider/logger/external/txs/plugin/TxsDataItem.java b/src/main/java/com/romraider/logger/external/txs/plugin/TxsDataItem.java index 471af88d0..bbd7e634d 100644 --- a/src/main/java/com/romraider/logger/external/txs/plugin/TxsDataItem.java +++ b/src/main/java/com/romraider/logger/external/txs/plugin/TxsDataItem.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,9 +41,9 @@ public TxsDataItem(String name, int itemIndex, ExternalSensorConversions... conv } public int getItemIndex(){ - return itemIndex; + return itemIndex; } - + public String getName() { return name; } @@ -63,4 +63,4 @@ public void setData(double data) { public EcuDataConvertor[] getConvertors() { return convertors; } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/logger/external/txs/plugin/TxsTunerDataSource.java b/src/main/java/com/romraider/logger/external/txs/plugin/TxsTunerDataSource.java index 55faf218a..c85efdbc0 100644 --- a/src/main/java/com/romraider/logger/external/txs/plugin/TxsTunerDataSource.java +++ b/src/main/java/com/romraider/logger/external/txs/plugin/TxsTunerDataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,6 +34,8 @@ import java.util.ArrayList; import java.util.List; +import java.util.Properties; + import javax.swing.Action; import com.romraider.logger.ecu.EcuLogger; @@ -91,6 +93,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new TxsRunner(port, dataItems, LOGGER, DEVICE); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/txs/plugin/TxsUtecLogger1DataSource.java b/src/main/java/com/romraider/logger/external/txs/plugin/TxsUtecLogger1DataSource.java index 482424a87..aa7ea643a 100644 --- a/src/main/java/com/romraider/logger/external/txs/plugin/TxsUtecLogger1DataSource.java +++ b/src/main/java/com/romraider/logger/external/txs/plugin/TxsUtecLogger1DataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,6 +42,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Properties; import javax.swing.Action; @@ -115,6 +116,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new TxsRunner(port, dataItems, LOGGER, DEVICE); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/logger/external/zt2/plugin/ZT2DataSource.java b/src/main/java/com/romraider/logger/external/zt2/plugin/ZT2DataSource.java index 3312dc522..e0efb647c 100644 --- a/src/main/java/com/romraider/logger/external/zt2/plugin/ZT2DataSource.java +++ b/src/main/java/com/romraider/logger/external/zt2/plugin/ZT2DataSource.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,6 +49,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; import javax.swing.Action; @@ -100,6 +101,9 @@ public String getPort() { return port; } + public void setProperties(Properties properties) { + } + public void connect() { runner = new ZT2Runner(port, dataItems); runAsDaemon(runner); diff --git a/src/main/java/com/romraider/maps/DataCell.java b/src/main/java/com/romraider/maps/DataCell.java index 42ebb2d01..eef75d024 100644 --- a/src/main/java/com/romraider/maps/DataCell.java +++ b/src/main/java/com/romraider/maps/DataCell.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,455 +19,558 @@ package com.romraider.maps; -import static com.romraider.util.ColorScaler.getScaledColor; -import static com.romraider.util.ParamChecker.isNullOrEmpty; -import static javax.swing.BorderFactory.createLineBorder; - -import java.awt.Color; -import java.awt.Font; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import java.io.Serializable; -import java.text.DecimalFormat; - -import javax.swing.JLabel; -import javax.swing.border.Border; +import java.text.ParseException; +import java.util.LinkedList; +import java.util.StringTokenizer; import org.apache.log4j.Logger; import com.romraider.Settings; +import com.romraider.Settings.Endian; import com.romraider.editor.ecu.ECUEditorManager; +import com.romraider.util.ByteUtil; import com.romraider.util.JEPUtil; +import com.romraider.util.NumberUtil; import com.romraider.util.SettingsManager; +import com.romraider.xml.RomAttributeParser; -public class DataCell extends JLabel implements MouseListener, Serializable { - private static final long serialVersionUID = -2904293227148940937L; +public class DataCell implements Serializable { + private static final long serialVersionUID = 1111479947434817639L; private static final Logger LOGGER = Logger.getLogger(DataCell.class); - private final DecimalFormat PERCENT_FORMAT = new DecimalFormat("#,##0.0%"); - private final Font defaultFont = new Font("Arial", Font.BOLD, 12); - int unSelectMask1 = MouseEvent.BUTTON1_DOWN_MASK + MouseEvent.CTRL_DOWN_MASK + MouseEvent.ALT_DOWN_MASK; - int unSelectMask2 = MouseEvent.BUTTON3_DOWN_MASK + MouseEvent.CTRL_DOWN_MASK + MouseEvent.ALT_DOWN_MASK; - - private final Table table; - private Boolean selected = false; - private Boolean highlighted = false; - private Boolean traced = false; + //View we need to keep up to date + private DataCellView view = null; + private Table table; - private int x = 0; - private int y = 0; + //This sounds like a View property, but the manipulation + //functions depend on this, so its better to put it here + private boolean isSelected = false; + private int bitMask = 0; + private double minAllowedBin = 0.0; + private double maxAllowedBin = 0.0; private double binValue = 0.0; private double originalValue = 0.0; private double compareToValue = 0.0; private String liveValue = Settings.BLANK; - - private final Color defaultBorderColor = new Color(0, 0, 0); - private final Color increaseBorderColor = getSettings().getIncreaseBorder(); - private final Color decreaseBorderColor = getSettings().getDecreaseBorder(); - private String staticText = null; + private Rom rom; + + //Index within table + private int index; - public DataCell(Table table) { + public DataCell(Table table, Rom rom) { this.table = table; - this.setHorizontalAlignment(CENTER); - this.setVerticalAlignment(CENTER); - this.setFont(defaultFont); - this.setOpaque(true); - this.setVisible(true); - this.addMouseListener(this); + this.rom = rom; + setBitMask(table.getBitMask()); //Take the global bitmask first } - public DataCell(Table table, String staticText) { - this(table); - this.staticText = staticText; - table.setStaticDataTable(true); + public DataCell(Table table, String staticText, Rom rom) { + this(table, rom); + final StringTokenizer st = new StringTokenizer(staticText, DataCellView.ST_DELIMITER); + if (st.hasMoreTokens()) { + this.staticText = st.nextToken(); + } } - public DataCell(Table table, double originalValue, int x, int y) { - this(table); - this.originalValue = originalValue; - this.binValue = originalValue; - this.x = x; - this.y = y; - this.setPreferredSize(getSettings().getCellSize()); - } + public DataCell(Table table, int index, Rom rom) { + this(table, rom); + this.index = index; - public double getBinValue() { - return binValue; + updateBinValueFromMemory(); + this.originalValue = this.binValue; + registerDataCell(this); } - public double getRealValue() { - return JEPUtil.evaluate(table.getCurrentScale().getExpression(), binValue); + public void setTable(Table t) { + this.table = t; } - public void setRealValue(String input) { - // create parser - try { - double result = 0.0; - if (!"x".equalsIgnoreCase(input)) { - result = JEPUtil.evaluate(table.getCurrentScale().getByteExpression(), Double.parseDouble(input)); - if (table.getStorageType() != Settings.STORAGE_TYPE_FLOAT) { - result = (int) Math.round(result); - } - - if(binValue != result) { - this.setBinValue(result); - } - } - } catch (NumberFormatException e) { - // Do nothing. input is null or not a valid number. - } + public void setRom(Rom rom) { + this.rom = rom; } - public double getCompareValue() { - return binValue - compareToValue; + public byte[] getBinary() { + return rom.getBinary(); } - public double getRealCompareValue() { - return JEPUtil.evaluate(table.getCurrentScale().getExpression(), binValue) - JEPUtil.evaluate(table.getCurrentScale().getExpression(), compareToValue); - } + public void setBitMask(int mask) { + if (mask == 0) return; - public double getRealCompareChangeValue() { - double realBinValue = JEPUtil.evaluate(table.getCurrentScale().getExpression(), binValue); - double realCompareValue = JEPUtil.evaluate(table.getCurrentScale().getExpression(), compareToValue); + //Clamp mask to max size + bitMask = (int) Math.min(mask, Math.pow(2,table.getStorageType()*8)-1); + } - if(realCompareValue != 0.0) { - // Compare change formula ((V2 - V1) / |V1|). - return ((realBinValue - realCompareValue) / Math.abs(realCompareValue)); + protected void calcValueRange() { + if (table.getStorageType() != Settings.STORAGE_TYPE_FLOAT) { + if (table.isSignedData()) { + switch (table.getStorageType()) { + case 1: + minAllowedBin = Byte.MIN_VALUE; + maxAllowedBin = Byte.MAX_VALUE; + break; + case 2: + minAllowedBin = Short.MIN_VALUE; + maxAllowedBin = Short.MAX_VALUE; + break; + case 4: + minAllowedBin = Integer.MIN_VALUE; + maxAllowedBin = Integer.MAX_VALUE; + break; + case Settings.STORAGE_TYPE_MOVI20: + minAllowedBin = Settings.MOVI20_MIN_VALUE; + maxAllowedBin = Settings.MOVI20_MAX_VALUE; + break; + case Settings.STORAGE_TYPE_MOVI20S: + minAllowedBin = Settings.MOVI20S_MIN_VALUE; + maxAllowedBin = Settings.MOVI20S_MAX_VALUE; + break; + } + } + else { + if (bitMask == 0) { + maxAllowedBin = (Math.pow(256, table.getStorageType()) - 1); + } + else { + maxAllowedBin =(int)(Math.pow(2,ByteUtil.lengthOfMask(bitMask)) - 1); + } + minAllowedBin = 0.0; + } } else { - // Use this to avoid divide by 0 or infinite increase. - return realBinValue - realCompareValue; - } - } + maxAllowedBin = Float.MAX_VALUE; - public Color getCompareColor() { - if(table instanceof Table1D) { - Table1D checkTable = (Table1D)table; - if(checkTable.isAxis() && !getSettings().isColorAxis()) { - return getSettings().getAxisColor(); + if (table.isSignedData()) { + minAllowedBin = 0.0; + } else { + minAllowedBin = -Float.MAX_VALUE; } } + } - double compareScale; - if (0.0 == getCompareValue()) { - return Settings.UNCHANGED_VALUE_COLOR; - }else if(table.getMinCompare() == table.getMaxCompare()) { - return getSettings().getMaxColor(); - } else { - compareScale = (getCompareValue() - table.getMinCompare()) / (table.getMaxCompare() - table.getMinCompare()); + private double getValueFromMemory(int index) { + double dataValue = 0.0; + byte[] input = getBinary(); + int storageType = table.getStorageType(); + Endian endian = table.getEndian(); + int ramOffset = table.getRamOffset(); + int storageAddress = table.getStorageAddress(); + boolean signed = table.isSignedData(); + + // populate data cells + if (storageType == Settings.STORAGE_TYPE_FLOAT) { //float storage type + byte[] byteValue = new byte[4]; + byteValue[0] = input[storageAddress + index * 4 - table.getRamOffset()]; + byteValue[1] = input[storageAddress + index * 4 - table.getRamOffset() + 1]; + byteValue[2] = input[storageAddress + index * 4 - table.getRamOffset() + 2]; + byteValue[3] = input[storageAddress + index * 4 - table.getRamOffset() + 3]; + dataValue = RomAttributeParser.byteToFloat(byteValue, table.getEndian(), table.getMemModelEndian()); + + } else if (storageType == Settings.STORAGE_TYPE_MOVI20 || + storageType == Settings.STORAGE_TYPE_MOVI20S) { // when data is in MOVI20 instruction + dataValue = RomAttributeParser.parseByteValue(input, + endian, + storageAddress + index * 3 - ramOffset, + storageType, + signed); + + } else { // integer storage type + if (bitMask == 0) { + dataValue = RomAttributeParser.parseByteValue(input, + endian, storageAddress + index * storageType - ramOffset, + storageType, signed); + } + else { + dataValue = RomAttributeParser.parseByteValueMasked(input, endian, + storageAddress + index * storageType - ramOffset, + storageType, signed, bitMask); + } } - return getScaledColor(compareScale); + + return dataValue; } - public Color getBinColor() { - if(table instanceof Table1D) { - Table1D checkTable = (Table1D)table; - if(checkTable.isAxis() && !getSettings().isColorAxis()) { - return getSettings().getAxisColor(); - } - } + private double getValueFromMemory() { + if (table.getDataLayout() == Table.DataLayout.BOSCH_SUBTRACT) { - if (table.getMaxAllowedBin() < getBinValue()) { - return getSettings().getWarningColor(); - } else if (table.getMinAllowedBin() > getBinValue()) { - return getSettings().getWarningColor(); - } else { - // limits not set, scale based on table values - double colorScale; - if (table.getMaxBin() - table.getMinBin() == 0.0) { - // if all values are the same, color will be middle value - colorScale = .5; - } else { - colorScale = (getBinValue() - table.getMinBin()) / (table.getMaxBin() - table.getMinBin()); + //Bosch Motronic subtract method + double dataValue = Math.pow(2, 8 * table.getStorageType()); + + for (int j = table.data.length - 1; j >= index; j--) { + dataValue -= getValueFromMemory(j); } - return getScaledColor(colorScale); + return dataValue; } - } - - public void drawCell() { - if(table == null) { - // Table will be null in the static case. - return; + else { + return getValueFromMemory(index); } + } - this.invalidate(); - setFont(getSettings().getTableFont()); - setText(getCellText()); - setToolTipText(getCellToolTip()); - setBackground(getCellBackgroundColor()); - setForeground(getCellTextColor()); - setBorder(getCellBorder()); - this.validate(); - table.validate(); - table.repaint(); - } - - private Color getCellBackgroundColor() { - Settings settings = getSettings(); - Color backgroundColor; - - if(highlighted) { - backgroundColor = settings.getHighlightColor(); - } else if(selected) { - backgroundColor = settings.getSelectColor(); - } else if(null == table.getCompareTable()) { - backgroundColor = getBinColor(); - }else { - backgroundColor = getCompareColor(); - } + public void saveBinValueInFile() { + if (table.getName().contains("Checksum Fix")) return; - return backgroundColor; - } + byte[] binData = getBinary(); + int userLevel = table.getUserLevel(); + int storageType = table.getStorageType(); + Endian endian = table.getEndian(); + int ramOffset = table.getRamOffset(); + int storageAddress = table.getStorageAddress(); + boolean isBoschSubtract = table.getDataLayout() == Table.DataLayout.BOSCH_SUBTRACT; - private Color getCellTextColor() { - Color textColor; + double crossedValue = 0; - if(traced) { - if(!getLiveValue().isEmpty()) { - if(table instanceof Table1D) { - textColor = Settings.scaleTextColor; - } else { - textColor = Settings.liveDataTraceTextColor; + //Do reverse cross referencing in for Bosch Subtract Axis array + if (isBoschSubtract) { + for (int i = table.data.length - 1; i >=index ; i--) { + if (i == index) + crossedValue -= table.data[i].getBinValue(); + else if (i == table.data.length - 1) + crossedValue = Math.pow(2, 8 * storageType) - getValueFromMemory(i); + else { + crossedValue -= getValueFromMemory(i); } - } else { - textColor = Settings.scaleTextColor; } - } else if (highlighted) { - textColor = Settings.highlightTextColor; - } else if (selected) { - textColor = Settings.selectTextColor; - } else { - textColor = Settings.scaleTextColor; } - return textColor; + if (userLevel <= getSettings().getUserLevel() && (userLevel < 5 || getSettings().isSaveDebugTables()) ) { + // determine output byte values + byte[] output; + int mask = bitMask; + + if (storageType != Settings.STORAGE_TYPE_FLOAT) { + int finalValue = 0; + + // convert byte values + if (table.isStaticDataTable() && storageType > 0) { + LOGGER.warn("Static data table: " + table.toString() + ", storageType: "+storageType); + + try { + finalValue = Integer.parseInt(getStaticText()); + } catch (NumberFormatException ex) { + LOGGER.error("Error parsing static data table value: " + getStaticText(), ex); + LOGGER.error("Validate the table definition storageType and data value."); + return; + } + } else if (table.isStaticDataTable() && storageType < 1) { + // Do not save the value. + //if (LOGGER.isDebugEnabled()) + // LOGGER.debug("The static data table value will not be saved."); + return; + } else { + finalValue = (int) (isBoschSubtract ? crossedValue : getBinValue()); + } + + if (mask != 0) { + // Shift left again + finalValue = finalValue << ByteUtil.firstOneOfMask(mask); + } + + output = RomAttributeParser.parseIntegerValue(finalValue, endian, storageType); + + int byteLength = storageType; + if (storageType == Settings.STORAGE_TYPE_MOVI20 || + storageType == Settings.STORAGE_TYPE_MOVI20S) { // when data is in MOVI20 instruction + byteLength = 3; + } + + //If mask enabled, only change bits within the mask + if (mask != 0) { + int tempBitMask = 0; + + for (int z = 0; z < byteLength; z++) { // insert into file + + tempBitMask = mask; + + //Trim mask depending on byte, from left to right + tempBitMask = (tempBitMask & (0xFF << 8 * (byteLength - 1 - z))) >> 8*(byteLength - 1 - z); + + // Delete old bits + binData[index * byteLength + z + storageAddress - ramOffset] &= ~tempBitMask; + + // Overwrite + binData[index * byteLength + z + storageAddress - ramOffset] |= output[z]; + } + } + //No Masking + else { + for (int z = 0; z < byteLength; z++) { // insert into file + binData[index * byteLength + z + storageAddress - ramOffset] = output[z]; + } + } + + } else { // float + // convert byte values + output = RomAttributeParser.floatToByte((float) getBinValue(), endian, table.getMemModelEndian()); + + for (int z = 0; z < 4; z++) { // insert in to file + binData[index * 4 + z + storageAddress - ramOffset] = output[z]; + } + } + } + + //On the Bosch substract model, we need to update all previous cells, because they depend on our value + if (isBoschSubtract && index > 0) table.data[index-1].saveBinValueInFile(); + + checkForDataUpdates(); } - private Border getCellBorder() { - Border border; - if(traced) { - border = createLineBorder(getSettings().getliveValueColor(), 2); - } else { - double checkValue; + public void registerDataCell(DataCell cell) { - if(null == table.getCompareTable()) { - checkValue= originalValue; - } else { - checkValue = compareToValue; + int memoryIndex = getMemoryStartAddress(cell); + + if (rom.byteCellMapping.containsKey(memoryIndex)) + { + rom.byteCellMapping.get(memoryIndex).add(cell); } + else { + LinkedList l = new LinkedList(); + l.add(cell); + rom.byteCellMapping.put(memoryIndex, l); + } + } - if (checkValue < binValue) { - border = createLineBorder(increaseBorderColor, 2); - } else if (checkValue > binValue) { - border = createLineBorder(decreaseBorderColor, 2); - } else { - border = createLineBorder(defaultBorderColor, 1); + public void checkForDataUpdates() { + int memoryIndex = getMemoryStartAddress(this); + + if (rom.byteCellMapping.containsKey(memoryIndex)){ + for(DataCell c : rom.byteCellMapping.get(memoryIndex)) { + c.updateBinValueFromMemory(); } } + } - return border; + public static int getMemoryStartAddress(DataCell cell) { + Table t = cell.getTable(); + return t.getStorageAddress() + cell.getIndexInTable() * t.getStorageType() - t.getRamOffset(); } - private String getCellText() { - if(table.isStaticDataTable()) { - return getStaticText(); - } + public Settings getSettings() + { + return SettingsManager.getSettings(); + } - DecimalFormat formatter = new DecimalFormat(table.getCurrentScale().getFormat()); - String displayString = ""; + public void setSelected(boolean selected) { + if (!table.isStaticDataTable() && this.isSelected != selected) { + this.isSelected = selected; - if (null == table.getCompareTable()) { - displayString = formatter.format(getRealValue()); - } else if (table.getCompareDisplay() == Settings.COMPARE_DISPLAY_ABSOLUTE) { - displayString = formatter.format(getRealCompareValue()); - } else if (table.getCompareDisplay() == Settings.COMPARE_DISPLAY_PERCENT) { - if (getCompareValue() == 0.0) { - displayString = PERCENT_FORMAT.format(0.0); - } else { - displayString = PERCENT_FORMAT.format(getRealCompareChangeValue()); + if (view!=null) { + ECUEditorManager.getECUEditor().getTableToolBar().updateTableToolBar(table); + view.drawCell(); } } + } - if(traced) { - if(!(table instanceof Table1D)) { - displayString = getLiveValueString(displayString); - } - } - return displayString; + public boolean isSelected() { + return isSelected; } - private String getCellToolTip() { - if(table.isStaticDataTable()) { - return getStaticText(); - } + public void updateBinValueFromMemory() { + //We do this here because once we start populating all settings should be set + if (minAllowedBin == 0 && maxAllowedBin == 0) + calcValueRange(); - return Double.toString(getRealValue()); + this.binValue = getValueFromMemory(); + updateView(); } - private String getLiveValue() { - return this.liveValue; + public void setDataView(DataCellView v) { + view = v; } - private String getLiveValueString(String currentValue) { - return currentValue + (isNullOrEmpty(getLiveValue()) ? Settings.BLANK : (':' + getLiveValue())); + public int getIndexInTable() { + return index; } - public void setBinValue(double newBinValue) { - if(binValue == newBinValue) { - return; + private void updateView() { + if (view != null) { + view.drawCell(); } + } - double checkedValue = newBinValue; + public Table getTable() { + return this.table; + } - // make sure it's in range - if(checkedValue < table.getMinAllowedBin()) { - checkedValue = table.getMinAllowedBin(); - } + public String getStaticText() { + return staticText; + } - if(checkedValue > table.getMaxAllowedBin()) { - checkedValue = table.getMaxAllowedBin(); - } + public String getLiveValue() { + return this.liveValue; + } - if(binValue == checkedValue) { - return; + public void setLiveDataTraceValue(String liveValue) { + if (this.liveValue != liveValue) { + this.liveValue = liveValue; + updateView(); } + } - // set bin. - binValue = checkedValue; - drawCell(); + public double getBinValue() { + return binValue; } - @Override - public String toString() { - return getCellText(); + public double getOriginalValue() { + return originalValue; } - public Boolean isSelected() { - return selected; + public double getCompareToValue() { + return compareToValue; } - public void setSelected(Boolean selected) { - if(!table.isStaticDataTable() && this.selected != selected) { - this.selected = selected; - drawCell(); - } + public double getRealValue() { + if (table.getCurrentScale() == null) return binValue; + + return JEPUtil.evaluate(table.getCurrentScale().getExpression(), binValue); } - public void setHighlighted(Boolean highlighted) { - if(!table.isStaticDataTable() && this.highlighted != highlighted) { - this.highlighted = highlighted; - drawCell(); + public void setRealValue(String input) throws UserLevelException { + // create parser + input = input.replaceAll(DataCellView.REPLACE_TEXT, Settings.BLANK); + try { + double result = 0.0; + if (!"x".equalsIgnoreCase(input)) { + + // Optimization: If it has no scaling use the value directly + if(table.getCurrentScale().getExpression().trim().equalsIgnoreCase("x")) + { + result = NumberUtil.doubleValue(input); + } + else if (table.getCurrentScale().getByteExpression() == null) { + result = table.getCurrentScale().approximateToByteFunction(NumberUtil.doubleValue(input), table.getStorageType(), table.isSignedData()); + } + else { + result = JEPUtil.evaluate(table.getCurrentScale().getByteExpression(), NumberUtil.doubleValue(input)); + } + + if (table.getStorageType() != Settings.STORAGE_TYPE_FLOAT) { + result = (int) Math.round(result); + } + + if (binValue != result) { + this.setBinValue(result); + } + } + } catch (ParseException e) { + // Do nothing. input is null or not a valid number. } } - public boolean isHighlighted() { - return highlighted; + public double getCompareValue() { + return binValue - compareToValue; } - @Override - public void mouseEntered(MouseEvent e) { - if(unSelectMask1 == (e.getModifiersEx() & unSelectMask1)) { - clearCell(); - } else if(unSelectMask2 == (e.getModifiersEx() & unSelectMask2)) { - clearCell(); - } else { - table.highlight(x, y); - } + public double getRealCompareValue() { + return JEPUtil.evaluate(table.getCurrentScale().getExpression(), binValue) - JEPUtil.evaluate(table.getCurrentScale().getExpression(), compareToValue); } - @Override - public void mousePressed(MouseEvent e) { - if (!e.isControlDown()) { - table.clearSelection(); - } + public double getRealCompareChangeValue() { + double realBinValue = JEPUtil.evaluate(table.getCurrentScale().getExpression(), binValue); + double realCompareValue = JEPUtil.evaluate(table.getCurrentScale().getExpression(), compareToValue); - if (e.isControlDown() && e.isAltDown()) { - clearCell(); + if (realCompareValue != 0.0) { + // Compare change formula ((V2 - V1) / |V1|). + return ((realBinValue - realCompareValue) / Math.abs(realCompareValue)); } else { - table.startHighlight(x, y); + // Use this to avoid divide by 0 or infinite increase. + return realBinValue - realCompareValue; } - requestFocus(); - ECUEditorManager.getECUEditor().getTableToolBar().updateTableToolBar(table); } - @Override - public void mouseReleased(MouseEvent e) { - table.stopHighlight(); - } + public void setBinValue(double newBinValue) throws UserLevelException { + if (binValue == newBinValue || table.locked || table.getName().contains("Checksum Fix")) { + return; + } - @Override - public void mouseClicked(MouseEvent e) { - } + if (table.userLevel > getSettings().getUserLevel()) + throw new UserLevelException(table.userLevel); - @Override - public void mouseExited(MouseEvent e) { - } + double checkedValue = newBinValue; + + // make sure it's in range + if (checkedValue < minAllowedBin) { + checkedValue = minAllowedBin; + } - private void clearCell() { - if(isHighlighted()) { - setHighlighted(false); + if (checkedValue > maxAllowedBin) { + checkedValue = maxAllowedBin; } - if(isSelected()) { - setSelected(false); + + if (binValue == checkedValue) { + return; } + + // set bin. + binValue = checkedValue; + saveBinValueInFile(); + updateView(); } - public void increment(double increment) { + public void increment(double increment) throws UserLevelException { double oldValue = getRealValue(); if (table.getCurrentScale().getCoarseIncrement() < 0.0) { increment = 0.0 - increment; } - double incResult = JEPUtil.evaluate(table.getCurrentScale().getByteExpression(), (oldValue + increment)); + double incResult = 0; + if (table.getCurrentScale().getByteExpression() == null) { + incResult = table.getCurrentScale().approximateToByteFunction(oldValue + increment, table.getStorageType(), table.isSignedData()); + } + else { + incResult = JEPUtil.evaluate(table.getCurrentScale().getByteExpression(), (oldValue + increment)); + } + if (table.getStorageType() == Settings.STORAGE_TYPE_FLOAT) { - if(binValue != incResult) { + if (binValue != incResult) { this.setBinValue(incResult); } } else { int roundResult = (int) Math.round(incResult); - if(binValue != roundResult) { + if (binValue != roundResult) { this.setBinValue(roundResult); } } - // make sure table is incremented if change isn't great enough - int maxValue = (int) Math.pow(8, table.getStorageType()); - + //Make sure we always change something. If the defined increment is too small this triggers + //TODO: This should use real values if (table.getStorageType() != Settings.STORAGE_TYPE_FLOAT && oldValue == getRealValue() && - binValue > 0.0 && - binValue < maxValue) { - LOGGER.debug(maxValue + " " + binValue); + ((increment > 0 && binValue < maxAllowedBin) || (increment < 0 && binValue > minAllowedBin))) { + if (LOGGER.isDebugEnabled()) + LOGGER.debug(maxAllowedBin + " " + binValue); increment(increment * 2); } } - public void undo() { + public void undo() throws UserLevelException { this.setBinValue(originalValue); } public void setRevertPoint() { this.setOriginalValue(binValue); - this.drawCell(); + updateView(); } public void setOriginalValue(double originalValue) { this.originalValue = originalValue; } + public int getBitMask() { + return this.bitMask; + } + public void setCompareValue(DataCell compareCell) { - if(Settings.DATA_TYPE_BIN == table.getCompareValueType()) + if (Settings.DataType.BIN == table.getCompareValueType()) { - if(this.compareToValue == compareCell.binValue) { + if (this.compareToValue == compareCell.binValue) { return; } this.compareToValue = compareCell.binValue; } else { - if(this.compareToValue == compareCell.originalValue) { + if (this.compareToValue == compareCell.originalValue) { return; } @@ -475,61 +578,52 @@ public void setCompareValue(DataCell compareCell) { } } - public void multiply(double factor) { - setBinValue(binValue * factor); - } + public void multiply(double factor) throws UserLevelException { + String newValue = (getRealValue() * factor) + ""; - public void setLiveDataTrace(boolean trace) { - if(traced != trace) { - traced = trace; - drawCell(); - } - } + //We need to convert from dot to comma, in the case of EU Format. + // This is because getRealValue to String has dot notation. + if (NumberUtil.getSeperator() == ',') newValue = newValue.replace('.', ','); - public void setLiveDataTraceValue(String liveValue) { - if(this.liveValue != liveValue) { - this.liveValue = liveValue; - drawCell(); - } - } - - private Settings getSettings() { - return SettingsManager.getSettings(); + setRealValue(newValue); } @Override public boolean equals(Object other) { - if(other == null) { + if (other == null) { return false; } - if(!(other instanceof DataCell)) { + if (!(other instanceof DataCell)) { return false; } DataCell otherCell = (DataCell) other; - if(this.table.isStaticDataTable() != otherCell.table.isStaticDataTable()) { + if (this.table.isStaticDataTable() != otherCell.table.isStaticDataTable()) { + return false; + } + + if (this.getBitMask() != otherCell.getBitMask()) { return false; } return binValue == otherCell.binValue; } - public String getStaticText() { - String displayString = null; - try { - DecimalFormat formatter = new DecimalFormat(table.getCurrentScale().getFormat()); + public double getMaxAllowedBin() { + return maxAllowedBin; + } - double staticDouble = Double.parseDouble(staticText); - displayString = formatter.format(JEPUtil.evaluate(table.getCurrentScale().getExpression(), staticDouble)); - } catch (Exception ex) { - displayString = this.staticText; - } - return displayString; + public double getMinAllowedBin() { + return minAllowedBin; } - public void setY(int y) { - this.y = y; + @Override + public String toString() { + if (null == staticText || staticText.isEmpty()) { + return String.valueOf(getRealValue()); + } + return staticText; } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/maps/DataCellView.java b/src/main/java/com/romraider/maps/DataCellView.java new file mode 100644 index 000000000..4010c4e68 --- /dev/null +++ b/src/main/java/com/romraider/maps/DataCellView.java @@ -0,0 +1,399 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps; + +import static com.romraider.util.ColorScaler.getScaledColor; +import static com.romraider.util.ParamChecker.isNullOrEmpty; +import static javax.swing.BorderFactory.createLineBorder; + +import java.awt.Color; +import java.awt.Font; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.io.Serializable; +import java.text.DecimalFormat; + +import javax.swing.JLabel; +import javax.swing.border.Border; + +import com.romraider.Settings; +import com.romraider.editor.ecu.ECUEditorManager; +import com.romraider.util.JEPUtil; +import com.romraider.util.SettingsManager; + +public class DataCellView extends JLabel implements MouseListener, Serializable { + private static final long serialVersionUID = 1L; + static final Font DEFAULT_FONT = new Font("Arial", Font.BOLD, 12); + static final String ST_DELIMITER = "\t\n\r\f"; + static final DecimalFormat FORMATTER = new DecimalFormat(); + static final String PERCENT_FORMAT = "#,##0.0%"; + static final String TT_FORMAT = "#,##0.##########"; + static final String TT_PERCENT_FORMAT = "#,##0.0#########%"; + static final String REPLACE_TEXT = "\u0020|\u00a0"; + + static int UNSELECT_MASK1 = MouseEvent.BUTTON1_DOWN_MASK + MouseEvent.CTRL_DOWN_MASK + MouseEvent.ALT_DOWN_MASK; + static int UNSELECT_MASK2 = MouseEvent.BUTTON3_DOWN_MASK + MouseEvent.CTRL_DOWN_MASK + MouseEvent.ALT_DOWN_MASK; + + private DataCell dataCell; //Data Source + private TableView tableView = null; + + private int x = 0; + private int y = 0; + + + private boolean highlighted = false; + private boolean traced = false; + private boolean tracedStale = false; + + private static final Border DEFAULT_BORDER = createLineBorder(new Color(0, 0, 0), 1); + private static final Border INCREASE_BORDER = createLineBorder(getSettings().getIncreaseBorder(), 2); + private static final Border DECREASE_BORDER = createLineBorder(getSettings().getDecreaseBorder(), 2); + private static final Border CURLIVE_BORDER = createLineBorder(getSettings().getCurLiveValueColor(), 2); + private static final Border STALELIVE_BORDER = createLineBorder(getSettings().getliveValueColor(), 2); + + + public DataCellView(DataCell cell, TableView view) { + this.dataCell = cell; + this.tableView = view; + this.setHorizontalAlignment(CENTER); + this.setVerticalAlignment(CENTER); + this.setFont(DEFAULT_FONT); + this.setOpaque(true); + this.setVisible(true); + this.addMouseListener(this); + + cell.setDataView(this); + this.y = cell.getIndexInTable(); + this.setPreferredSize(getSettings().getCellSize()); + } + + public DataCellView(DataCell cell, TableView view, int x, int y) { + this(cell, view); + + this.x = x; + this.y = y; + } + + public boolean equals (DataCellView v) { + return v.dataCell.equals(dataCell); + } + + public DataCell getDataCell() { + return dataCell; + } + + private static Settings getSettings() { + return SettingsManager.getSettings(); + } + + public void drawCell() { + if(tableView == null || tableView.isHidden()) { + // Table will be null in the static case. + return; + } + + tableView.updatePresetPanel(); + //this.invalidate(); + setFont(getSettings().getTableFont()); + setText(getCellText()); + setToolTipText(getCellToolTip()); + setBackground(getCellBackgroundColor()); + setForeground(getCellTextColor()); + setBorder(getCellBorder()); + //this.validate(); + //super.repaint(); + } + + private Color getCellBackgroundColor() { + Settings settings = getSettings(); + Color backgroundColor; + + if(highlighted) { + backgroundColor = settings.getHighlightColor(); + } else if(dataCell.isSelected()) { + backgroundColor = settings.getSelectColor(); + } else if(null == tableView.getTable().getCompareTable()) { + backgroundColor = getBinColor(); + }else { + backgroundColor = getCompareColor(); + } + + return backgroundColor; + } + + public Color getCompareColor() { + Table t = tableView.getTable(); + + if(tableView instanceof Table1DView) {; + if(((Table1DView)tableView).isAxis() && !getSettings().isColorAxis()) { + return getSettings().getAxisColor(); + } + } + + double compareScale; + if (0.0 == dataCell.getCompareValue()) { + return Settings.UNCHANGED_VALUE_COLOR; + }else if(t.getMinCompare() == t.getMaxCompare()) { + return getSettings().getMaxColor(); + } else { + compareScale = (dataCell.getCompareValue() - t.getMinCompare()) / (t.getMaxCompare() - t.getMinCompare()); + } + return getScaledColor(compareScale); + } + + public Color getBinColor() { + Table t = tableView.getTable(); + + if(tableView instanceof Table1DView) {; + if(((Table1DView)tableView).isAxis() && !getSettings().isColorAxis()) { + return getSettings().getAxisColor(); + } + } + + if (dataCell.getMaxAllowedBin() < dataCell.getBinValue()) { + return getSettings().getWarningColor(); + } else if (dataCell.getMinAllowedBin() > dataCell.getBinValue()) { + return getSettings().getWarningColor(); + } else { + // limits not set, scale based on table values + double colorScale; + if (t.getMaxBin() - t.getMinBin() == 0.0) { + // if all values are the same, color will be middle value + colorScale = .5; + } else { + colorScale = (dataCell.getRealValue() - t.getMinReal()) / (t.getMaxReal() - t.getMinReal()); + } + + return getScaledColor(colorScale); + } + } + + @Override + public void mouseEntered(MouseEvent e) { + if (UNSELECT_MASK1 == (e.getModifiersEx() & UNSELECT_MASK1)) { + clearCell(); + } else if (UNSELECT_MASK2 == (e.getModifiersEx() & UNSELECT_MASK2)) { + clearCell(); + } else { + tableView.highlight(x, y); + } + } + + @Override + public void mousePressed(MouseEvent e) { + if (!e.isControlDown()) { + dataCell.getTable().clearSelection(); + } + + if (e.isControlDown() && e.isAltDown()) { + clearCell(); + } else { + tableView.startHighlight(x, y); + } + requestFocus(); + ECUEditorManager.getECUEditor().getTableToolBar().updateTableToolBar(dataCell.getTable()); + } + + @Override + public void mouseReleased(MouseEvent e) { + tableView.stopHighlight(); + } + + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + private Color getCellTextColor() { + Color textColor; + + if(traced) { + if(!dataCell.getLiveValue().isEmpty()) { + if(tableView.getTable() instanceof Table1D) { + textColor = Settings.scaleTextColor; + } else { + textColor = Settings.liveDataTraceTextColor; + } + } else { + textColor = Settings.scaleTextColor; + } + } else if (highlighted) { + textColor = Settings.highlightTextColor; + } else if (dataCell.isSelected()) { + textColor = Settings.selectTextColor; + } else { + textColor = Settings.scaleTextColor; + } + + return textColor; + } + + private Border getCellBorder() { + Border border; + if(traced) { + border = CURLIVE_BORDER; + if(tracedStale) { + border = STALELIVE_BORDER; + } + } else { + double checkValue; + + if(null == tableView.getTable().getCompareTable()) { + checkValue= dataCell.getOriginalValue(); + } else { + checkValue = dataCell.getCompareToValue(); + } + + if (checkValue < dataCell.getBinValue()) { + border = INCREASE_BORDER; + } else if (checkValue > dataCell.getBinValue()) { + border = DECREASE_BORDER; + } else { + border = DEFAULT_BORDER; + } + } + + return border; + } + + public String getCellText() { + if(tableView.getTable().isStaticDataTable()) { + return getStaticText(); + } + + FORMATTER.applyPattern(tableView.getTable().getCurrentScale().getFormat()); + String displayString = ""; + + if (null == tableView.getTable().getCompareTable()) { + displayString = FORMATTER.format(dataCell.getRealValue()); + } else if (tableView.getCompareDisplay() == Settings.CompareDisplay.ABSOLUTE) { + displayString = FORMATTER.format(dataCell.getRealCompareValue()); + } else if (tableView.getCompareDisplay() == Settings.CompareDisplay.PERCENT) { + FORMATTER.applyPattern(PERCENT_FORMAT); + if (dataCell.getCompareValue() == 0.0) { + displayString = FORMATTER.format(0.0); + } else { + displayString = FORMATTER.format(dataCell.getRealCompareChangeValue()); + } + } + + if(traced) { + if(!(tableView.getTable() instanceof Table1D)) { + displayString = getLiveValueString(displayString); + } + } + return displayString; + } + + private String getCellToolTip() { + if(tableView.getTable().isStaticDataTable()) { + return getStaticText(); + } + String ttString = null; + FORMATTER.applyPattern(TT_FORMAT); + if (null == tableView.getTable().getCompareTable()) { + ttString = FORMATTER.format(dataCell.getRealValue()); + } else if (tableView.getCompareDisplay() == Settings.CompareDisplay.ABSOLUTE) { + ttString = FORMATTER.format(dataCell.getRealCompareValue()); + } else if (tableView.getCompareDisplay() == Settings.CompareDisplay.PERCENT) { + FORMATTER.applyPattern(TT_PERCENT_FORMAT); + if (dataCell.getCompareValue() == 0.0) { + ttString = FORMATTER.format(0.0); + } else { + ttString = FORMATTER.format(dataCell.getRealCompareChangeValue()); + } + } + if(traced) { + if(!(tableView.getTable() instanceof Table1D)) { + ttString = getLiveValueString(ttString); + } + } + return ttString; + } + + + private void clearCell() { + if(isHighlighted()) { + setHighlighted(false); + } + if(dataCell.isSelected()) { + dataCell.setSelected(false); + } + } + + public boolean isSelected() { + return dataCell.isSelected(); + } + + @Override + public String toString() { + return getCellText(); + } + + + public void setHighlighted(boolean highlighted) { + if(!tableView.getTable().isStaticDataTable() && this.highlighted != highlighted) { + this.highlighted = highlighted; + drawCell(); + } + } + + public boolean isHighlighted() { + return highlighted; + } + + public void setLiveDataTrace(boolean trace) { + if(traced != trace) { + traced = trace; + drawCell(); + } + } + + public void setPreviousLiveDataTrace(boolean trace) { + if(tracedStale != trace) { + tracedStale = trace; + drawCell(); + } + } + + private String getLiveValueString(String currentValue) { + return currentValue + (isNullOrEmpty(dataCell.getLiveValue()) ? Settings.BLANK : (':' + dataCell.getLiveValue())); + } + + public String getStaticText() { + String displayString = null; + try { + FORMATTER.applyPattern(tableView.getTable().getCurrentScale().getFormat()); + double staticDouble = Double.parseDouble(dataCell.getStaticText()); + displayString = FORMATTER.format(JEPUtil.evaluate(tableView.getTable().getCurrentScale().getExpression(), staticDouble)); + } catch (Exception ex) { + displayString = dataCell.getStaticText(); + } + return displayString; + } + + public void setY(int y) { + this.y = y; + } + +} diff --git a/src/main/java/com/romraider/maps/PresetManager.java b/src/main/java/com/romraider/maps/PresetManager.java new file mode 100644 index 000000000..809940903 --- /dev/null +++ b/src/main/java/com/romraider/maps/PresetManager.java @@ -0,0 +1,139 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps; + +import java.util.LinkedList; + +import com.romraider.Settings.Endian; +import com.romraider.util.ByteUtil; + +public class PresetManager { + private LinkedList presets = new LinkedList(); + private Table table; + + public PresetManager(Table t){ + table = t; + } + + public class PresetEntry { + int dataCellOffset = 0; + String name; + boolean isBitMask; + LinkedList data; + } + + private int parseStringToInt(String s) { + Integer i = ByteUtil.parseUnsignedInt(s, 16); + + if (table.getStorageType() > 1 && table.getEndian() == Endian.LITTLE) + { + if(table.getStorageType() == 2) { + i = Short.reverseBytes((short)(i&0xFFFF))&0xFFFF; + } + else if(table.getStorageType() == 4) { + i = Integer.reverseBytes(i); + } + } + return i; + } + + public boolean isPresetActive(PresetEntry entry) { + if (entry.data != null && table.getDataSize() >= entry.data.size() + entry.dataCellOffset) { + for (int i = 0; i < entry.data.size(); i++) { + DataCell[] data = table.data; + if ((int) data[i + entry.dataCellOffset].getBinValue() != entry.data.get(i)) { + return false; + } + } + return true; + } + return false; + } + + public void applyPreset(PresetEntry entry) { + if (entry.data != null && table.getDataSize() >= entry.data.size() + entry.dataCellOffset) { + for (int i = 0; i < entry.data.size(); i++) { + try { + table.data[i + entry.dataCellOffset].setBinValue(entry.data.get(i)); + } catch (UserLevelException e) { + TableView.showInvalidUserLevelPopup(e); + } + } + } + } + + public void clearPreset(PresetEntry entry) { + if (entry.data != null && table.getDataSize() >= entry.data.size() + entry.dataCellOffset) { + for (int i = 0; i < entry.data.size(); i++) { + try { + table.data[i+ entry.dataCellOffset].setBinValue(0); + } catch (UserLevelException e) { + TableView.showInvalidUserLevelPopup(e); + } + } + } + } + + private PresetEntry createPresetEntryValue(String name, String data, int dataCellOffset, boolean isBitMask) { + PresetEntry entry = new PresetEntry(); + entry.name = name; + entry.data = new LinkedList(); + entry.dataCellOffset = dataCellOffset; + entry.isBitMask = isBitMask; + + data = data.trim(); + + for (String s : data.split(data.contains(",") ? "," : " ")) { + if(!s.isEmpty()){ + entry.data.add(parseStringToInt(s)); + } + } + + return entry; + } + + //Don't check for duplicate names, just add + public void setPresetValues(String name, String data, int dataCellOffset, boolean isBitMask) { + PresetEntry entry = createPresetEntryValue(name, data, dataCellOffset, isBitMask); + + presets.add(entry); + } + + //Check for duplicate names, then replace if exist or add otherwise + public void addPresetValue(String name, String data, int dataCellOffset, boolean isBitMask) { + PresetEntry oldEntry = null; + PresetEntry newEntry = createPresetEntryValue(name, data, dataCellOffset, isBitMask); + + for (int i = 0; i < presets.size(); i++) { + if (presets.get(i).name.equalsIgnoreCase(newEntry.name)){ + oldEntry = presets.set(i, newEntry); + break; + } + } + + if (oldEntry == null) { + presets.add(newEntry); + } + } + + public LinkedList getPresets(){ + return this.presets; + } +} diff --git a/src/main/java/com/romraider/maps/PresetPanel.java b/src/main/java/com/romraider/maps/PresetPanel.java new file mode 100644 index 000000000..4257dce18 --- /dev/null +++ b/src/main/java/com/romraider/maps/PresetPanel.java @@ -0,0 +1,180 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.border.EmptyBorder; + +import com.romraider.maps.PresetManager.PresetEntry; +import com.romraider.maps.Table.TableType; + +public class PresetPanel extends JPanel { + private static final long serialVersionUID = 1L; + private final List buttonGroup = new ArrayList(); + private PresetManager manager; + private TableView table; + private final int minimumWidth = 500; + + public PresetPanel(TableView t, PresetManager manager) { + this.manager = manager; + this.table = t; + setBorder(new EmptyBorder(2, 2, 2, 2)); + setLayout(new GridBagLayout()); + } + + public void populatePanel() { + //If this is an axis within another table dont show the panel + if(table.getTable().getType() == TableType.TABLE_1D) { + if(((Table1D) (table.getTable())).getAxisParent() != null) { + return; + } + } + + JPanel radioPanel = new JPanel(new GridLayout(0, 1)); + radioPanel.setBorder(new EmptyBorder(0, 2, 7, 0)); + boolean isSwitchTable = table.getTable() instanceof TableSwitch; + + JLabel optionLabel = new JLabel(); + String s = isSwitchTable ? table.getName(): "Presets"; + optionLabel.setText(s); + optionLabel.setPreferredSize(new Dimension(minimumWidth, 20)); + + Font f = optionLabel.getFont(); + if (isSwitchTable) + optionLabel.setFont(f.deriveFont(f.getStyle() | Font.BOLD, 15)); + else + optionLabel.setFont(f.deriveFont(f.getStyle() | Font.BOLD)); + + radioPanel.add(optionLabel); + + //Setup button for each preset + for (PresetEntry entry : manager.getPresets()) { + PresetButton button = new PresetButton(entry); + + button.setText(entry.name); + + if (isSwitchTable) { + Font x = button.getFont(); + button.setFont(x.deriveFont(x.getStyle(), 15)); + } + + button.addActionListener(new PresetListener(entry, table)); + buttonGroup.add(button); + radioPanel.add(button); + } + + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.BOTH; + c.anchor = GridBagConstraints.FIRST_LINE_START; + c.gridx = 0; + c.gridy = 0; + add(radioPanel, c); + + //Add description if its a switch + String stringDesc = table.getTable().getDescription(); + + if(isSwitchTable && stringDesc != null && stringDesc.trim().length() > 0) { + JTextArea desc = new JTextArea(stringDesc); + desc.setLineWrap(true); + desc.setWrapStyleWord(true); + desc.setOpaque(false); + + Font x = optionLabel.getFont(); + desc.setFont(x.deriveFont(x.getStyle(), 12)); + + c.gridx = 0; + c.gridy = 1; + c.anchor = GridBagConstraints.LAST_LINE_START; + add(desc, c); + } + + //Move it to the bottom and left + //For sure better way to do this... + JPanel temp = new JPanel(); + temp.setLayout(new BorderLayout()); + temp.add(this, BorderLayout.WEST); + + table.add(temp, BorderLayout.SOUTH); + repaint(); + } + + @Override + public void repaint() { + if (buttonGroup != null) { + for (PresetButton button: buttonGroup) { + button.checkIfActive(); + } + } + super.repaint(); + } + + class PresetButton extends JCheckBox{ + private static final long serialVersionUID = 1L; + PresetEntry entry; + + public PresetButton(PresetEntry entry) { + this.entry = entry; + } + + public void checkIfActive() { + setSelected(manager.isPresetActive(entry)); + } + } + + class PresetListener implements ActionListener{ + PresetEntry entry; + TableView view; + + public PresetListener(PresetEntry entry, TableView view) { + this.entry = entry; + this.view = view; + } + + @Override + public void actionPerformed(ActionEvent event) { + if (((PresetButton) (event.getSource())).isSelected()) { + manager.applyPreset(entry); + } + else if(entry.isBitMask){ + manager.clearPreset(entry); + } + + //Make sure we update all other checkboxes + //DataCellView usually calls this, but we dont have any DataCell + //if we are hidden + if(view.isHidden()) + view.updatePresetPanel(); + } + } +} diff --git a/src/main/java/com/romraider/maps/Rom.java b/src/main/java/com/romraider/maps/Rom.java index 5092850db..63195f47b 100644 --- a/src/main/java/com/romraider/maps/Rom.java +++ b/src/main/java/com/romraider/maps/Rom.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2025 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,208 +24,312 @@ import static com.romraider.util.HexUtil.asHex; import static javax.swing.JOptionPane.DEFAULT_OPTION; import static javax.swing.JOptionPane.QUESTION_MESSAGE; +import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; import static javax.swing.JOptionPane.showOptionDialog; import java.beans.PropertyVetoException; import java.io.File; import java.io.Serializable; +import java.text.MessageFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; import java.util.List; +import java.util.ResourceBundle; import java.util.Vector; +import java.util.regex.PatternSyntaxException; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; import org.apache.log4j.Logger; +import org.w3c.dom.Document; import com.romraider.Settings; +import com.romraider.dataflowSimulation.DataflowSimulation; +import com.romraider.editor.ecu.ECUEditorManager; import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler; +import com.romraider.maps.checksum.ChecksumManager; import com.romraider.swing.CategoryTreeNode; import com.romraider.swing.JProgressPane; import com.romraider.swing.TableFrame; import com.romraider.swing.TableTreeNode; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; -import com.romraider.xml.InvalidTableNameException; -import com.romraider.xml.TableNotFoundException; public class Rom extends DefaultMutableTreeNode implements Serializable { private static final long serialVersionUID = 7865405179738828128L; private static final Logger LOGGER = Logger.getLogger(Rom.class); - private RomID romID = new RomID(); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + Rom.class.getName()); + + private RomID romID; + private File definitionPath; private String fileName = ""; private File fullFileName = new File("."); - private final Vector tableNodes = new Vector(); private byte[] binData; - private boolean isAbstract = false; - - public Rom() { - tableNodes.clear(); + private Document doc; + + // This is currently only used for unit testing + // It could however be used to create a list of faulty tables instead + // of an endless loop or error messages with a bad definition or bin + private List faultyTables = new LinkedList(); + + //This keeps track of DataCells on a byte level + //This might also be possible to achieve by using the same Data Tables + protected HashMap> byteCellMapping = new HashMap>(); + + private final LinkedHashMap tableNodes = new LinkedHashMap(); + private final LinkedList simulations = new LinkedList(); + private LinkedList checksumManagers = new LinkedList(); + + private final Settings settings = SettingsManager.getSettings(); + + public Rom(RomID romID) { + this.romID = romID; } + + public List getFaultyTables() + { + return faultyTables; + } + + //This makes sure we automatically sort the tables by name + public void sortedAdd(DefaultMutableTreeNode currentParent, DefaultMutableTreeNode newNode) { + boolean found = false; + for(int k = 0; k < currentParent.getChildCount(); k++){ + TreeNode n = currentParent.getChildAt(k); + + //Category nodes should be placed at the top + if(newNode instanceof CategoryTreeNode && !(n instanceof CategoryTreeNode)) { + found = true; + } + else if(!(newNode instanceof CategoryTreeNode) && n instanceof CategoryTreeNode) { + continue; + } + else if(settings.isTableTreeSorted() && + (n.toString().compareToIgnoreCase(newNode.toString()) >= 0)) { + found = true; + } + + if(found) { + currentParent.insert(newNode, k); + break; + } + } - public void refreshDisplayedTables() { - // Remove all nodes from the ROM tree node. + if(!found) { + currentParent.add(newNode); + } + } + + public List refreshDisplayedTables() { + return refreshDisplayedTables(null); + } + + /* + * Refreshes the list of tables for a rom. Takes a regex (or null) as input for filtering. + * Outputs a list of paths that should be expanded based on the filter. + */ + public List refreshDisplayedTables(String filterText) { super.removeAllChildren(); Settings settings = SettingsManager.getSettings(); + boolean shouldFilter = filterText != null && !filterText.isEmpty(); + boolean anyTablesAdded = false; - // Add nodes to ROM tree. - for (TableTreeNode tableTreeNode : tableNodes) { - TableFrame tableFrame = tableTreeNode.getFrame(); - Table table = tableFrame.getTable(); + // Collect TreePaths for expansion + List pathsToExpand = new ArrayList(); - if (settings.isDisplayHighTables() || settings.getUserLevel() >= table.getUserLevel()) { - boolean categoryExists = false; - - for (int j = 0; j < getChildCount(); j++) { - if (getChildAt(j).toString().equals(table.getCategory())) { - // add to appropriate category - getChildAt(j).add(tableTreeNode); - categoryExists = true; - break; - } - } + for (TableTreeNode tableTreeNode : tableNodes.values()) { + Table table = tableTreeNode.getTable(); - if (!categoryExists) { // if category does not already exist, create it - CategoryTreeNode categoryNode = new CategoryTreeNode(table.getCategory()); - categoryNode.add(tableTreeNode); - this.add(categoryNode); + boolean addToTree = true; + if (shouldFilter) { + try { + addToTree = table.getName().toLowerCase().contains(filterText.toLowerCase()); + } catch (PatternSyntaxException exception) { + addToTree = false; } } - } - } - public void addTable(Table table) { - boolean found = false; - String frameTitle = this.getFileName()+" - "+table.getName(); + if (!addToTree) continue; + anyTablesAdded = true; - for (int i = 0; i < tableNodes.size(); i++) { - if (tableNodes.get(i).getTable().equals(table)) { - tableNodes.remove(i); - tableNodes.add(i, new TableTreeNode(new TableFrame(frameTitle, table))); - found = true; - break; - } - } - if (!found) { - tableNodes.add(new TableTreeNode(new TableFrame(frameTitle, table))); - } - } + String[] categories = table.getCategory().split("//"); - public void addTableByName(Table table) { - boolean found = false; - String frameTitle = this.getFileName()+" - "+table.getName(); + if (settings.isDisplayHighTables() || settings.getUserLevel() >= table.getUserLevel()) { + DefaultMutableTreeNode currentParent = this; - for (int i = 0; i < tableNodes.size(); i++) { - if (tableNodes.get(i).getTable().getName().equalsIgnoreCase(table.getName())) { - tableNodes.remove(i); - tableNodes.add(i, new TableTreeNode(new TableFrame(frameTitle, table))); - found = true; - break; + for (int i = 0; i < categories.length; i++) { + boolean categoryExists = false; + + for (int j = 0; j < currentParent.getChildCount(); j++) { + if (currentParent.getChildAt(j).toString().equalsIgnoreCase(categories[i])) { + categoryExists = true; + currentParent = (DefaultMutableTreeNode) currentParent.getChildAt(j); + break; + } + } + + if (!categoryExists) { + CategoryTreeNode categoryNode = new CategoryTreeNode(categories[i]); + sortedAdd(currentParent, categoryNode); + currentParent = categoryNode; + } + + // Only add last category in path for expansion + if (shouldFilter) { + pathsToExpand.add(new TreePath(currentParent.getPath())); + } + + if (i == categories.length - 1) { + sortedAdd(currentParent, tableTreeNode); + } + } } } - if (!found) { - tableNodes.add(new TableTreeNode(new TableFrame(frameTitle, table))); - } - } - public void removeTable(Table table) { - for(int i = 0; i < tableNodes.size(); i++) { - if(tableNodes.get(i).getTable().equals(table)) { - tableNodes.remove(i); - return; - } + if (!anyTablesAdded && shouldFilter) { + sortedAdd(this, new DefaultMutableTreeNode(rb.getString("NOMATCHES"))); } + + return pathsToExpand; } + public void addTableByName(Table table) { + table.setRom(this); + tableNodes.put(table.getName().toLowerCase(), new TableTreeNode(table)); + } + + public void addSimulation(DataflowSimulation sim) { + simulations.add(sim); + } + + public LinkedList getSimulations() + { + return this.simulations; + } + public void removeTableByName(Table table) { - for(int i = 0; i < tableNodes.size(); i++) { - if(tableNodes.get(i).getTable().getName().equalsIgnoreCase(table.getName())) { - tableNodes.remove(i); - return; - } + if(tableNodes.containsKey(table.getName().toLowerCase())) { + tableNodes.remove(table.getName().toLowerCase()); } } - public Table getTableByName(String tableName) throws TableNotFoundException, InvalidTableNameException { - if(null == tableName || tableName.isEmpty()) { - throw new InvalidTableNameException(); - } + public Table getTableByName(String tableName) { + TableTreeNode node = getTableNodeByName(tableName); - for (TableTreeNode tableNode : tableNodes) { - if (tableNode.getTable().getName().equalsIgnoreCase(tableName)) { - return tableNode.getTable(); - } + if(node != null) + return node.getTable(); + return null; + } + + public TableTreeNode getTableNodeByName(String tableName) { + if(!tableNodes.containsKey(tableName.toLowerCase())) { + return null; + } + else { + return tableNodes.get(tableName.toLowerCase()); } - throw new TableNotFoundException(); } public List
findTables(String regex) { List
result = new ArrayList
(); - for (TableTreeNode tableNode : tableNodes) { + for (TableTreeNode tableNode : tableNodes.values()) { String name = tableNode.getTable().getName(); if (name.matches(regex)) result.add(tableNode.getTable()); } return result; } + // Table storage address extends beyond end of file + private void showBadTablePopup(Table table, Exception ex) { + LOGGER.error(table.getName() + + " type " + table.getType() + " start " + + table.getStorageAddress() + " " + binData.length + " filesize", ex); + + JOptionPane.showMessageDialog(null, + MessageFormat.format(rb.getString("ADDROUTOFBNDS"), table.getName()), + rb.getString("ECUDEFERROR"), JOptionPane.ERROR_MESSAGE); + } + + private void showNullExceptionPopup(Table table, Exception ex) { + LOGGER.error("Error Populating Table", ex); + JOptionPane.showMessageDialog(null, + MessageFormat.format(rb.getString("TABLELOADERR"), table.getName()), + rb.getString("ECUDEFERROR"), JOptionPane.ERROR_MESSAGE); + } + + private void handleException(Table table, Exception e, boolean isOutOfBounds) + { + boolean isTesting = SettingsManager.getTesting(); + + if(!isTesting) + { + if(isOutOfBounds) + showBadTablePopup(table, e); + else + showNullExceptionPopup(table, e); + } + else + { + e.printStackTrace(); + } + faultyTables.add(table.getName()); + } + public void populateTables(byte[] binData, JProgressPane progress) { this.binData = binData; - for (int i = 0; i < tableNodes.size(); i++) { + int size = tableNodes.size(); + int i = 0; + faultyTables.clear(); + for(String name: tableNodes.keySet()) { // update progress - int currProgress = (int) (i / (double) tableNodes.size() * 40); - progress.update("Populating tables...", 50 + currProgress); + int currProgress = (int) (i / (double) size * 100); + progress.update(rb.getString("POPTABLES"), currProgress); - Table table = tableNodes.get(i).getTable(); + Table table = tableNodes.get(name.toLowerCase()).getTable(); try { - // if storageaddress has not been set (or is set to 0) omit table - if (table.getStorageAddress() != 0) { + if (table.getStorageAddress() >= 0) { try { - table.populateTable(binData, this.getRomID().getRamOffset()); + table.populateTable(this); TableUpdateHandler.getInstance().registerTable(table); if (null != table.getName() && table.getName().equalsIgnoreCase("Checksum Fix")){ - setEditStamp(binData, table.getStorageAddress()); + setEditStamp(binData, table.getStorageAddress() - table.getRamOffset()); } + i++; } catch (ArrayIndexOutOfBoundsException ex) { - - LOGGER.error(table.getName() + - " type " + table.getType() + " start " + - table.getStorageAddress() + " " + binData.length + " filesize", ex); - - // table storage address extends beyond end of file - JOptionPane.showMessageDialog(SwingUtilities.windowForComponent(table), "Storage address for table \"" + table.getName() + - "\" is out of bounds.\nPlease check ECU definition file.", "ECU Definition Error", JOptionPane.ERROR_MESSAGE); - tableNodes.removeElementAt(i); - i--; + handleException(table, ex, true); + size--; } catch (IndexOutOfBoundsException iex) { - LOGGER.error(table.getName() + - " type " + table.getType() + " start " + - table.getStorageAddress() + " " + binData.length + " filesize", iex); - - // table storage address extends beyond end of file - JOptionPane.showMessageDialog(SwingUtilities.windowForComponent(table), "Storage address for table \"" + table.getName() + - "\" is out of bounds.\nPlease check ECU definition file.", "ECU Definition Error", JOptionPane.ERROR_MESSAGE); - tableNodes.removeElementAt(i); - i--; + handleException(table, iex, true); + size--; } - } else { - tableNodes.removeElementAt(i); - // decrement i because length of vector has changed - i--; + tableNodes.remove(table.getName().toLowerCase()); + size--; } } catch (NullPointerException ex) { - LOGGER.error("Error Populating Table", ex); - JOptionPane.showMessageDialog(SwingUtilities.windowForComponent(table), "There was an error loading table " + table.getName(), "ECU Definition Error", JOptionPane.ERROR_MESSAGE); - tableNodes.removeElementAt(i); - i--; + handleException(table, ex, false); + size--; } } + + for(String s: faultyTables) { + tableNodes.remove(s.toLowerCase()); + } } private void setEditStamp(byte[] binData, int address) { @@ -258,12 +362,31 @@ public String getRomIDString() { return romID.getXmlid(); } + public byte[] getBinary() { + return binData; + } + + public void setDocument(Document d) { + this.doc = d; + } + public Document getDocument() { + return this.doc; + } + + public void setDefinitionPath(File s) { + definitionPath = s; + } + + public File getDefinitionPath() { + return definitionPath; + } + @Override public String toString() { String output = ""; output = output + "\n---- Rom ----" + romID.toString(); - for (int i = 0; i < tableNodes.size(); i++) { - output = output + tableNodes.get(i).getTable(); + for(String s : tableNodes.keySet()) { + output = output + tableNodes.get(s).getTable(); } output = output + "\n---- End Rom ----"; @@ -276,13 +399,14 @@ public String getFileName() { public Vector
getTables() { Vector
tables = new Vector
(); - for(TableTreeNode tableNode : tableNodes) { + for(TableTreeNode tableNode : tableNodes.values()) { tables.add(tableNode.getTable()); } + Collections.sort(tables); return tables; } - public Vector getTableNodes() { + public HashMap getTableNodes() { return this.tableNodes; } @@ -290,18 +414,45 @@ public void setFileName(String fileName) { this.fileName = fileName; } + private void showChecksumFixPopup(TableTreeNode checksum) { + Object[] options = {rb.getString("YES"), rb.getString("NO")}; + final String message = rb.getString("CHKSUMINVALID"); + + int answer = showOptionDialog( + SwingUtilities.windowForComponent(checksum.getTable().getTableView()), + message, + rb.getString("CHECKSUMFIX"), + DEFAULT_OPTION, + QUESTION_MESSAGE, + null, + options, + options[0]); + if (answer == 0) { + //TODO: Move to Subaru checksum + calculateRomChecksum( + binData, + checksum.getTable() + ); + } + } + + //Most of this function is useless now, since each Datacell is now responsible for each memory region + //It is only used to correct the Subaru Checksum. Should be moved somewhere else TODO public byte[] saveFile() { + + //There can be more than 1 Checksum Fix tables, find them all final List checksumTables = new ArrayList(); - for (TableTreeNode tableNode : tableNodes) { - tableNode.getTable().saveFile(binData); - if (tableNode.getTable().getName().contains("Checksum Fix")) { - checksumTables.add(tableNode); + for (String name: tableNodes.keySet()) { + if (name.startsWith("checksum fix")) { + checksumTables.add(tableNodes.get(name)); } } if (checksumTables.size() == 1) { final TableTreeNode checksum = checksumTables.get(0); - byte count = binData[checksum.getTable().getStorageAddress() + 207]; + int binDataPos = checksum.getTable().getStorageAddress() - + checksum.getTable().getRamOffset(); + byte count = binData[binDataPos + 207]; if (count == -1) { count = 1; } @@ -315,45 +466,26 @@ public byte[] saveFile() { romStamp, 0, binData, - checksum.getTable().getStorageAddress() + 204, + binDataPos + 204, 4); - setEditStamp(binData, checksum.getTable().getStorageAddress()); + setEditStamp(binData, binDataPos); } for (TableTreeNode checksum : checksumTables) { if (!checksum.getTable().isLocked()) { + //TODO: Move to Subaru checksum calculateRomChecksum( binData, - checksum.getTable().getStorageAddress(), - checksum.getTable().getDataSize() + checksum.getTable() ); } else if (checksum.getTable().isLocked() && !checksum.getTable().isButtonSelected()) { - - Object[] options = {"Yes", "No"}; - final String message = String.format( - "One or more ROM image Checksums is invalid. " + - "Calculate new Checksums?%n" + - "(NOTE: this will only fix the Checksums it will NOT repair a corrupt ROM image)"); - int answer = showOptionDialog( - SwingUtilities.windowForComponent(checksum.getTable()), - message, - "Checksum Fix", - DEFAULT_OPTION, - QUESTION_MESSAGE, - null, - options, - options[0]); - if (answer == 0) { - calculateRomChecksum( - binData, - checksum.getTable().getStorageAddress(), - checksum.getTable().getDataSize() - ); - } + showChecksumFixPopup(checksum); } } + + updateChecksum(); return binData; } @@ -361,19 +493,47 @@ public void clearData() { super.removeAllChildren(); // Hide and dispose all frames. - for(TableTreeNode tableTreeNode : tableNodes) { + for(TableTreeNode tableTreeNode : tableNodes.values()) { TableFrame frame = tableTreeNode.getFrame(); - frame.setVisible(false); - try { - frame.setClosed(true); - } catch (PropertyVetoException e) { - ; // Do nothing. + + TableUpdateHandler.getInstance().deregisterTable(tableTreeNode.getTable()); + + // Quite slow and doesn't seem to be necessary after testing, + // uncomment if you disagree + + //tableTreeNode.getTable().clearData(); + + if(frame != null) { + try { + frame.setClosed(true); + } catch (PropertyVetoException e) { + // Do nothing. + } + frame.dispose(); + + if(frame.getTableView() != null) { + frame.getTableView().setVisible(false); + frame.getTableView().setData(null); + frame.getTableView().setTable(null); + frame.setTableView(null); + } } - frame.dispose(); + + tableTreeNode.setUserObject(null); } + clearByteMapping(); + checksumManagers.clear(); tableNodes.clear(); binData = null; + doc = null; + } + + public void clearByteMapping() { + for(List l: byteCellMapping.values())l.clear(); + + byteCellMapping.clear(); + byteCellMapping = null; } public int getRealFileSize() { @@ -387,33 +547,66 @@ public File getFullFileName() { public void setFullFileName(File fullFileName) { this.fullFileName = fullFileName; this.setFileName(fullFileName.getName()); - for (TableTreeNode tableNode : tableNodes) { - String frameTitle = this.getFileName() + " - " + tableNode.getTable().getName(); - tableNode.getFrame().setTitle(frameTitle); - } } - public boolean isAbstract() { - return isAbstract; + @Override + public DefaultMutableTreeNode getChildAt(int i) { + return (DefaultMutableTreeNode) super.getChildAt(i); + } + + public void addChecksumManager(ChecksumManager checksumManager) { + this.checksumManagers.add(checksumManager); } - public void setAbstract(boolean isAbstract) { - this.isAbstract = isAbstract; + public int getNumChecksumsManagers() { + return checksumManagers.size(); } - public void refreshTableCompareMenus() { - for(TableTreeNode tableNode : getTableNodes()) { - tableNode.getFrame().refreshSimilarOpenTables(); + public int validateChecksum() { + int correctChecksums = 0; + boolean valid = true; + + if (!checksumManagers.isEmpty()) { + for(ChecksumManager cm: checksumManagers) { + int localCorrectCs = cm.validate(binData); + + if (cm == null || cm.getNumberOfChecksums() != localCorrectCs) { + valid = false; + } + correctChecksums += localCorrectCs; + } + } + + if(!valid) { + showMessageDialog(null, + rb.getString("INVLAIDCHKSUM"), + rb.getString("CHKSUMFAIL"), + WARNING_MESSAGE); } + + return correctChecksums; } - @Override - public DefaultMutableTreeNode getChildAt(int i) { - return (DefaultMutableTreeNode) super.getChildAt(i); + public int updateChecksum() { + int updatedCs = 0; + + for(ChecksumManager cm: checksumManagers) { + updatedCs += cm.update(binData); + } + + ECUEditorManager.getECUEditor().getStatusPanel().setStatus( + String.format(rb.getString("CHECKSUMFIXED"), updatedCs, getTotalAmountOfChecksums())); + + return updatedCs; } - @Override - public DefaultMutableTreeNode getLastChild() { - return (DefaultMutableTreeNode) super.getLastChild(); + public int getTotalAmountOfChecksums() { + int cs = 0; + + for(ChecksumManager cm: checksumManagers) { + cs += cm.getNumberOfChecksums(); + } + + return cs; } } \ No newline at end of file diff --git a/src/main/java/com/romraider/maps/RomChecksum.java b/src/main/java/com/romraider/maps/RomChecksum.java index adf90c796..0faa6cc5a 100644 --- a/src/main/java/com/romraider/maps/RomChecksum.java +++ b/src/main/java/com/romraider/maps/RomChecksum.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2018 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,23 +26,59 @@ public class RomChecksum { - public static void calculateRomChecksum(byte[] input, int storageAddress, int dataSize) { + public static void calculateRomChecksum(byte[] input, Table table) + { + calculateRomChecksum( + input, + table.getStorageAddress(), + table.getDataSize(), + table.getRamOffset() + ); + } + + public static int validateRomChecksum(byte[] input, Table table) + { + return validateRomChecksum( + input, + table.getStorageAddress(), + table.getDataSize(), + table.getRamOffset() + ); + } + + private static void calculateRomChecksum(byte[] input, int storageAddress, int dataSize, int offset) { + storageAddress = storageAddress - offset; for (int i = storageAddress; i < storageAddress + dataSize; i+=12) { + int startAddr = (int)parseByteValue(input, Settings.Endian.BIG, i , 4, true); + int endAddr = (int)parseByteValue(input, Settings.Endian.BIG, i+4, 4, true); + int off = offset; + //0 means checksum is disabled, keep it + if (startAddr == 0 && endAddr == 0) { + off = 0; + } byte[] newSum = calculateChecksum(input, - (int)parseByteValue(input, 0, i , 4, true), - (int)parseByteValue(input, 0, i+4, 4, true)); + startAddr - off, + endAddr - off); System.arraycopy(newSum, 0, input, i + 8, 4); } } - public static int validateRomChecksum(byte[] input, int storageAddress, int dataSize) { + private static int validateRomChecksum(byte[] input, int storageAddress, int dataSize, int offset) { + storageAddress = storageAddress - offset; int result = 0; int[] results = new int[dataSize / 12]; int j = 0; for (int i = storageAddress; i < storageAddress + dataSize; i+=12) { - int startAddr = (int)parseByteValue(input, 0, i , 4, true); - int endAddr = (int)parseByteValue(input, 0, i+4, 4, true); - int diff = (int)parseByteValue(input, 0, i+8, 4, true); + int startAddr = (int)parseByteValue(input, Settings.Endian.BIG, i , 4, true); + int endAddr = (int)parseByteValue(input, Settings.Endian.BIG, i+4, 4, true); + int diff = (int)parseByteValue(input, Settings.Endian.BIG, i+8, 4, true); + int off = offset; + //0 means checksum is disabled, keep it + if (startAddr == 0 && endAddr == 0) { + off = 0; + } + startAddr -= off; + endAddr -= off; if (j == 0 && startAddr == 0 && endAddr == 0 && @@ -65,7 +101,7 @@ public static int validateRomChecksum(byte[] input, int storageAddress, int data private static int validateChecksum(byte[] input, int startAddr, int endAddr, int diff) { int byteSum = 0; for (int i=startAddr; i 2 + && internalIdString.substring(0, 2).equalsIgnoreCase("0x")) { + + // put romid in to byte array to check for match without "0x" + byte[] romIDBytes = asBytes(internalIdString.substring(2)); + + //If file is smaller than the address we are looking for, it can't be it + if(file.length < getInternalIdAddress() + romIDBytes.length) return false; + + //Extract bytes at specified location in ROM + byte[] romBytes = Arrays.copyOfRange(file, + getInternalIdAddress(), getInternalIdAddress() + romIDBytes.length); + + //Check if bytes match + return Arrays.equals(romIDBytes, romBytes); + } + else { + if(file.length < getInternalIdAddress() + getInternalIdString().length()) return false; + + String ecuID = new String(file, getInternalIdAddress(), + getInternalIdString().length()); + return ecuID.equalsIgnoreCase(getInternalIdString()); + } + + } catch (Exception ex) { + // if any exception is encountered, names do not match or code is buggy :) + LOGGER.warn("Error finding match", ex); + return false; + } + } + @Override public String toString() { return String.format( "%n ---- RomID %s ----" + + "%n Version: %s" + "%n Internal ID Address: %s" + "%n Internal ID String: %s" + "%n Case ID: %s" + @@ -61,6 +113,7 @@ public String toString() { "%n Memory Model: %s" + "%n ---- End RomID %s ----", xmlid, + version, internalIdAddress, internalIdString, caseId, @@ -76,11 +129,6 @@ public String toString() { xmlid); } - public RomID() { - this.internalIdString = ""; - this.caseId = ""; - } - public String getXmlid() { return xmlid; } @@ -185,11 +233,23 @@ public void setMemModel(String memModel) { this.memModel = memModel; } + public void setOffset(int offset) { + this.ramOffset = -offset; + noRamOffset=true; + } + + public void disableRamOffset() { + noRamOffset = true; + ramOffset = 0; + } + public int getRamOffset() { return ramOffset; } public void setRamOffset(int ramOffset) { + if(noRamOffset) return; + this.ramOffset = ramOffset; } @@ -216,4 +276,28 @@ public String getEditStamp() { public void setEditStamp(String editStamp) { this.editStamp = editStamp; } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + public String getChecksum() { + return checksum; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getVersion() { + return version; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } } \ No newline at end of file diff --git a/src/main/java/com/romraider/maps/Scale.java b/src/main/java/com/romraider/maps/Scale.java index 741f7fb16..3120eb128 100644 --- a/src/main/java/com/romraider/maps/Scale.java +++ b/src/main/java/com/romraider/maps/Scale.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,13 +22,17 @@ package com.romraider.maps; import java.io.Serializable; +import java.util.HashMap; + +import com.romraider.util.JEPUtil; public class Scale implements Serializable { private static final long serialVersionUID = 5836610685159474795L; + private String category = "Raw Value"; private String name = "Raw Value"; - private String unit = "0x"; + private String unit = "raw value"; private String expression = "x"; private String byteExpression = "x"; private String format = "#.##"; @@ -36,23 +40,107 @@ public class Scale implements Serializable { private double fineIncrement = 1; private double min = 0.0; private double max = 0.0; - - public Scale() { - } + + HashMap cachedValues = new HashMap(); + int maxCacheSize = 100; @Override public String toString() { - return "\n ---- Scale ----" + - "\n Name: " + getName() + - "\n Expression: " + getExpression() + - "\n Byte Expression: " + getByteExpression() + - "\n Unit: " + getUnit() + - "\n Format: " + getFormat() + - "\n Coarse Increment: " + getCoarseIncrement() + - "\n Fine Increment: " + getFineIncrement() + - "\n Min: " + getMin() + - "\n Max: " + getMax() + - "\n ---- End Scale ----\n"; + return "\n ---- Scale ----" + + "\n Category: " + getCategory() + + "\n Name: " + getName() + + "\n Expression: " + getExpression() + + "\n Byte Expression: " + getByteExpression() + + "\n Unit: " + getUnit() + + "\n Format: " + getFormat() + + "\n Coarse Increment: " + getCoarseIncrement() + + "\n Fine Increment: " + getFineIncrement() + + "\n Min: " + getMin() + + "\n Max: " + getMax() + + "\n ---- End Scale ----\n"; + } + + public boolean validate() { + //We use the approximation method here + if(getByteExpression() == null) return true; + + if(expression.equals("x") && byteExpression.equals("x")) return true; + + double startValue = 5; + // convert real world value of "5" + double toReal = JEPUtil.evaluate(getExpression(), startValue); + double endValue = JEPUtil.evaluate(getByteExpression(), toReal); + + // if real to byte doesn't equal 5, report conflict + if (Math.abs(endValue - startValue) > .001) return false; + else return true; + } + + public double approximateToByteFunction(double input, int storageType, boolean signed) { + + // Check if we already calculated this + if(cachedValues.containsKey(input)) + { + return cachedValues.get(input); + } + + long maxValue = (int) Math.pow(2, 8 * storageType); + long minValue = 0; + + if(signed) { + minValue = -maxValue/2; + maxValue = maxValue/2 - 1; + } + else { + maxValue--; + } + + double error = 1; + double lastError = 9999999; + + int currentStep = (int) ((maxValue - minValue) / 2); + int stepSize = (int) (Math.pow(2, 8 * storageType) / 2);; + double epsilon = 0.00001; + double output = 0; + + while(stepSize > 0 && error > epsilon) { + double minusValue = JEPUtil.evaluate(getExpression(), currentStep-stepSize); + double plusValue = JEPUtil.evaluate(getExpression(), currentStep+stepSize); + + double plusError = Math.abs(plusValue - input); + double minusError = Math.abs(minusValue - input); + + //Check if we need to go up or down + if(plusError < minusError) { + currentStep += stepSize; + error = plusError; + } + else { + currentStep -= stepSize; + error = minusError; + } + + if(error < lastError) + output = currentStep; + + if(error < epsilon) + break; + + stepSize/=2; + lastError = error; + } + + if(cachedValues.size() < maxCacheSize) + { + cachedValues.put(input, output); + } + + //System.out.println("Input: " + input + " from approx: " + JEPUtil.evaluate(getExpression(), output)); + return currentStep; + } + + public void setCategory(String category) { + this.category = category; } public String getUnit() { @@ -106,7 +194,10 @@ public String getByteExpression() { } public void setByteExpression(String byteExpression) { - this.byteExpression = byteExpression; + if(byteExpression.isEmpty()) + this.byteExpression = null; + else + this.byteExpression = byteExpression; } public double getFineIncrement() { @@ -117,6 +208,22 @@ public void setFineIncrement(double fineIncrement) { this.fineIncrement = fineIncrement; } + /** + * category is used to group like scalings, such as Metric, + * Imperial, etc. (case insensitive).
+ * This is the value shown in the Table Tool bar scaling selection list. + * @return category name + */ + public String getCategory() { + return category; + } + + /** + * name is defined in a scalingbase element (case insensitive).
+ * name is used by the base attribute in a scaling element definition + * to inherit from a scalingbase. + * @return name as defined in scalingbase + */ public String getName() { return name; } @@ -158,11 +265,26 @@ public boolean equals(Object other) { Scale otherScale = (Scale)other; + if( (null == this.getCategory() && null == otherScale.getCategory()) + || (this.getCategory().isEmpty() && otherScale.getCategory().isEmpty()) ) + { + ;// Skip Category compare if Category is null or empty. + } else + { + if(!this.getCategory().equalsIgnoreCase(otherScale.getCategory())) + { + return false; + } + } + if( (null == this.getName() && null == otherScale.getName()) - || (this.getName().isEmpty() && otherScale.getName().isEmpty()) ) { + || (this.getName().isEmpty() && otherScale.getName().isEmpty()) ) + { ;// Skip name compare if name is null or empty. - } else { - if(!this.getName().equalsIgnoreCase(otherScale.getName())) { + } else + { + if(!this.getName().equalsIgnoreCase(otherScale.getName())) + { return false; } } @@ -212,4 +334,4 @@ public boolean equals(Object other) { return false; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/maps/Table.java b/src/main/java/com/romraider/maps/Table.java index c1f65ba7b..db7f9ded1 100644 --- a/src/main/java/com/romraider/maps/Table.java +++ b/src/main/java/com/romraider/maps/Table.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,87 +19,52 @@ package com.romraider.maps; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.Toolkit; -import java.awt.Window; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.StringSelection; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.io.IOException; import java.io.Serializable; -import java.util.StringTokenizer; import java.util.Vector; import javax.naming.NameNotFoundException; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.InputMap; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.KeyStroke; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; + +import org.apache.log4j.Logger; import com.romraider.Settings; -import com.romraider.editor.ecu.ECUEditorManager; -import com.romraider.swing.TableToolBar; +import com.romraider.swing.TableFrame; +import com.romraider.util.ByteUtil; import com.romraider.util.JEPUtil; +import com.romraider.util.NumberUtil; import com.romraider.util.SettingsManager; -import com.romraider.xml.RomAttributeParser; -public abstract class Table extends JPanel implements Serializable { +public abstract class Table implements Serializable, Comparable
{ private static final long serialVersionUID = 6559256489995552645L; + protected static final Logger LOGGER = Logger.getLogger(Table.class); + protected static final String ST_DELIMITER = "\t\n\r\f"; + protected static Settings.Endian memModelEndian; + + protected TableView tableView; + protected TableFrame tableFrame; protected String name; - protected int type; protected String category = "Other"; protected String description = Settings.BLANK; protected Vector scales = new Vector(); protected Scale curScale; + protected PresetManager presetManager; + protected int tableBitMask; protected int storageAddress; protected int storageType; protected boolean signed; - protected int endian; + protected Settings.Endian endian = Settings.Endian.BIG; protected boolean flip; - protected DataCell[] data = new DataCell[0]; + + protected DataLayout dataLayout = DataLayout.DEFAULT; //DataCell Ordering + protected DataCell[] data = new DataCell[1]; + protected boolean beforeRam = false; protected int ramOffset = 0; - protected BorderLayout borderLayout = new BorderLayout(); - protected GridLayout centerLayout = new GridLayout(1, 1, 0, 0); - protected JPanel centerPanel = new JPanel(centerLayout); - protected JLabel tableLabel; - protected int verticalOverhead = 103; - protected int horizontalOverhead = 2; - protected int cellHeight = (int) getSettings().getCellSize().getHeight(); - protected int cellWidth = (int) getSettings().getCellSize().getWidth(); - protected int minHeight = 100; - protected int minWidthNoOverlay = 465; - protected int minWidthOverlay = 700; - protected int highlightX; - protected int highlightY; - protected boolean highlight = false; + protected int userLevel = 0; protected boolean locked = false; - protected String logParam = Settings.BLANK; - protected boolean overlayLog = false; - - protected CopyTableWorker copyTableWorker; - protected CopySelectionWorker copySelectionWorker; - - protected double minAllowedBin = 0.0; - protected double maxAllowedBin = 0.0; protected double maxBin; protected double minBin; @@ -107,432 +72,116 @@ public abstract class Table extends JPanel implements Serializable { protected double maxCompare = 0.0; protected double minCompare = 0.0; - protected int compareDisplay = Settings.COMPARE_DISPLAY_ABSOLUTE; - protected int compareValueType = Settings.DATA_TYPE_BIN; - + protected Rom rom; protected boolean staticDataTable = false; - protected String liveAxisValue = Settings.BLANK; - protected int liveDataIndex = 0; - private Table compareTable = null; + protected Settings.DataType compareValueType = Settings.DataType.BIN; - public Table() { - scales.clear(); - scales.add(new Scale()); - - this.setLayout(borderLayout); - this.add(centerPanel, BorderLayout.CENTER); - centerPanel.setVisible(true); - - // key binding actions - Action rightAction = new AbstractAction() { - private static final long serialVersionUID = 1042884198300385041L; - - @Override - public void actionPerformed(ActionEvent e) { - cursorRight(); - } - }; - Action leftAction = new AbstractAction() { - private static final long serialVersionUID = -4970441255677214171L; - - @Override - public void actionPerformed(ActionEvent e) { - cursorLeft(); - } - }; - Action downAction = new AbstractAction() { - private static final long serialVersionUID = -7898502951121825984L; - - @Override - public void actionPerformed(ActionEvent e) { - cursorDown(); - } - }; - Action upAction = new AbstractAction() { - private static final long serialVersionUID = 6937621541727666631L; - - @Override - public void actionPerformed(ActionEvent e) { - cursorUp(); - } - }; - Action incCoarseAction = new AbstractAction() { - private static final long serialVersionUID = -8308522736529183148L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().incrementCoarse(); - } - }; - Action decCoarseAction = new AbstractAction() { - private static final long serialVersionUID = -7407628920997400915L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().decrementCoarse(); - } - }; - Action incFineAction = new AbstractAction() { - private static final long serialVersionUID = 7261463425941761433L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().incrementFine(); - } - }; - Action decFineAction = new AbstractAction() { - private static final long serialVersionUID = 8929400237520608035L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().decrementFine(); - } - }; - Action num0Action = new AbstractAction() { - private static final long serialVersionUID = -6310984176739090034L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('0'); - } - }; - Action num1Action = new AbstractAction() { - private static final long serialVersionUID = -6187220355403883499L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('1'); - } - }; - Action num2Action = new AbstractAction() { - private static final long serialVersionUID = -8745505977907325720L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('2'); - } - }; - Action num3Action = new AbstractAction() { - private static final long serialVersionUID = 4694872385823448942L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('3'); - } - }; - Action num4Action = new AbstractAction() { - private static final long serialVersionUID = 4005741329254221678L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('4'); - } - }; - Action num5Action = new AbstractAction() { - private static final long serialVersionUID = -5846094949106279884L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('5'); - } - }; - Action num6Action = new AbstractAction() { - private static final long serialVersionUID = -5338656374925334150L; - - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('6'); - } - }; - Action num7Action = new AbstractAction() { - private static final long serialVersionUID = 1959983381590509303L; + public enum DataLayout { + DEFAULT, + BOSCH_SUBTRACT + } - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('7'); - } - }; - Action num8Action = new AbstractAction() { - private static final long serialVersionUID = 7442763278699460648L; + public void setTableView(TableView v) { + this.tableView = v; + } - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('8'); - } - }; - Action num9Action = new AbstractAction() { - private static final long serialVersionUID = 7475171864584215094L; + public TableView getTableView() { + return this.tableView; + } - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('9'); - } - }; - Action numPointAction = new AbstractAction() { - private static final long serialVersionUID = -4729135055857591830L; + public void setTableFrame(TableFrame v) { + this.tableFrame = v; + } - @Override - public void actionPerformed(ActionEvent e) { - getToolbar().focusSetValue('.'); - } - }; - Action copyAction = new AbstractAction() { - private static final long serialVersionUID = -6978981449261938672L; + public TableFrame getTableFrame() { + return this.tableFrame; + } - @Override - public void actionPerformed(ActionEvent e) { - copySelection(); - } - }; - Action pasteAction = new AbstractAction() { - private static final long serialVersionUID = 2026817603236490899L; + public DataCell[] getData() { + return data; + } - @Override - public void actionPerformed(ActionEvent e) { - paste(); - } - }; - Action interpolate = new AbstractAction() { - private static final long serialVersionUID = -2350912575392447149L; + public void addStaticDataCell(String s) { + setStaticDataTable(true); + DataCell c = new DataCell(this, s, null); - @Override - public void actionPerformed(ActionEvent e) { - interpolate(); + for(int i = 0; i < data.length; i++) { + if(data[i] == null) { + data[i] = c; + break; } - }; - Action verticalInterpolate = new AbstractAction() { - private static final long serialVersionUID = -2350912575392447149L; + } + } - @Override - public void actionPerformed(ActionEvent e) { - verticalInterpolate(); + //Cleans up all references to avoid data leaks + public void clearData() { + if(data != null) { + for(int i=0;i getScales() { public void addScale(Scale scale) { // look for scale, replace or add new for (int i = 0; i < scales.size(); i++) { - if (scales.get(i).getName().equalsIgnoreCase(scale.getName())) { + if (scales.get(i).getCategory().equalsIgnoreCase(scale.getCategory())) { scales.remove(i); break; } @@ -575,11 +231,12 @@ public void addScale(Scale scale) { this.curScale = scale; } - if(SettingsManager.getSettings().getDefaultScale().equalsIgnoreCase(scale.getName())) { + if(SettingsManager.getSettings().getDefaultScale().equalsIgnoreCase(scale.getCategory())) { + this.curScale = scale; + } + else if("Default".equalsIgnoreCase(scale.getCategory())) { this.curScale = scale; } - - validateScaling(); } public int getStorageAddress() { @@ -596,7 +253,6 @@ public int getStorageType() { public void setStorageType(int storageType) { this.storageType = storageType; - calcValueRange(); } public boolean isSignedData() { @@ -607,11 +263,11 @@ public void setSignedData(boolean signed) { this.signed = signed; } - public int getEndian() { + public Settings.Endian getEndian() { return endian; } - public void setEndian(int endian) { + public void setEndian(Settings.Endian endian) { this.endian = endian; } @@ -639,30 +295,53 @@ public String getLogParam() { return logParam; } + public String getLogParamString() { + return getName()+ ":" + getLogParam(); + } + @Override public String toString() { - /*String output = "\n ---- Table " + name + " ----" + - scale + - "\n Category: " + category + - "\n Type: " + type + - "\n Description: " + description + - "\n Storage Address: " + Integer.toHexString(storageAddress) + - "\n Storage Type: " + storageType + - "\n Endian: " + endian + - "\n Flip: " + flip + - "\n ---- End Table " + name + " ----"; - for (int i = 0; i < data.length; i++) { - if (data[i] != null) { - output = output + "\nData: " + data[i]; + if(null == name || name.isEmpty()) { + StringBuilder sb = new StringBuilder(); + sb.append(Settings.DEFAULT_TABLE_NAME); + + if(0 != this.getStorageAddress()) { + sb.append(" ("+this.getStorageAddress() + ")"); } + + if(null != this.getLogParam() && !this.getLogParam().isEmpty()) { + sb.append(" - " + this.getLogParam()); + } + + return sb.toString(); } + return name; + } - return output;*/ - return getName(); + public void setName(String n) { + this.name = n; } - @Override - public boolean equals(Object other) { + public String getName() { + return name; + } + + public StringBuffer getTableAsString() { + StringBuffer output = new StringBuffer(Settings.BLANK); + for (int i = 0; i < data.length; i++) { + + if(data[i]!= null) + output.append(NumberUtil.stringValue(data[i].getRealValue())); + + if (i < data.length - 1) { + output.append(Settings.TAB); + } + } + return output; + } + + //Faster version of equals where data doesnt matter (yet) + public boolean equalsWithoutData(Object other) { try { if(null == other) { return false; @@ -678,30 +357,17 @@ public boolean equals(Object other) { Table otherTable = (Table)other; - if( (null == this.getName() && null == otherTable.getName()) - || (this.getName().isEmpty() && otherTable.getName().isEmpty()) ) { - ;// Skip name compare if name is null or empty. - } else { - if(!this.getName().equalsIgnoreCase(otherTable.getName())) { - return false; - } + if(storageAddress != otherTable.storageAddress) { + return false; } - if(this.data.length != otherTable.data.length) - { + if(!this.name.equals(otherTable.name)) { return false; } - if(this.data.equals(otherTable.data)) + if(this.data.length != otherTable.data.length) { - return true; - } - - // Compare Bin Values - for(int i=0 ; i < this.data.length ; i++) { - if(! this.data[i].equals(otherTable.data[i])) { - return false; - } + return false; } return true; @@ -711,84 +377,60 @@ public boolean equals(Object other) { } } - public double getMaxAllowedBin() { - return maxAllowedBin; - } - - public double getMinAllowedBin() { - return minAllowedBin; - } - - public double getMaxAllowedReal() { - return JEPUtil.evaluate(getCurrentScale().getExpression(), getMaxAllowedBin()); - } + @Override + public boolean equals(Object other) { + try { + boolean withoutData = equalsWithoutData(other); + if(!withoutData) return false; - public double getMinAllowedReal() { - return JEPUtil.evaluate(getCurrentScale().getExpression(), getMinAllowedBin()); - } + Table otherTable = (Table)other; - private void calcValueRange() { - if (getStorageType() != Settings.STORAGE_TYPE_FLOAT) { - if (isSignedData()) { - switch (getStorageType()) { - case 1: - minAllowedBin = Byte.MIN_VALUE; - maxAllowedBin = Byte.MAX_VALUE; - break; - case 2: - minAllowedBin = Short.MIN_VALUE; - maxAllowedBin = Short.MAX_VALUE; - break; - case 4: - minAllowedBin = Integer.MIN_VALUE; - maxAllowedBin = Integer.MAX_VALUE; - break; + // Compare Bin Values + for(int i=0 ; i < this.data.length ; i++) { + if(! this.data[i].equals(otherTable.data[i])) { + return false; } } - else { - maxAllowedBin = (Math.pow(256, getStorageType()) - 1); - minAllowedBin = 0.0; - } - } else { - maxAllowedBin = Float.MAX_VALUE; - if(isSignedData()) { - minAllowedBin = 0.0; - } else { - minAllowedBin = -Float.MAX_VALUE; - } + return true; + } catch(Exception ex) { + // TODO: Log Exception. + return false; } } public void calcCellRanges() { - double binMax = data[0].getBinValue(); - double binMin = data[0].getBinValue(); + if(data.length > 0) { + double binMax = data[0].getBinValue(); + double binMin = data[0].getBinValue(); - double compareMax = data[0].getCompareValue(); - double compareMin = data[0].getCompareValue(); + double compareMax = data[0].getCompareValue(); + double compareMin = data[0].getCompareValue(); - for(DataCell cell : data) { - // Calc bin - if(binMax < cell.getBinValue()) { - binMax = cell.getBinValue(); - } - if(binMin > cell.getBinValue()) { - binMin = cell.getBinValue(); - } + for(DataCell cell : data) { - // Calc compare - double compareValue = cell.getCompareValue(); - if(compareMax < compareValue) { - compareMax = compareValue; - } - if(compareMin > compareValue) { - compareMin = compareValue; + // Calc bin + if(binMax < cell.getBinValue()) { + binMax = cell.getBinValue(); + } + if(binMin > cell.getBinValue()) { + binMin = cell.getBinValue(); + } + + // Calc compare + double compareValue = cell.getCompareValue(); + if(compareMax < compareValue) { + compareMax = compareValue; + } + if(compareMin > compareValue) { + compareMin = compareValue; + } } + setMaxBin(binMax); + setMinBin(binMin); + setMaxCompare(compareMax); + setMinCompare(compareMin); } - setMaxBin(binMax); - setMinBin(binMin); - setMaxCompare(compareMax); - setMinCompare(compareMin); } public double getMaxBin() { @@ -800,11 +442,11 @@ public double getMinBin() { } public double getMaxReal() { - return JEPUtil.evaluate(getCurrentScale().getExpression(), getMaxBin()); + return JEPUtil.evaluate(getCurrentScale().getExpression(), getMaxBin()); } public double getMinReal() { - return JEPUtil.evaluate(getCurrentScale().getExpression(), getMinBin()); + return JEPUtil.evaluate(getCurrentScale().getExpression(), getMinBin()); } public void setMaxBin(double maxBin) { @@ -831,396 +473,203 @@ public void setMinCompare(double minCompare) { this.minCompare = minCompare; } - public void drawTable() { - for(DataCell cell : data) { - if(null != cell) { - cell.drawCell(); - } + public void setRevertPoint() { + for (DataCell cell : data) { + cell.setRevertPoint(); } } - public Dimension getFrameSize() { - int height = verticalOverhead + cellHeight; - int width = horizontalOverhead + data.length * cellWidth; - if (height < minHeight) { - height = minHeight; - } - int minWidth = isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; - if (width < minWidth) { - width = minWidth; + public void undoAll() throws UserLevelException { + for (DataCell cell : data) { + cell.undo(); } - return new Dimension(width, height); } - public void increment(double increment) { - if (!locked && !(userLevel > getSettings().getUserLevel())) { - for (DataCell cell : data) { - if (cell.isSelected()) { - cell.increment(increment); - } - } - } else if (userLevel > getSettings().getUserLevel()) { - JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" + - userLevel + " or greater. Click View->User Level to change your userlevel.", - "Table cannot be modified", - JOptionPane.INFORMATION_MESSAGE); - } + //Don't check for duplicate names, just add + public void setPresetValues(String name, String value) { + if(presetManager == null) presetManager = new PresetManager(this); + presetManager.setPresetValues(name, value, 0, false); } - public void multiply(double factor) { - if (!locked && !(userLevel > getSettings().getUserLevel())) { - for (DataCell cell : data) { - if (cell.isSelected()) { - cell.multiply(factor); - } - } - } else if (userLevel > getSettings().getUserLevel()) { - JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" + - userLevel + " or greater. Click View->User Level to change your userlevel.", - "Table cannot be modified", - JOptionPane.INFORMATION_MESSAGE); - } + //Don't check for duplicate names, just add + public void setPresetValues(String name, String value, int dataCellOffset) { + if(presetManager == null) presetManager = new PresetManager(this); + presetManager.setPresetValues(name, value, dataCellOffset, true); } - public void setRealValue(String realValue) { - if (!locked && userLevel <= getSettings().getUserLevel()) { - for(DataCell cell : data) { - if (cell.isSelected()) { - cell.setRealValue(realValue); - } - } - } else if (userLevel > getSettings().getUserLevel()) { - JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" + - userLevel + " or greater. Click View->User Level to change your userlevel.", - "Table cannot be modified", - JOptionPane.INFORMATION_MESSAGE); - } + //Check for duplicate names, then replace if exist or add otherwise + public void addPresetValue(String name, String value) { + if(presetManager == null) presetManager = new PresetManager(this); + presetManager.addPresetValue(name, value, 0, false); } - public void clearSelection() { - clearSelectedData(); + //Check for duplicate names, then replace if exist or add otherwise + public void addPresetValue(String name, String value, int dataCellOffset) { + if(presetManager == null) presetManager = new PresetManager(this); + presetManager.addPresetValue(name, value, dataCellOffset, true); } - public void clearSelectedData() { - for (DataCell cell : data) { - if(cell.isSelected()) { - cell.setSelected(false); - } - } + public boolean isBeforeRam() { + return beforeRam; } - public void startHighlight(int x, int y) { - this.highlightY = y; - this.highlightX = x; - highlight = true; - highlight(x, y); + public void setBeforeRam(boolean beforeRam) { + this.beforeRam = beforeRam; } - public void highlight(int x, int y) { - if (highlight) { - for (int i = 0; i < data.length; i++) { - if ((i >= highlightY && i <= y) || (i <= highlightY && i >= y)) { - data[i].setHighlighted(true); - } else { - data[i].setHighlighted(false); - } - } + public void setDataLayout(String s) { + if(s.trim().equalsIgnoreCase("bosch_subtract")) { + setDataLayout(DataLayout.BOSCH_SUBTRACT); } - } - - public void stopHighlight() { - highlight = false; - // loop through, selected and un-highlight - for (DataCell cell : data) { - if (cell.isHighlighted()) { - cell.setHighlighted(false); - if(!cell.isSelected()) { - cell.setSelected(true); - } - } + else { + setDataLayout(DataLayout.DEFAULT); } } - public abstract void cursorUp(); - - public abstract void cursorDown(); - - public abstract void cursorLeft(); + public void setDataLayout(DataLayout m) { + this.dataLayout = m; + } - public abstract void cursorRight(); + public DataLayout getDataLayout() { + return this.dataLayout; + } - public void setRevertPoint() { - for (DataCell cell : data) { - cell.setRevertPoint(); + public void setStringMask(String stringMask) { + if(!stringMask.isEmpty()) { + int mask = ByteUtil.parseUnsignedInt(stringMask, 16); + setBitMask(mask); } } - public void undoAll() { - clearLiveDataTrace(); - for (DataCell cell : data) { - cell.undo(); - } + public void setBitMask(int mask) { + //We dont update the DataCells here! + //Clamp to max size + tableBitMask = (int) Math.min(mask, Math.pow(2,getStorageType()*8)-1); } - public void undoSelected() { - clearLiveDataTrace(); - for (DataCell cell : data) { - // reset current value to original value - if (cell.isSelected()) { - cell.undo(); - } - } + public int getBitMask() { + return tableBitMask; } - public byte[] saveFile(byte[] binData) { - if (userLevel <= getSettings().getUserLevel() && (userLevel < 5 || getSettings().isSaveDebugTables()) ) { - for (int i = 0; i < data.length; i++) { - // determine output byte values - byte[] output; - if (storageType != Settings.STORAGE_TYPE_FLOAT) { - // convert byte values - output = RomAttributeParser.parseIntegerValue((int) data[i].getBinValue(), endian, storageType); - for (int z = 0; z < storageType; z++) { // insert into file - binData[i * storageType + z + getStorageAddress() - ramOffset] = output[z]; - } - - } else { // float - // convert byte values - output = RomAttributeParser.floatToByte((float) data[i].getBinValue(), endian); - for (int z = 0; z < 4; z++) { // insert in to file - binData[i * 4 + z + getStorageAddress() - ramOffset] = output[z]; - } + public void validateScaling() { + if (getType() != TableType.SWITCH) { + for(Scale scale : scales) { + if (!scale.validate()) { + TableView.showBadScalePopup(this, scale); } } } - return binData; - } - - public boolean isBeforeRam() { - return beforeRam; } - public void setBeforeRam(boolean beforeRam) { - this.beforeRam = beforeRam; - } - - @Override - public void addKeyListener(KeyListener listener) { - super.addKeyListener(listener); - for (DataCell cell : data) { - for (int z = 0; z < storageType; z++) { - cell.addKeyListener(listener); - } + public void populateCompareValues(Table otherTable) { + if(null == otherTable) { + return; } - } - public void selectCellAt(int y) { - if(y >= 0 && y < data.length) { - clearSelection(); - data[y].setSelected(true); - highlightY = y; - ECUEditorManager.getECUEditor().getTableToolBar().updateTableToolBar(this); + DataCell[] compareData = otherTable.getData(); + if(data.length != compareData.length) { + return; } - } - public void copySelection() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(this); - if(null != ancestorWindow) { - ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + int i = 0; + for(DataCell cell : data) { + cell.setCompareValue(compareData[i]); + i++; } - ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - copySelectionWorker = new CopySelectionWorker(this); - copySelectionWorker.execute(); + calcCellRanges(); + if(tableView != null) tableView.drawTable(); } - public StringBuffer getTableAsString() { - StringBuffer output = new StringBuffer(Settings.BLANK); - for (int i = 0; i < data.length; i++) { - output.append(data[i].getRealValue()); - if (i < data.length - 1) { - output.append(Settings.TAB); + public void clearSelection() { + if(data!=null) { + for (DataCell cell : data) { + cell.setSelected(false); } } - return output; } - public void copyTable() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(this); - if(null != ancestorWindow) { - ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + public void selectCellAt(int y) { + if(y >= 0 && y < data.length) { + clearSelection(); + data[y].setSelected(true); + if(tableView!=null) tableView.highlightBeginY = y; } - ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - copyTableWorker = new CopyTableWorker(this); - copyTableWorker.execute(); - } - - public String getCellAsString(int index) { - return data[index].getText(); } - public void pasteValues(String[] input) { - //set real values - for (int i = 0; i < input.length; i++) { - try { - Double.parseDouble(input[i]); - data[i].setRealValue(input[i]); - } catch (NumberFormatException ex) { /* not a number, do nothing */ } + public void selectCellAtWithoutClear(int y) { + if(y >= 0 && y < data.length) { + data[y].setSelected(true); + if(tableView!=null) tableView.highlightBeginY = y; } } - public void paste() { - // TODO: This sounds like desearialize. - - StringTokenizer st = new StringTokenizer(Settings.BLANK); - try { - String input = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null).getTransferData(DataFlavor.stringFlavor); - st = new StringTokenizer(input); - } catch (UnsupportedFlavorException ex) { /* wrong paste type -- do nothing */ - } catch (IOException ex) { - } - - String pasteType = st.nextToken(); - - if ("[Table1D]".equalsIgnoreCase(pasteType)) { // copied entire table - int i = 0; - while (st.hasMoreTokens()) { - String currentToken = st.nextToken(); - try { - if (!data[i].getText().equalsIgnoreCase(currentToken)) { - data[i].setRealValue(currentToken); - } - } catch (ArrayIndexOutOfBoundsException ex) { /* table larger than target, ignore*/ } - i++; - } - } else if ("[Selection1D]".equalsIgnoreCase(pasteType)) { // copied selection - if (data[highlightY].isSelected()) { - int i = 0; - while (st.hasMoreTokens()) { - try { - data[highlightY + i].setRealValue(st.nextToken()); - } catch (ArrayIndexOutOfBoundsException ex) { /* paste larger than target, ignore */ } - i++; - } - } - } + public double linearInterpolation(double x, double x1, double x2, double y1, double y2) { + return (x1 == x2) ? y1 : (y1 + (x - x1) * (y2 - y1) / (x2 - x1)); } - - public void verticalInterpolate() { + + public void verticalInterpolate() throws UserLevelException{ horizontalInterpolate(); } - public void horizontalInterpolate() { + public void horizontalInterpolate() throws UserLevelException { int[] coords = { getDataSize(), 0}; DataCell[] tableData = getData(); - int y; - for (y = 0; y < getDataSize(); y++) { - if (tableData[y].isSelected()) { - if (y < coords[0]) - coords[0] = y; - if (y > coords[1]) - coords[1] = y; + for (int i = 0; i < getDataSize(); ++i) { + if (tableData[i].isSelected()) { + if (i < coords[0]) + coords[0] = i; + if (i > coords[1]) + coords[1] = i; } } + if (coords[1] - coords[0] > 1) { - double diff = (tableData[coords[0]].getRealValue() - tableData[coords[1]].getRealValue()) / (coords[1] - coords[0]); - if (Math.abs(diff) > 0) { - for (y = coords[0] + 1; y < coords[1]; y++) - data[y].setRealValue(String.valueOf(tableData[y - 1].getRealValue() - diff)); + double y1, y2; + y1 = tableData[coords[0]].getBinValue(); + y2 = tableData[coords[1]].getBinValue(); + for (int i = coords[0] + 1; i < coords[1]; ++i) { + float p = (float)((i - coords[0]))/(coords[1] - coords[0]); + data[i].setBinValue((y2*p)+(y1 *(1-p))); } } } + + public abstract double queryTable(Double input_x, Double input_y); - public void interpolate() { + public void interpolate() throws UserLevelException { horizontalInterpolate(); } - public void validateScaling() { - if (type != Settings.TABLE_SWITCH) { - - // make sure a scale is present - if (scales.isEmpty()) { - scales.add(new Scale()); - } - - for(Scale scale : scales) { - double startValue = 5; - double toReal = JEPUtil.evaluate(scale.getExpression(), startValue); // convert real world value of "5" - double endValue = JEPUtil.evaluate(scale.getByteExpression(), toReal); - - // if real to byte doesn't equal 5, report conflict - if (Math.abs(endValue - startValue) > .001) { - - JPanel panel = new JPanel(); - panel.setLayout(new GridLayout(4, 1)); - panel.add(new JLabel("The real value and byte value conversion expressions for table " + getName() + " are invalid.")); - panel.add(new JLabel("To real value: " + scale.getExpression())); - panel.add(new JLabel("To byte: " + scale.getByteExpression())); - - JCheckBox check = new JCheckBox("Always display this message", true); - check.setHorizontalAlignment(JCheckBox.RIGHT); - panel.add(check); - - check.addActionListener( - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getSettings().setCalcConflictWarning(((JCheckBox) e.getSource()).isSelected()); - } - } - ); - - JOptionPane.showMessageDialog(SwingUtilities.windowForComponent(this), panel, - "Warning", JOptionPane.ERROR_MESSAGE); - } + public void increment(double increment) throws UserLevelException { + for (DataCell cell : data) { + if (cell.isSelected()) { + cell.increment(increment); } } } - public void populateCompareValues(Table otherTable) { - if(null == otherTable) { - return; - } - - DataCell[] compareData = otherTable.getData(); - if(data.length != compareData.length) { - return; - } - - clearLiveDataTrace(); + public void multiply(double factor) throws UserLevelException{ + for (DataCell cell : data) { + if (cell.isSelected()) { + cell.multiply(factor); + } + } + } - int i = 0; + public void setRealValue(String realValue) throws UserLevelException { for(DataCell cell : data) { - cell.setCompareValue(compareData[i]); - i++; + if (cell.isSelected()) { + cell.setRealValue(realValue); + } } - - calcCellRanges(); - drawTable(); - } - - public void setCompareDisplay(int compareDisplay) { - this.compareDisplay = compareDisplay; - drawTable(); - } - - public int getCompareDisplay() { - return this.compareDisplay; - } - - public void setCompareValueType(int compareValueType) { - this.compareValueType = compareValueType; - drawTable(); - } - - public int getCompareValueType() { - return this.compareValueType; } + public abstract boolean isLiveDataSupported(); + + public int getUserLevel() { return userLevel; } @@ -1234,9 +683,9 @@ public void setUserLevel(int userLevel) { } } - public void setScaleByName(String scaleName) throws NameNotFoundException { + public void setScaleByCategory(String scaleName) throws NameNotFoundException { for(Scale scale : scales) { - if(scale.getName().equalsIgnoreCase(scaleName)) { + if(scale.getCategory().equalsIgnoreCase(scaleName)) { Scale currentScale = getCurrentScale(); if(currentScale == null || !currentScale.equals(scale)) { this.setCurrentScale(scale); @@ -1250,8 +699,10 @@ public void setScaleByName(String scaleName) throws NameNotFoundException { public void setCurrentScale(Scale curScale) { this.curScale = curScale; - updateTableLabel(); - drawTable(); + + if(tableView!=null) { + tableView.drawTable(); + } } public Settings getSettings() @@ -1259,11 +710,6 @@ public Settings getSettings() return SettingsManager.getSettings(); } - public TableToolBar getToolbar() - { - return ECUEditorManager.getECUEditor().getTableToolBar(); - } - public boolean isLocked() { return locked; } @@ -1272,111 +718,32 @@ public void setLocked(boolean locked) { this.locked = locked; } - public void setOverlayLog(boolean overlayLog) { - this.overlayLog = overlayLog; - if (overlayLog) { - clearLiveDataTrace(); - } - } - - public boolean getOverlayLog() - { - return this.overlayLog; - } - - public double getLiveAxisValue() { - try { - return Double.parseDouble(liveAxisValue); - } catch (NumberFormatException e) { - return 0.0; - } - } - - public abstract boolean isLiveDataSupported(); - public abstract boolean isButtonSelected(); - public void highlightLiveData(String liveVal) { - if (getOverlayLog()) { - double liveValue = 0.0; - try{ - liveValue = Double.parseDouble(liveVal); - } catch(NumberFormatException nex) { - return; - } - - int startIdx = data.length; - for (int i = 0; i < data.length; i++) { - double currentValue = data[i].getRealValue(); - if (liveValue == currentValue) { - startIdx = i; - break; - } else if (liveValue < currentValue){ - startIdx = i-1; - break; - } - } - - setLiveDataIndex(startIdx); - DataCell cell = data[getLiveDataIndex()]; - cell.setLiveDataTrace(true); - cell.setLiveDataTraceValue(liveVal); - getToolbar().setLiveDataValue(liveVal); - } - } - - public void updateLiveDataHighlight() { - if (getOverlayLog()) { - data[getLiveDataIndex()].setLiveDataTrace(true); - } - } - - public int getLiveDataIndex() { - return liveDataIndex; - } - - public void setLiveDataIndex(int index) { - if (index < 0) { - index = 0; - } - if (index >= data.length) { - index = data.length - 1; - } - this.liveDataIndex = index; - } - - public void clearLiveDataTrace() { - for (DataCell cell : data) { - cell.setLiveDataTrace(false); - } - } - - public String getLogParamString() { - return getName()+ ":" + getLogParam(); - } - public Table getCompareTable() { return compareTable; } public void setCompareTable(Table compareTable) { this.compareTable = compareTable; + + if(tableView!= null) tableView.drawTable(); } - public void updateTableLabel() { - if(null == name || name.isEmpty()) { - ;// Do not update label. - } else if(null == getCurrentScale () || "0x" == getCurrentScale().getUnit()) { - // static or no scale exists. - tableLabel.setText(getName()); - } else { - tableLabel.setText(getName() + " (" + getCurrentScale().getUnit() + ")"); - } + public void setCompareValueType(Settings.DataType compareValueType) { + this.compareValueType = compareValueType; + + if(tableView!= null) tableView.drawTable(); + } + + public Settings.DataType getCompareValueType() { + return this.compareValueType; } public void colorCells() { calcCellRanges(); - drawTable(); + + if(tableView!=null) tableView.drawTable(); } public void refreshCompare() { @@ -1390,89 +757,49 @@ public boolean isStaticDataTable() { public void setStaticDataTable(boolean staticDataTable) { this.staticDataTable = staticDataTable; } -} -class CopySelectionWorker extends SwingWorker { - Table table; + public void setMemModelEndian(Settings.Endian endian) { + memModelEndian = endian; + } - public CopySelectionWorker(Table table) { - this.table = table; + public Settings.Endian getMemModelEndian() { + return memModelEndian; } - @Override - protected Void doInBackground() throws Exception { - // find bounds of selection - // coords[0] = x min, y min, x max, y max - String newline = System.getProperty("line.separator"); - String output = "[Selection1D]" + newline; - boolean copy = false; - int[] coords = new int[2]; - coords[0] = table.getDataSize(); - - for (int i = 0; i < table.getDataSize(); i++) { - if (table.getData()[i].isSelected()) { - if (i < coords[0]) { - coords[0] = i; - copy = true; - } - if (i > coords[1]) { - coords[1] = i; - copy = true; - } - } + public enum TableType { + TABLE_1D(1), + TABLE_2D(2), + TABLE_3D(3), + // X_AXIS(4), + // Y_AXIS(5), + SWITCH(6); + + private final int marshallingCode; + + TableType(int marshallingCode) { + this.marshallingCode = marshallingCode; } - //make a string of the selection - for (int i = coords[0]; i <= coords[1]; i++) { - if (table.getData()[i].isSelected()) { - output = output + table.getData()[i].getText(); - } else { - output = output + "x"; // x represents non-selected cell - } - if (i < coords[1]) { - output = output + "\t"; + + public int getDimension() { + switch (this) { + case TABLE_1D: + return 1; + case TABLE_2D: + return 2; + case TABLE_3D: + return 3; + default: + return -1; } } - //copy to clipboard - if (copy) { - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(output), null); - } - return null; - } - @Override - public void done() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(table); - if(null != ancestorWindow) { - ancestorWindow.setCursor(null); + public String getMarshallingString() { + return String.valueOf(marshallingCode); } - table.setCursor(null); - ECUEditorManager.getECUEditor().setCursor(null); - } -} - -class CopyTableWorker extends SwingWorker { - Table table; - - public CopyTableWorker(Table table) { - this.table = table; - } - - @Override - protected Void doInBackground() throws Exception { - String tableHeader = table.getSettings().getTableHeader(); - StringBuffer output = new StringBuffer(tableHeader); - output.append(table.getTableAsString()); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(String.valueOf(output)), null); - return null; } @Override - public void done() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(table); - if(null != ancestorWindow) { - ancestorWindow.setCursor(null); - } - table.setCursor(null); - ECUEditorManager.getECUEditor().setCursor(null); + public int compareTo(Table otherTable) { + return this.getName().compareTo(otherTable.getName()); } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/maps/Table1D.java b/src/main/java/com/romraider/maps/Table1D.java index 21a11ebb5..31cf659fd 100644 --- a/src/main/java/com/romraider/maps/Table1D.java +++ b/src/main/java/com/romraider/maps/Table1D.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,21 +18,17 @@ */ package com.romraider.maps; - -import java.awt.BorderLayout; - -import javax.swing.JLabel; - import com.romraider.Settings; public class Table1D extends Table { private static final long serialVersionUID = -8747180767803835631L; private Table axisParent = null; - - public Table1D() { - super(); + + @Override + public TableType getType() { + return TableType.TABLE_1D; } - + public void setAxisParent(Table axisParent) { this.axisParent = axisParent; } @@ -41,186 +37,38 @@ public Table getAxisParent() { return axisParent; } - public void addStaticDataCell(DataCell input) { - for(int i = 0; i < data.length; i++) { - if(data[i] == null) { - data[i] = input; - data[i].setY(i); - break; - } - } - } - - @Override - public void populateTable(byte[] input, int romRamOffset) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { - centerLayout.setRows(1); - centerLayout.setColumns(this.getDataSize()); - - super.populateTable(input, romRamOffset); - - // add to table - for (int i = 0; i < this.getDataSize(); i++) { - centerPanel.add(this.getDataCell(i)); - } - - if(null == name || name.isEmpty()) { - ;// Do not add label. - } else if(null == getCurrentScale () || "0x" == getCurrentScale().getUnit()) { - // static or no scale exists. - tableLabel = new JLabel(getName(), JLabel.CENTER); - add(tableLabel, BorderLayout.NORTH); - } else { - tableLabel = new JLabel(getName() + " (" + getCurrentScale().getUnit() + ")", JLabel.CENTER); - add(tableLabel, BorderLayout.NORTH); - } - } - - @Override - public String toString() { - return super.toString() + " (1D)"; - } - - @Override - public void cursorUp() { - if (type == Settings.TABLE_Y_AXIS) { - if (highlightY > 0 && data[highlightY].isSelected()) { - selectCellAt(highlightY - 1); - } - } else if (type == Settings.TABLE_X_AXIS) { - // Y axis is on top.. nothing happens - } else if (type == Settings.TABLE_1D) { - // no where to move up to - } - } - @Override - public void cursorDown() { - if (type == Settings.TABLE_Y_AXIS) { - if (getAxisParent().getType() == Settings.TABLE_3D) { - if (highlightY < getDataSize() - 1 && data[highlightY].isSelected()) { - selectCellAt(highlightY + 1); - } - } else if (getAxisParent().getType() == Settings.TABLE_2D) { - if (data[highlightY].isSelected()) { - getAxisParent().selectCellAt(highlightY); - } - } - } else if (type == Settings.TABLE_X_AXIS && data[highlightY].isSelected()) { - ((Table3D) getAxisParent()).selectCellAt(highlightY, this); - } else if (type == Settings.TABLE_1D) { - // no where to move down to - } - } - - @Override - public void cursorLeft() { - if (type == Settings.TABLE_Y_AXIS) { - // X axis is on left.. nothing happens - if (getAxisParent().getType() == Settings.TABLE_2D) { - if (data[highlightY].isSelected()) { - selectCellAt(highlightY - 1); + public StringBuffer getTableAsString() { + if(isStaticDataTable()) { + StringBuffer output = new StringBuffer(Settings.BLANK); + for (int i = 0; i < data.length; i++) { + output.append(data[i].getStaticText()); + if (i < data.length - 1) { + output.append(Settings.TAB); } } - } else if (type == Settings.TABLE_X_AXIS && data[highlightY].isSelected()) { - if (highlightY > 0) { - selectCellAt(highlightY - 1); - } - } else if (type == Settings.TABLE_1D && data[highlightY].isSelected()) { - if (highlightY > 0) { - selectCellAt(highlightY - 1); - } - } - } - - @Override - public void cursorRight() { - if (type == Settings.TABLE_Y_AXIS && data[highlightY].isSelected()) { - if (getAxisParent().getType() == Settings.TABLE_3D) { - ((Table3D) getAxisParent()).selectCellAt(highlightY, this); - } else if (getAxisParent().getType() == Settings.TABLE_2D) { - selectCellAt(highlightY + 1); - } - } else if (type == Settings.TABLE_X_AXIS && data[highlightY].isSelected()) { - if (highlightY < getDataSize() - 1) { - selectCellAt(highlightY + 1); - } - } else if (type == Settings.TABLE_1D && data[highlightY].isSelected()) { - if (highlightY < getDataSize() - 1) { - selectCellAt(highlightY + 1); - } + return output; + } else { + return super.getTableAsString(); + } } - + @Override - public void clearSelection() { - // Call to the axis parent. The axis parent should then call to clear this data. - getAxisParent().clearSelection(); + public double queryTable(Double input_x, Double input_y) { + // No axis, so nothing to query + return 0; } - + @Override - public void startHighlight(int x, int y) { - Table axisParent = getAxisParent(); - axisParent.clearSelectedData(); - - if(axisParent instanceof Table3D) { - Table3D table3D = (Table3D) axisParent; - if(getType() == Settings.TABLE_X_AXIS) { - table3D.getYAxis().clearSelectedData(); - } else if (getType() == Settings.TABLE_Y_AXIS) { - table3D.getXAxis().clearSelectedData(); - } - } else if (axisParent instanceof Table2D) { - ((Table2D) axisParent).getAxis().clearSelectedData(); - } - - - super.startHighlight(x, y); + public void clearData() { + super.clearData(); + axisParent = null; } @Override - public String getCellAsString(int index) { - return data[index].getText(); - } - - @Override - public void highlightLiveData(String liveVal) { - if (getOverlayLog()) { - double liveValue = 0.0; - try{ - liveValue = Double.parseDouble(liveVal); - } catch(NumberFormatException nex) { - return; - } - - int startIdx = data.length; - for (int i = 0; i < data.length; i++) { - double currentValue = 0.0; - if(isStaticDataTable() && null != data[i].getStaticText()) { - try { - currentValue = Double.parseDouble(data[i].getStaticText()); - } catch(NumberFormatException nex) { - return; - } - } else { - currentValue = data[i].getRealValue(); - } - - if (liveValue == currentValue) { - startIdx = i; - break; - } else if (liveValue < currentValue){ - startIdx = i-1; - break; - } - } - - setLiveDataIndex(startIdx); - DataCell cell = data[getLiveDataIndex()]; - cell.setLiveDataTrace(true); - cell.setLiveDataTraceValue(liveVal); - getToolbar().setLiveDataValue(liveVal); - } - getAxisParent().updateLiveDataHighlight(); + public String toString() { + return super.toString() + " (1D)"; } @Override @@ -232,12 +80,7 @@ public boolean isLiveDataSupported() { public boolean isButtonSelected() { return true; } - - public boolean isAxis() { - return getType() == Settings.TABLE_X_AXIS || - getType() == Settings.TABLE_Y_AXIS || isStaticDataTable(); - } - + @Override public boolean equals(Object other) { try { @@ -255,10 +98,6 @@ public boolean equals(Object other) { Table1D otherTable = (Table1D)other; - if(this.isAxis() != otherTable.isAxis()) { - return false; - } - if(this.data.length != otherTable.data.length) { return false; @@ -282,25 +121,6 @@ public boolean equals(Object other) { return false; } } +} - @Override - public void updateTableLabel() { - this.getAxisParent().updateTableLabel(); - } - - @Override - public StringBuffer getTableAsString() { - if(isStaticDataTable()) { - StringBuffer output = new StringBuffer(Settings.BLANK); - for (int i = 0; i < data.length; i++) { - output.append(data[i].getStaticText()); - if (i < data.length - 1) { - output.append(Settings.TAB); - } - } - return output; - } else { - return super.getTableAsString(); - } - } -} \ No newline at end of file + \ No newline at end of file diff --git a/src/main/java/com/romraider/maps/Table1DView.java b/src/main/java/com/romraider/maps/Table1DView.java new file mode 100644 index 000000000..7ee9f8f00 --- /dev/null +++ b/src/main/java/com/romraider/maps/Table1DView.java @@ -0,0 +1,374 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2025 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps; + +import java.awt.BorderLayout; + +import javax.swing.JLabel; +import javax.swing.border.EmptyBorder; +import com.romraider.util.NumberUtil; + +public class Table1DView extends TableView { + + private static final long serialVersionUID = -8747180767803835631L; + private Table1D table; + private Table1DType type; + + public enum Table1DType { + NO_AXIS, + X_AXIS, + Y_AXIS; + } + + public Table1DView(Table1D table, Table1DType axisType) { + this(table, axisType, false); + } + + public Table1DView(Table1D table, Table1DType axisType, boolean hide) { + super(table); + this.table = table; + this.hide = hide; + this.type = axisType; + } + + public Table1DType getType() { + return type; + } + + public void addStaticDataCell(DataCellView input) { + for(int i = 0; i < data.length; i++) { + if(data[i] == null) { + data[i] = input; + data[i].setY(i); + break; + } + } + } + + @Override + public void populateTableVisual() { + super.populateTableVisual(); + + //Only populate the rest if we aren't an axis + if(!isAxis() && !isHidden()) { + centerLayout.setRows(1); + centerLayout.setColumns(table.getDataSize()); + + // add to table + for (int i = 0; i < table.getDataSize(); i++) { + centerPanel.add(this.getDataCell(i)); + } + + if(null == table.name || table.name.isEmpty()) { + ;// Do not add label. + } else if(null == table.getCurrentScale () || "0x" == table.getCurrentScale().getUnit()) { + // static or no scale exists. + tableLabel = new JLabel(getName(), JLabel.CENTER); + add(tableLabel, BorderLayout.NORTH); + } else { + tableLabel = new JLabel(getName() + " (" + table.getCurrentScale().getUnit() + ")", JLabel.CENTER); + add(tableLabel, BorderLayout.NORTH); + } + + if(tableLabel != null) + tableLabel.setBorder(new EmptyBorder(2, 4, 2, 4)); + } + + if(!isAxis() && presetPanel != null) + presetPanel.populatePanel(); + } + + @Override + public String toString() { + return table.toString() + " View"; + } + + @Override + public void cursorUp() { + if (type == Table1DType.Y_AXIS) { + if (highlightBeginY > 0 && data[highlightBeginY].isSelected()) { + table.selectCellAt(highlightBeginY - 1); + } + } + } + + @Override + public void cursorDown() { + if (type == Table1DType.Y_AXIS) { + if (table.getAxisParent().getType() == Table.TableType.TABLE_3D) { + if (highlightBeginY < table.getDataSize() - 1 && data[highlightBeginY].isSelected()) { + table.selectCellAt(highlightBeginY + 1); + } + } else if (table.getAxisParent().getType() == Table.TableType.TABLE_2D) { + if (data[highlightBeginY].isSelected()) { + table.selectCellAt(highlightBeginY); + } + } + } else if (type == Table1DType.X_AXIS && data[highlightBeginY].isSelected()) { + ((Table3D) table.getAxisParent()).selectCellAt(highlightBeginY); + } else if (table.getType() == Table.TableType.TABLE_1D) { + // no where to move down to + } + } + + @Override + public void cursorLeft() { + if (type == Table1DType.Y_AXIS) { + // X axis is on left.. nothing happens + if (table.getAxisParent().getType() == Table.TableType.TABLE_2D) { + if (data[highlightBeginY].isSelected()) { + table.selectCellAt(highlightBeginY - 1); + } + } + } else if (type == Table1DType.X_AXIS && data[highlightBeginY].isSelected()) { + if (highlightBeginY > 0) { + table.selectCellAt(highlightBeginY - 1); + } + } else if (table.getType() == Table.TableType.TABLE_1D && data[highlightBeginY].isSelected()) { + if (highlightBeginY > 0) { + table.selectCellAt(highlightBeginY - 1); + } + } + } + + @Override + public void cursorRight() { + if (type == Table1DType.Y_AXIS && data[highlightBeginY].isSelected()) { + if (table.getAxisParent().getType() == Table.TableType.TABLE_3D) { + ((Table3D) table.getAxisParent()).selectCellAt(highlightBeginY); + } else if (table.getAxisParent().getType() == Table.TableType.TABLE_2D) { + table.selectCellAt(highlightBeginY + 1); + } + } else if (type == Table1DType.X_AXIS && data[highlightBeginY].isSelected()) { + if (highlightBeginY < table.getDataSize() - 1) { + table.selectCellAt(highlightBeginY + 1); + } + } else if (table.getType() == Table.TableType.TABLE_1D && data[highlightBeginY].isSelected()) { + if (highlightBeginY < table.getDataSize() - 1) { + table.selectCellAt(highlightBeginY + 1); + } + } + } + + @Override + public void shiftCursorUp() { + if (type == Table1DType.Y_AXIS) { + if (highlightBeginY > 0 && data[highlightBeginY].isSelected()) { + table.selectCellAtWithoutClear(highlightBeginY - 1); + } + } + } + + @Override + public void shiftCursorDown() { + if (type == Table1DType.Y_AXIS) { + if (table.getAxisParent().getType() == Table.TableType.TABLE_3D) { + if (highlightBeginY < table.getDataSize() - 1 && data[highlightBeginY].isSelected()) { + table.selectCellAtWithoutClear(highlightBeginY + 1); + } + } else if (table.getAxisParent().getType() == Table.TableType.TABLE_2D) { + if (data[highlightBeginY].isSelected()) { + table.getAxisParent().getTableView().table.selectCellAtWithoutClear(highlightBeginY); + } + } + } else if (type == Table1DType.X_AXIS && data[highlightBeginY].isSelected()) { + ((Table3D) table.getAxisParent()).selectCellAt(highlightBeginY); + } + } + + @Override + public void shiftCursorLeft() { + if (type == Table1DType.Y_AXIS) { + // X axis is on left.. nothing happens + if (table.getAxisParent().getType() == Table.TableType.TABLE_2D) { + if (data[highlightBeginY].isSelected()) { + table.selectCellAtWithoutClear(highlightBeginY - 1); + } + } + } else if (type == Table1DType.X_AXIS && data[highlightBeginY].isSelected()) { + if (highlightBeginY > 0) { + table.selectCellAtWithoutClear(highlightBeginY - 1); + } + } else if (table.getType() == Table.TableType.TABLE_1D && data[highlightBeginY].isSelected()) { + if (highlightBeginY > 0) { + table.selectCellAtWithoutClear(highlightBeginY - 1); + } + } + } + + @Override + public void shiftCursorRight() { + if (type == Table1DType.Y_AXIS && data[highlightBeginY].isSelected()) { + if (table.getAxisParent().getType() == Table.TableType.TABLE_3D) { + ((Table3D) table.getAxisParent()).selectCellAt(highlightBeginY); + } else if (table.getAxisParent().getType() == Table.TableType.TABLE_2D) { + table.selectCellAtWithoutClear(highlightBeginY + 1); + } + } else if (type == Table1DType.X_AXIS && data[highlightBeginY].isSelected()) { + if (highlightBeginY < table.getDataSize() - 1) { + table.selectCellAtWithoutClear(highlightBeginY + 1); + } + } else if (table.getType() == Table.TableType.TABLE_1D && data[highlightBeginY].isSelected()) { + if (highlightBeginY < table.getDataSize() - 1) { + table.selectCellAtWithoutClear(highlightBeginY + 1); + } + } + } + + public void clearSelectionInParent() { + // Call to the axis parent. The axis parent should then call to clear this data. + Table p = table.getAxisParent(); + + if(p != null) + p.clearSelection(); + } + + @Override + public void startHighlight(int x, int y) { + Table axisParent = table.getAxisParent(); + + if(axisParent != null) + axisParent.clearSelection(); + + if(axisParent instanceof Table3D) { + Table3D table3D = (Table3D) axisParent; + if(type == Table1DType.X_AXIS) { + table3D.getYAxis().clearSelection(); + } else if (type == Table1DType.Y_AXIS) { + table3D.getXAxis().clearSelection(); + } + } else if (axisParent instanceof Table2D) { + ((Table2D) axisParent).getAxis().clearSelection(); + } + + + super.startHighlight(x, y); + } + + @Override + public String getCellAsString(int index) { + return data[index].getText(); + } + + @Override + public void highlightLiveData(String liveVal) { + if (getOverlayLog()) { + double liveValue = 0.0; + try { + liveValue = NumberUtil.doubleValue(liveVal); + } catch (Exception ex) { + LOGGER.error("Table1D - live data highlight parsing error for value: " + liveVal); + return; + } + + int startIdx = data.length; + double currentErrorToLiveValue = Double.POSITIVE_INFINITY; + for (int i = 0; i < data.length; i++) { + double currentValue = 0.0; + if(table.isStaticDataTable() && null != data[i].getStaticText()) { + try { + currentValue = Double.parseDouble(data[i].getStaticText()); + } catch(NumberFormatException nex) { + return; + } + } else { + currentValue = data[i].getDataCell().getRealValue(); + } + + if(Math.abs(currentValue - liveValue) < currentErrorToLiveValue) + { + currentErrorToLiveValue = Math.abs(currentValue - liveValue); + startIdx = i; + + if(currentErrorToLiveValue <= 0.001) break; + } + } + + setLiveDataIndex(startIdx); + DataCellView cellp = data[getPreviousLiveDataIndex()]; + cellp.setPreviousLiveDataTrace(true); + DataCellView cell = data[getLiveDataIndex()]; + cell.setPreviousLiveDataTrace(false); + cell.setLiveDataTrace(true); + cell.getDataCell().setLiveDataTraceValue(liveVal); + getToolbar().setLiveDataValue(liveVal); + } + + getAxisParent().updateLiveDataHighlight(); + } + + public boolean isAxis() { + return type == Table1DType.X_AXIS || + type == Table1DType.Y_AXIS || table.isStaticDataTable(); + } + + @Override + public boolean equals(Object other) { + try { + if(null == other) { + return false; + } + + if(other == this) { + return true; + } + + if(!(other instanceof Table1D)) { + return false; + } + + Table1DView otherTable = (Table1DView)other; + + if(this.isAxis() != otherTable.isAxis()) { + return false; + } + + if(this.data.length != otherTable.data.length) + { + return false; + } + + if(this.data.equals(otherTable.data)) + { + return true; + } + + // Compare Bin Values + for(int i=0 ; i < this.data.length ; i++) { + if(! this.data[i].equals(otherTable.data[i])) { + return false; + } + } + + return true; + } catch(Exception ex) { + // TODO: Log Exception. + return false; + } + } + + + @Override + public void updateTableLabel() { + if(getAxisParent() == null) { + super.updateTableLabel(); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/maps/Table2D.java b/src/main/java/com/romraider/maps/Table2D.java index 7b91b89fa..1736ebe3f 100644 --- a/src/main/java/com/romraider/maps/Table2D.java +++ b/src/main/java/com/romraider/maps/Table2D.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,39 +20,17 @@ package com.romraider.maps; import static com.romraider.util.ParamChecker.isNullOrEmpty; - -import java.awt.BorderLayout; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.Window; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.StringSelection; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.event.KeyListener; -import java.io.IOException; -import java.util.StringTokenizer; - import javax.naming.NameNotFoundException; -import javax.swing.JLabel; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; - import com.romraider.Settings; -import com.romraider.editor.ecu.ECUEditorManager; import com.romraider.util.SettingsManager; public class Table2D extends Table { private static final long serialVersionUID = -7684570967109324784L; private Table1D axis = new Table1D(); - private JLabel axisLabel; - private CopyTable2DWorker copyTable2DWorker; - private CopySelection2DWorker copySelection2DWorker; - - public Table2D() { - super(); - verticalOverhead += 18; + @Override + public TableType getType() { + return TableType.TABLE_2D; } public Table1D getAxis() { @@ -69,6 +47,13 @@ public String toString() { return super.toString() + " (2D)";// + axis; } + @Override + public void clearData() { + super.clearData(); + axis.clearData(); + axis=null; + } + @Override public void populateCompareValues(Table otherTable) { if(null == otherTable || !(otherTable instanceof Table2D)) { @@ -92,88 +77,9 @@ public void refreshCompare() { } @Override - public StringBuffer getTableAsString() { - StringBuffer output = new StringBuffer(Settings.BLANK); - output.append(axis.getTableAsString()); - output.append(Settings.NEW_LINE); - output.append(super.getTableAsString()); - return output; - } - - @Override - public Dimension getFrameSize() { - int height = verticalOverhead + cellHeight * 2; - int width = horizontalOverhead + data.length * cellWidth; - if (height < minHeight) { - height = minHeight; - } - int minWidth = isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; - if (width < minWidth) { - width = minWidth; - } - return new Dimension(width, height); - } - - @Override - public void populateTable(byte[] input, int romRamOffset) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { - centerLayout.setRows(2); - centerLayout.setColumns(this.getDataSize()); - - try { - axis.populateTable(input, romRamOffset); - super.populateTable(input, romRamOffset); - } catch (ArrayIndexOutOfBoundsException ex) { - throw new ArrayIndexOutOfBoundsException(); - } - - // add to table - for (int i = 0; i < this.getDataSize(); i++) { - centerPanel.add(axis.getDataCell(i)); - } - if (flip) { - for (int i = this.getDataSize() - 1; i >= 0; i--) { - centerPanel.add(this.getDataCell(i)); - } - } else { - for (int i = 0; i < this.getDataSize(); i++) { - centerPanel.add(this.getDataCell(i)); - } - } - - if(null == axis.getName() || axis.getName().isEmpty() || "" == axis.getName()) { - ;// Do not add label. - } else if(null == axis.getCurrentScale() || "0x" == axis.getCurrentScale().getUnit()) { - // static or no scale exists. - axisLabel = new JLabel(axis.getName(), JLabel.CENTER); - add(axisLabel, BorderLayout.NORTH); - } else { - axisLabel = new JLabel(axis.getName() + " (" + axis.getCurrentScale().getUnit() + ")", JLabel.CENTER); - add(axisLabel, BorderLayout.NORTH); - } - - tableLabel = new JLabel(getCurrentScale().getUnit(), JLabel.CENTER); - add(tableLabel, BorderLayout.SOUTH); - repaint(); - } - - @Override - public void updateTableLabel() { - if(null == axis.getName() || axis.getName().length() < 1 || "" == axis.getName()) { - ;// Do not update label. - } else if(null == axis.getCurrentScale() || "0x" == axis.getCurrentScale().getUnit()) { - // static or no scale exists. - axisLabel.setText(axis.getName()); - } else { - axisLabel.setText(axis.getName() + " (" + axis.getCurrentScale().getUnit() + ")"); - } - - tableLabel.setText(getCurrentScale().getUnit()); - } - - @Override - public void clearSelection() { - axis.clearSelectedData(); - clearSelectedData(); + public void populateTable(Rom rom) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { + axis.populateTable(rom); + super.populateTable(rom); } @Override @@ -183,211 +89,156 @@ public void setRevertPoint() { } @Override - public void undoAll() { + public void undoAll() throws UserLevelException { super.undoAll(); axis.undoAll(); } @Override - public byte[] saveFile(byte[] binData) { - binData = super.saveFile(binData); - binData = axis.saveFile(binData); - return binData; - } - - @Override - public void addKeyListener(KeyListener listener) { - super.addKeyListener(listener); - axis.addKeyListener(listener); + public String getLogParamString() { + StringBuilder sb = new StringBuilder(); + sb.append(axis.getLogParamString()+ ", "); + sb.append(getName()+ ":" + getLogParam()); + return sb.toString(); } @Override - public void cursorUp() { - if (data[highlightY].isSelected()) { - axis.selectCellAt(highlightY); - } + public boolean isLiveDataSupported() { + return !isNullOrEmpty(axis.getLogParam()); } @Override - public void drawTable() { - super.drawTable(); - axis.drawTable(); + public boolean isButtonSelected() { + return true; } @Override - public void cursorDown() { - axis.cursorDown(); + public void setCompareValueType(Settings.DataType compareValueType) { + super.setCompareValueType(compareValueType); + axis.setCompareValueType(compareValueType); } @Override - public void cursorLeft() { - if (highlightY > 0 && data[highlightY].isSelected()) { - selectCellAt(highlightY - 1); - } else { - axis.cursorLeft(); + public void setCurrentScale(Scale curScale) { + if(SettingsManager.getSettings().isScaleHeadersAndData() && !axis.isStaticDataTable()) { + try { + this.axis.setScaleByCategory(curScale.getCategory()); + } catch (NameNotFoundException e) { + try { + this.axis.setScaleByCategory(SettingsManager.getSettings().getDefaultScale()); + } catch (NameNotFoundException e1) { + try { + this.axis.setScaleByCategory("Default"); + } catch (NameNotFoundException e2) { + e2.printStackTrace(); + } + } + } } - } + this.curScale = curScale; - @Override - public void cursorRight() { - if (highlightY < data.length - 1 && data[highlightY].isSelected()) { - selectCellAt(highlightY + 1); - } else { - axis.cursorRight(); - } + if(tableView != null) tableView.drawTable(); } @Override - public void startHighlight(int x, int y) { - axis.clearSelectedData(); - super.startHighlight(x, y); + public void clearSelection() { + if(axis!=null) + axis.clearSelection(); + + super.clearSelection(); } @Override - public void copySelection() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(this); - if(null != ancestorWindow) { - ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - } - ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - super.copySelection(); - copySelection2DWorker = new CopySelection2DWorker(this); - copySelection2DWorker.execute(); + public void setRealValue(String realValue) throws UserLevelException { + super.setRealValue(realValue); + axis.setRealValue(realValue); } @Override - public void copyTable() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(this); - if(null != ancestorWindow) { - ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - } - ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - copyTable2DWorker = new CopyTable2DWorker(this); - copyTable2DWorker.execute(); + public void increment(double increment) throws UserLevelException { + super.increment(increment); + axis.increment(increment); } @Override - public void paste() { - StringTokenizer st = new StringTokenizer(""); - String input = ""; - try { - input = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null).getTransferData(DataFlavor.stringFlavor); - st = new StringTokenizer(input); - } catch (UnsupportedFlavorException ex) { /* wrong paste type -- do nothing */ - } catch (IOException ex) { - } - - String pasteType = st.nextToken(); - - if (pasteType.equalsIgnoreCase("[Table2D]")) { // Paste table - String axisValues = "[Table1D]" + Settings.NEW_LINE + st.nextToken(Settings.NEW_LINE); - String dataValues = "[Table1D]" + Settings.NEW_LINE + st.nextToken(Settings.NEW_LINE); - - // put axis in clipboard and paste - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(axisValues), null); - axis.paste(); - // put datavalues in clipboard and paste - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(dataValues), null); - super.paste(); - // reset clipboard - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(input), null); - - } else if (pasteType.equalsIgnoreCase("[Selection1D]")) { // paste selection - if (data[highlightY].isSelected()) { - super.paste(); - } else { - axis.paste(); - } - } + public void multiply(double factor) throws UserLevelException{ + super.multiply(factor); + axis.multiply(factor); } @Override - public void interpolate() { + public void interpolate() throws UserLevelException { super.interpolate(); this.getAxis().interpolate(); } @Override - public void verticalInterpolate() { + public void verticalInterpolate() throws UserLevelException { super.verticalInterpolate(); this.getAxis().verticalInterpolate(); } @Override - public void horizontalInterpolate() { - super.horizontalInterpolate(); - this.getAxis().horizontalInterpolate(); - } + public void horizontalInterpolate() throws UserLevelException { + int[] coords = { getDataSize(), 0}; + DataCell[] tableData = getData(); + DataCell[] axisData = getAxis().getData(); - @Override - public boolean isLiveDataSupported() { - return !isNullOrEmpty(axis.getLogParam()); - } - - @Override - public boolean isButtonSelected() { - return true; - } - - @Override - public void clearLiveDataTrace() { - super.clearLiveDataTrace(); - axis.clearLiveDataTrace(); - } - - @Override - public void updateLiveDataHighlight() { - if (getOverlayLog()) { - data[axis.getLiveDataIndex()].setLiveDataTrace(true); + for (int i = 0; i < getDataSize(); ++i) { + if (tableData[i].isSelected()) { + if (i < coords[0]) + coords[0] = i; + if (i > coords[1]) + coords[1] = i; + } } - } - - @Override - public String getLogParamString() { - StringBuilder sb = new StringBuilder(); - sb.append(axis.getLogParamString()+ ", "); - sb.append(getName()+ ":" + getLogParam()); - return sb.toString(); - } - - @Override - public void setOverlayLog(boolean overlayLog) { - super.setOverlayLog(overlayLog); - axis.setOverlayLog(overlayLog); - if (overlayLog) { - axis.clearLiveDataTrace(); + if (coords[1] - coords[0] > 1) { + double x, x1, x2, y1, y2; + x1 = axisData[coords[0]].getBinValue(); + y1 = tableData[coords[0]].getBinValue(); + x2 = axisData[coords[1]].getBinValue(); + y2 = tableData[coords[1]].getBinValue(); + for (int i = coords[0] + 1; i < coords[1]; ++i) { + x = axisData[i].getBinValue(); + data[i].setBinValue(linearInterpolation(x, x1, x2, y1, y2)); + } } + // Interpolate x axis in case the x axis in selected. + this.getAxis().horizontalInterpolate(); } + + @Override + public double queryTable(Double input_x, Double input_y) { + double input = input_x == null ? input_y : input_x; + DataCell[] tableData = getData(); + DataCell[] axisData = getAxis().getData(); + + int start = 0; + int end = tableData.length - 1; + boolean foundEnd = false; + + for (int i = 0; i < tableData.length && i < axisData.length; i++) { + DataCell c = axisData[i]; + if (c.getRealValue() <= input) { + start = i; + } + if (c.getRealValue() >= input && !foundEnd) { + end = i; + foundEnd = true; + } + } + + return linearInterpolation(input, axisData[start].getRealValue(), axisData[end].getRealValue(), + tableData[start].getRealValue(), tableData[end].getRealValue()); + } @Override - public void setCompareDisplay(int compareDisplay) { - super.setCompareDisplay(compareDisplay); - axis.setCompareDisplay(compareDisplay); - } - - @Override - public void setCompareValueType(int compareValueType) { - super.setCompareValueType(compareValueType); - axis.setCompareValueType(compareValueType); - } - - @Override - public void setCurrentScale(Scale curScale) { - if(SettingsManager.getSettings().isScaleHeadersAndData() && !axis.isStaticDataTable()) { - try { - this.axis.setScaleByName(curScale.getName()); - } catch (NameNotFoundException e) { - try { - this.axis.setScaleByName(SettingsManager.getSettings().getDefaultScale()); - } catch (NameNotFoundException e1) { - } - } - } - this.curScale = curScale; - updateTableLabel(); - drawTable(); + public StringBuffer getTableAsString() { + StringBuffer output = new StringBuffer(Settings.BLANK); + output.append(axis.getTableAsString()); + output.append(Settings.NEW_LINE); + output.append(super.getTableAsString()); + return output; } @Override @@ -441,69 +292,4 @@ public boolean equals(Object other) { return false; } } - - @Override - public void repaint() { - super.repaint(); - if(null != axis) { - axis.repaint(); - } - } } - -class CopySelection2DWorker extends SwingWorker { - Table2D table; - Table extendedTable; - - public CopySelection2DWorker(Table2D table) - { - this.table = table; - } - - @Override - protected Void doInBackground() throws Exception { - table.getAxis().copySelection(); - return null; - } - - @Override - public void done() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(table); - if(null != ancestorWindow) { - ancestorWindow.setCursor(null); - } - table.setCursor(null); - ECUEditorManager.getECUEditor().setCursor(null); - } -} - -class CopyTable2DWorker extends SwingWorker { - Table2D table; - - public CopyTable2DWorker(Table2D table) - { - this.table = table; - } - - @Override - protected Void doInBackground() throws Exception { - String tableHeader = table.getSettings().getTable2DHeader(); - StringBuffer output = new StringBuffer(tableHeader); - output.append(table.getTableAsString()); - - //copy to clipboard - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(output.toString()), null); - return null; - - } - - @Override - public void done() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(table); - if(null != ancestorWindow) { - ancestorWindow.setCursor(null); - } - table.setCursor(null); - ECUEditorManager.getECUEditor().setCursor(null); - } -} \ No newline at end of file diff --git a/src/main/java/com/romraider/maps/Table2DView.java b/src/main/java/com/romraider/maps/Table2DView.java new file mode 100644 index 000000000..9d40e5b97 --- /dev/null +++ b/src/main/java/com/romraider/maps/Table2DView.java @@ -0,0 +1,293 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.KeyListener; +import java.util.StringTokenizer; + +import javax.swing.JLabel; +import javax.swing.border.EmptyBorder; + +import com.romraider.Settings; +import com.romraider.maps.Table1DView.Table1DType; + +public class Table2DView extends TableView { + private static final long serialVersionUID = -7684570967109324784L; + private JLabel axisLabel; + private Table1DView axis; + + public Table2DView(Table2D table) { + super(table); + axis = new Table1DView(table.getAxis(), Table1DType.X_AXIS); + axis.setAxisParent(this); + verticalOverhead += 18; + } + + public Table1DView getAxis() { + return axis; + } + + public JLabel getAxisLabel() { + return axisLabel; + } + + public void setAxisLabel(JLabel label) { + axisLabel = label; + } + + @Override + public String toString() { + return super.toString() + " (2D)";// + axis; + } + + @Override + public Dimension getFrameSize() { + int height = verticalOverhead + cellHeight * 2; + int width = horizontalOverhead + data.length * cellWidth; + if (height < minHeight) { + height = minHeight; + } + int minWidth = table.isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; + if (width < minWidth) { + width = minWidth; + } + return new Dimension(width, height); + } + + @Override + public void populateTableVisual(){ + super.populateTableVisual(); + + centerLayout.setRows(2); + centerLayout.setColumns(table.getDataSize()); + + axis.populateTableVisual(); + // add to table + for (int i = 0; i < table.getDataSize(); i++) { + centerPanel.add(axis.getDataCell(i)); + } + + if (table.flip) { + for (int i = table.getDataSize() - 1; i >= 0; i--) { + centerPanel.add(this.getDataCell(i)); + } + } else { + for (int i = 0; i < table.getDataSize(); i++) { + centerPanel.add(this.getDataCell(i)); + } + } + + if (null == axis.getName() || axis.getName().isEmpty() || Settings.BLANK == axis.getName()) { + // Do not add label. + } else if (null == axis.getTable().getCurrentScale() || "0x" == axis.getTable().getCurrentScale().getUnit()) { + // static or no scale exists. + axisLabel = new JLabel(axis.getName(), JLabel.CENTER); + add(axisLabel, BorderLayout.NORTH); + } else { + axisLabel = new JLabel(axis.getName() + " (" + axis.getTable().getCurrentScale().getUnit() + ")", JLabel.CENTER); + add(axisLabel, BorderLayout.NORTH); + } + + tableLabel = new JLabel(table.getCurrentScale().getUnit(), JLabel.CENTER); + add(tableLabel, BorderLayout.SOUTH); + + if (axisLabel != null) + axisLabel.setBorder(new EmptyBorder(2, 4, 2, 4)); + + if (presetPanel != null) presetPanel.populatePanel(); + repaint(); + } + + @Override + public void updateTableLabel() { + if (null == axis.getName() || axis.getName().length() < 1 || Settings.BLANK == axis.getName()) { + // Do not update label. + } else if (null == axis.getTable().getCurrentScale() || "0x" == axis.getTable().getCurrentScale().getUnit()) { + // static or no scale exists. + axisLabel.setText(axis.getName()); + } else { + axisLabel.setText(axis.getName() + " (" + axis.getTable().getCurrentScale().getUnit() + ")"); + } + + tableLabel.setText(table.getCurrentScale().getUnit()); + } + + @Override + public void addKeyListener(KeyListener listener) { + super.addKeyListener(listener); + axis.addKeyListener(listener); + } + + @Override + public void cursorUp() { + if (data[highlightBeginY].isSelected()) { + axis.getTable().selectCellAt(highlightBeginY); + } + } + + @Override + public void drawTable() { + super.drawTable(); + + if (axis != null) + axis.drawTable(); + } + + @Override + public void cursorDown() { + axis.cursorDown(); + } + + @Override + public void cursorLeft() { + if (highlightBeginY > 0 && data[highlightBeginY].isSelected()) { + table.selectCellAt(highlightBeginY - 1); + } else { + axis.cursorLeft(); + } + } + + @Override + public void cursorRight() { + if (highlightBeginY < data.length - 1 && data[highlightBeginY].isSelected()) { + table.selectCellAt(highlightBeginY + 1); + } else { + axis.cursorRight(); + } + } + + @Override + public void shiftCursorUp() { + if (data[highlightBeginY].isSelected()) { + data[highlightBeginY].getDataCell().setSelected(false); + } + axis.getTable().selectCellAt(highlightBeginY); + } + + @Override + public void shiftCursorDown() { + axis.cursorDown(); + } + + @Override + public void shiftCursorLeft() { + if (highlightBeginY > 0 && data[highlightBeginY].isSelected()) { + table.selectCellAtWithoutClear(highlightBeginY - 1); + } else { + axis.shiftCursorLeft(); + } + } + + @Override + public void shiftCursorRight() { + if (highlightBeginY < data.length - 1 && data[highlightBeginY].isSelected()) { + table.selectCellAtWithoutClear(highlightBeginY + 1); + } else { + axis.shiftCursorRight(); + } + } + + @Override + public void startHighlight(int x, int y) { + axis.getTable().clearSelection(); + super.startHighlight(x, y); + } + + @Override + public void copySelection() { + super.copySelection(); + axis.copySelection(); + } + + @Override + public void copyTable() { + String tableHeader = TableView.getSettings().getTable2DHeader(); + StringBuffer output = new StringBuffer(tableHeader); + output.append(table.getTableAsString()); + + setClipboard(output.toString()); + } + + @Override + public void paste(String s) throws UserLevelException { + StringTokenizer st = new StringTokenizer(s, Table.ST_DELIMITER); + String pasteType = st.nextToken(); + + if (pasteType.equalsIgnoreCase("[Table2D]")) { // Paste table + String currentToken = st.nextToken(Settings.NEW_LINE); + if (currentToken.endsWith("\t")) { + currentToken = st.nextToken(Settings.NEW_LINE); + } + + String axisValues = "[Table1D]" + Settings.NEW_LINE + currentToken; + String dataValues = "[Table1D]" + Settings.NEW_LINE + st.nextToken(Settings.NEW_LINE); + + axis.paste(axisValues); + super.paste(dataValues); + } else if (pasteType.equalsIgnoreCase("[Selection1D]")) { // paste selection + if (data[highlightBeginY].isSelected()) { + super.paste(s); + } else { + axis.paste(s); + } + } + } + + @Override + public void clearLiveDataTrace() { + super.clearLiveDataTrace(); + axis.clearLiveDataTrace(); + } + + @Override + public void updateLiveDataHighlight() { + if (getOverlayLog()) { + data[axis.getPreviousLiveDataIndex()].setPreviousLiveDataTrace(true); + data[axis.getLiveDataIndex()].setPreviousLiveDataTrace(false); + data[axis.getLiveDataIndex()].setLiveDataTrace(true); + } + } + + @Override + public void setOverlayLog(boolean overlayLog) { + super.setOverlayLog(overlayLog); + axis.setOverlayLog(overlayLog); + } + + @Override + public void setCompareDisplay(Settings.CompareDisplay compareDisplay) { + super.setCompareDisplay(compareDisplay); + axis.setCompareDisplay(compareDisplay); + } + + @Override + public boolean equals(Object other) { + return table.equals(other); + } + + @Override + public void repaint() { + super.repaint(); + if (null != axis) { + axis.repaint(); + } + } +} diff --git a/src/main/java/com/romraider/maps/Table3D.java b/src/main/java/com/romraider/maps/Table3D.java index 25e02550b..ece40556f 100644 --- a/src/main/java/com/romraider/maps/Table3D.java +++ b/src/main/java/com/romraider/maps/Table3D.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,54 +21,33 @@ import static com.romraider.util.ParamChecker.isNullOrEmpty; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.Toolkit; -import java.awt.Window; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.StringSelection; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.event.KeyListener; -import java.io.IOException; -import java.util.StringTokenizer; - import javax.naming.NameNotFoundException; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; - import com.romraider.Settings; -import com.romraider.editor.ecu.ECUEditorManager; -import com.romraider.logger.ecu.ui.swing.vertical.VerticalLabelUI; +import com.romraider.util.NumberUtil; import com.romraider.util.SettingsManager; -import com.romraider.xml.RomAttributeParser; public class Table3D extends Table { private static final long serialVersionUID = 3103448753263606599L; + private Table1D xAxis = new Table1D(); - private Table1D yAxis = new Table1D(); - private JLabel xAxisLabel; - private JLabel yAxisLabel; + private Table1D yAxis= new Table1D(); - @SuppressWarnings("hiding") DataCell[][] data = new DataCell[1][1]; private boolean swapXY = false; private boolean flipX = false; private boolean flipY = false; + + // Skip cells after row/column ends before next row/column starts + private int skipCells = 0; - CopyTable3DWorker copyTable3DWorker; - CopySelection3DWorker copySelection3DWorker; + @Override + public TableType getType() { + return Table.TableType.TABLE_3D; + } - public Table3D() { - super(); - verticalOverhead += 39; - horizontalOverhead += 10; + public Table3DView getTableView() { + return (Table3DView) tableView; } public Table1D getXAxis() { @@ -115,7 +94,6 @@ public void setFlipY(boolean flipY) { public void setSizeX(int size) { data = new DataCell[size][data[0].length]; - centerLayout.setColumns(size + 1); } public int getSizeX() { @@ -124,54 +102,91 @@ public int getSizeX() { public void setSizeY(int size) { data = new DataCell[data.length][size]; - centerLayout.setRows(size + 1); } public int getSizeY() { return data[0].length; } + + public int getSkipCells() { + return this.skipCells; + } + public void setSkipCells(int skipCells) { + this.skipCells = skipCells; + } + + @Override - public void drawTable() { + public void clearData() { for(DataCell[] column : data) { for(DataCell cell : column) { - if(null != cell) { - cell.drawCell(); + cell.setTable(null); + cell.setRom(null); + } + } + + xAxis.clearData(); + yAxis.clearData(); + + data = null; + xAxis=null; + yAxis=null; + } + + @Override + public StringBuffer getTableAsString() { + StringBuffer output = new StringBuffer(Settings.BLANK); + + output.append(xAxis.getTableAsString()); + output.append(Settings.NEW_LINE); + + for (int y = 0; y < getSizeY(); y++) { + output.append(NumberUtil.stringValue(yAxis.data[y].getRealValue())); + output.append(Settings.TAB); + + for (int x = 0; x < getSizeX(); x++) { + + output.append(NumberUtil.stringValue(data[x][y].getRealValue())); + + if (x < getSizeX() - 1) { + output.append(Settings.TAB); } } + + if (y < getSizeY() - 1) { + output.append(Settings.NEW_LINE); + } } - xAxis.drawTable(); - yAxis.drawTable(); + + return output; } @Override - public void populateTable(byte[] input, int romRamOffset) throws NullPointerException, ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { + public void populateTable(Rom rom) throws NullPointerException, ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { + validateScaling(); + // fill first empty cell - centerPanel.add(new JLabel()); if (!beforeRam) { - this.ramOffset = romRamOffset; + this.ramOffset = rom.getRomID().getRamOffset(); } // temporarily remove lock boolean tempLock = locked; locked = false; - // populate axiis + // populate axes try { - xAxis.populateTable(input, romRamOffset); - yAxis.populateTable(input, romRamOffset); + xAxis.populateTable(rom); + yAxis.populateTable(rom); } catch (ArrayIndexOutOfBoundsException ex) { throw new ArrayIndexOutOfBoundsException(); } - for (int x = 0; x < xAxis.getDataSize(); x++) { - centerPanel.add(xAxis.getDataCell(x)); - } - int offset = 0; - int iMax = swapXY ? xAxis.getDataSize() : yAxis.getDataSize(); int jMax = swapXY ? yAxis.getDataSize() : xAxis.getDataSize(); + for (int i = 0; i < iMax; i++) { for (int j = 0; j < jMax; j++) { @@ -182,103 +197,27 @@ public void populateTable(byte[] input, int romRamOffset) throws NullPointerExce x = y; y = z; } - - - double cellBinValue; - - // populate data cells - if (storageType == Settings.STORAGE_TYPE_FLOAT) { //float storage type - byte[] byteValue = new byte[4]; - byteValue[0] = input[getStorageAddress() + offset * 4 - ramOffset]; - byteValue[1] = input[getStorageAddress() + offset * 4 - ramOffset + 1]; - byteValue[2] = input[getStorageAddress() + offset * 4 - ramOffset + 2]; - byteValue[3] = input[getStorageAddress() + offset * 4 - ramOffset + 3]; - cellBinValue = RomAttributeParser.byteToFloat(byteValue, endian); - - } else { // integer storage type - cellBinValue = RomAttributeParser.parseByteValue(input, - endian, - getStorageAddress() + offset * storageType - ramOffset, - storageType, - signed); + DataCell c = new DataCell(this, offset, rom); + data[x][y] = c; + + // If on last cell on row/column + if(j == jMax - 1) + { + offset+= 1 + this.skipCells; } - - // show locked cell - if (tempLock) { - data[x][y].setForeground(Color.GRAY); + else + { + offset++; } - - data[x][y] = new DataCell(this, cellBinValue, x, y); - offset++; - } - } - - for (int y = 0; y < yAxis.getDataSize(); y++) { - centerPanel.add(yAxis.getDataCell(y)); - for (int x = 0; x < xAxis.getDataSize(); x++) { - centerPanel.add(data[x][y]); } } // reset locked status locked = tempLock; - - GridLayout topLayout = new GridLayout(2, 1); - JPanel topPanel = new JPanel(topLayout); - this.add(topPanel, BorderLayout.NORTH); - topPanel.add(new JLabel(getName(), JLabel.CENTER), BorderLayout.NORTH); - - if(null == xAxis.getName() || xAxis.getName().length() < 1 || "" == xAxis.getName()) { - ;// Do not add label. - } else if(null == xAxis.getCurrentScale() || "0x" == xAxis.getCurrentScale().getUnit()) { - // static or no scale exists. - xAxisLabel = new JLabel(xAxis.getName(), JLabel.CENTER); - topPanel.add(xAxisLabel, BorderLayout.NORTH); - } else { - xAxisLabel = new JLabel(xAxis.getName() + " (" + xAxis.getCurrentScale().getUnit() + ")", JLabel.CENTER); - topPanel.add(xAxisLabel, BorderLayout.NORTH); - } - - yAxisLabel = null; - if(null == yAxis.getName() || yAxis.getName().length() < 1 || "" == yAxis.getName()) { - ;// Do not add label. - } else if(null == yAxis.getCurrentScale() || "0x" == yAxis.getCurrentScale().getUnit()) { - // static or no scale exists. - yAxisLabel = new JLabel(yAxis.getName()); - } else { - yAxisLabel = new JLabel(yAxis.getName() + " (" + yAxis.getCurrentScale().getUnit() + ")"); - } - - yAxisLabel.setUI(new VerticalLabelUI(false)); - add(yAxisLabel, BorderLayout.WEST); - - tableLabel = new JLabel(getCurrentScale().getUnit(), JLabel.CENTER); - add(tableLabel, BorderLayout.SOUTH); - calcCellRanges(); - } - - @Override - public void updateTableLabel() { - if(null == xAxis.getName() || xAxis.getName().length() < 1 || "" == xAxis.getName()) { - ;// Do not update label. - } else if(null == xAxis.getCurrentScale() || "0x" == xAxis.getCurrentScale().getUnit()) { - // static or no scale exists. - xAxisLabel.setText(xAxis.getName()); - } else { - xAxisLabel.setText(xAxis.getName() + " (" + xAxis.getCurrentScale().getUnit() + ")"); - } - - if(null == yAxis.getName() || yAxis.getName().length() < 1 || "" == yAxis.getName()) { - ;// Do not update label. - } else if(null == yAxis.getCurrentScale() || "0x" == yAxis.getCurrentScale().getUnit()) { - // static or no scale exists. - yAxisLabel.setText(yAxis.getName()); - } else { - yAxisLabel.setText(yAxis.getName() + " (" + yAxis.getCurrentScale().getUnit() + ")"); - } - tableLabel.setText(getCurrentScale().getUnit()); + //Add Raw Scale + addScale(new Scale()); } @Override @@ -315,32 +254,6 @@ public void calcCellRanges() { setMinCompare(compareMin); } - @Override - public StringBuffer getTableAsString() { - StringBuffer output = new StringBuffer(Settings.BLANK); - - output.append(xAxis.getTableAsString()); - output.append(Settings.NEW_LINE); - - for (int y = 0; y < getSizeY(); y++) { - output.append(yAxis.data[y].getRealValue()); - output.append(Settings.TAB); - - for (int x = 0; x < getSizeX(); x++) { - output.append(data[x][y].getRealValue()); - if (x < getSizeX() - 1) { - output.append(Settings.TAB); - } - } - - if (y < getSizeY() - 1) { - output.append(Settings.NEW_LINE); - } - } - - return output; - } - @Override public void populateCompareValues(Table otherTable) { if(null == otherTable || !(otherTable instanceof Table3D)) { @@ -355,8 +268,6 @@ public void populateCompareValues(Table otherTable) { return; } - clearLiveDataTrace(); - int x=0; for (DataCell[] column : data) { int y = 0; @@ -371,7 +282,7 @@ public void populateCompareValues(Table otherTable) { yAxis.populateCompareValues(compareTable3D.getYAxis()); calcCellRanges(); - drawTable(); + if(tableView != null) tableView.drawTable(); } @Override @@ -381,104 +292,10 @@ public void refreshCompare() { yAxis.refreshCompare(); } - @Override - public Dimension getFrameSize() { - int height = verticalOverhead + cellHeight * data[0].length; - int width = horizontalOverhead + data.length * cellWidth; - if (height < minHeight) { - height = minHeight; - } - int minWidth = isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; - if (width < minWidth) { - width = minWidth; - } - return new Dimension(width, height); - } @Override public String toString() { - return super.toString() + " (3D)";/* + - "\n Flip X: " + flipX + - "\n Size X: " + data.length + - "\n Flip Y: " + flipY + - "\n Size Y: " + data[0].length + - "\n Swap X/Y: " + swapXY + - xAxis + - yAxis;*/ - } - - @Override - public void increment(double increment) { - if (!locked) { - for (int x = 0; x < this.getSizeX(); x++) { - for (int y = 0; y < this.getSizeY(); y++) { - if (data[x][y].isSelected()) { - data[x][y].increment(increment); - } - } - } - } - } - - @Override - public void multiply(double factor) { - if (!locked) { - for (int x = 0; x < this.getSizeX(); x++) { - for (int y = 0; y < this.getSizeY(); y++) { - if (data[x][y].isSelected()) { - data[x][y].multiply(factor); - } - } - } - } - } - - @Override - public void clearSelection() { - xAxis.clearSelectedData(); - yAxis.clearSelectedData(); - clearSelectedData(); - } - - @Override - public void clearSelectedData() { - for (int x = 0; x < this.getSizeX(); x++) { - for (int y = 0; y < this.getSizeY(); y++) { - data[x][y].setSelected(false); - } - } - } - - @Override - public void highlight(int xCoord, int yCoord) { - if (highlight) { - for (int x = 0; x < this.getSizeX(); x++) { - for (int y = 0; y < this.getSizeY(); y++) { - if (((y >= highlightY && y <= yCoord) || - (y <= highlightY && y >= yCoord)) && - ((x >= highlightX && x <= xCoord) || - (x <= highlightX && x >= xCoord))) { - data[x][y].setHighlighted(true); - } else { - data[x][y].setHighlighted(false); - } - } - } - } - } - - @Override - public void stopHighlight() { - highlight = false; - // loop through, selected and un-highlight - for (int x = 0; x < this.getSizeX(); x++) { - for (int y = 0; y < this.getSizeY(); y++) { - if (data[x][y].isHighlighted()) { - data[x][y].setSelected(true); - data[x][y].setHighlighted(false); - } - } - } + return super.toString() + " (3D)"; } @Override @@ -493,8 +310,7 @@ public void setRevertPoint() { } @Override - public void undoAll() { - clearLiveDataTrace(); + public void undoAll() throws UserLevelException { for (int x = 0; x < this.getSizeX(); x++) { for (int y = 0; y < this.getSizeY(); y++) { data[x][y].undo(); @@ -505,443 +321,273 @@ public void undoAll() { } @Override - public void undoSelected() { - clearLiveDataTrace(); - for (int x = 0; x < this.getSizeX(); x++) { - for (int y = 0; y < this.getSizeY(); y++) { - if (data[x][y].isSelected()) { - data[x][y].undo(); - } - } - } + public boolean isLiveDataSupported() { + return !isNullOrEmpty(xAxis.getLogParam()) && !isNullOrEmpty(yAxis.getLogParam()); + } + + @Override + public boolean isButtonSelected() { + return true; } + public DataCell[][] get3dData() { + return data; + } @Override - public byte[] saveFile(byte[] binData) { - if ( userLevel <= getSettings().getUserLevel() && (userLevel < 5 || getSettings().isSaveDebugTables()) ) { - binData = xAxis.saveFile(binData); - binData = yAxis.saveFile(binData); - int offset = 0; - - int iMax = swapXY ? xAxis.getDataSize() : yAxis.getDataSize(); - int jMax = swapXY ? yAxis.getDataSize() : xAxis.getDataSize(); - for (int i = 0; i < iMax; i++) { - for (int j = 0; j < jMax; j++) { - - int x = flipY ? jMax - j - 1 : j; - int y = flipX ? iMax - i - 1 : i; - if (swapXY) { - int z = x; - x = y; - y = z; - } + public void setCompareValueType(Settings.DataType compareValueType) { + super.setCompareValueType(compareValueType); + xAxis.setCompareValueType(compareValueType); + yAxis.setCompareValueType(compareValueType); + } - // determine output byte values - byte[] output; - if (storageType != Settings.STORAGE_TYPE_FLOAT) { - output = RomAttributeParser.parseIntegerValue((int) data[x][y].getBinValue(), endian, storageType); - for (int z = 0; z < storageType; z++) { - binData[offset * storageType + z + getStorageAddress() - ramOffset] = output[z]; - } - } else { // float - output = RomAttributeParser.floatToByte((float) data[x][y].getBinValue(), endian); - for (int z = 0; z < 4; z++) { - binData[offset * 4 + z + getStorageAddress() - ramOffset] = output[z]; + @Override + public void setCurrentScale(Scale curScale) { + if(SettingsManager.getSettings().isScaleHeadersAndData()) { + if(!xAxis.isStaticDataTable()) { + try { + this.xAxis.setScaleByCategory(curScale.getCategory()); + } catch (NameNotFoundException e) { + try { + this.xAxis.setScaleByCategory(SettingsManager.getSettings().getDefaultScale()); + } catch (NameNotFoundException e1) { + try { + this.xAxis.setScaleByCategory("Default"); + } catch (NameNotFoundException e2) { + e2.printStackTrace(); } } - - - offset++; } } - } - return binData; - } - - @Override - public void setRealValue(String realValue) { - if (!locked && !(userLevel > getSettings().getUserLevel()) ) { - for(DataCell[] column : data) { - for(DataCell cell : column) { - if(cell.isSelected()) { - cell.setRealValue(realValue); + if(!yAxis.isStaticDataTable()) { + try { + this.yAxis.setScaleByCategory(curScale.getCategory()); + } catch (NameNotFoundException e) { + try { + this.yAxis.setScaleByCategory(SettingsManager.getSettings().getDefaultScale()); + } catch (NameNotFoundException e1) { + try { + this.yAxis.setScaleByCategory("Default"); + } catch (NameNotFoundException e2) { + e2.printStackTrace(); + } } } } - } else if (userLevel > getSettings().getUserLevel()) { - JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" + - userLevel + " or greater. Click View->User Level to change your userlevel.", - "Table cannot be modified", - JOptionPane.INFORMATION_MESSAGE); } - xAxis.setRealValue(realValue); - yAxis.setRealValue(realValue); - } - @Override - public void addKeyListener(KeyListener listener) { - xAxis.addKeyListener(listener); - yAxis.addKeyListener(listener); - for (int x = 0; x < this.getSizeX(); x++) { - for (int y = 0; y < this.getSizeY(); y++) { - data[x][y].addKeyListener(listener); - } - } + this.curScale = curScale; + if(tableView!=null) tableView.drawTable(); } - public void selectCellAt(int y, Table1D axisType) { - if (axisType.getType() == Settings.TABLE_Y_AXIS) { - selectCellAt(0, y); - } else { // y axis - selectCellAt(y, 0); + private void setHighlightXY(int x, int y) { + if(tableView!=null) { + tableView.highlightBeginX = x; + tableView.highlightBeginY = y; } - ECUEditorManager.getECUEditor().getTableToolBar().updateTableToolBar(this); } public void deSelectCellAt(int x, int y) { clearSelection(); data[x][y].setSelected(false); - highlightX = x; - highlightY = y; + setHighlightXY(x,y); } public void selectCellAt(int x, int y) { clearSelection(); data[x][y].setSelected(true); - highlightX = x; - highlightY = y; + setHighlightXY(x,y); } public void selectCellAtWithoutClear(int x, int y) { data[x][y].setSelected(true); - highlightX = x; - highlightY = y; - } - - @Override - public void cursorUp() { - if (highlightY > 0 && data[highlightX][highlightY].isSelected()) { - selectCellAt(highlightX, highlightY - 1); - } else if (data[highlightX][highlightY].isSelected()) { - xAxis.selectCellAt(highlightX); - } else { - xAxis.cursorUp(); - yAxis.cursorUp(); - } + setHighlightXY(x,y); } @Override - public void cursorDown() { - if (highlightY < getSizeY() - 1 && data[highlightX][highlightY].isSelected()) { - selectCellAt(highlightX, highlightY + 1); - } else { - xAxis.cursorDown(); - yAxis.cursorDown(); - } - } - - @Override - public void cursorLeft() { - if (highlightX > 0 && data[highlightX][highlightY].isSelected()) { - selectCellAt(highlightX - 1, highlightY); - } else if (data[highlightX][highlightY].isSelected()) { - yAxis.selectCellAt(highlightY); - } else { - xAxis.cursorLeft(); - yAxis.cursorLeft(); - } - } + public void clearSelection() { + if(xAxis!=null) + xAxis.clearSelection(); - @Override - public void cursorRight() { - if (highlightX < getSizeX() - 1 && data[highlightX][highlightY].isSelected()) { - selectCellAt(highlightX + 1, highlightY); - } else { - xAxis.cursorRight(); - yAxis.cursorRight(); - } - } + if(yAxis!=null) + yAxis.clearSelection(); - @Override - public void startHighlight(int x, int y) { - xAxis.clearSelectedData(); - yAxis.clearSelectedData(); - super.startHighlight(x, y); - } - - @Override - public void copySelection() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(this); - if(null != ancestorWindow) { - ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + if(data!=null) { + for (int x = 0; x < getSizeX(); x++) { + for (int y = 0; y < getSizeY(); y++) { + data[x][y].setSelected(false); + } + } } - ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - copySelection3DWorker = new CopySelection3DWorker(this); - copySelection3DWorker.execute(); - } @Override - public void copyTable() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(this); - if(null != ancestorWindow) { - ancestorWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - } - ECUEditorManager.getECUEditor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - copyTable3DWorker = new CopyTable3DWorker(this); - copyTable3DWorker.execute(); + public void increment(double increment) throws UserLevelException { + for (int x = 0; x < getSizeX(); x++) { + for (int y = 0; y < getSizeY(); y++) { + if (data[x][y].isSelected()) { + data[x][y].increment(increment); + } + } + } } @Override - public void paste() { - StringTokenizer st = new StringTokenizer(""); - String input = ""; - try { - input = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null).getTransferData(DataFlavor.stringFlavor); - st = new StringTokenizer(input); - } catch (UnsupportedFlavorException ex) { /* wrong paste type -- do nothing */ - } catch (IOException ex) { - } - - String pasteType = st.nextToken(); - - if ("[Table3D]".equalsIgnoreCase(pasteType)) { // Paste table - String newline = System.getProperty("line.separator"); - String xAxisValues = "[Table1D]" + newline + st.nextToken(newline); - - // build y axis and data values - StringBuffer yAxisValues = new StringBuffer("[Table1D]" + newline + st.nextToken("\t")); - StringBuffer dataValues = new StringBuffer("[Table3D]" + newline + st.nextToken("\t") + st.nextToken(newline)); - while (st.hasMoreTokens()) { - yAxisValues.append("\t").append(st.nextToken("\t")); - dataValues.append(newline).append(st.nextToken("\t")).append(st.nextToken(newline)); + public void multiply(double factor) throws UserLevelException { + for (int x = 0; x < getSizeX(); x++) { + for (int y = 0; y < getSizeY(); y++) { + if (data[x][y].isSelected()) { + data[x][y].multiply(factor); + } + } } - - // put x axis in clipboard and paste - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(xAxisValues), null); - xAxis.paste(); - // put y axis in clipboard and paste - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(String.valueOf(yAxisValues)), null); - yAxis.paste(); - // put datavalues in clipboard and paste - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(String.valueOf(dataValues)), null); - pasteValues(); - // reset clipboard - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(input), null); - - } else if ("[Selection3D]".equalsIgnoreCase(pasteType)) { // paste selection - pasteValues(); - } else if ("[Selection1D]".equalsIgnoreCase(pasteType)) { // paste selection - xAxis.paste(); - yAxis.paste(); - } } - public void pasteValues() { - StringTokenizer st = new StringTokenizer(""); - String newline = System.getProperty("line.separator"); - try { - String input = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null).getTransferData(DataFlavor.stringFlavor); - st = new StringTokenizer(input); - } catch (UnsupportedFlavorException ex) { /* wrong paste type -- do nothing */ - } catch (IOException ex) { - } - - String pasteType = st.nextToken(); - - // figure paste start cell - int startX = 0; - int startY = 0; - // if pasting a table, startX and Y at 0, else highlight is start - if ("[Selection3D]".equalsIgnoreCase(pasteType)) { - startX = highlightX; - startY = highlightY; - } - - // set values - for (int y = startY; y < getSizeY(); y++) { - if (st.hasMoreTokens()) { - StringTokenizer currentLine = new StringTokenizer(st.nextToken(newline)); - for (int x = startX; x < getSizeX(); x++) { - if (currentLine.hasMoreTokens()) { - String currentToken = currentLine.nextToken(); - - try { - if (!data[x][y].getText().equalsIgnoreCase(currentToken)) { - data[x][y].setRealValue(currentToken); - } - } catch (ArrayIndexOutOfBoundsException ex) { /* copied table is larger than current table*/ } - } + @Override + public void setRealValue(String realValue) throws UserLevelException { + for(DataCell[] column : data) { + for(DataCell cell : column) { + if(cell.isSelected()) { + cell.setRealValue(realValue); } } } + xAxis.setRealValue(realValue); + yAxis.setRealValue(realValue); } @Override - public void verticalInterpolate() { + public void verticalInterpolate() throws UserLevelException { int[] coords = { getSizeX(), getSizeY(), 0, 0}; DataCell[][] tableData = get3dData(); - - int x, y; - for (x = 0; x < getSizeX(); x++) { - for (y = 0; y < getSizeY(); y++) { - if (tableData[x][y].isSelected()) { - if (x < coords[0]) - coords[0] = x; - if (x > coords[2]) - coords[2] = x; - if (y < coords[1]) - coords[1] = y; - if (y > coords[3]) - coords[3] = y; + DataCell[] axisData = getYAxis().getData(); + int i, j; + for (i = 0; i < getSizeX(); ++i) { + for (j = 0; j < getSizeY(); ++j) { + if (tableData[i][j].isSelected()) { + if (i < coords[0]) + coords[0] = i; + if (i > coords[2]) + coords[2] = i; + if (j < coords[1]) + coords[1] = j; + if (j > coords[3]) + coords[3] = j; } } } if (coords[3] - coords[1] > 1) { - double diff; - for (y = coords[0]; y <= coords[2]; y++) { - diff = (tableData[y][coords[1]].getRealValue() - tableData[y][coords[3]].getRealValue()) / (coords[3] - coords[1]); - if (Math.abs(diff) > 0) { - for (x = coords[1] + 1; x < coords[3]; x++) - tableData[y][x].setRealValue(String.valueOf(tableData[y][x - 1].getRealValue() - diff)); + double x, startX, endX, startY, endY; + startX = axisData[coords[1]].getBinValue(); + endX = axisData[coords[3]].getBinValue(); + for (i = coords[0]; i <= coords[2]; ++i) { + startY = tableData[i][coords[1]].getBinValue(); + endY = tableData[i][coords[3]].getBinValue(); + for (j = coords[1] + 1; j < coords[3]; ++j) { + x = axisData[j].getBinValue(); + tableData[i][j].setBinValue(linearInterpolation(x, startX, endX, startY, endY)); } } } // Interpolate y axis in case the y axis in selected. - this.getYAxis().verticalInterpolate(); + getYAxis().verticalInterpolate(); } @Override - public void horizontalInterpolate() { + public void horizontalInterpolate() throws UserLevelException { int[] coords = { getSizeX(), getSizeY(), 0, 0 }; DataCell[][] tableData = get3dData(); - - int x, y; - for (x = 0; x < getSizeX(); x++) { - for (y = 0; y < getSizeY(); y++) { - if (tableData[x][y].isSelected()) { - if (x < coords[0]) - coords[0] = x; - if (x > coords[2]) - coords[2] = x; - if (y < coords[1]) - coords[1] = y; - if (y > coords[3]) - coords[3] = y; + DataCell[] axisData = getXAxis().getData(); + int i, j; + for (i = 0; i < getSizeX(); ++i) { + for (j = 0; j < getSizeY(); ++j) { + if (tableData[i][j].isSelected()) { + if (i < coords[0]) + coords[0] = i; + if (i > coords[2]) + coords[2] = i; + if (j < coords[1]) + coords[1] = j; + if (j > coords[3]) + coords[3] = j; } } } if (coords[2] - coords[0] > 1) { - double diff; - for (x = coords[1]; x <= coords[3]; x++) { - diff = (tableData[coords[0]][x].getRealValue() - tableData[coords[2]][x].getRealValue()) / (coords[2] - coords[0]); - if (Math.abs(diff) > 0) { - for (y = coords[0] + 1; y < coords[2]; y++) - tableData[y][x].setRealValue(String.valueOf(tableData[y - 1][x].getRealValue() - diff)); + double x, startX, endX, startY, endY; + startX = axisData[coords[0]].getBinValue(); + endX = axisData[coords[2]].getBinValue(); + for (i = coords[1]; i <= coords[3]; ++i) { + startY = tableData[coords[0]][i].getBinValue(); + endY = tableData[coords[2]][i].getBinValue(); + for (j = coords[0] + 1; j < coords[2]; ++j) { + x = axisData[j].getBinValue(); + tableData[j][i].setBinValue(linearInterpolation(x, startX, endX, startY, endY)); } } } // Interpolate x axis in case the x axis in selected. - this.getXAxis().horizontalInterpolate(); + getXAxis().horizontalInterpolate(); } @Override - public void interpolate() { + public void interpolate() throws UserLevelException { verticalInterpolate(); horizontalInterpolate(); } - @Override - public boolean isLiveDataSupported() { - return !isNullOrEmpty(xAxis.getLogParam()) && !isNullOrEmpty(yAxis.getLogParam()); - } - - @Override - public boolean isButtonSelected() { - return true; - } - - @Override - public void highlightLiveData(String liveValue) { - if (getOverlayLog()) { - int x = xAxis.getLiveDataIndex(); - int y = yAxis.getLiveDataIndex(); - DataCell cell = data[x][y]; - cell.setLiveDataTrace(true); - cell.setLiveDataTraceValue(liveValue); - getToolbar().setLiveDataValue(liveValue); - } - } - - @Override - public void updateLiveDataHighlight() { - if (getOverlayLog()) { - int x = xAxis.getLiveDataIndex(); - int y = yAxis.getLiveDataIndex(); - data[x][y].setLiveDataTrace(true); - } - } - - @Override - public void clearLiveDataTrace() { - xAxis.clearLiveDataTrace(); - yAxis.clearLiveDataTrace(); - for (int x = 0; x < getSizeX(); x++) { - for (int y = 0; y < getSizeY(); y++) { - data[x][y].setLiveDataTrace(false); - } - } - } - - public DataCell[][] get3dData() { - return data; - } - - @Override - public void setCompareDisplay(int compareDisplay) { - super.setCompareDisplay(compareDisplay); - xAxis.setCompareDisplay(compareDisplay); - yAxis.setCompareDisplay(compareDisplay); - } - - @Override - public void setCompareValueType(int compareValueType) { - super.setCompareValueType(compareValueType); - xAxis.setCompareValueType(compareValueType); - yAxis.setCompareValueType(compareValueType); - } - - @Override - public void setCurrentScale(Scale curScale) { - if(SettingsManager.getSettings().isScaleHeadersAndData()) { - if(!xAxis.isStaticDataTable()) { - try { - this.xAxis.setScaleByName(curScale.getName()); - } catch (NameNotFoundException e) { - try { - this.xAxis.setScaleByName(SettingsManager.getSettings().getDefaultScale()); - } catch (NameNotFoundException e1) { - } - } - } - if(!yAxis.isStaticDataTable()) { - try { - this.yAxis.setScaleByName(curScale.getName()); - } catch (NameNotFoundException e) { - try { - this.yAxis.setScaleByName(SettingsManager.getSettings().getDefaultScale()); - } catch (NameNotFoundException e1) { - } - } - } - } - this.curScale = curScale; - updateTableLabel(); - drawTable(); - } + @Override + public double queryTable(Double input_x, Double input_y) { + DataCell[][] tableData = get3dData(); + DataCell[] axisXData = getXAxis().getData(); + DataCell[] axisYData = getYAxis().getData(); + + int startX = 0; + int endX = axisXData.length - 1; + boolean foundEnd = false; + + for (int i = 0; i < axisXData.length; i++) { + DataCell c = axisXData[i]; + if (c.getRealValue() <= input_x) { + startX = i; + } + if (c.getRealValue() >= input_x && !foundEnd) { + foundEnd = true; + endX = i; + } + } + + int startY = 0; + int endY = axisYData.length - 1; + foundEnd = false; + + for (int i = 0; i < axisYData.length; i++) { + DataCell c = axisYData[i]; + if (c.getRealValue() <= input_y) { + startY = i; + } + if (c.getRealValue() >= input_y && !foundEnd) { + endY = i; + foundEnd = true; + } + } + + double valueX1 = linearInterpolation(input_x, + axisXData[startX].getRealValue(), + axisXData[endX].getRealValue(), + tableData[startX][startY].getRealValue(), + tableData[endX][startY].getRealValue()); + + double valueX2 = linearInterpolation(input_x, + axisXData[startX].getRealValue(), + axisXData[endX].getRealValue(), + tableData[startX][endY].getRealValue(), + tableData[endX][endY].getRealValue()); + + + return linearInterpolation(input_y, axisYData[startY].getRealValue(), axisYData[endY].getRealValue(), + valueX1, valueX2); + } @Override public String getLogParamString() { @@ -952,17 +598,6 @@ public String getLogParamString() { return sb.toString(); } - @Override - public void setOverlayLog(boolean overlayLog) { - super.setOverlayLog(overlayLog); - xAxis.setOverlayLog(overlayLog); - yAxis.setOverlayLog(overlayLog); - if (overlayLog) { - xAxis.clearLiveDataTrace(); - yAxis.clearLiveDataTrace(); - } - } - @Override public boolean equals(Object other) { try { @@ -1020,123 +655,4 @@ public boolean equals(Object other) { return false; } } - - @Override - public void repaint() { - super.repaint(); - - if(null != xAxis) { - xAxis.repaint(); - } - - if(null != yAxis) { - yAxis.repaint(); - } - } -} - -class CopySelection3DWorker extends SwingWorker { - Table3D table; - - public CopySelection3DWorker(Table3D table) - { - this.table = table; - } - - @Override - protected Void doInBackground() throws Exception { - // find bounds of selection - // coords[0] = x min, y min, x max, y max - boolean copy = false; - int[] coords = new int[4]; - coords[0] = table.getSizeX(); - coords[1] = table.getSizeY(); - - for (int x = 0; x < table.getSizeX(); x++) { - for (int y = 0; y < table.getSizeY(); y++) { - if (table.get3dData()[x][y].isSelected()) { - if (x < coords[0]) { - coords[0] = x; - copy = true; - } - if (x > coords[2]) { - coords[2] = x; - copy = true; - } - if (y < coords[1]) { - coords[1] = y; - copy = true; - } - if (y > coords[3]) { - coords[3] = y; - copy = true; - } - } - } - } - // make string of selection - if (copy) { - String newline = System.getProperty("line.separator"); - StringBuffer output = new StringBuffer("[Selection3D]" + newline); - for (int y = coords[1]; y <= coords[3]; y++) { - for (int x = coords[0]; x <= coords[2]; x++) { - if (table.get3dData()[x][y].isSelected()) { - output.append(table.get3dData()[x][y].getText()); - } else { - output.append("x"); // x represents non-selected cell - } - if (x < coords[2]) { - output.append("\t"); - } - } - if (y < coords[3]) { - output.append(newline); - } - //copy to clipboard - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(String.valueOf(output)), null); - } - } else { - table.getXAxis().copySelection(); - table.getYAxis().copySelection(); - } - return null; - } - - @Override - public void done() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(table); - if(null != ancestorWindow) { - ancestorWindow.setCursor(null); - } - table.setCursor(null); - ECUEditorManager.getECUEditor().setCursor(null); - } -} - -class CopyTable3DWorker extends SwingWorker { - Table3D table; - - public CopyTable3DWorker(Table3D table) - { - this.table = table; - } - - @Override - protected Void doInBackground() throws Exception { - String tableHeader = table.getSettings().getTable3DHeader(); - StringBuffer output = new StringBuffer(tableHeader); - output.append(table.getTableAsString()); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(String.valueOf(output)), null); - return null; - } - - @Override - public void done() { - Window ancestorWindow = SwingUtilities.getWindowAncestor(table); - if(null != ancestorWindow){ - ancestorWindow.setCursor(null); - } - table.setCursor(null); - ECUEditorManager.getECUEditor().setCursor(null); - } } diff --git a/src/main/java/com/romraider/maps/Table3DView.java b/src/main/java/com/romraider/maps/Table3DView.java new file mode 100644 index 000000000..5e415e5c0 --- /dev/null +++ b/src/main/java/com/romraider/maps/Table3DView.java @@ -0,0 +1,614 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.KeyListener; + +import java.util.StringTokenizer; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; + +import com.romraider.Settings; +import com.romraider.editor.ecu.ECUEditorManager; +import com.romraider.logger.ecu.ui.swing.vertical.VerticalLabelUI; +import com.romraider.maps.Table1DView.Table1DType; +import com.romraider.util.NumberUtil; + +public class Table3DView extends TableView { + + private static final long serialVersionUID = 3103448753263606599L; + // private static final ResourceBundle rb = new ResourceUtil().getBundle(Table3DView.class.getName()); + private Table3D table; + private Table1DView xAxis; + private Table1DView yAxis; + private JLabel xAxisLabel; + private JLabel yAxisLabel; + + DataCellView[][] data; + + public Table3DView(Table3D table) { + super(table); + this.table = table; + xAxis = new Table1DView(table.getXAxis(), Table1DType.X_AXIS); + yAxis = new Table1DView(table.getYAxis(), Table1DType.Y_AXIS); + xAxis.setAxisParent(this); + yAxis.setAxisParent(this); + + verticalOverhead += 39; + horizontalOverhead += 10; + } + + @Override + public Table3D getTable() { + return table; + } + + public Table1DView getXAxis() { + return xAxis; + } + + public Table1DView getYAxis() { + return yAxis; + } + + @Override + public void drawTable() { + if(data!=null) { + for(DataCellView[] column : data) { + for(DataCellView cell : column) { + if(null != cell) { + cell.drawCell(); + } + } + } + } + + if(xAxis!=null) + xAxis.drawTable(); + + if(yAxis!=null) + yAxis.drawTable(); + + updateTableLabel(); + } + + @Override + public void populateTableVisual() { + // fill first empty cell + centerPanel.add(new JLabel()); + centerLayout.setColumns(table.getSizeX()+1); + centerLayout.setRows(table.getSizeY()+1); + + // temporarily remove lock + boolean tempLock = table.locked; + table.locked = false; + + xAxis.populateTableVisual(); + yAxis.populateTableVisual(); + for (int x = 0; x < xAxis.getTable().getDataSize(); x++) { + centerPanel.add(xAxis.getDataCell(x)); + } + + data = new DataCellView[table.getSizeX()][table.getSizeY()]; + + int iMax = table.getSwapXY() ? xAxis.getTable().getDataSize() : yAxis.getTable().getDataSize(); + int jMax = table.getSwapXY() ? yAxis.getTable().getDataSize() : xAxis.getTable().getDataSize(); + for (int i = 0; i < iMax; i++) { + for (int j = 0; j < jMax; j++) { + + int x = table.getFlipY() ? jMax - j - 1 : j; + int y = table.getFlipX() ? iMax - i - 1 : i; + if (table.getSwapXY()) { + int z = x; + x = y; + y = z; + } + + // show locked cell + if (tempLock) { + data[x][y].setForeground(Color.GRAY); + } + + data[x][y] = new DataCellView(table.get3dData()[x][y], this, x,y); + } + } + + for (int y = 0; y < yAxis.getTable().getDataSize(); y++) { + centerPanel.add(yAxis.getDataCell(y)); + for (int x = 0; x < xAxis.getTable().getDataSize(); x++) { + centerPanel.add(data[x][y]); + } + } + + // reset locked status + table.locked = tempLock; + + GridLayout topLayout = new GridLayout(2, 1); + JPanel topPanel = new JPanel(topLayout); + this.add(topPanel, BorderLayout.NORTH); + topPanel.add(new JLabel(getName(), JLabel.CENTER), BorderLayout.NORTH); + + if(null == xAxis.getName() || xAxis.getName().length() < 1 || Settings.BLANK == xAxis.getName()) { + ;// Do not add label. + } else if(null == xAxis.getTable().getCurrentScale() || "0x" == xAxis.getTable().getCurrentScale().getUnit()) { + // static or no scale exists. + xAxisLabel = new JLabel(xAxis.getName(), JLabel.CENTER); + topPanel.add(xAxisLabel, BorderLayout.NORTH); + } else { + xAxisLabel = new JLabel(xAxis.getName() + " (" + xAxis.getTable().getCurrentScale().getUnit() + ")", JLabel.CENTER); + topPanel.add(xAxisLabel, BorderLayout.NORTH); + } + + yAxisLabel = null; + if(null == yAxis.getName() || yAxis.getName().length() < 1 || Settings.BLANK == yAxis.getName()) { + ;// Do not add label. + } else if(null == yAxis.getTable().getCurrentScale() || "0x" == yAxis.getTable().getCurrentScale().getUnit()) { + // static or no scale exists. + yAxisLabel = new JLabel(yAxis.getName()); + } else { + yAxisLabel = new JLabel(yAxis.getName() + " (" + yAxis.getTable().getCurrentScale().getUnit() + ")"); + } + + if(yAxisLabel!=null) { + yAxisLabel.setUI(new VerticalLabelUI(false)); + add(yAxisLabel, BorderLayout.WEST); + yAxisLabel.setBorder(new EmptyBorder(2, 4, 2, 4)); + } + + tableLabel = new JLabel(table.getCurrentScale().getUnit(), JLabel.CENTER); + add(tableLabel, BorderLayout.SOUTH); + + if(xAxisLabel!=null) + xAxisLabel.setBorder(new EmptyBorder(2, 4, 2, 4)); + + if(presetPanel != null) presetPanel.populatePanel(); + } + + @Override + public void updateTableLabel() { + if(null == xAxis.getName() || xAxis.getName().length() < 1 || Settings.BLANK == xAxis.getName()) { + ;// Do not update label. + } else if(null == xAxis.getTable().getCurrentScale() || "0x" == xAxis.getTable().getCurrentScale().getUnit()) { + // static or no scale exists. + xAxisLabel.setText(xAxis.getName()); + } else { + xAxisLabel.setText(xAxis.getName() + " (" + xAxis.getTable().getCurrentScale().getUnit() + ")"); + } + + if(null == yAxis.getName() || yAxis.getName().length() < 1 || Settings.BLANK == yAxis.getName()) { + ;// Do not update label. + } else if(null == yAxis.getTable().getCurrentScale() || "0x" == yAxis.getTable().getCurrentScale().getUnit()) { + // static or no scale exists. + yAxisLabel.setText(yAxis.getName()); + } else { + yAxisLabel.setText(yAxis.getName() + " (" + yAxis.getTable().getCurrentScale().getUnit() + ")"); + } + + tableLabel.setText(table.getCurrentScale().getUnit()); + } + + @Override + public Dimension getFrameSize() { + int height = verticalOverhead + cellHeight * data[0].length; + int width = horizontalOverhead + data.length * cellWidth; + if (height < minHeight) { + height = minHeight; + } + int minWidth = table.isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; + if (width < minWidth) { + width = minWidth; + } + return new Dimension(width, height); + } + + @Override + public String toString() { + return super.toString() + " (3D)";/* + + "\n Flip X: " + flipX + + "\n Size X: " + data.length + + "\n Flip Y: " + flipY + + "\n Size Y: " + data[0].length + + "\n Swap X/Y: " + swapXY + + xAxis + + yAxis;*/ + } + + + @Override + public void highlight(int xCoord, int yCoord) { + if (highlight) { + for (int x = 0; x < table.getSizeX(); x++) { + for (int y = 0; y < table.getSizeY(); y++) { + if (((y >= highlightBeginY && y <= yCoord) || + (y <= highlightBeginY && y >= yCoord)) && + ((x >= highlightBeginX && x <= xCoord) || + (x <= highlightBeginX && x >= xCoord))) { + data[x][y].setHighlighted(true); + } else { + data[x][y].setHighlighted(false); + } + } + } + } + } + + @Override + public void stopHighlight() { + highlight = false; + // loop through, selected and un-highlight + for (int x = 0; x < table.getSizeX(); x++) { + for (int y = 0; y < table.getSizeY(); y++) { + if (data[x][y].isHighlighted()) { + data[x][y].getDataCell().setSelected(true); + data[x][y].setHighlighted(false); + } + } + } + } + + @Override + public void undoSelected() throws UserLevelException { + clearLiveDataTrace(); + for (int x = 0; x < table.getSizeX(); x++) { + for (int y = 0; y < table.getSizeY(); y++) { + if (data[x][y].isSelected()) { + data[x][y].getDataCell().undo(); + } + } + } + } + + @Override + public void addKeyListener(KeyListener listener) { + xAxis.addKeyListener(listener); + yAxis.addKeyListener(listener); + for (int x = 0; x < table.getSizeX(); x++) { + for (int y = 0; y < table.getSizeY(); y++) { + data[x][y].addKeyListener(listener); + } + } + } + + public void selectCellAt(int y, Table1DView axisType) { + if (axisType.getType() == Table1DType.Y_AXIS) { + table.selectCellAt(0, y); + } else { // y axis + table.selectCellAt(y, 0); + } + ECUEditorManager.getECUEditor().getTableToolBar().updateTableToolBar(table); + } + + @Override + public void cursorUp() { + if (highlightBeginY > 0 && data[highlightBeginX][highlightBeginY].isSelected()) { + table.selectCellAt(highlightBeginX, highlightBeginY - 1); + } else if (data[highlightBeginX][highlightBeginY].isSelected()) { + xAxis.getTable().selectCellAt(highlightBeginX); + } else { + xAxis.cursorUp(); + yAxis.cursorUp(); + } + } + + @Override + public void cursorDown() { + if (highlightBeginY < table.getSizeY() - 1 && data[highlightBeginX][highlightBeginY].isSelected()) { + table.selectCellAt(highlightBeginX, highlightBeginY + 1); + } else { + xAxis.cursorDown(); + yAxis.cursorDown(); + } + } + + @Override + public void cursorLeft() { + if (highlightBeginX > 0 && data[highlightBeginX][highlightBeginY].isSelected()) { + table.selectCellAt(highlightBeginX - 1, highlightBeginY); + } else if (data[highlightBeginX][highlightBeginY].isSelected()) { + yAxis.getTable().selectCellAt(highlightBeginY); + } else { + xAxis.cursorLeft(); + yAxis.cursorLeft(); + } + } + + @Override + public void cursorRight() { + if (highlightBeginX < table.getSizeX() - 1 && data[highlightBeginX][highlightBeginY].isSelected()) { + table.selectCellAt(highlightBeginX + 1, highlightBeginY); + } else { + xAxis.cursorRight(); + yAxis.cursorRight(); + } + } + + @Override + public void shiftCursorUp() { + if (highlightBeginY > 0 && data[highlightBeginX][highlightBeginY].isSelected()) { + table.selectCellAtWithoutClear(highlightBeginX, highlightBeginY - 1); + } else if (data[highlightBeginX][highlightBeginY].isSelected()) { + data[highlightBeginX][highlightBeginY].getDataCell().setSelected(false); + xAxis.getTable().selectCellAt(highlightBeginX); + } else { + xAxis.cursorUp(); + yAxis.shiftCursorUp(); + } + } + + @Override + public void shiftCursorDown() { + if (highlightBeginY < table.getSizeY() - 1 && data[highlightBeginX][highlightBeginY].isSelected()) { + table.selectCellAtWithoutClear(highlightBeginX, highlightBeginY + 1); + } else { + xAxis.shiftCursorDown(); + yAxis.shiftCursorDown(); + } + } + + @Override + public void shiftCursorLeft() { + if (highlightBeginX > 0 && data[highlightBeginX][highlightBeginY].isSelected()) { + table.selectCellAtWithoutClear(highlightBeginX - 1, highlightBeginY); + } else if (data[highlightBeginX][highlightBeginY].isSelected()) { + yAxis.getTable().selectCellAt(highlightBeginY); + } else { + xAxis.shiftCursorLeft(); + yAxis.shiftCursorLeft(); + } + } + + @Override + public void shiftCursorRight() { + if (highlightBeginX < table.getSizeX() - 1 && data[highlightBeginX][highlightBeginY].isSelected()) { + table.selectCellAtWithoutClear(highlightBeginX + 1, highlightBeginY); + } else { + xAxis.shiftCursorRight(); + yAxis.shiftCursorRight(); + } + } + + @Override + public void startHighlight(int x, int y) { + xAxis.getTable().clearSelection(); + yAxis.getTable().clearSelection(); + super.startHighlight(x, y); + } + + @Override + public void copySelection() { + // find bounds of selection + // coords[0] = x min, y min, x max, y max + boolean copy = false; + int[] coords = new int[4]; + coords[0] = getTable().getSizeX(); + coords[1] = getTable().getSizeY(); + + for (int x = 0; x < getTable().getSizeX(); x++) { + for (int y = 0; y < getTable().getSizeY(); y++) { + if (get3dData()[x][y].isSelected()) { + if (x < coords[0]) { + coords[0] = x; + copy = true; + } + if (x > coords[2]) { + coords[2] = x; + copy = true; + } + if (y < coords[1]) { + coords[1] = y; + copy = true; + } + if (y > coords[3]) { + coords[3] = y; + copy = true; + } + } + } + } + // make string of selection + if (copy) { + StringBuffer output = new StringBuffer("[Selection3D]" + Settings.NEW_LINE); + for (int y = coords[1]; y <= coords[3]; y++) { + for (int x = coords[0]; x <= coords[2]; x++) { + if (get3dData()[x][y].isSelected()) { + output.append(NumberUtil.stringValue(get3dData()[x][y].getDataCell().getRealValue())); + } else { + output.append("x"); // x represents non-selected cell + } + if (x < coords[2]) { + output.append("\t"); + } + } + if (y < coords[3]) { + output.append(Settings.NEW_LINE); + } + + setClipboard(String.valueOf(output)); + } + } else { + getTable().getXAxis().getTableView().copySelection(); + getTable().getYAxis().getTableView().copySelection(); + } + } + + @Override + public void copyTable() { + String tableHeader = TableView.getSettings().getTable3DHeader(); + StringBuffer output = new StringBuffer(tableHeader); + output.append(getTable().getTableAsString()); + + setClipboard(String.valueOf(output)); + } + + @Override + public void paste(String s) throws UserLevelException { + StringTokenizer st = new StringTokenizer(s, Table.ST_DELIMITER); + String pasteType = st.nextToken(); + + if ("[Table3D]".equalsIgnoreCase(pasteType)) { // Paste table + String currentToken = st.nextToken(Settings.NEW_LINE); + if (currentToken.endsWith("\t")) { + currentToken = st.nextToken(Settings.NEW_LINE); + } + String xAxisValues = "[Table1D]" + Settings.NEW_LINE + currentToken; + + // build y axis and data values + StringBuffer yAxisValues = new StringBuffer("[Table1D]" + Settings.NEW_LINE + st.nextToken("\t")); + StringBuffer dataValues = new StringBuffer("[Table3D]" + Settings.NEW_LINE + st.nextToken("\t") + st.nextToken(Settings.NEW_LINE)); + while (st.hasMoreTokens()) { + yAxisValues.append("\t").append(st.nextToken("\t")); + dataValues.append(Settings.NEW_LINE).append(st.nextToken("\t")).append(st.nextToken(Settings.NEW_LINE)); + } + + xAxis.paste(xAxisValues); + yAxis.paste(String.valueOf(yAxisValues)); + pasteValues(String.valueOf(dataValues)); + + } else if ("[Selection3D]".equalsIgnoreCase(pasteType)) { // paste selection + pasteValues(s); + } else if ("[Selection1D]".equalsIgnoreCase(pasteType)) { // paste selection + xAxis.paste(); + yAxis.paste(); + } + } + + public void pasteValues(String s) throws UserLevelException { + StringTokenizer st = new StringTokenizer(s, Table.ST_DELIMITER); + String pasteType = st.nextToken(); + + // figure paste start cell + int startX = 0; + int startY = 0; + + // if pasting a table, startX and Y at 0, else find highlight + if ("[Selection3D]".equalsIgnoreCase(pasteType)) { + boolean somethingSelected = false; + + for (int x = getTable().getSizeX() - 1; x >=0 ; x--) { + for (int y = 0; y < getTable().getSizeY(); y++) { + if(data[x][y].isSelected()) { + startX = x; + startY = y; + somethingSelected = true; + break; + } + } + } + + if(!somethingSelected) return; + } + + // set values + for (int y = startY; st.hasMoreTokens() && y < table.getSizeY(); y++) { + String checkToken = st.nextToken(Settings.NEW_LINE); + if (y==startY && checkToken.endsWith("\t")) { + checkToken = st.nextToken(Settings.NEW_LINE); + } + StringTokenizer currentLine = new StringTokenizer(checkToken, Table.ST_DELIMITER); + for (int x = startX; currentLine.hasMoreTokens() && x < table.getSizeX(); x++) { + String currentToken = currentLine.nextToken(); + + try { + if (!data[x][y].getText().equalsIgnoreCase(currentToken)) { + data[x][y].getDataCell().setRealValue(currentToken); + } + } catch (ArrayIndexOutOfBoundsException ex) { /* copied table is larger than current table*/ } + } + } + } + + @Override + public void highlightLiveData(String liveValue) { + if (getOverlayLog()) { + int x = xAxis.getLiveDataIndex(); + int y = yAxis.getLiveDataIndex(); + DataCellView cell = data[x][y]; + cell.setLiveDataTrace(true); + cell.getDataCell().setLiveDataTraceValue(liveValue); + getToolbar().setLiveDataValue(liveValue); + } + } + + @Override + public void updateLiveDataHighlight() { + if (getOverlayLog()) { + int x = xAxis.getLiveDataIndex(); + int y = yAxis.getLiveDataIndex(); + int xp = xAxis.getPreviousLiveDataIndex(); + int yp = yAxis.getPreviousLiveDataIndex(); + data[xp][yp].setPreviousLiveDataTrace(true); + data[x][y].setPreviousLiveDataTrace(false); + data[x][y].setLiveDataTrace(true); + } + } + + @Override + public void clearLiveDataTrace() { + xAxis.clearLiveDataTrace(); + yAxis.clearLiveDataTrace(); + for (int x = 0; x < table.getSizeX(); x++) { + for (int y = 0; y < table.getSizeY(); y++) { + data[x][y].setLiveDataTrace(false); + data[x][y].setPreviousLiveDataTrace(false); + } + } + } + + public DataCellView[][] get3dData() { + return data; + } + + @Override + public void setCompareDisplay(Settings.CompareDisplay compareDisplay) { + super.setCompareDisplay(compareDisplay); + xAxis.setCompareDisplay(compareDisplay); + yAxis.setCompareDisplay(compareDisplay); + } + + @Override + public void setOverlayLog(boolean overlayLog) { + super.setOverlayLog(overlayLog); + xAxis.setOverlayLog(overlayLog); + yAxis.setOverlayLog(overlayLog); + } + + @Override + public boolean equals(Object other) { + return table.equals(other); + } + + @Override + public void repaint() { + super.repaint(); + + if(null != xAxis) { + xAxis.repaint(); + } + + if(null != yAxis) { + yAxis.repaint(); + } + } +} diff --git a/src/main/java/com/romraider/maps/TableBitwiseSwitch.java b/src/main/java/com/romraider/maps/TableBitwiseSwitch.java new file mode 100644 index 000000000..485e14643 --- /dev/null +++ b/src/main/java/com/romraider/maps/TableBitwiseSwitch.java @@ -0,0 +1,76 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps; + +import java.util.LinkedList; +import com.romraider.util.ByteUtil; + +public class TableBitwiseSwitch extends TableSwitch { + private static final long serialVersionUID = -4887718305447362308L; + private LinkedList bits = new LinkedList(); + + public TableBitwiseSwitch() { + storageType = 1; + } + + @Override + public void populateTable(Rom rom) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { + if(isStaticDataTable()) return; + validateScaling(); + + // temporarily remove lock; + boolean tempLock = locked; + locked = false; + + if (!beforeRam) { + this.ramOffset = rom.getRomID().getRamOffset(); + } + + setDataSize(bits.size()); + int i = 0; + for (int bit : bits) { + data[i] = new DataCell(this, 0, rom); //Offset is always 0 + data[i].setBitMask(ByteUtil.bitToMask(bit)); + data[i].updateBinValueFromMemory(); + i++; + } + + // reset locked status + locked = tempLock; + calcCellRanges(); + + //Add Raw Scale + addScale(new Scale()); + } + + @Override + public void clearData() { + super.clearData(); + bits.clear(); + } + + @Override + public void setPresetValues(String name, String bitPos) { + if (bitPos != null && bitPos.length() > 0) { + bits.add(Integer.parseInt(bitPos)); + super.setPresetValues(name, "1", bits.size() - 1); + } + } +} diff --git a/src/main/java/com/romraider/maps/TableBitwiseSwitchView.java b/src/main/java/com/romraider/maps/TableBitwiseSwitchView.java new file mode 100644 index 000000000..80b3d3375 --- /dev/null +++ b/src/main/java/com/romraider/maps/TableBitwiseSwitchView.java @@ -0,0 +1,28 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps; + +public class TableBitwiseSwitchView extends TableSwitchView { + private static final long serialVersionUID = 7672148184533172213L; + + public TableBitwiseSwitchView(TableBitwiseSwitch t) { + super(t); + } +} diff --git a/src/main/java/com/romraider/maps/TableSwitch.java b/src/main/java/com/romraider/maps/TableSwitch.java index 52b9e0c36..e5166b9a4 100644 --- a/src/main/java/com/romraider/maps/TableSwitch.java +++ b/src/main/java/com/romraider/maps/TableSwitch.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,369 +20,64 @@ package com.romraider.maps; import static com.romraider.maps.RomChecksum.validateRomChecksum; -import static com.romraider.util.ByteUtil.indexOfBytes; -import static com.romraider.util.HexUtil.asBytes; -import static javax.swing.JOptionPane.ERROR_MESSAGE; import static javax.swing.JOptionPane.INFORMATION_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.showMessageDialog; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.Insets; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.text.MessageFormat; +import java.util.ResourceBundle; -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JTextArea; - -import com.romraider.Settings; - -public class TableSwitch extends Table { +import com.romraider.util.ResourceUtil; +public class TableSwitch extends Table1D { private static final long serialVersionUID = -4887718305447362308L; - private final ButtonGroup buttonGroup = new ButtonGroup(); - private final Map switchStates = new HashMap(); - private int dataSize = 0; - + private static final ResourceBundle rb = new ResourceUtil().getBundle( + TableSwitch.class.getName()); + public TableSwitch() { - super(); + super(); storageType = 1; - type = Settings.TABLE_SWITCH; - locked = true; - removeAll(); - setLayout(new BorderLayout()); - } - - @Override - public void setDataSize(int size) { - if (dataSize == 0) dataSize = size; - } - - @Override - public int getDataSize() { - return dataSize; - } - - @Override - public void populateTable(byte[] input, int romRamOffset) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { - JPanel radioPanel = new JPanel(new GridLayout(0, 1)); - radioPanel.add(new JLabel(" " + getName())); - for (String stateName : switchStates.keySet()) { - JRadioButton button = new JRadioButton(stateName); - buttonGroup.add(button); - radioPanel.add(button); - } - add(radioPanel, BorderLayout.CENTER); - - // Validate the ROM image checksums. - // if the result is >0: position of failed checksum - // if the result is 0: all the checksums matched - // if the result is -1: all the checksums have been previously disabled - if (super.getName().contains("Checksum Fix")) { - int result = validateRomChecksum(input, getStorageAddress(), dataSize); - String message = String.format( - "Checksum No. %d is invalid in table: %s%n" + - "The ROM image may be corrupt or it has been %n" + - "hex edited manually.%n" + - "The checksum can be corrected when the ROM is saved.", - result, super.getName()); - if (result > 0) { - showMessageDialog(this, - message, - "ERROR - Checksums Failed", - WARNING_MESSAGE); - setButtonsUnselected(buttonGroup); - } - else if (result == -1){ - message = "All Checksums are disabled."; - showMessageDialog(this, - message, - "Warning - Checksum Status", - INFORMATION_MESSAGE); - getButtonByText(buttonGroup, "on").setSelected(true); - } - else { - getButtonByText(buttonGroup, "off").setSelected(true); - locked = false; - } - return; - } - - // Validate XML switch definition data against the ROM data to select - // the appropriate switch setting or throw an error if there is a - // mismatch and disable this table's editing ability. - if (!beforeRam) { - this.ramOffset = romRamOffset; - } - Map sourceStatus = new HashMap(); - for (String stateName : switchStates.keySet()) { - byte[] sourceData = new byte[dataSize]; - System.arraycopy( - input, - storageAddress - ramOffset, - sourceData, - 0, - dataSize); - int compareResult = indexOfBytes(sourceData, getValues(stateName)); - if (compareResult == -1) { - getButtonByText(buttonGroup, stateName).setSelected(false); - } - else { - getButtonByText(buttonGroup, stateName).setSelected(true); - } - sourceStatus.put(stateName, compareResult); - } - - for (String source : sourceStatus.keySet()) { - if (sourceStatus.get(source) != -1) { - locked = false; - break; - } - } - - if (locked) { - String mismatch = String.format("Table: %s%nTable editing has been disabled.%nDefinition file or ROM image may be corrupt.", super.getName()); - showMessageDialog(this, - mismatch, - "ERROR - Data Mismatch", - ERROR_MESSAGE); - setButtonsUnselected(buttonGroup); - } - } - - @Override - public void setName(String name) { - super.setName(name); - } - - @Override - public int getType() { - return Settings.TABLE_SWITCH; - } - - @Override - public void setDescription(String description) { - super.setDescription(description); - JTextArea descriptionArea = new JTextArea(description); - descriptionArea.setOpaque(false); - descriptionArea.setEditable(false); - descriptionArea.setWrapStyleWord(true); - descriptionArea.setLineWrap(true); - descriptionArea.setMargin(new Insets(0,5,5,5)); - - add(descriptionArea, BorderLayout.SOUTH); - } - - @Override - public byte[] saveFile(byte[] input) { - if (!super.getName().contains("Checksum Fix")) { - if (!locked) { - JRadioButton selectedButton = getSelectedButton(buttonGroup); - System.arraycopy( - switchStates.get(selectedButton.getText()), - 0, - input, - getStorageAddress() - ramOffset, - dataSize); - } - } - return input; - } - - public void setValues(String name, String input) { - switchStates.put(name, asBytes(input)); - } - - public byte[] getValues(String key) { - return switchStates.get(key); - } - - @Override - public Dimension getFrameSize() { - int height = verticalOverhead + 75; - int width = horizontalOverhead; - if (height < minHeight) { - height = minHeight; - } - int minWidth = isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; - if (width < minWidth) { - width = minWidth; - } - return new Dimension(width, height); } - - public ButtonGroup getButtonGroup() { - return this.buttonGroup; - } - - public Map getSwitchStates() { - return this.switchStates; - } - - @Override - public void cursorUp() { - } - - @Override - public void cursorDown() { - } - - @Override - public void cursorLeft() { - } - - @Override - public void cursorRight() { - } - - @Override - public boolean isLiveDataSupported() { - return false; - } - - @Override - public boolean isButtonSelected() { - if (buttonGroup.getSelection() == null) { - return false; - } - else { - return true; - } - } - - @Override - public boolean equals(Object other) { - // TODO: Validate DTC equals. - try { - if(null == other) { - return false; - } - - if(other == this) { - return true; - } - - if(!(other instanceof TableSwitch)) { - return false; - } - - TableSwitch otherTable = (TableSwitch)other; - - if( (null == this.getName() && null == otherTable.getName()) - || (this.getName().isEmpty() && otherTable.getName().isEmpty()) ) { - ;// Skip name compare if name is null or empty. - } else if(!this.getName().equalsIgnoreCase(otherTable.getName())) { - return false; - } - - if(this.getDataSize() != otherTable.getDataSize()) { - return false; - } - - if(this.getSwitchStates() == otherTable.getSwitchStates()) { - return true; - } - - // Compare Map Keys - Set keys = new HashSet(this.getSwitchStates().keySet()); - Set otherKeys = new HashSet(otherTable.getSwitchStates().keySet()); - - if(keys.size() != otherKeys.size()) { - return false; - } - - if(!keys.containsAll(otherKeys)) { - return false; - } - - // Compare Map Values. - Set values = new HashSet(this.getSwitchStates().values()); - Set otherValues = new HashSet(otherTable.getSwitchStates().values()); - if(values.equals(otherValues)) { - return true; - } - - // Compare DTC. Is there a better way to compare the DTC? - for(String key : keys) { - JRadioButton button = getButtonByText(this.getButtonGroup(), key); - JRadioButton otherButton = getButtonByText(otherTable.getButtonGroup(), key); - - if(button.isSelected() != otherButton.isSelected()) { - return false; - } - } - - return true; - } catch(Exception ex) { - // TODO: Log Exception. - return false; - } - } - - @Override - public void populateCompareValues(Table compareTable) { - return; // Do nothing. - } - - @Override - public void calcCellRanges() { - return; // Do nothing. - } - - @Override - public void drawTable() - { - return; // Do nothing. - } - - @Override - public void updateTableLabel() { - return; // Do nothing. - } - - @Override - public void setCurrentScale(Scale curScale) { - return; // Do nothing. - } - - - // returns the selected radio button in the specified group - private static JRadioButton getSelectedButton(ButtonGroup group) { - for (Enumeration e = group.getElements(); e.hasMoreElements(); ) { - JRadioButton b = (JRadioButton)e.nextElement(); - if (b.getModel() == group.getSelection()) { - return b; - } - } - return null; - } - - // Unselects & disables all radio buttons in the specified group - private static void setButtonsUnselected(ButtonGroup group) { - for (Enumeration e = group.getElements(); e.hasMoreElements(); ) { - JRadioButton b = (JRadioButton)e.nextElement(); - b.setSelected(false); - b.setEnabled(false); - } - } - - // returns the radio button based on its display text - private static JRadioButton getButtonByText(ButtonGroup group, String text) { - for (Enumeration e = group.getElements(); e.hasMoreElements(); ) { - JRadioButton b = (JRadioButton)e.nextElement(); - if (b.getText().equalsIgnoreCase(text)) { - return b; - } - } - return null; + + @Override + public TableType getType() { + return Table.TableType.SWITCH; + } + + //TODO: Clean this up! + @Override + public void populateTable(Rom rom) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { + super.populateTable(rom); + + // Validate the ROM image checksums. + // if the result is >0: position of failed checksum + // if the result is 0: all the checksums matched + // if the result is -1: all the checksums have been previously disabled + if (super.getName().contains("Checksum Fix")) { + int result = validateRomChecksum(getDataCell(0).getBinary(), this); + + String message = MessageFormat.format( + rb.getString("CHKSUMINVALID"), result, super.getName()); + if (result > 0) { + showMessageDialog(null, + message, + rb.getString("CHKSUMSFAILED"), + WARNING_MESSAGE); + // setButtonsUnselected(buttonGroup); + } + else if (result == -1){ + message = rb.getString("ALLDISABLED"); + showMessageDialog(null, + message, + rb.getString("CHKSUMSTATUS"), + INFORMATION_MESSAGE); + //getButtonByText(buttonGroup, "on").setSelected(true); + } + else { + //getButtonByText(buttonGroup, "off").setSelected(true); + locked = false; + } + return; + } } } diff --git a/src/main/java/com/romraider/maps/TableSwitchView.java b/src/main/java/com/romraider/maps/TableSwitchView.java new file mode 100644 index 000000000..05610a9e7 --- /dev/null +++ b/src/main/java/com/romraider/maps/TableSwitchView.java @@ -0,0 +1,29 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps; + +public class TableSwitchView extends Table1DView { + private static final long serialVersionUID = 1L; + + //Same as a Table1DView just hidden data + public TableSwitchView(TableSwitch t) { + super(t, Table1DType.NO_AXIS, true); + } +} diff --git a/src/main/java/com/romraider/maps/TableView.java b/src/main/java/com/romraider/maps/TableView.java new file mode 100644 index 000000000..6d7c11a5c --- /dev/null +++ b/src/main/java/com/romraider/maps/TableView.java @@ -0,0 +1,966 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.Toolkit; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.io.IOException; +import java.io.Serializable; +import java.text.MessageFormat; +import java.util.ResourceBundle; +import java.util.StringTokenizer; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.InputMap; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.KeyStroke; +import org.apache.log4j.Logger; + +import com.romraider.Settings; +import com.romraider.editor.ecu.ECUEditorManager; +import com.romraider.swing.TableFrame; +import com.romraider.swing.TableToolBar; +import com.romraider.util.NumberUtil; +import com.romraider.util.ResourceUtil; +import com.romraider.util.SettingsManager; + +public abstract class TableView extends JPanel implements Serializable { + private static final long serialVersionUID = 6559256489995552645L; + protected static final Logger LOGGER = Logger.getLogger(TableView.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle(TableView.class.getName()); + + protected Table table; + protected TableView parent; + protected PresetPanel presetPanel; + protected DataCellView[] data; + + protected boolean hide; //Hide the actual data + protected BorderLayout borderLayout = new BorderLayout(); + protected GridLayout centerLayout = new GridLayout(1, 1, 0, 0); + protected JPanel centerPanel = new JPanel(centerLayout); + protected JLabel tableLabel; + protected int verticalOverhead = 103; + protected int horizontalOverhead = 2; + protected int cellHeight = (int) getSettings().getCellSize().getHeight(); + protected int cellWidth = (int) getSettings().getCellSize().getWidth(); + protected int minHeight = 100; + protected int minWidthNoOverlay = 465; + protected int minWidthOverlay = 700; + + protected int highlightBeginX; + protected int highlightBeginY; + + protected boolean highlight = false; + protected boolean overlayLog = false; + protected String liveAxisValue = Settings.BLANK; + protected int liveDataIndex = 0; + protected int previousLiveDataIndex = 0; + + protected Settings.CompareDisplay compareDisplay = Settings.CompareDisplay.ABSOLUTE; + + protected TableView(Table table) { + this.table = table; + + this.setLayout(borderLayout); + this.add(centerPanel, BorderLayout.CENTER); + centerPanel.setVisible(true); + + // key binding actions + Action rightAction = new AbstractAction() { + private static final long serialVersionUID = 1042884198300385041L; + + @Override + public void actionPerformed(ActionEvent e) { + cursorRight(); + } + }; + Action leftAction = new AbstractAction() { + private static final long serialVersionUID = -4970441255677214171L; + + @Override + public void actionPerformed(ActionEvent e) { + cursorLeft(); + } + }; + Action downAction = new AbstractAction() { + private static final long serialVersionUID = -7898502951121825984L; + + @Override + public void actionPerformed(ActionEvent e) { + cursorDown(); + } + }; + Action upAction = new AbstractAction() { + private static final long serialVersionUID = 6937621541727666631L; + + @Override + public void actionPerformed(ActionEvent e) { + cursorUp(); + } + }; + Action shiftRightAction = new AbstractAction() { + private static final long serialVersionUID = 1042888914300385041L; + + @Override + public void actionPerformed(ActionEvent e) { + shiftCursorRight(); + } + }; + Action shiftLeftAction = new AbstractAction() { + private static final long serialVersionUID = -4970441655277214171L; + + @Override + public void actionPerformed(ActionEvent e) { + shiftCursorLeft(); + } + }; + Action shiftDownAction = new AbstractAction() { + private static final long serialVersionUID = -7898502951812125984L; + + @Override + public void actionPerformed(ActionEvent e) { + shiftCursorDown(); + } + }; + Action shiftUpAction = new AbstractAction() { + private static final long serialVersionUID = 6937621527147666631L; + + @Override + public void actionPerformed(ActionEvent e) { + shiftCursorUp(); + } + }; + Action incCoarseAction = new AbstractAction() { + private static final long serialVersionUID = -8308522736529183148L; + + @Override + public void actionPerformed(ActionEvent e) { + try { + getToolbar().incrementCoarse(); + } catch (UserLevelException e1) { + showInvalidUserLevelPopup(e1); + } + } + }; + Action decCoarseAction = new AbstractAction() { + private static final long serialVersionUID = -7407628920997400915L; + + @Override + public void actionPerformed(ActionEvent e) { + try { + getToolbar().decrementCoarse(); + } catch (UserLevelException e1) { + showInvalidUserLevelPopup(e1); + } + } + }; + Action incFineAction = new AbstractAction() { + private static final long serialVersionUID = 7261463425941761433L; + + @Override + public void actionPerformed(ActionEvent e) { + try { + getToolbar().incrementFine(); + } catch (UserLevelException e1) { + showInvalidUserLevelPopup(e1); + } + } + }; + Action decFineAction = new AbstractAction() { + private static final long serialVersionUID = 8929400237520608035L; + + @Override + public void actionPerformed(ActionEvent e) { + try { + getToolbar().decrementFine(); + } catch (UserLevelException e1) { + showInvalidUserLevelPopup(e1); + } + } + }; + Action num0Action = new AbstractAction() { + private static final long serialVersionUID = -6310984176739090034L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('0'); + } + }; + Action num1Action = new AbstractAction() { + private static final long serialVersionUID = -6187220355403883499L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('1'); + } + }; + Action num2Action = new AbstractAction() { + private static final long serialVersionUID = -8745505977907325720L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('2'); + } + }; + Action num3Action = new AbstractAction() { + private static final long serialVersionUID = 4694872385823448942L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('3'); + } + }; + Action num4Action = new AbstractAction() { + private static final long serialVersionUID = 4005741329254221678L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('4'); + } + }; + Action num5Action = new AbstractAction() { + private static final long serialVersionUID = -5846094949106279884L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('5'); + } + }; + Action num6Action = new AbstractAction() { + private static final long serialVersionUID = -5338656374925334150L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('6'); + } + }; + Action num7Action = new AbstractAction() { + private static final long serialVersionUID = 1959983381590509303L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('7'); + } + }; + Action num8Action = new AbstractAction() { + private static final long serialVersionUID = 7442763278699460648L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('8'); + } + }; + Action num9Action = new AbstractAction() { + private static final long serialVersionUID = 7475171864584215094L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('9'); + } + }; + Action numPointAction = new AbstractAction() { + private static final long serialVersionUID = -4729135055857591830L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('.'); + } + }; + Action copyAction = new AbstractAction() { + private static final long serialVersionUID = -6978981449261938672L; + + @Override + public void actionPerformed(ActionEvent e) { + copySelection(); + } + }; + Action pasteAction = new AbstractAction() { + private static final long serialVersionUID = 2026817603236490899L; + + @Override + public void actionPerformed(ActionEvent e) { + try { + paste(); + } catch (UserLevelException e1) { + showInvalidUserLevelPopup(e1); + } + } + }; + + class InterpolateAction extends AbstractAction{ + private static final long serialVersionUID = -2357532575392447149L; + Table t; + + public InterpolateAction(Table t) { + this.t = t; + } + @Override + public void actionPerformed(ActionEvent e) { + try { + t.interpolate(); + } catch (UserLevelException e1) { + showInvalidUserLevelPopup(e1); + } + } + }; + + Action interpolate = new InterpolateAction(table); + + class VerticalInterpolateAction extends AbstractAction { + private static final long serialVersionUID = -2375322575392447149L; + Table t; + + public VerticalInterpolateAction(Table t) { + this.t = t; + } + @Override + public void actionPerformed(ActionEvent e) { + try { + t.verticalInterpolate(); + } catch (UserLevelException e1) { + showInvalidUserLevelPopup(e1); + } + } + }; + + Action verticalInterpolate = new VerticalInterpolateAction(table); + + class HorizontalInterpolateAction extends AbstractAction { + private static final long serialVersionUID = -6346750245035640773L; + Table t; + + public HorizontalInterpolateAction(Table t) { + this.t = t; + } + + @Override + public void actionPerformed(ActionEvent e) { + try { + t.horizontalInterpolate(); + } catch (UserLevelException e1) { + showInvalidUserLevelPopup(e1); + } + } + }; + + Action horizontalInterpolate = new HorizontalInterpolateAction(table); + + class MultiplyAction extends AbstractAction { + private static final long serialVersionUID = -2753212575392447149L; + @Override + public void actionPerformed(ActionEvent e) { + try { + getToolbar().multiply(); + } catch (UserLevelException e1) { + showInvalidUserLevelPopup(e1); + } + } + }; + + Action multiplyAction = new MultiplyAction(); + + Action numNegAction = new AbstractAction() { + private static final long serialVersionUID = -7532750245035640773L; + + @Override + public void actionPerformed(ActionEvent e) { + getToolbar().focusSetValue('-'); + } + }; + + // set input mapping + InputMap im = getInputMap(WHEN_IN_FOCUSED_WINDOW); + + KeyStroke right = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0); + KeyStroke left = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0); + KeyStroke up = KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0); + KeyStroke down = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0); + KeyStroke shiftRight = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.SHIFT_DOWN_MASK); + KeyStroke shiftLeft = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.SHIFT_DOWN_MASK); + KeyStroke shiftUp = KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.SHIFT_DOWN_MASK); + KeyStroke shiftDown = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.SHIFT_DOWN_MASK); + KeyStroke decrement = KeyStroke.getKeyStroke('-'); + KeyStroke increment = KeyStroke.getKeyStroke('+'); + KeyStroke decrement2 = KeyStroke.getKeyStroke("control DOWN"); + KeyStroke increment2 = KeyStroke.getKeyStroke("control UP"); + KeyStroke decrement3 = KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, KeyEvent.CTRL_DOWN_MASK); + KeyStroke increment3 = KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, KeyEvent.CTRL_DOWN_MASK); + KeyStroke decrement4 = KeyStroke.getKeyStroke("control shift DOWN"); + KeyStroke increment4 = KeyStroke.getKeyStroke("control shift UP"); + KeyStroke num0 = KeyStroke.getKeyStroke('0'); + KeyStroke num1 = KeyStroke.getKeyStroke('1'); + KeyStroke num2 = KeyStroke.getKeyStroke('2'); + KeyStroke num3 = KeyStroke.getKeyStroke('3'); + KeyStroke num4 = KeyStroke.getKeyStroke('4'); + KeyStroke num5 = KeyStroke.getKeyStroke('5'); + KeyStroke num6 = KeyStroke.getKeyStroke('6'); + KeyStroke num7 = KeyStroke.getKeyStroke('7'); + KeyStroke num8 = KeyStroke.getKeyStroke('8'); + KeyStroke num9 = KeyStroke.getKeyStroke('9'); + KeyStroke mulKey = KeyStroke.getKeyStroke('*'); + KeyStroke mulKeys = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.CTRL_DOWN_MASK); + KeyStroke numPoint = KeyStroke.getKeyStroke('.'); + KeyStroke copy = KeyStroke.getKeyStroke("control C"); + KeyStroke paste = KeyStroke.getKeyStroke("control V"); + KeyStroke interp = KeyStroke.getKeyStroke("shift I"); + KeyStroke vinterp = KeyStroke.getKeyStroke("shift V"); + KeyStroke hinterp = KeyStroke.getKeyStroke("shift H"); + KeyStroke numNeg = KeyStroke.getKeyStroke('-'); + + im.put(right, "right"); + im.put(left, "left"); + im.put(up, "up"); + im.put(down, "down"); + im.put(shiftRight, "shiftRight"); + im.put(shiftLeft, "shiftLeft"); + im.put(shiftUp, "shiftUp"); + im.put(shiftDown, "shiftDown"); + im.put(increment, "incCoarseAction"); + im.put(decrement, "decCoarseAction"); + im.put(increment2, "incCoarseAction"); + im.put(decrement2, "decCoarseAction"); + im.put(increment3, "incFineAction"); + im.put(decrement3, "decFineAction"); + im.put(increment4, "incFineAction"); + im.put(decrement4, "decFineAction"); + im.put(num0, "num0Action"); + im.put(num1, "num1Action"); + im.put(num2, "num2Action"); + im.put(num3, "num3Action"); + im.put(num4, "num4Action"); + im.put(num5, "num5Action"); + im.put(num6, "num6Action"); + im.put(num7, "num7Action"); + im.put(num8, "num8Action"); + im.put(num9, "num9Action"); + im.put(numPoint, "numPointAction"); + im.put(copy, "copyAction"); + im.put(paste, "pasteAction"); + im.put(interp, "interpolate"); + im.put(vinterp, "verticalInterpolate"); + im.put(hinterp, "horizontalInterpolate"); + im.put(mulKey, "mulAction"); + im.put(mulKeys, "mulAction"); + im.put(numNeg, "numNeg"); + + getActionMap().put(im.get(right), rightAction); + getActionMap().put(im.get(left), leftAction); + getActionMap().put(im.get(up), upAction); + getActionMap().put(im.get(down), downAction); + getActionMap().put(im.get(shiftRight), shiftRightAction); + getActionMap().put(im.get(shiftLeft), shiftLeftAction); + getActionMap().put(im.get(shiftUp), shiftUpAction); + getActionMap().put(im.get(shiftDown), shiftDownAction); + getActionMap().put(im.get(increment), incCoarseAction); + getActionMap().put(im.get(decrement), decCoarseAction); + getActionMap().put(im.get(increment2), incCoarseAction); + getActionMap().put(im.get(decrement2), decCoarseAction); + getActionMap().put(im.get(increment3), incFineAction); + getActionMap().put(im.get(decrement3), decFineAction); + getActionMap().put(im.get(increment4), incFineAction); + getActionMap().put(im.get(decrement4), decFineAction); + getActionMap().put(im.get(num0), num0Action); + getActionMap().put(im.get(num1), num1Action); + getActionMap().put(im.get(num2), num2Action); + getActionMap().put(im.get(num3), num3Action); + getActionMap().put(im.get(num4), num4Action); + getActionMap().put(im.get(num5), num5Action); + getActionMap().put(im.get(num6), num6Action); + getActionMap().put(im.get(num7), num7Action); + getActionMap().put(im.get(num8), num8Action); + getActionMap().put(im.get(num9), num9Action); + getActionMap().put(im.get(numPoint), numPointAction); + getActionMap().put(im.get(mulKey), multiplyAction); + getActionMap().put(im.get(mulKeys), multiplyAction); + getActionMap().put(im.get(copy), copyAction); + getActionMap().put(im.get(paste), pasteAction); + getActionMap().put(im.get(interp), interpolate); + getActionMap().put(im.get(vinterp), verticalInterpolate); + getActionMap().put(im.get(hinterp), horizontalInterpolate); + getActionMap().put(im.get(numNeg), numNegAction); + + this.setInputMap(WHEN_FOCUSED, im); + } + + public TableFrame getFrame() { + return table.getTableFrame(); + } + + public TableView getAxisParent() { + return parent; + } + + public void setAxisParent(TableView v) { + this.parent = v; + } + + public void setTable(Table t) { + this.table = t; + } + + public Table getTable() { + return this.table; + } + + public DataCellView[] getData() { + return data; + } + + public void setData(DataCellView[] data) { + this.data = data; + } + + public DataCellView getDataCell(int location) { + return data[location]; + } + + public boolean isHidden() { + return hide; + } + + public void setHidden(boolean b) { + this.hide = b; + + if(this.hide!=b) { + if(!b) { + data = null; + } + else { + populateTableVisual(); + } + } + } + + @Override + public String toString() { + return table.toString(); + } + + public void updatePresetPanel() { + if(presetPanel != null) + presetPanel.repaint(); + } + + public void drawTable() { + updateTableLabel(); + + if(data!=null && !isHidden()) { + for(DataCellView cell : data) { + if(null != cell) { + cell.drawCell(); + } + } + } + } + + protected void addPresetPanel(PresetManager m) { + presetPanel = new PresetPanel(this, m); + } + + public void populateTableVisual() { + //Populate Views from table here + if(getTable().presetManager != null) addPresetPanel(getTable().presetManager); + + if(!isHidden() && table.getData() != null) { + data = new DataCellView[table.getDataSize()]; + + for(int i= 0; i < table.getDataSize(); i++) { + DataCell c = table.getData()[i]; + if (c!=null) { + data[i] = new DataCellView(c, this); + } + } + } + } + + public Dimension getFrameSize() { + int height = verticalOverhead + cellHeight; + int width = horizontalOverhead + data.length * cellWidth; + if (height < minHeight) { + height = minHeight; + } + int minWidth = table.isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; + if (width < minWidth) { + width = minWidth; + } + return new Dimension(width, height); + } + + public void startHighlight(int x, int y) { + this.highlightBeginY = y; + this.highlightBeginX = x; + highlight = true; + highlight(x, y); + } + + public void highlight(int x, int y) { + if (highlight) { + for (int i = 0; i < data.length; i++) { + if ((i >= highlightBeginY && i <= y) || (i <= highlightBeginY && i >= y)) { + data[i].setHighlighted(true); + } else { + data[i].setHighlighted(false); + } + } + } + } + + public void stopHighlight() { + highlight = false; + // loop through, selected and un-highlight + for (DataCellView cell : data) { + if (cell.isHighlighted()) { + cell.setHighlighted(false); + cell.getDataCell().setSelected(true); + } + } + } + + public abstract void cursorUp(); + + public abstract void cursorDown(); + + public abstract void cursorLeft(); + + public abstract void cursorRight(); + + public abstract void shiftCursorUp(); + + public abstract void shiftCursorDown(); + + public abstract void shiftCursorLeft(); + + public abstract void shiftCursorRight(); + + public void undoSelected() throws UserLevelException { + for (DataCellView cell : data) { + // reset current value to original value + if (cell.isSelected()) { + cell.getDataCell().undo(); + } + } + } + + public static void showInvalidUserLevelPopup(UserLevelException e) { + JOptionPane.showMessageDialog(null, MessageFormat.format( + rb.getString("USERLVLTOLOW"), e.getLevel()), + rb.getString("TBLNOTMODIFY"), + JOptionPane.INFORMATION_MESSAGE); + } + + @Override + public void addKeyListener(KeyListener listener) { + super.addKeyListener(listener); + for (DataCellView cell : data) { + cell.addKeyListener(listener); + } + } + + public void copySelection() { + StringBuilder output = new StringBuilder("[Selection1D]" + Settings.NEW_LINE); + + boolean copy = false; + int[] coords = new int[2]; + coords[0] = table.getDataSize(); + + for (int i = 0; i < table.getDataSize(); i++) { + if (getData()[i].isSelected()) { + if (i < coords[0]) { + coords[0] = i; + copy = true; + } + if (i > coords[1]) { + coords[1] = i; + copy = true; + } + } + } + + //Make a string of the selection + for (int i = coords[0]; i <= coords[1]; i++) { + if (getData()[i].isSelected()) { + output.append(NumberUtil.stringValue(table.getData()[i].getRealValue())); + } else { + output.append("x"); // x represents non-selected cell + } + if (i < coords[1]) { + output.append("\t"); + } + } + + //Copy to clipboard + if (copy) { + setClipboard(output.toString()); + } + } + + //TODO: Clean this up + protected void setClipboard(String s) { + try { + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(s), null); + } catch(IllegalStateException e) { + + try { + Thread.sleep(20); + } catch (InterruptedException e1) {} + + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(s), null); + } + } + + public void copyTable() { + String tableHeader = table.getSettings().getTableHeader(); + StringBuffer output = new StringBuffer(tableHeader); + output.append(table.getTableAsString()); + + setClipboard(String.valueOf(output)); + } + + public String getCellAsString(int index) { + return data[index].getText(); + } + + public void pasteValues(String[] input) throws UserLevelException { + //set real values + for (int i = 0; i < input.length; i++) { + try { + Double.parseDouble(input[i]); + data[i].getDataCell().setRealValue(input[i]); + } catch (NumberFormatException ex) { /* not a number, do nothing */ } + } + } + + public void paste() throws UserLevelException { + String input; + + try { + input = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null).getTransferData(DataFlavor.stringFlavor); + } catch (UnsupportedFlavorException ex) { + return; + } catch (IOException ex) { + return; + } + + paste(input); + } + + public void paste(String s) throws UserLevelException { + StringTokenizer st = new StringTokenizer(s, Table.ST_DELIMITER); + + if (!table.isStaticDataTable()) { + String pasteType = st.nextToken(); + boolean selectedOnly = false; + if ("[Selection1D]".equalsIgnoreCase(pasteType)) selectedOnly = true; + + if ("[Table1D]".equalsIgnoreCase(pasteType) || "[Selection1D]".equalsIgnoreCase(pasteType)) { + + //Find the leftmost selected cell as start + int startSelection = 0; + for(int i=0; i < data.length;i++) { + if(data[i].isSelected()) { + startSelection=i; + break; + } + } + + if ((selectedOnly && data[startSelection].isSelected()) || !selectedOnly) { + int i = 0; + while (st.hasMoreTokens()) { + String currentToken = st.nextToken(); + try { + if (!data[startSelection + i].getText().equalsIgnoreCase(currentToken)) { + data[startSelection + i].getDataCell().setRealValue(currentToken); + } + } catch (ArrayIndexOutOfBoundsException ex) { + break; + } + i++; + } + } + } + } + } + + public void setCompareDisplay(Settings.CompareDisplay compareDisplay) { + this.compareDisplay = compareDisplay; + drawTable(); + } + + public Settings.CompareDisplay getCompareDisplay() { + return this.compareDisplay; + } + + public static Settings getSettings() + { + return SettingsManager.getSettings(); + } + + public TableToolBar getToolbar() + { + return ECUEditorManager.getECUEditor().getTableToolBar(); + } + + public void setOverlayLog(boolean overlayLog) { + this.overlayLog = overlayLog; + + if(!overlayLog) + { + clearLiveDataTrace(); + } + } + + public boolean getOverlayLog() + { + return this.overlayLog; + } + + public int getLiveDataIndex() { + return liveDataIndex; + } + + public int getPreviousLiveDataIndex() { + return previousLiveDataIndex; + } + + public void setLiveDataIndex(int index) { + if (index < 0) { + index = 0; + } + if (index >= data.length) { + index = data.length - 1; + } + this.previousLiveDataIndex = this.liveDataIndex; + this.liveDataIndex = index; + } + + public double getLiveAxisValue() { + try { + return Double.parseDouble(liveAxisValue); + } catch (NumberFormatException e) { + return 0.0; + } + } + + + public void highlightLiveData(String liveVal) { + if (getOverlayLog()) { + double liveValue = 0.0; + try { + liveValue = NumberUtil.doubleValue(liveVal); + } catch (Exception ex) { + LOGGER.error("Table - live data highlight parsing error for value: " + liveVal); + return; + } + + int startIdx = data.length; + for (int i = 0; i < data.length; i++) { + double currentValue = data[i].getDataCell().getRealValue(); + if (liveValue == currentValue) { + startIdx = i; + break; + } else if (liveValue < currentValue){ + startIdx = i-1; + break; + } + } + + setLiveDataIndex(startIdx); + DataCellView cell = data[getLiveDataIndex()]; + cell.setPreviousLiveDataTrace(false); + cell.setLiveDataTrace(true); + cell.getDataCell().setLiveDataTraceValue(liveVal); + getToolbar().setLiveDataValue(liveVal); + } + } + + public void updateLiveDataHighlight() { + if (getOverlayLog()) { + data[getPreviousLiveDataIndex()].setPreviousLiveDataTrace(true); + data[getLiveDataIndex()].setPreviousLiveDataTrace(false); + data[getLiveDataIndex()].setLiveDataTrace(true); + } + } + + public void clearLiveDataTrace() { + for (DataCellView cell : data) { + cell.setLiveDataTrace(false); + cell.setPreviousLiveDataTrace(false); + } + } + + + public void updateTableLabel() { + if(tableLabel != null) { + if(null == table.name || table.name.isEmpty()) { + ;// Do not update label. + } else if(null == table.getCurrentScale () || "0x" == table.getCurrentScale().getUnit()) { + // static or no scale exists. + tableLabel.setText(getName()); + } else { + tableLabel.setText(getName() + " (" + table.getCurrentScale().getUnit() + ")"); + } + } + } + + public String getName() { + return table.getName(); + } + + public static void showBadScalePopup(Table table, Scale scale) { + JPanel panel = new JPanel(); + panel.setLayout(new GridLayout(4, 1)); + panel.add(new JLabel(MessageFormat.format( + rb.getString("REALBYTEINVALID"), table.toString()))); + panel.add(new JLabel(MessageFormat.format( + rb.getString("REALVALUE"), scale.getExpression()))); + panel.add(new JLabel(MessageFormat.format( + rb.getString("BYTEVALUE"), scale.getByteExpression()))); + + JCheckBox check = new JCheckBox(rb.getString("DISPLAYMSG"), true); + check.setHorizontalAlignment(JCheckBox.RIGHT); + panel.add(check); + + + check.addActionListener( + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + getSettings().setCalcConflictWarning(((JCheckBox) e.getSource()).isSelected()); + } + } + ); + + JOptionPane.showMessageDialog(null, panel, + rb.getString("WARNING"), JOptionPane.ERROR_MESSAGE); + } +} diff --git a/src/main/java/com/romraider/maps/UserLevelException.java b/src/main/java/com/romraider/maps/UserLevelException.java new file mode 100644 index 000000000..a4ada4a50 --- /dev/null +++ b/src/main/java/com/romraider/maps/UserLevelException.java @@ -0,0 +1,14 @@ +package com.romraider.maps; + +public class UserLevelException extends Exception { + private static final long serialVersionUID = 1L; + private int level = -1; + + public UserLevelException(int level) { + this.level = level; + } + + public int getLevel() { + return level; + } +} diff --git a/src/main/java/com/romraider/maps/checksum/CalculateALT2.java b/src/main/java/com/romraider/maps/checksum/CalculateALT2.java new file mode 100644 index 000000000..32f4a48a2 --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/CalculateALT2.java @@ -0,0 +1,87 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import static com.romraider.maps.checksum.ChecksumALT2.SKIPLOC; +import static com.romraider.maps.checksum.NissanChecksum.END; +import static com.romraider.maps.checksum.NissanChecksum.START; +import static com.romraider.maps.checksum.NissanChecksum.SUMLOC; +import static com.romraider.maps.checksum.NissanChecksum.SUMT; +import static com.romraider.maps.checksum.NissanChecksum.XORLOC; +import static com.romraider.maps.checksum.NissanChecksum.XORT; +import static com.romraider.xml.RomAttributeParser.parseByteValue; + +import java.util.Map; + +import com.romraider.Settings; + +public final class CalculateALT2 implements Calculator { + + public CalculateALT2() { + } + + public final void calculate( + Map range, + byte[] binData, + Map results) { + + // 32bit checksum calculation + int sumt = 0; + int xort = 0; + int dw = 0; + for (int i = range.get(START) + 4; i < range.get(END); i += 4) { + if ((i == range.get(SUMLOC)) + || (i == range.get(XORLOC) + || (i == range.get(SKIPLOC)))) continue; + dw = (int)parseByteValue(binData, Settings.Endian.BIG, i, 4, true); + sumt += dw; + xort ^= dw; + } + results.put(SUMT, sumt); + results.put(XORT, xort); + + // 16bit calibration checksum calculation + short sum = 0; + for (int i = range.get(START) + 2; i < range.get(SKIPLOC); i += 2) { + if (i == range.get(SUMLOC)) { // include 32bit sumt + dw = results.get(SUMT); + sum += (short)((dw >> 16) & 0xffff); + sum += (short)(dw & 0xffff); + i += 2; // advance 2 bytes as sumt is 32bits + continue; + } + if (i == range.get(XORLOC)) { // include 32bit xort + dw = results.get(XORT); + sum += (short)((dw >> 16) & 0xffff); + sum += (short)(dw & 0xffff); + i += 2; // advance 2 bytes as xort is 32bits + continue; + } + sum += (short)parseByteValue(binData, Settings.Endian.BIG, i, 2, false); + } + results.put(START, (int)sum); + // 16bit code checksum calculation + sum = 0; + for (int i = range.get(SKIPLOC) + 2; i < range.get(END); i += 2) { + sum += (short)parseByteValue(binData, Settings.Endian.BIG, i, 2, false); + } + results.put(SKIPLOC, (int)sum); + } +} diff --git a/src/main/java/com/romraider/maps/checksum/CalculateSTD.java b/src/main/java/com/romraider/maps/checksum/CalculateSTD.java new file mode 100644 index 000000000..95f5db3a5 --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/CalculateSTD.java @@ -0,0 +1,56 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import static com.romraider.maps.checksum.NissanChecksum.END; +import static com.romraider.maps.checksum.NissanChecksum.START; +import static com.romraider.maps.checksum.NissanChecksum.SUMLOC; +import static com.romraider.maps.checksum.NissanChecksum.SUMT; +import static com.romraider.maps.checksum.NissanChecksum.XORLOC; +import static com.romraider.maps.checksum.NissanChecksum.XORT; +import static com.romraider.xml.RomAttributeParser.parseByteValue; + +import java.util.Map; + +import com.romraider.Settings; + +public final class CalculateSTD implements Calculator { + + public CalculateSTD() { + } + + public final void calculate( + Map range, + byte[] binData, + Map results) { + + int sumt = 0; + int xort = 0; + int dw = 0; + for (int i = range.get(START); i < range.get(END); i += 4) { + if ((i == range.get(SUMLOC)) || (i == range.get(XORLOC))) continue; + dw = (int)parseByteValue(binData, Settings.Endian.BIG, i, 4, true); + sumt += dw; + xort ^= dw; + } + results.put(SUMT, sumt); + results.put(XORT, xort); + } +} diff --git a/src/main/java/com/romraider/maps/checksum/Calculator.java b/src/main/java/com/romraider/maps/checksum/Calculator.java new file mode 100644 index 000000000..62fd763ed --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/Calculator.java @@ -0,0 +1,38 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import java.util.Map; + +/** + * The Calculator interface is implemented by CalculateXXX classes + * which perform the actual checksum calculation. + */ +public interface Calculator { + + /** + * Calculate the sum and xor total over the address range provided. + * @param range - a map of with the address ranges use. + * @param binData - the binary data t calculate over. + * @param results - a map containing the keys for sumt and xort + */ + void calculate( + Map range, byte[] binData, Map results); +} diff --git a/src/main/java/com/romraider/maps/checksum/ChecksumALT.java b/src/main/java/com/romraider/maps/checksum/ChecksumALT.java new file mode 100644 index 000000000..370825698 --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/ChecksumALT.java @@ -0,0 +1,31 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +/** + * This class implements the "alt" checksum validation and calculations + * for Nissan ROMs. + */ + public final class ChecksumALT extends NissanChecksum { + + public ChecksumALT() { + calculator = new CalculateSTD(); + } +} diff --git a/src/main/java/com/romraider/maps/checksum/ChecksumALT2.java b/src/main/java/com/romraider/maps/checksum/ChecksumALT2.java new file mode 100644 index 000000000..c602de95b --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/ChecksumALT2.java @@ -0,0 +1,89 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import static com.romraider.xml.RomAttributeParser.parseByteValue; +import static com.romraider.xml.RomAttributeParser.parseIntegerValue; + +import java.util.Map; + +import com.romraider.Settings; +import com.romraider.util.HexUtil; + +/** + * This class implements the "alt2" checksum validation and calculations + * for Nissan ROMs. + */ +public final class ChecksumALT2 extends NissanChecksum { + protected static final String SKIPLOC = "skiploc"; + + public ChecksumALT2() { + calculator = new CalculateALT2(); + } + + @Override + public void configure(Map vars) { + super.configure(vars); + if (vars.containsKey(SKIPLOC)) { + range.put(SKIPLOC, HexUtil.hexToInt(vars.get(SKIPLOC))); + } + else { + range.put(SKIPLOC, 0x20000); + } + } + + @Override + public int getNumberOfChecksums() { + return 4; + } + + @Override + public int validate(byte[] binData) { + calculator.calculate(range, binData, results); + int valid = 0; + + if(results.get(SUMT) == (int)parseByteValue(binData, Settings.Endian.BIG, range.get(SUMLOC), 4, true)) { + valid++; + } + + if(results.get(XORT) == (int)parseByteValue(binData, Settings.Endian.BIG, range.get(XORLOC), 4, true)) { + valid++; + } + + if(results.get(START) == (short)parseByteValue(binData, Settings.Endian.BIG, range.get(START), 2, false)) { + valid++; + } + + if(results.get(SKIPLOC) == (short)parseByteValue(binData, Settings.Endian.BIG, range.get(SKIPLOC), 2, false)) { + valid++; + } + + return valid; + } + + @Override + public int update(byte[] binData) { + // SUMT & XORT are updated in super before START and SKIPLOC + super.update(binData); + System.arraycopy(parseIntegerValue(results.get(START), Settings.Endian.BIG, 2), 0, binData, range.get(START), 2); + System.arraycopy(parseIntegerValue(results.get(SKIPLOC), Settings.Endian.BIG, 2), 0, binData, range.get(SKIPLOC), 2); + return getNumberOfChecksums(); + } +} diff --git a/src/main/java/com/romraider/maps/checksum/ChecksumBYTEXOR.java b/src/main/java/com/romraider/maps/checksum/ChecksumBYTEXOR.java new file mode 100644 index 000000000..65690ecce --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/ChecksumBYTEXOR.java @@ -0,0 +1,86 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import static com.romraider.xml.RomAttributeParser.parseByteValue; + +import java.util.Map; + +import com.romraider.Settings; +import com.romraider.util.HexUtil; + +/** + * This class implements the XOR single byte checksum validation and calculations + * for some BMW non-engine ECU ROMs. + */ + public final class ChecksumBYTEXOR implements ChecksumManager { + private static final String START = "start"; + private static final String END = "end"; + private static final String XORLOC = "xorloc"; + private int start; + private int end; + private int xorloc; + private byte xort; + + @Override + public void configure(Map vars) { + this.start = HexUtil.hexToInt(vars.get(START)); + this.end = HexUtil.hexToInt(vars.get(END)); + this.xorloc = HexUtil.hexToInt(vars.get(XORLOC)); + } + + @Override + public int getNumberOfChecksums() { + return 1; + } + + @Override + public int validate(byte[] binData) { + calculate(binData); + int valid = 0; + + if(xort == (byte)parseByteValue(binData, Settings.Endian.BIG, xorloc, 1, false)) + valid++; + + return valid; + } + + @Override + public int update(byte[] binData) { + int updateNeeded = 0; + calculate(binData); + + if(binData[xorloc] != xort) updateNeeded++; + + binData[xorloc] = xort; + + return updateNeeded; + } + + private void calculate(byte[] binData) { + xort = 0; + int dw = 0; + for (int i = start; i < end; i += 1) { + if ((i == xorloc)) continue; + dw = (byte)parseByteValue(binData, Settings.Endian.BIG, i, 1, false); + xort ^= dw; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/maps/checksum/ChecksumCOPY.java b/src/main/java/com/romraider/maps/checksum/ChecksumCOPY.java new file mode 100644 index 000000000..325a2241d --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/ChecksumCOPY.java @@ -0,0 +1,71 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import java.util.Map; +import com.romraider.util.HexUtil; + +/** + * This class implements a copy "checksum", which can be useful for old Motronic + * ECUs. It simply checks if an array of data is identical to a specified + * location and copies it over if necessary + */ +public final class ChecksumCOPY implements ChecksumManager { + private static final String START = "start"; + private static final String END = "end"; + private static final String LOC = "loc"; + private int start; // Start of checksum area + private int end; // End of area (inclusive) + private int loc; // Start of location where data is copied + + @Override + public void configure(Map vars) { + if (start >= end) { + this.start = HexUtil.hexToInt(vars.get(START)); + this.end = HexUtil.hexToInt(vars.get(END)); + this.loc = HexUtil.hexToInt(vars.get(LOC)); + } + } + + @Override + public int getNumberOfChecksums() { + return 1; + } + + @Override + public int validate(byte[] binData) { + for (int i = 0; i <= end - start; i++) { + if (binData[start + i] != binData[loc + i]) { + return 0; + } + } + return 1; + } + + @Override + public int update(byte[] binData) { + int updateNeeded = 1 - validate(binData); + + if (updateNeeded > 0) { + System.arraycopy(binData, start, binData, loc, end - start + 1); + } + return updateNeeded; + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/maps/checksum/ChecksumE38PCM.java b/src/main/java/com/romraider/maps/checksum/ChecksumE38PCM.java new file mode 100644 index 000000000..46683a2ba --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/ChecksumE38PCM.java @@ -0,0 +1,229 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import java.util.Map; + +import com.romraider.Settings.Endian; +import com.romraider.xml.RomAttributeParser; + +/** + * This class implements the E38 (GM) PCM checksum algorithm Implementation + * ported from: https://github.com/antuspcm/E38-Sum-Tool + */ +public final class ChecksumE38PCM implements ChecksumManager { + segment[] seg = new segment[7]; + + class segment { + public int start; + public int end; + public short lsum; + public short lcvn; + public short csum; + public short ccvn; + boolean calculated; + } + + @Override + public void configure(Map vars) { + } + + @Override + public int getNumberOfChecksums() { + return 12; + } + + @Override + public int validate(byte[] binData) { + calculate(binData); + + int correctChecksums = 0; + for (int i = 1; i <= 6; i++) { + if (seg[i].calculated) { + if (seg[i].ccvn == seg[i].lcvn) { + correctChecksums++; + } + if (seg[i].lsum == seg[i].csum) { + correctChecksums++; + } + } + } + return correctChecksums; + } + + @Override + public int update(byte[] binData) { + int correctedChecksums = 0; + + // Seems like some checksums depend on each other? + // Need to do it twice + for (int k = 0; k < 2; k++) { + calculate(binData); + + for (int i = 1; i <= 6; i++) { + if (seg[i].ccvn != seg[i].lcvn) { + correctedChecksums++; + + binData[seg[i].start + 0x1E] = (byte) ((seg[i].ccvn >>> 8) & 0xFF); + binData[seg[i].start + 0x1E + 1] = (byte) ((seg[i].ccvn) & 0xFF); + + } + if (seg[i].lsum != seg[i].csum) { + correctedChecksums++; + + binData[seg[i].start] = (byte) ((seg[i].csum >>> 8) & 0xFF); + binData[seg[i].start + 1] = (byte) ((seg[i].csum) & 0xFF); + } + } + } + return correctedChecksums; + } + + private void calculate(byte[] bin) { + // load index + int index = 0x10000; + for (int i = 1; i <= 6; i++) { + seg[i] = new segment(); + } + + seg[1].start = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0x24, 4, false); + seg[1].end = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0x28, 4, false); + seg[2].start = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0x48, 4, false); + seg[2].end = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0x4c, 4, false); + seg[3].start = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0x6b, 4, false); + seg[3].end = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0x6f, 4, false); + seg[4].start = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0x8e, 4, false); + seg[4].end = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0x92, 4, false); + seg[5].start = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0xb1, 4, false); + seg[5].end = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0xb5, 4, false); + seg[6].start = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0xd4, 4, false); + seg[6].end = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, index + 0xd8, 4, false); + + for (int a = 1; a <= 6; a++) { + if (seg[a].start > 0x200000) { + // log.AppendText("Segment " + a + " start is out of range" + + return; + } + + if (seg[a].end > 0x200000) { + // log.AppendText("Segment " + a + " end is out of range" + + return; + } + + if (seg[a].start % 2 != 0) { + // log.AppendText("Segment " + a + " does not start on a word boundry" + + return; + } + if (seg[a].end % 2 == 0) { + // log.AppendText("Segment " + a + " does not end on a word boundry" + + return; + } + if (seg[a].end - seg[a].start < 0x24) { + // log.AppendText("Segment " + a + " is impossibly short" + + return; + } + } + + // load data, log + for (int i = 1; i <= 6; i++) { + seg[i].lsum = (short) RomAttributeParser.parseByteValue(bin, Endian.BIG, seg[i].start, 2, false); + seg[i].lcvn = (short) RomAttributeParser.parseByteValue(bin, Endian.BIG, seg[i].start + 0x1E, 2, false); + seg[i].csum = segmentsum(bin, seg[i].start, seg[i].end); + seg[i].ccvn = segmentcvn(bin, seg[i].start, seg[i].end); + seg[i].calculated = true; + } + } + + private int gmcrc16(byte[] bin, long init, int s, int e) { + int num; + byte num2; + byte num3; + byte num4; + int num5; + int num6; + + int[] crc16t = new int[] { 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, 0xC601, 0x06C0, + 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, + 0x0E40, 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, 0xD801, 0x18C0, 0x1980, 0xD941, + 0x1B00, 0xDBC1, 0xDA81, 0x1A40, 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, 0x1400, + 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, + 0xD081, 0x1040, 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, 0x3600, 0xF6C1, 0xF781, + 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, + 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, + 0x2BC0, 0x2A80, 0xEA41, 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, 0xE401, 0x24C0, + 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, + 0xE041, 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, 0x6600, 0xA6C1, 0xA781, 0x6740, + 0xA501, 0x65C0, 0x6480, 0xA441, 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, 0xAA01, + 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, + 0x7A80, 0xBA41, 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, 0xB401, 0x74C0, 0x7580, + 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, + 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, + 0x95C1, 0x9481, 0x5440, 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, 0x5A00, 0x9AC1, + 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, + 0x4A40, 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, 0x4400, 0x84C1, 0x8581, 0x4540, + 0x8701, 0x47C0, 0x4680, 0x8641, 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 }; + + num = s; // location counter + while ((int) num <= (int) e) // until final address (inclusive) + { + num2 = bin[num]; // num2=current byte + num3 = (byte) (init & 0xff); // num3=sum low byte + num4 = (byte) ((init & 0xff00) / 0x100); // num4=sum high byte + int temp1 = (short) (((num3 & 0xFF)) ^ (num2 & 0xFF)); + num5 = crc16t[temp1]; // sum low byte xord with data used as index to another xor table + int temp2 = (int) (num5 ^ (num4 & 0xFF)); + init = temp2 & 0xffff; // xor table byte xord with sum high byte + num++; // next byte + } + num6 = (int) init & 0xFFFFFFFF; // return the sum + return num6; + } + + public int swapab(int p0) { + int num; + int num2; + int num3; + try { + num = (p0 & 0xff00) / 0x100; + num2 = p0 & 0xff; + num3 = (num2 * 0x100) + num; + return num3; + } catch (Exception ex) { + } + return 0; + } + + public short segmentsum(byte[] bin, int s, int e) { + int sum = 0; + for (int i = s + 2; i <= e; i += 2) { + int combined = (int) RomAttributeParser.parseByteValue(bin, Endian.BIG, i, 2, false); + sum += combined; + } + sum = (((sum & 0xFFFF) ^ 0xFFFF) + 1) & 0xFFFF; + return (short) sum; + } + + public short segmentcvn(byte[] bin, int s, int e) { + int sum = gmcrc16(bin, 0, s + 2, s + 0x1d); + sum = gmcrc16(bin, sum, s + 0x20, e); + sum = swapab(sum); + return (short) sum; + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/maps/checksum/ChecksumFactory.java b/src/main/java/com/romraider/maps/checksum/ChecksumFactory.java new file mode 100644 index 000000000..52a7e8910 --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/ChecksumFactory.java @@ -0,0 +1,106 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; + +import java.io.File; +import java.net.URL; +import java.net.URLClassLoader; +import java.text.MessageFormat; +import java.util.Map; +import java.util.ResourceBundle; + +import org.apache.log4j.Logger; + +import com.romraider.maps.Rom; +import com.romraider.util.ResourceUtil; + +/** + * Instantiate a ChecksumManager class. + */ +public final class ChecksumFactory { + private static final Logger LOGGER = Logger.getLogger(ChecksumFactory.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + ChecksumFactory.class.getName()); + private static final String PATH = "path"; + private static final String TYPE = "type"; + private static final String MISSING = rb.getString("MISSING"); + private static final String NO_CLASS = rb.getString("NOCLASS"); + private ChecksumFactory() { + } + + /** + * Instantiate the specific ChecksumManager class based on + * the "type" requested. + * @param attrs - the configuration for the checksum manager, must + * contain a "type" K,V pair + * @return a configured instance of the requested ChecksumManager + * @throws ClassNotFoundException if the class based on "type" + * does not exist + */ + public static ChecksumManager getManager(Rom rom, + Map attrs) { + + ChecksumManager cm = null; + Class cls; + ClassLoader cl; + + final String type = attrs.get(TYPE); + final String pathCustomChecksum = attrs.get(PATH); + + try { + String path; + + //Custom checksum which comes with the definition + //Path is relative to the current definition directory + if(pathCustomChecksum != null && rom.getDefinitionPath() != null) { + path = rom.getDefinitionPath().getParent() + pathCustomChecksum; + cl = new URLClassLoader(new URL[]{new File(path).toURI().toURL()}); + cls = cl.loadClass(ChecksumFactory.class.getPackage().getName() + "." + type); + + LOGGER.info("Loaded custom checksum type " + type + " from " + path); + } + //Checksum included in RR + else { + path = ChecksumFactory.class.getPackage().getName() + ".Checksum" + type.toUpperCase(); + cls = Class.forName(path); + } + + cm = (ChecksumManager) cls.newInstance(); + cm.configure(attrs); + } catch (Exception e) { + String message = null; + if (type == null) { + message = MISSING; + } + else { + message = MessageFormat.format(NO_CLASS, type.toUpperCase()); + } + + e.printStackTrace(); + showMessageDialog(null, + message, + e.toString(), ERROR_MESSAGE); + } + return cm; + } +} diff --git a/src/main/java/com/romraider/maps/checksum/ChecksumMOTRONICDOUBLE.java b/src/main/java/com/romraider/maps/checksum/ChecksumMOTRONICDOUBLE.java new file mode 100644 index 000000000..56de2f07e --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/ChecksumMOTRONICDOUBLE.java @@ -0,0 +1,82 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import static com.romraider.xml.RomAttributeParser.parseByteValue; + +import java.util.Map; + +import com.romraider.Settings; +import com.romraider.util.HexUtil; + +/** + * This class implements the Double Checksum for some older Motronic Ecus + */ + public final class ChecksumMOTRONICDOUBLE extends ChecksumMOTRONICSINGLE { + private static final String START2 = "startsecond"; + private static final String END2 = "endsecond"; + + private int start2; + private int end2; + + @Override + public void configure(Map vars) { + super.configure(vars); + this.start2 = HexUtil.hexToInt(vars.get(START2)); + this.end2 = HexUtil.hexToInt(vars.get(END2)); + } + + @Override + public int getNumberOfChecksums() { + return 1; + } + + @Override + public int validate(byte[] binData) { + short checksum = calculate(initial, binData, start, end); + checksum = calculate(checksum, binData, start2, end2); + short checksumInBin = (short)parseByteValue(binData, Settings.Endian.BIG, loc, 2, false); + int valid = 0; + + if(checksum == checksumInBin) + valid++; + + return valid; + } + + @Override + public int update(byte[] binData) { + int updateNeeded = 0; + short checksumInBin = (short)parseByteValue(binData, Settings.Endian.BIG, loc, 2, false); + + short checksum = calculate(initial, binData, start, end); + checksum = calculate(checksum, binData, start2, end2); + + if(checksumInBin != checksum) + { + updateNeeded++; + + binData[loc] = (byte)((checksum >> 8) & 0xFF); + binData[loc+1] = (byte)((checksum) & 0xFF); + } + + return updateNeeded; + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/maps/checksum/ChecksumMOTRONICSINGLE.java b/src/main/java/com/romraider/maps/checksum/ChecksumMOTRONICSINGLE.java new file mode 100644 index 000000000..192dc74c5 --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/ChecksumMOTRONICSINGLE.java @@ -0,0 +1,94 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import static com.romraider.xml.RomAttributeParser.parseByteValue; + +import java.util.Map; + +import com.romraider.Settings; +import com.romraider.util.HexUtil; + +/** + * This class implements the Single Checksum for some older Motronic Ecus + */ + public class ChecksumMOTRONICSINGLE implements ChecksumManager { + protected static final String START = "start"; + protected static final String END = "end"; + protected static final String LOC = "loc"; + protected static final String INITIAL = "initial"; + + protected int start; + protected int end; + protected int loc; + protected short initial = 0; + + @Override + public void configure(Map vars) { + this.start = HexUtil.hexToInt(vars.get(START)); + this.end = HexUtil.hexToInt(vars.get(END)); + this.loc = HexUtil.hexToInt(vars.get(LOC)); + + if(vars.get(INITIAL) != null) + this.initial = (short) HexUtil.hexToInt(vars.get(INITIAL)); + } + + @Override + public int getNumberOfChecksums() { + return 1; + } + + @Override + public int validate(byte[] binData) { + short checksum = calculate(initial, binData, start, end); + short checksumInBin = (short) parseByteValue(binData, Settings.Endian.BIG, loc, 2, false); + int valid = 0; + + if(checksum == checksumInBin) + valid++; + + return valid; + } + + @Override + public int update(byte[] binData) { + int updateNeeded = 0; + short checksum = calculate(initial, binData, start, end); + short checksumInBin = (short)parseByteValue(binData, Settings.Endian.BIG, loc, 2, false); + + if(checksumInBin != checksum) { + updateNeeded++; + + binData[loc] = (byte)((checksum >> 8) & 0xFF); + binData[loc+1] = (byte)((checksum) & 0xFF); + } + + return updateNeeded; + } + + public static short calculate(short initalValue, byte[] binData, int startAddress, int endAddress) { + short value = initalValue; + for (int i = startAddress; i <= endAddress; i++) { + value += parseByteValue(binData, Settings.Endian.BIG, i, 1, false); + } + + return value; + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/maps/checksum/ChecksumManager.java b/src/main/java/com/romraider/maps/checksum/ChecksumManager.java new file mode 100644 index 000000000..b6740cb52 --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/ChecksumManager.java @@ -0,0 +1,58 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2017 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import java.util.Map; + +/** + * The Checksum Manager interface is implemented by Checksum classes + * which perform validation and calculation of ROM checksums upon open + * and save. + */ +public interface ChecksumManager { + + /** + * Once the ChecksumManager is created configure it with the + * information needed to perform checksums. + * @param vars - a map of variables specific to the type of + * checksums being performed + */ + void configure(Map vars); + + /** + * Returns the amount of checksums + * @return Number of total checksums + */ + int getNumberOfChecksums(); + + /** + * Perform the checksum validation upon ROM file loading. + * @param binData - the ROM file to validate + * @return Number of correct checksums + */ + int validate(byte[] data); + + /** + * Update the checksum upon saving the ROM file. + * @param data - the ROM file to update + * @return Number of checksums which needed to be updated + */ + int update(byte[] data); +} diff --git a/src/main/java/com/romraider/maps/checksum/ChecksumSTD.java b/src/main/java/com/romraider/maps/checksum/ChecksumSTD.java new file mode 100644 index 000000000..faf795ce4 --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/ChecksumSTD.java @@ -0,0 +1,31 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +/** + * This class implements the "std" checksum validation and calculations + * for Nissan ROMs. + */ + public final class ChecksumSTD extends NissanChecksum { + + public ChecksumSTD() { + calculator = new CalculateSTD(); + } +} diff --git a/src/main/java/com/romraider/maps/checksum/NcsCoDec.java b/src/main/java/com/romraider/maps/checksum/NcsCoDec.java new file mode 100644 index 000000000..cdb26d1ea --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/NcsCoDec.java @@ -0,0 +1,181 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Encoding and decoding routines based on: + * https://github.com/fenugrec/nissutils/blob/master/cli_utils/ + */ + +package com.romraider.maps.checksum; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; + +import com.romraider.util.HexUtil; + +/** + * This class contains functions to encode and decoded data as well as + * calculate its CRC in Nissan fashion. + */ +public final class NcsCoDec { + + public NcsCoDec() { + } + + /** + * For the given inBuf, decode the data with the supplied code + * and return the decoded data + */ + public final byte[] nisDecode(ByteBuffer inBuf, int code) { + final ByteBuffer outBuf = ByteBuffer.allocate(inBuf.capacity()).order(ByteOrder.BIG_ENDIAN); + inBuf.rewind(); + while (inBuf.hasRemaining()) { + outBuf.putInt(decode(inBuf.getInt(), code)); + } + return outBuf.array(); + } + + /** + * For the given inBuf, encode the data with the supplied code + * and return the encoded data + */ + public final byte[] nisEncode(ByteBuffer inBuf, int code) { + final ByteBuffer outBuf = ByteBuffer.allocate(inBuf.capacity()).order(ByteOrder.BIG_ENDIAN); + inBuf.rewind(); + while (inBuf.hasRemaining()) { + outBuf.putInt(encode(inBuf.getInt(), code)); + } + return outBuf.array(); + } + + /** + * For the given encoded data, decode the data with the supplied code + * and return decoded data + */ + // https://github.com/fenugrec/nissutils/blob/master/cli_utils/nislib.c#dec1 + private final int decode(int data, int code) { + final int dH = data >>> 16; + final int dL = data & 0xFFFF; + final int cH = code >>> 16; + final int cL = code & 0xFFFF; + final int kL = mess2(dH, dL, cL); + final int kH = mess1(dL, kL, cH); + return (kH << 16) | kL; + } + + /** + * For the given data, encode the data with the supplied code + * and return the encoded data + */ + // https://github.com/fenugrec/nissutils/blob/master/cli_utils/nislib.c#enc1 + private final int encode(int data, int code) { + final int dH = data >>> 16; + final int dL = data & 0xFFFF; + final int cH = code >>> 16; + final int cL = code & 0xFFFF; + final int kL = mess1(dH, dL, cH); + final int kH = mess2(dL, kL, cL); + return (kH << 16 | kL); + } + + // https://github.com/fenugrec/nissutils/blob/master/cli_utils/nislib.c#mess1 + private final int mess1(int a, int b, int x) { + final int var0 = (x + b) & 0xFFFF; + final int var1 = var0 << 2; + final int var2 = var1 >>> 16; + final int var3 = var2 + var0 + var1 - 1; + return (var3 ^ a) & 0xFFFF; + } + + // https://github.com/fenugrec/nissutils/blob/master/cli_utils/nislib.c#mess2 + private final int mess2(int a, int b, int x) { + final int var0 = (x + b) & 0xFFFF; + final int var1 = var0 << 1; + final int var2 = ((var1 >>> 16) + var0 + var1 - 1) & 0xFFFF; + final int var3 = var2 << 4; + final int var4 = var3 + (var3 >>> 16); + return (a ^ var4 ^ var2) & 0xFFFF; + } + + /** + * For the given data, calculate the 16 bit CRC. + */ + // sub_15CC in 1ZN67A + public final short calcCrc(byte[] data) { + int r6; + int r5; + int crc = 0xffff; + for (int i = 0; i < data.length; i++) { + r5 = data[i]; + for (int j = 0; j < 8; j++) { + r6 = crc & 1; + crc = crc >>> 1; + if(r6 != (r5 & 1)) { + crc = crc ^ 0x8408; + } + r5 = r5 >> 1; + } + } + return (short) crc; + } + + /** + * Test the NisCoDec functions + */ + public static void main(String[] args) { + final NcsCoDec codec = new NcsCoDec(); + String bin_text = "FFFF22E4000115F8000116A000011724000117C80002B9C4E00180F884F820088B1B62F0E7EC9625D91426209623656062637205645C60430274901D7501655C029C760560530624D20D420B75019013D60C029C9011A0040624E4AC644CB18BE5127F204F266EF66DF66CF66BF66AF6000B69F697B481050848035EFFFF22E4"; + byte[] bin = HexUtil.asBytes(bin_text); + final int scode = 0xC2C0823F; + ByteBuffer data = ByteBuffer.allocate(bin.length).order(ByteOrder.BIG_ENDIAN).put(bin); + final byte[] dataEncoded = codec.nisEncode(data, scode); + short crc = codec.calcCrc(dataEncoded); + short invert = (short) ~crc; + short le = (short) (((invert << 8) | ((invert & 0xffff) >>> 8)) & 0xffff); + final byte[] crcCheck = new byte[dataEncoded.length + 2]; + System.arraycopy(dataEncoded, 0, crcCheck, 0, dataEncoded.length); + crcCheck[crcCheck.length - 2] = (byte) (invert & 0xff); + crcCheck[crcCheck.length - 1] = (byte) ((invert & 0xffff) >>> 8); + short residue = codec.calcCrc(crcCheck); + System.out.println(String.format( + "Encode Test:%nbin data: %s%nscode: %08X%nencoded: %s%nCRC (D10D): %04X%n~CRC (2EF2): %04X%n" + + "little-endian ~CRC (F22E): %04X%nresidue: %04X", + HexUtil.asHex(bin), scode, HexUtil.asHex(dataEncoded), crc, invert, le, + residue)); + String text = "34830000003030303030303041060431434D43375150443430310000000000000000005230303030434F4E332B0619022000005CAD04"; + byte[] hex = HexUtil.asBytes(text); + residue = codec.calcCrc(hex); + System.out.println(String.format("%s%nCRC: %04X%n~CRC: %04X", + HexUtil.asHex(hex), residue, (short)~residue)); + text = "348300000030FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB9BC"; + hex = HexUtil.asBytes(text); + residue = codec.calcCrc(hex); + System.out.println(String.format("%s%nCRC: %04X%n~CRC: %04X", + HexUtil.asHex(hex), residue, (short)~residue)); + data.rewind(); + data = ByteBuffer.allocate(dataEncoded.length).order(ByteOrder.BIG_ENDIAN).put(dataEncoded); + byte[] dataDecoded = codec.nisDecode(data, scode); + System.out.println(String.format("Decoded Data: %s", + HexUtil.asHex(dataDecoded))); + if(bin_text.equalsIgnoreCase(HexUtil.asHex(dataDecoded))) { + System.out.println("Decoded data matches input data"); + } + else { + System.out.println("DATA DOES NOT MATCH !!!"); + } + } +} diff --git a/src/main/java/com/romraider/maps/checksum/NissanChecksum.java b/src/main/java/com/romraider/maps/checksum/NissanChecksum.java new file mode 100644 index 000000000..dbbfdf9f9 --- /dev/null +++ b/src/main/java/com/romraider/maps/checksum/NissanChecksum.java @@ -0,0 +1,82 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import static com.romraider.xml.RomAttributeParser.parseByteValue; +import static com.romraider.xml.RomAttributeParser.parseIntegerValue; + +import java.util.HashMap; +import java.util.Map; + +import com.romraider.Settings; +import com.romraider.util.HexUtil; + +/** + * This class provides common methods implemented by different + * checksum calculation type classes. + */ + abstract class NissanChecksum implements ChecksumManager { + public static final String START = "start"; + public static final String END = "end"; + public static final String SUMLOC = "sumloc"; + public static final String XORLOC = "xorloc"; + public static final String SUMT = "sumt"; + public static final String XORT = "xort"; + protected final Map range = new HashMap(); + protected final Map results = new HashMap(); + protected Calculator calculator; + + @Override + public void configure(Map vars) { + range.put(START, HexUtil.hexToInt(vars.get(START))); + range.put(END, HexUtil.hexToInt(vars.get(END))); + range.put(SUMLOC, HexUtil.hexToInt(vars.get(SUMLOC))); + range.put(XORLOC, HexUtil.hexToInt(vars.get(XORLOC))); + } + + @Override + public int getNumberOfChecksums() { + return 2; + } + + @Override + public int validate(byte[] binData) { + calculator.calculate(range, binData, results); + int valid = 0; + + if(results.get(SUMT) == (int)parseByteValue(binData, Settings.Endian.BIG, range.get(SUMLOC), 4, true)) { + valid++; + } + + if((results.get(XORT) == (int)parseByteValue(binData, Settings.Endian.BIG, range.get(XORLOC), 4, true))) { + valid++; + } + + return valid; + } + + @Override + public int update(byte[] binData) { + calculator.calculate(range, binData, results); + System.arraycopy(parseIntegerValue(results.get(SUMT), Settings.Endian.BIG, 4), 0, binData, range.get(SUMLOC), 4); + System.arraycopy(parseIntegerValue(results.get(XORT), Settings.Endian.BIG, 4), 0, binData, range.get(XORLOC), 4); + return getNumberOfChecksums(); + } +} diff --git a/src/main/java/com/romraider/net/BrowserControl.java b/src/main/java/com/romraider/net/BrowserControl.java index 371769b24..ff42b700c 100644 --- a/src/main/java/com/romraider/net/BrowserControl.java +++ b/src/main/java/com/romraider/net/BrowserControl.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,7 +38,8 @@ public static void displayURL(String url) { Method browseMethod = display.getDeclaredMethod("browse", java.net.URI.class); browseMethod.invoke(getDesktopMethod, new URI(url)); } catch (Exception e) { - LOGGER.debug("Failed to display URL via java.awt.Desktop. Calling by OS depended method.", e); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Failed to display URL via java.awt.Desktop. Calling by OS depended method.", e); displayURLtraditional(url); } } diff --git a/src/main/java/com/romraider/ramtune/test/RamTuneTestApp.java b/src/main/java/com/romraider/ramtune/test/RamTuneTestApp.java index 88a2dd4d3..460098bd8 100644 --- a/src/main/java/com/romraider/ramtune/test/RamTuneTestApp.java +++ b/src/main/java/com/romraider/ramtune/test/RamTuneTestApp.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ import static com.romraider.util.HexUtil.asHex; import static com.romraider.util.ThreadUtil.runAsDaemon; import static com.romraider.util.ThreadUtil.sleep; +import static com.romraider.util.ParamChecker.isNullOrEmpty; import static java.awt.FlowLayout.LEFT; import static java.awt.Font.PLAIN; import static java.awt.GridBagConstraints.BOTH; @@ -49,8 +50,12 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; +import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -73,6 +78,10 @@ import com.romraider.logger.ecu.comms.io.protocol.LoggerProtocol; import com.romraider.logger.ecu.comms.manager.PollingState; import com.romraider.logger.ecu.comms.manager.PollingStateImpl; +import com.romraider.logger.ecu.definition.EcuDataLoader; +import com.romraider.logger.ecu.definition.EcuDataLoaderImpl; +import com.romraider.logger.ecu.definition.Module; +import com.romraider.logger.ecu.definition.Transport; import com.romraider.logger.ecu.ui.SerialPortComboBox; import com.romraider.ramtune.test.command.executor.CommandExecutor; import com.romraider.ramtune.test.command.executor.CommandExecutorImpl; @@ -102,18 +111,33 @@ public final class RamTuneTestApp extends AbstractFrame { private final JTextField addressField = new JTextField(6); private final JTextField lengthField = new JTextField(4); private final JTextField sendTimeoutField = new JTextField(4); + private final JTextField blocksize = new JTextField(3); private final JTextArea dataField = new JTextArea(5, 80); private final JTextArea responseField = new JTextArea(10, 80); private final JCheckBox blockRead = new JCheckBox("Block Read"); private final SerialPortComboBox portsComboBox; private final JComboBox commandComboBox; - private static byte ecuId = 0x10; + private static Module module; private static String userTp; private static String userLibrary; + private static String target; + private static Settings settings = SettingsManager.getSettings(); + private Map>> protocolList = + new HashMap>>(); public RamTuneTestApp(String title) { super(title); - Settings settings = SettingsManager.getSettings(); + final EcuDataLoader dataLoader = new EcuDataLoaderImpl(); + if (isNullOrEmpty(settings.getLoggerDefinitionFilePath())) { + showErrorDialog("A Logger definition file needs to be configured before connecting."); + windowClosing(null); + } + dataLoader.loadConfigFromXml( + settings.getLoggerDefinitionFilePath(), + settings.getLoggerProtocol(), + settings.getFileLoggingControllerSwitchId(), null); + protocolList = dataLoader.getProtocols(); + target = settings.getTargetModule(); portsComboBox = new SerialPortComboBox(); userTp = settings.getTransportProtocol(); userLibrary = settings.getJ2534Device(); @@ -121,7 +145,7 @@ public RamTuneTestApp(String title) { // Read Address blocks only seems to work with ISO9141, it // may not be implemented in the ECU for ISO15765 final LoggerProtocol lp = ProtocolFactory.getProtocol( - "SSM", + settings.getLoggerProtocol(), ISO9141 ); protocol = lp.getProtocol(); @@ -214,6 +238,11 @@ private Component buildInputPanel() { blockRead.setSelected(true); blockRead.setToolTipText("uncheck to read range byte at a time"); blockReadPanel.add(blockRead); + blockReadPanel.add(new JLabel("Block Size:")); + blocksize.setText("128"); + blocksize.setToolTipText("Set to value allowed by the ECU"); + blockReadPanel.add(blocksize); + JPanel addressPanel = new JPanel(new FlowLayout(LEFT)); addressPanel.add(addressFieldPanel); addressPanel.add(lengthPanel); @@ -267,13 +296,14 @@ public void actionPerformed(ActionEvent e) { @Override public void run() { button.setEnabled(false); + CommandExecutor commandExecutor = null; try { ConnectionProperties connectionProperties = new RamTuneTestAppConnectionProperties(protocol.getDefaultConnectionProperties(), getSendTimeout()); - final CommandExecutor commandExecutor = new CommandExecutorImpl(connectionProperties, (String) portsComboBox.getSelectedItem()); + commandExecutor = new CommandExecutorImpl(connectionProperties, (String) portsComboBox.getSelectedItem()); final CommandGenerator commandGenerator = (CommandGenerator) commandComboBox.getSelectedItem(); if (validateInput(commandGenerator) && confirmCommandExecution(commandGenerator)) { StringBuilder builder = new StringBuilder(); - List commands = commandGenerator.createCommands(ecuId, getData(), getAddress(), getLength(), getBlockRead()); + List commands = commandGenerator.createCommands(module, getData(), getAddress(), getLength(), getBlockRead(), getBlockSize()); for (byte[] command : commands) { appendResponseLater("SND [" + commandGenerator + "]:\t" + asHex(command) + "\n"); byte[] response = protocol.preprocessResponse(command, commandExecutor.executeCommand(command), pollMode); @@ -282,10 +312,10 @@ public void run() { } appendResponseLater("DATA [Raw]:\t" + builder.toString() + "\n\n"); } - commandExecutor.close(); } catch (Exception ex) { reportError(ex); } finally { + commandExecutor.close(); button.setEnabled(true); } } @@ -328,6 +358,10 @@ private boolean getBlockRead() { return blockRead.isSelected(); } + private int getBlockSize() { + return getIntFromField(blocksize); + } + private int getSendTimeout() { return getIntFromField(sendTimeoutField); } @@ -392,28 +426,56 @@ private JPanel buildComPortPanel() { JPanel panel = new JPanel(new FlowLayout(LEFT)); panel.add(buildComPorts()); panel.add(buildSendTimeout()); - final JCheckBox ecuCheckBox = new JCheckBox("ECU"); - final JCheckBox tcuCheckBox = new JCheckBox("TCU"); - ecuCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent actionEvent) { - tcuCheckBox.setSelected(false); - ecuId = 0x10; + + final ButtonGroup moduleGroup = new ButtonGroup(); + for (Module module : getModuleList()) { + final JCheckBox cb = new JCheckBox(module.getName().toUpperCase()); + final String tipText = String.format( + "%s Polling.", module.getDescription()); + cb.setToolTipText(tipText); + if (settings.getTargetModule().equalsIgnoreCase(module.getName())) { + cb.setSelected(true); + setTarget(module.getName()); } - }); - tcuCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent actionEvent) { - ecuCheckBox.setSelected(false); - ecuId = 0x18; + cb.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + final JCheckBox source = (JCheckBox) actionEvent.getSource(); + if (source.isSelected()) { + setTarget(source.getText()); + } + } + }); + + moduleGroup.add(cb); + panel.add(cb); + } + return panel; + } + + private void setTarget(String name) { + for (Module module: getModuleList()) { + if (module.getName().equalsIgnoreCase(name)) { + RamTuneTestApp.module = module; } - }); - ecuCheckBox.setSelected(true); + } + } + + private Transport getTransportById(String id) { + Transport loggerTransport = null; + for (Transport transport : getTransportMap().keySet()) { + if (transport.getId().equalsIgnoreCase(id)) + loggerTransport = transport; + } + return loggerTransport; + } - panel.add(ecuCheckBox); - panel.add(tcuCheckBox); + private Map> getTransportMap() { + return protocolList.get(settings.getLoggerProtocol()); + } - return panel; + private Collection getModuleList() { + return getTransportMap().get(getTransportById(settings.getTransportProtocol())); } private Component buildSendTimeout() { @@ -459,7 +521,7 @@ public static void startTestApp(final int defaultCloseOperation) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - RamTuneTestApp ramTuneTestApp = new RamTuneTestApp("SSM Read/Write"); + RamTuneTestApp ramTuneTestApp = new RamTuneTestApp("Control Module Read/Write"); ramTuneTestApp.setIconImage(new ImageIcon( getClass().getResource("/graphics/romraider-ico.gif")).getImage()); ramTuneTestApp.setDefaultCloseOperation(defaultCloseOperation); ramTuneTestApp.addWindowListener(ramTuneTestApp); @@ -472,7 +534,7 @@ public void run() { @Override public void windowClosing(WindowEvent e) { - Settings settings = SettingsManager.getSettings(); + setTarget(target); settings.setTransportProtocol(userTp); settings.setJ2534Device(userLibrary); } diff --git a/src/main/java/com/romraider/ramtune/test/command/generator/AbstractCommandGenerator.java b/src/main/java/com/romraider/ramtune/test/command/generator/AbstractCommandGenerator.java index 19667a35c..ffd53f5ed 100644 --- a/src/main/java/com/romraider/ramtune/test/command/generator/AbstractCommandGenerator.java +++ b/src/main/java/com/romraider/ramtune/test/command/generator/AbstractCommandGenerator.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,5 +30,6 @@ public AbstractCommandGenerator(Protocol protocol) { this.protocol = protocol; } + @Override public abstract String toString(); } diff --git a/src/main/java/com/romraider/ramtune/test/command/generator/CommandGenerator.java b/src/main/java/com/romraider/ramtune/test/command/generator/CommandGenerator.java index 405215cd2..3486060c2 100644 --- a/src/main/java/com/romraider/ramtune/test/command/generator/CommandGenerator.java +++ b/src/main/java/com/romraider/ramtune/test/command/generator/CommandGenerator.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,8 +21,10 @@ import java.util.List; -public interface CommandGenerator { +import com.romraider.logger.ecu.definition.Module; - List createCommands(byte id, byte[] data, byte[] address, int length, boolean blockRead); +public interface CommandGenerator { + List createCommands(Module module, byte[] data, byte[] address, + int length, boolean blockRead, int blocksize); } diff --git a/src/main/java/com/romraider/ramtune/test/command/generator/EcuInitCommandGenerator.java b/src/main/java/com/romraider/ramtune/test/command/generator/EcuInitCommandGenerator.java index 94a1710ec..c1502f6a9 100644 --- a/src/main/java/com/romraider/ramtune/test/command/generator/EcuInitCommandGenerator.java +++ b/src/main/java/com/romraider/ramtune/test/command/generator/EcuInitCommandGenerator.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,19 +19,22 @@ package com.romraider.ramtune.test.command.generator; -import com.romraider.io.protocol.Protocol; import static java.util.Arrays.asList; + import java.util.List; +import com.romraider.io.protocol.Protocol; +import com.romraider.logger.ecu.definition.Module; + public final class EcuInitCommandGenerator extends AbstractCommandGenerator { public EcuInitCommandGenerator(Protocol protocol) { super(protocol); } - public List createCommands(byte id, byte[] data, byte[] address, - int length, boolean blockRead) { - return asList(protocol.constructEcuInitRequest(id)); + public List createCommands(Module module, byte[] data, byte[] address, + int length, boolean blockRead, int blocksize) { + return asList(protocol.constructEcuInitRequest(module)); } public String toString() { diff --git a/src/main/java/com/romraider/ramtune/test/command/generator/ReadCommandGenerator.java b/src/main/java/com/romraider/ramtune/test/command/generator/ReadCommandGenerator.java index 7dcb42fd0..385e2af82 100644 --- a/src/main/java/com/romraider/ramtune/test/command/generator/ReadCommandGenerator.java +++ b/src/main/java/com/romraider/ramtune/test/command/generator/ReadCommandGenerator.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,42 +19,46 @@ package com.romraider.ramtune.test.command.generator; -import com.romraider.io.protocol.Protocol; import static com.romraider.util.ParamChecker.checkGreaterThanZero; +import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; import static java.util.Arrays.asList; + import java.math.BigInteger; import java.util.ArrayList; import java.util.List; +import com.romraider.io.protocol.Protocol; +import com.romraider.logger.ecu.definition.Module; + public final class ReadCommandGenerator extends AbstractCommandGenerator { - private static final int INCREMENT_SIZE = 128; public ReadCommandGenerator(Protocol protocol) { super(protocol); } - public List createCommands(byte id, byte[] data, byte[] address, - int length, boolean blockRead) { - checkGreaterThanZero(id, "Target ID"); + public List createCommands(Module module, byte[] data, byte[] address, + int length, boolean blockRead, int blocksize) { + checkNotNull(module, "module"); checkNotNullOrEmpty(address, "address"); checkGreaterThanZero(length, "length"); + checkGreaterThanZero(blocksize, "blocksize"); if (length == 1) { - return asList(createCommandForAddress(id, address)); + return asList(createCommandForAddress(module, address)); } else { - return createCommandsForRange(id, address, length, blockRead); + return createCommandsForRange(module, address, length, blockRead, blocksize); } } - private byte[] createCommandForAddress(byte id, byte[] address) { - return protocol.constructReadAddressRequest(id, new byte[][]{address}); + private byte[] createCommandForAddress(Module module, byte[] address) { + return protocol.constructReadAddressRequest(module, new byte[][]{address}); } - private List createCommandsForRange(byte id, byte[] address, - int length, boolean blockRead) { + private List createCommandsForRange(Module module, byte[] address, + int length, boolean blockRead, int blocksize) { int incrementSize = 1; if (blockRead) { - incrementSize = INCREMENT_SIZE; + incrementSize = blocksize; } List commands = new ArrayList(); byte[] readAddress = copy(address); @@ -62,9 +66,9 @@ private List createCommandsForRange(byte id, byte[] address, while (i < length) { int readLength = (length - i) > incrementSize ? incrementSize : length - i; if (readLength == 1) { - commands.add(createCommandForAddress(id, readAddress)); + commands.add(createCommandForAddress(module, readAddress)); } else { - commands.add(protocol.constructReadMemoryRequest(id, readAddress, readLength)); + commands.add(protocol.constructReadMemoryRequest(module, readAddress, readLength)); } i += incrementSize; System.arraycopy(incrementAddress(readAddress, readLength), 0, readAddress, 0, readAddress.length); diff --git a/src/main/java/com/romraider/ramtune/test/command/generator/WriteCommandGenerator.java b/src/main/java/com/romraider/ramtune/test/command/generator/WriteCommandGenerator.java index c17f8038c..c56380154 100644 --- a/src/main/java/com/romraider/ramtune/test/command/generator/WriteCommandGenerator.java +++ b/src/main/java/com/romraider/ramtune/test/command/generator/WriteCommandGenerator.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ package com.romraider.ramtune.test.command.generator; +import static com.romraider.util.ParamChecker.checkNotNull; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; import java.nio.ByteBuffer; @@ -27,6 +28,7 @@ import java.util.List; import com.romraider.io.protocol.Protocol; +import com.romraider.logger.ecu.definition.Module; import com.romraider.util.ByteUtil; public final class WriteCommandGenerator extends AbstractCommandGenerator { @@ -35,16 +37,23 @@ public WriteCommandGenerator(Protocol protocol) { super(protocol); } - public List createCommands(byte id, byte[] data, byte[] address, - int length, boolean blockRead) { + public List createCommands(Module module, byte[] data, byte[] address, + int length, boolean blockRead, int blocksize) { + checkNotNull(module, "module"); checkNotNullOrEmpty(address, "address"); checkNotNullOrEmpty(data, "data"); final List commands = new ArrayList(); - for (int i = 0; i < length; i++) { - int singleAddress = ByteUtil.asUnsignedInt(address) + i; - byte[] singleAddrBytes = intToByteArray(singleAddress); + if (blockRead) { commands.add( - protocol.constructWriteAddressRequest(id, singleAddrBytes, data[i])); + protocol.constructWriteMemoryRequest(module, address, data)); + } + else { + for (int i = 0; i < length; i++) { + int singleAddress = ByteUtil.asUnsignedInt(address) + i; + byte[] singleAddrBytes = intToByteArray(singleAddress); + commands.add( + protocol.constructWriteAddressRequest(module, singleAddrBytes, data[i])); + } } return commands; } diff --git a/src/main/java/com/romraider/swing/CompareImagesForm.java b/src/main/java/com/romraider/swing/CompareImagesForm.java index 6d374895a..16dabf1d3 100644 --- a/src/main/java/com/romraider/swing/CompareImagesForm.java +++ b/src/main/java/com/romraider/swing/CompareImagesForm.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,8 @@ import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.text.MessageFormat; +import java.util.ResourceBundle; import java.util.Vector; import javax.swing.DefaultListModel; @@ -47,10 +49,12 @@ import com.romraider.editor.ecu.ECUEditorManager; import com.romraider.maps.Rom; import com.romraider.maps.Table; +import com.romraider.util.ResourceUtil; public class CompareImagesForm extends JFrame implements ActionListener { - private static final long serialVersionUID = -8937472127815934398L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + CompareImagesForm.class.getName()); private final Vector roms; private final JPanel contentPane; private final JComboBox comboBoxImageLeft; @@ -67,14 +71,14 @@ public CompareImagesForm(Vector roms, Image parentImage) { setResizable(false); this.roms = roms; - setTitle("Compare Images"); + setTitle(rb.getString("TITLE")); setBounds(100, 100, 600, 450); this.contentPane = new JPanel(); this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(this.contentPane); - JLabel lblSelectImages = new JLabel("Selected Images"); + JLabel lblSelectImages = new JLabel(rb.getString("LBLSELECTED")); lblSelectImages.setBounds(10, 11, 79, 14); contentPane.setLayout(null); @@ -86,28 +90,28 @@ public CompareImagesForm(Vector roms, Image parentImage) { this.comboBoxImageLeft = new JComboBox(); this.comboBoxImageLeft.setBounds(10, 7, 554, 20); - this.comboBoxImageLeft.setToolTipText("Select an image to compare."); + this.comboBoxImageLeft.setToolTipText(rb.getString("TTSELECTIMG")); this.comboBoxImageLeft.setRenderer( new ComboBoxRenderer() ); panelImageSelector.add(this.comboBoxImageLeft); this.comboBoxImageRight = new JComboBox(); this.comboBoxImageRight.setBounds(10, 32, 554, 20); - this.comboBoxImageRight.setToolTipText("Select an image to compare."); + this.comboBoxImageRight.setToolTipText(rb.getString("TTSELECTIMG")); this.comboBoxImageRight.setRenderer( new ComboBoxRenderer() ); panelImageSelector.add(this.comboBoxImageRight); - this.btnCompare = new JButton("Compare"); + this.btnCompare = new JButton(rb.getString("BTNCOMPARE")); this.btnCompare.addActionListener(this); this.btnCompare.setBounds(10, 64, 89, 23); panelImageSelector.add(this.btnCompare); this.contentPane.add(panelImageSelector); this.contentPane.add(lblSelectImages); - JLabel lblResults = new JLabel("Results:"); + JLabel lblResults = new JLabel(rb.getString("LBLRESULTS")); lblResults.setBounds(10, 141, 46, 14); contentPane.add(lblResults); - lblImageResultString = new JLabel("Compare images..."); + lblImageResultString = new JLabel(rb.getString("LBLCOMPAREIMGS")); lblImageResultString.setBounds(66, 141, 518, 14); contentPane.add(lblImageResultString); scrollPaneResults = new JScrollPane(); @@ -128,11 +132,14 @@ public void valueChanged(ListSelectionEvent arg0) { Rom rightRom = (Rom) comboBoxImageRight.getSelectedItem(); // Display Tables - TableTreeNode leftNode = findAndShowTable(leftRom, tableName); - TableTreeNode rightNode = findAndShowTable(rightRom, tableName); - + TableTreeNode leftNode = leftRom.getTableNodeByName(tableName); + TableTreeNode rightNode = rightRom.getTableNodeByName(tableName); + // Set Comparison if(leftNode != null && rightNode != null) { + ECUEditorManager.getECUEditor().displayTable(leftNode); + ECUEditorManager.getECUEditor().displayTable(rightNode); + leftNode.getFrame().compareByTable(rightNode.getTable()); // Update menu bar for(int i = 0; i< leftNode.getFrame().getTableMenuBar().getSimilarOpenTables().getItemCount(); i++) { @@ -149,17 +156,7 @@ public void valueChanged(ListSelectionEvent arg0) { }); populateComboBoxes(); } - - private TableTreeNode findAndShowTable(Rom rom, String tableName) { - for(TableTreeNode node : rom.getTableNodes()) { - if(node != null && node.getTable().getName().equals(tableName)){ - ECUEditorManager.getECUEditor().displayTable(node.getFrame()); - return node; - } - } - return null; - } - + public void populateComboBoxes() { for(int i=0; i 0 && different == 0 && missing == 0) { - lblImageResultString.setText("Images are equal."); + lblImageResultString.setText(rb.getString("LBLEQUALS")); lblImageResultString.setForeground(Settings.TABLE_EQUAL_COLOR); } else if(different > 0) { - lblImageResultString.setText("Images are NOT equal. Equal Tables: "+equal+", Changed Tables: "+different+", Missing Tables: "+missing); + lblImageResultString.setText(MessageFormat.format( + rb.getString("LBLNOTEQUAL"), equal, different, missing)); lblImageResultString.setForeground(Settings.TABLE_DIFFERENT_COLOR); } else { - lblImageResultString.setText("Images are NOT equal. Equal Tables: "+equal+", Changed Tables: "+different+", Missing Tables: "+missing); + lblImageResultString.setText(MessageFormat.format( + rb.getString("LBLNOTEQUAL"), equal, different, missing)); lblImageResultString.setForeground(Settings.TABLE_MISSING_COLOR); } // Check if the list has items. if(listModelChanges.size() < 1) { - listModelChanges.addElement(new ListItem(0, "No tables are equal, different, or missing.")); - lblImageResultString.setText("Unable to compare images."); + listModelChanges.addElement(new ListItem(0, rb.getString("LBLNOEDM"))); + lblImageResultString.setText(rb.getString("NOCOMPARE")); lblImageResultString.setForeground(Color.RED); return; } @@ -250,17 +250,17 @@ public void compareTables(Rom left, Rom right) // Add list items for 0 counts. if(equal == 0) { - listModelChanges.addElement(new ListItem(1, "No Equal Tables.")); + listModelChanges.addElement(new ListItem(1, rb.getString("NOEQUAL"))); } if(different == 0) { - listModelChanges.addElement(new ListItem(2, "No Changed Tables.")); + listModelChanges.addElement(new ListItem(2, rb.getString("NOCHANGED"))); } if(missing == 0) { - listModelChanges.addElement(new ListItem(3, "No Missing Tables.")); + listModelChanges.add(0, new ListItem(3, rb.getString("NOMISSING"))); } } @@ -344,20 +344,26 @@ public Component getListCellRendererComponent(JList paramList, Object value, case 1: // equal - default green setForeground(Settings.TABLE_EQUAL_COLOR); + setText(MessageFormat.format( + rb.getString("UNCHANGED"), item.getValue())); break; case 2: // different - default red setForeground(Settings.TABLE_DIFFERENT_COLOR); + setText(MessageFormat.format( + rb.getString("MODIFIED"), item.getValue())); break; case 3: // missing - default yellow setForeground(Settings.TABLE_MISSING_COLOR); + setText(MessageFormat.format( + rb.getString("MISSING"), item.getValue())); break; default: setForeground(paramList.getForeground()); + setText(item.getValue()); break; } - setText(item.getValue()); return this; } } diff --git a/src/main/java/com/romraider/swing/CustomToolbarLayout.java b/src/main/java/com/romraider/swing/CustomToolbarLayout.java index a925d0f2a..8c326c157 100644 --- a/src/main/java/com/romraider/swing/CustomToolbarLayout.java +++ b/src/main/java/com/romraider/swing/CustomToolbarLayout.java @@ -10,14 +10,6 @@ public class CustomToolbarLayout extends FlowLayout { private static final long serialVersionUID = 1L; - public CustomToolbarLayout() { - super(); - } - - public CustomToolbarLayout(int align) { - super(align); - } - public CustomToolbarLayout(int align, int hgap, int vgap) { super(align, hgap, vgap); } diff --git a/src/main/java/com/romraider/swing/DataflowFrame.java b/src/main/java/com/romraider/swing/DataflowFrame.java new file mode 100644 index 000000000..52d78ee32 --- /dev/null +++ b/src/main/java/com/romraider/swing/DataflowFrame.java @@ -0,0 +1,283 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.swing; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Map; + +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.SwingUtilities; +import javax.swing.border.EtchedBorder; +import javax.swing.border.TitledBorder; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; + +import com.romraider.dataflowSimulation.DataflowSimulation; +import com.romraider.dataflowSimulation.GenericAction; +import com.romraider.dataflowSimulation.GenericAction.GenericActionType; +import com.romraider.editor.ecu.ECUEditor; +import com.romraider.maps.Table; +import com.romraider.maps.Table2DView; +import com.romraider.maps.Table3DView; +import com.romraider.maps.TableView; + +public final class DataflowFrame extends AbstractFrame { + private static final long serialVersionUID = 7140513114169019846L; + + private final DataflowSimulation sim; + + HashMap inputsFields = new HashMap(); + + LinkedList inputs = new LinkedList(); + LinkedList outputs = new LinkedList();; + LinkedList centerDisplay = new LinkedList(); + JCheckBox enableLogButton; + private final Font boldFont = new Font("Dialog", Font.BOLD, 14); + + public DataflowFrame(DataflowSimulation sim) { + super("Dataflow Simulation: " + sim.getName()); + this.sim = sim; + sim.setFrame(this); + initUserInterface(); + } + + private void initUserInterface() { + // setup main panel + JPanel mainPanel = new JPanel(new BorderLayout()); + JPanel contentPanel = buildContentPanel(); + mainPanel.add(new JScrollPane(contentPanel), BorderLayout.CENTER); + mainPanel.add(buildInputPanel(), BorderLayout.NORTH); + + // Causes scrolling issues... + // if (!sim.getDescription().isEmpty()) + // mainPanel.add(buildDescriptionPanel(), BorderLayout.NORTH); + updateContentPanel(); + + // add to container + getContentPane().add(mainPanel); + } + + private JPanel buildDescriptionPanel() { + JPanel descPanel = new JPanel(new GridLayout(sim.getNumberOfActions(), 3)); + descPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Description")); + JLabel desc = new JLabel(sim.getDescription()); + descPanel.add(desc); + + return descPanel; + } + + private JPanel buildContentPanel() { + JPanel contentPanel = new JPanel(); + contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS)); + contentPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Simulation")); + + for (int i = 0; i < sim.getNumberOfActions(); i++) { + GenericAction a = sim.getAction(i); + a.init(sim.getRom()); + + JPanel line = new JPanel(new GridLayout(1, 3)); + + JLabel input = new JLabel(""); + input.setHorizontalAlignment(JLabel.CENTER); + input.setFont(boldFont); + inputs.add(input); + line.add(input); + + if (a.getType() == GenericActionType.CALCULATION) { + JLabel center = new JLabel(""); + center.setHorizontalAlignment(JLabel.CENTER); + center.setFont(boldFont); + centerDisplay.add(center); + line.add(center); + } else if (a.getType() == GenericActionType.TABLE) { + TableView v = ECUEditor.getTableViewForTable(a.getTable()); + if (v != null) { + centerDisplay.add(v); + line.add(v); + v.populateTableVisual(); + } else { + JLabel error = new JLabel("Failed to find table!"); + error.setFont(boldFont); + error.setHorizontalAlignment(JLabel.CENTER); + centerDisplay.add(error); + line.add(error); + } + } + + JLabel output = new JLabel(); + output.setHorizontalAlignment(JLabel.CENTER); + output.setFont(boldFont); + outputs.add(output); + line.add(output); + contentPanel.add(line); + contentPanel.add(Box.createVerticalStrut(20)); + } + + return contentPanel; + } + + public void updateContentPanel() { + // Update inputs if variables were changed via logger + if (enableLogButton.isSelected()) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + for (Map.Entry entry : inputsFields.entrySet()) { + String newText = GenericAction.DEFAULT_FORMATTER.format(sim.getVariableValue(entry.getKey())); + if (!newText.equals(entry.getValue().getText())) { + entry.getValue().setText(newText); + } + } + } + }); + } + + for (int i = 0; i < sim.getNumberOfActions(); i++) { + GenericAction a = sim.getAction(i); + sim.simulate(i); + + inputs.get(i).setText(a.getInputText()); + outputs.get(i).setText(a.getOutputText()); + + String centerText = a.getCenterTextReference(); + Table table = a.getTable(); + + if (centerText != null) { + // Add linebreak if needed + ((JLabel) centerDisplay.get(i)).setText("" + centerText.replaceAll("(.{80})", "$1
")); + } else if (table != null) { + TableView v = ((TableView) centerDisplay.get(i)); + + v.setOverlayLog(true); + v.clearLiveDataTrace(); + if (v instanceof Table3DView) { + Table3DView view3D = (Table3DView) v; + view3D.getXAxis().highlightLiveData(a.getInputs().get(0).toString()); + view3D.getYAxis().highlightLiveData(a.getInputs().get(1).toString()); + } else if (v instanceof Table2DView) { + Table2DView view2D = (Table2DView) v; + view2D.getAxis().highlightLiveData(a.getInputs().get(0).toString()); + } + v.drawTable(); + } + + } + } + + private Component buildInputPanel() { + GridBagLayout gridBagLayout = new GridBagLayout(); + JPanel inputPanel = new JPanel(gridBagLayout); + inputPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Inputs")); + JPanel fieldPanel = new JPanel(new FlowLayout()); + + enableLogButton = new JCheckBox("Update from Logger"); + enableLogButton.setEnabled(!sim.getInputsWithLogParam().isEmpty()); + fieldPanel.add(enableLogButton); + enableLogButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + sim.setUpdateFromLogger(enableLogButton.isSelected()); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + HashSet inputsWithLog = sim.getInputsWithLogParam(); + for (Map.Entry entry : inputsFields.entrySet()) { + if (inputsWithLog.contains(entry.getKey())) { + entry.getValue().setEnabled(!enableLogButton.isSelected()); + } + } + } + }); + } + }); + + LinkedList inputs = sim.getInputs(); + for (final String i : inputs) { + final JTextField text = new JTextField("", 5); + fieldPanel.add(new JLabel(i)); + text.setText(sim.getVariableValue(i).toString()); + inputsFields.put(i, text); + + text.getDocument().addDocumentListener(new DocumentListener() { + public void changedUpdate(DocumentEvent e) { + update(); + } + + public void removeUpdate(DocumentEvent e) { + update(); + } + + public void insertUpdate(DocumentEvent e) { + update(); + } + + public void update() { + try { + if (!text.getText().equals(sim.getVariableValue(i).toString())) { + sim.setVariableValue(i, Double.parseDouble(text.getText())); + updateContentPanel(); + } + } catch (NumberFormatException ex) { + // Do nothing + } + + } + }); + + fieldPanel.add(text); + inputPanel.add(fieldPanel); + } + + return inputPanel; + } + + public static void openWindow(final DataflowSimulation sim) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + DataflowFrame dataflow = new DataflowFrame(sim); + dataflow.setIconImage(new ImageIcon(getClass().getResource("/graphics/romraider-ico.gif")).getImage()); + dataflow.setDefaultCloseOperation(DISPOSE_ON_CLOSE); + dataflow.addWindowListener(dataflow); + dataflow.setLocation(100, 50); + dataflow.pack(); + dataflow.setVisible(true); + } + }); + } +} diff --git a/src/main/java/com/romraider/swing/DebugPanel.java b/src/main/java/com/romraider/swing/DebugPanel.java index fdbc3ad91..cfcd0bbac 100644 --- a/src/main/java/com/romraider/swing/DebugPanel.java +++ b/src/main/java/com/romraider/swing/DebugPanel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,35 +20,44 @@ package com.romraider.swing; import static com.romraider.Version.PRODUCT_NAME; + import com.romraider.net.URL; +import com.romraider.util.ResourceUtil; + import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import java.awt.BorderLayout; import java.awt.GridLayout; +import java.text.MessageFormat; +import java.util.ResourceBundle; public class DebugPanel extends JPanel { private static final long serialVersionUID = -7159385694793030962L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DebugPanel.class.getName()); public DebugPanel(Exception ex, String url) { setLayout(new BorderLayout()); JPanel top = new JPanel(new GridLayout(7, 1)); - top.add(new JLabel(PRODUCT_NAME + " has encountered an exception. Please review the details below.")); - top.add(new JLabel("If you are unable to fix this problem please visit the following website")); - top.add(new JLabel("and provide these details and the steps that lead to this error.")); + top.add(new JLabel(MessageFormat.format( + rb.getString("LABEL1"), + PRODUCT_NAME))); + top.add(new JLabel(rb.getString("LABEL2"))); + top.add(new JLabel(rb.getString("LABEL3"))); top.add(new JLabel()); top.add(new URL(url)); top.add(new JLabel()); - top.add(new JLabel("Details:")); + top.add(new JLabel(rb.getString("LABEL4"))); add(top, BorderLayout.NORTH); - JTextArea output = new JTextArea(ex.getMessage()); + JTextArea output = new JTextArea(ex.toString()); add(output, BorderLayout.CENTER); output.setAutoscrolls(true); output.setRows(10); output.setColumns(40); ex.printStackTrace(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/swing/DefinitionFilter.java b/src/main/java/com/romraider/swing/DefinitionFilter.java new file mode 100644 index 000000000..96a0cc953 --- /dev/null +++ b/src/main/java/com/romraider/swing/DefinitionFilter.java @@ -0,0 +1,78 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2020 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.swing; + +import javax.swing.filechooser.FileFilter; + +import com.romraider.util.ResourceUtil; +import com.romraider.xml.ConversionLayer.BMWCodingConversionLayer; +import com.romraider.xml.ConversionLayer.ConversionLayer; +import com.romraider.xml.ConversionLayer.VDFConversionLayer; +import com.romraider.xml.ConversionLayer.XDFConversionLayer; + +import java.io.File; +import java.util.ResourceBundle; + +public class DefinitionFilter extends FileFilter { + + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DefinitionFilter.class.getName()); + + + private String[] regexFilters = { + ConversionLayer.xmlRegexFileNameFilter, + new BMWCodingConversionLayer().getRegexFileNameFilter(), + new XDFConversionLayer().getRegexFileNameFilter(), + new VDFConversionLayer().getRegexFileNameFilter() + }; + + private String[] filterDescr = {".xml", ".Cxx (NCS Expert)", ".xdf (Tuner Pro)", ".vdf|.jdf (Jet Tuner)"}; + private String startDescription; + + public DefinitionFilter() { + startDescription = rb.getString("DESC"); + } + + public boolean accept(File f) { + if (f != null) { + if (f.isDirectory()) { + return true; + } + for (String s : regexFilters) { + if(f.getName().matches(s)) return true; + } + } + return false; + } + + public String getDescription() { + String s = startDescription; + s+=" ("; + + for(int i=0; i < filterDescr.length; i++){ + s+=filterDescr[i]; + + if(i < filterDescr.length - 1) s+=", "; + } + + s+=")"; + return s; + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/swing/DefinitionManager.java b/src/main/java/com/romraider/swing/DefinitionManager.java index 92c7d6ca9..151dbc542 100644 --- a/src/main/java/com/romraider/swing/DefinitionManager.java +++ b/src/main/java/com/romraider/swing/DefinitionManager.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,23 +19,36 @@ package com.romraider.swing; -import java.awt.Font; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.Properties; +import java.util.ResourceBundle; +import java.util.Scanner; import java.util.Vector; -import javax.swing.JFileChooser; -import javax.swing.ListSelectionModel; +import javax.swing.*; +import com.romraider.Settings; import com.romraider.editor.ecu.ECUEditorManager; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; +import com.romraider.xml.ConversionLayer.ConversionLayer; +import com.romraider.xml.ConversionLayer.ConversionLayerFactory; public class DefinitionManager extends javax.swing.JFrame implements ActionListener { private static final long serialVersionUID = -3920843496218196737L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DefinitionManager.class.getName()); public static int MOVE_UP = 0; public static int MOVE_DOWN = 1; + private final Properties props = loadSequences(); Vector fileNames; @@ -55,7 +68,6 @@ public DefinitionManager() { btnMoveDown.addActionListener(this); btnApply.addActionListener(this); btnUndo.addActionListener(this); - } private void initSettings() { @@ -85,81 +97,81 @@ private void initComponents() { btnUndo = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("Definition File Manager"); + setTitle(rb.getString("TITLE")); jScrollPane1.setViewportView(definitionList); - defLabel.setText("ECU Definition File Priority"); + defLabel.setText(rb.getString("FILEPRIORITY")); - btnMoveUp.setText("Move Up"); + btnMoveUp.setText(rb.getString("MOVEUP")); - btnMoveDown.setText("Move Down"); + btnMoveDown.setText(rb.getString("MOVEDOWN")); - btnAddDefinition.setText("Add..."); + btnAddDefinition.setText(rb.getString("ADD")); - btnRemoveDefinition.setText("Remove"); + btnRemoveDefinition.setText(rb.getString("REMOVE")); - btnSave.setText("Save"); + btnSave.setText(rb.getString("SAVE")); - btnCancel.setText("Cancel"); + btnCancel.setText(rb.getString("CANCEL")); - btnApply.setText("Apply"); + btnApply.setText(rb.getString("APPLY")); - btnUndo.setText("Undo"); + btnUndo.setText(rb.getString("UNDO")); - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); + GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(layout.createSequentialGroup() + layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() .addContainerGap() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) - .add(layout.createSequentialGroup() - .add(btnSave) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(btnApply) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(btnUndo) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(btnCancel)) - .add(layout.createSequentialGroup() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(defLabel) - .add(layout.createSequentialGroup() - .add(btnMoveDown) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(btnMoveUp))) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 80, Short.MAX_VALUE) - .add(btnAddDefinition))) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(btnRemoveDefinition))) - .addContainerGap()) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE) + .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(btnSave) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnApply) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnUndo) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnCancel)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(defLabel) + .addGroup(layout.createSequentialGroup() + .addComponent(btnMoveDown) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnMoveUp))) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 80, Short.MAX_VALUE) + .addComponent(btnAddDefinition))) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnRemoveDefinition))) + .addContainerGap()) ); - layout.linkSize(new java.awt.Component[]{btnAddDefinition, btnMoveDown, btnMoveUp, btnRemoveDefinition}, org.jdesktop.layout.GroupLayout.HORIZONTAL); + layout.linkSize(SwingConstants.HORIZONTAL, new Component[]{btnAddDefinition, btnMoveDown, btnMoveUp, btnRemoveDefinition}); layout.setVerticalGroup( - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(layout.createSequentialGroup() - .addContainerGap() - .add(defLabel) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(btnMoveUp) - .add(btnMoveDown) - .add(btnRemoveDefinition, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(btnAddDefinition)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(btnSave) - .add(btnApply) - .add(btnUndo) - .add(btnCancel)) - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(defLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(btnMoveUp) + .addComponent(btnMoveDown) + .addComponent(btnRemoveDefinition, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) + .addComponent(btnAddDefinition)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(btnSave) + .addComponent(btnApply) + .addComponent(btnUndo) + .addComponent(btnCancel)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// //GEN-END:initComponents @@ -208,11 +220,80 @@ public void saveSettings() { } public void addFile() { - JFileChooser fc = new JFileChooser("./"); - fc.setFileFilter(new XMLFilter()); + final Settings settings = SettingsManager.getSettings(); + final JFileChooser fc = new JFileChooser(settings.getLastDefinitionDir()); + fc.setMultiSelectionEnabled(true); + fc.setFileFilter(new DefinitionFilter()); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { - fileNames.add(fc.getSelectedFile().getAbsolutePath()); + for (File f : fc.getSelectedFiles()) { + boolean alreadyAdded = false; + + //Check if it already exists in the list + for (String path : fileNames) { + if (path.equalsIgnoreCase(f.getAbsolutePath())) { + alreadyAdded = true; + break; + } + } + + if (!alreadyAdded) { + //If its a file that needs to be converted sometimes a warning + //should be displayed to the user + if (ConversionLayerFactory.requiresConversionLayer(f)) { + ConversionLayer layer = ConversionLayerFactory.getConversionLayerForFile(f); + + if (layer.getDefinitionPickerInfo() != null) { + JOptionPane.showMessageDialog(null, layer.getDefinitionPickerInfo(), + rb.getString("CONVERSIONTITLE"), JOptionPane.WARNING_MESSAGE); + } + } + } + else { + continue; // selected file(s) for loop + } + + // Try to determine if the selected file is valid, refuse to + // add invalid types. + // File types and search sequences are loaded from a properties file. + if (props.size() > 0) { + String fileType = "RomRaider"; + boolean breakSearch = false; + try { + final Scanner scan = new Scanner(f); + // Scan the file looking for invalid string sequences, + // the value of a properties file key. + while(scan.hasNext()) { + breakSearch = false; + final String line = scan.nextLine().toLowerCase().toString(); + for (Object key : props.keySet()) { + if (line.contains(props.getProperty((String) key))) { + fileType = (String) key; + breakSearch = true; + break; // for loop + } + } + if (breakSearch) break; // while loop + } + scan.close(); + + } catch (FileNotFoundException e) { + // Since the user selected it, it should be found. + e.printStackTrace(); + } + if (!fileType.equalsIgnoreCase("RomRaider")) { + JOptionPane.showMessageDialog(this, MessageFormat.format( + rb.getString("INVALIDMSG"), fileType, f.getName()), + rb.getString("INVALIDFILE"), + JOptionPane.WARNING_MESSAGE); + continue; + } + } + fileNames.add(f.getAbsolutePath()); + + settings.setLastDefinitionDir(f.getParentFile()); + } + updateListModel(); } } @@ -260,4 +341,28 @@ public void updateListModel() { private javax.swing.JScrollPane jScrollPane1; // End of variables declaration//GEN-END:variables + /** + * Load String search sequences from a user customized properties file. + * The file will populate a search list if it is present. + * String search Sequences in the file are in type=sequence sets. + * @exception FileNotFoundException if the directory or file is not present + * @exception IOException if there's some kind of IO error + */ + private Properties loadSequences() { + final Properties sequences = new Properties(); + try { + final FileInputStream propFile = new FileInputStream("./customize/nameSequences.properties"); + sequences.load(propFile); + propFile.close(); + } catch (FileNotFoundException e) { + JOptionPane.showMessageDialog(null, e.getLocalizedMessage(), + "FileNotFoundException", + JOptionPane.ERROR_MESSAGE); + } catch (IOException e) { + JOptionPane.showMessageDialog(null, e.getLocalizedMessage(), + "IOException", + JOptionPane.ERROR_MESSAGE); + } + return sequences; + } } diff --git a/src/main/java/com/romraider/swing/ECUEditorMenuBar.java b/src/main/java/com/romraider/swing/ECUEditorMenuBar.java index 8820cb5be..474c9530b 100644 --- a/src/main/java/com/romraider/swing/ECUEditorMenuBar.java +++ b/src/main/java/com/romraider/swing/ECUEditorMenuBar.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +38,9 @@ import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; +import java.text.MessageFormat; +import java.util.List; +import java.util.ResourceBundle; import javax.swing.ButtonGroup; import javax.swing.JFileChooser; @@ -50,575 +53,617 @@ import com.romraider.Settings; import com.romraider.editor.ecu.ECUEditor; import com.romraider.editor.ecu.ECUEditorManager; +import com.romraider.dataflowSimulation.DataflowSimulation; import com.romraider.maps.Rom; import com.romraider.maps.Table; import com.romraider.net.BrowserControl; import com.romraider.ramtune.test.RamTuneTestApp; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; public class ECUEditorMenuBar extends JMenuBar implements ActionListener { - private static final long serialVersionUID = -4777040428837855236L; - private final JMenu fileMenu = new JMenu("File"); - private final JMenuItem openImage = new JMenuItem("Open Image..."); - private final JMenuItem openImages = new JMenuItem("Open Image(s)..."); - private final JMenuItem saveImage = new JMenuItem("Save Image As..."); - private final JMenuItem saveAsRepository = new JMenuItem("Save Image As Repository..."); - private final JMenuItem refreshImage = new JMenuItem("Refresh Image"); - private final JMenuItem closeImage = new JMenuItem("Close Image"); - private final JMenuItem closeAll = new JMenuItem("Close All Images"); - private final JMenuItem exit = new JMenuItem("Exit"); - - private final JMenu definitionMenu = new JMenu("ECU Definitions"); - private final JMenuItem defManager = new JMenuItem("ECU Definition Manager..."); - private final JMenuItem editDefinition = new JMenuItem("Edit ECU Definitions..."); - private final JMenuItem updateDefinition = new JMenuItem("Get ECU Definitions..."); - - private final JMenu editMenu = new JMenu("Edit"); - private final JMenuItem settings = new JMenuItem(PRODUCT_NAME + " Settings..."); - private final JMenuItem compareImages = new JMenuItem("Compare Images..."); - private final JMenu convertRom = new JMenu("Convert Image"); - private final JMenuItem convertIncrease = new JMenuItem("160KB --> 192KB..."); - private final JMenuItem convertDecrease = new JMenuItem("192KB --> 160KB..."); - private final ButtonGroup convertGroup = new ButtonGroup(); - - private final JMenu viewMenu = new JMenu("View"); - private final JMenuItem romProperties = new JMenuItem("ECU Image Properties"); - private final ButtonGroup levelGroup = new ButtonGroup(); - private final JMenu levelMenu = new JMenu("User Level"); - private final JRadioButtonMenuItem level1 = new JRadioButtonMenuItem("1 Beginner"); - private final JRadioButtonMenuItem level2 = new JRadioButtonMenuItem("2 Intermediate"); - private final JRadioButtonMenuItem level3 = new JRadioButtonMenuItem("3 Advanced"); - private final JRadioButtonMenuItem level4 = new JRadioButtonMenuItem("4 Highest"); - private final JRadioButtonMenuItem level5 = new JRadioButtonMenuItem("5 Debug Mode"); - - private final JMenu loggerMenu = new JMenu("Logger"); - private final JMenuItem openLogger = new JMenuItem("Launch Logger..."); - - private final JMenu ramTuneMenu = new JMenu("SSM"); - private final JMenuItem launchRamTuneTestApp = new JMenuItem("Launch Test App..."); - - private final JMenu helpMenu = new JMenu("Help"); - private final JMenuItem about = new JMenuItem("About " + PRODUCT_NAME); - - public ECUEditorMenuBar() { - // file menu items - add(fileMenu); - fileMenu.setMnemonic('F'); - - fileMenu.add(openImage); - openImage.addActionListener(this); - openImage.setMnemonic('O'); - - //fileMenu.add(openImages); - //openImages.addActionListener(this); - //openImages.setMnemonic('I'); - - fileMenu.add(saveImage); - saveImage.addActionListener(this); - saveImage.setMnemonic('S'); - - fileMenu.add(saveAsRepository); - saveAsRepository.setMnemonic('D'); - saveAsRepository.addActionListener(this); - - fileMenu.add(refreshImage); - refreshImage.addActionListener(this); - refreshImage.setMnemonic('R'); - - fileMenu.add(new JSeparator()); - - fileMenu.add(closeImage); - closeImage.addActionListener(this); - closeImage.setMnemonic('C'); - - //fileMenu.add(closeAll); - //closeAll.addActionListener(this); - //closeAll.setMnemonic('A'); - - fileMenu.add(new JSeparator()); - - fileMenu.add(exit); - exit.addActionListener(this); - exit.setMnemonic('X'); - - // edit menu items - add(editMenu); - editMenu.setMnemonic('E'); - - editMenu.add(settings); - settings.addActionListener(this); - settings.setMnemonic('S'); - - editMenu.add(compareImages); - compareImages.addActionListener(this); - compareImages.setMnemonic('C'); - - editMenu.add(convertRom); - convertRom.setMnemonic('O'); - - convertRom.add(convertIncrease); - convertIncrease.addActionListener(this); - convertIncrease.setMnemonic('I'); - - convertRom.add(convertDecrease); - convertDecrease.addActionListener(this); - convertDecrease.setMnemonic('D'); - - convertGroup.add(convertIncrease); - convertGroup.add(convertDecrease); - - // ecu def menu items - add(definitionMenu); - definitionMenu.setMnemonic('D'); - - definitionMenu.add(defManager); - defManager.addActionListener(this); - defManager.setMnemonic('D'); - - definitionMenu.add(updateDefinition); - updateDefinition.addActionListener(this); - updateDefinition.setMnemonic('U'); - - //definitionMenu.add(editDefinition); - //editDefinition.setMnemonic('E'); - //editDefinition.addActionListener(this); - - // view menu items - add(viewMenu); - viewMenu.setMnemonic('V'); - - viewMenu.add(romProperties); - romProperties.addActionListener(this); - romProperties.setMnemonic('P'); - - viewMenu.add(levelMenu); - levelMenu.setMnemonic('U'); - - levelMenu.add(level1); - level1.addActionListener(this); - level1.setMnemonic('1'); - - levelMenu.add(level2); - level2.addActionListener(this); - level2.setMnemonic('2'); - - levelMenu.add(level3); - level3.addActionListener(this); - level3.setMnemonic('3'); - - levelMenu.add(level4); - level4.addActionListener(this); - level4.setMnemonic('4'); - - levelMenu.add(level5); - level5.addActionListener(this); - level5.setMnemonic('5'); - - levelGroup.add(level1); - levelGroup.add(level2); - levelGroup.add(level3); - levelGroup.add(level4); - levelGroup.add(level5); - - // select correct userlevel button - if (getSettings().getUserLevel() == 1) { - level1.setSelected(true); - } else if (getSettings().getUserLevel() == 2) { - level2.setSelected(true); - } else if (getSettings().getUserLevel() == 3) { - level3.setSelected(true); - } else if (getSettings().getUserLevel() == 4) { - level4.setSelected(true); - } else if (getSettings().getUserLevel() == 5) { - level5.setSelected(true); - } - - // logger menu items - add(loggerMenu); - loggerMenu.setMnemonic('L'); - - loggerMenu.add(openLogger); - openLogger.addActionListener(this); - openLogger.setMnemonic('O'); - - // ramtune menu items - add(ramTuneMenu); - ramTuneMenu.setMnemonic('R'); - - ramTuneMenu.add(launchRamTuneTestApp); - launchRamTuneTestApp.addActionListener(this); - launchRamTuneTestApp.setMnemonic('L'); - - // help menu items - add(helpMenu); - helpMenu.setMnemonic('H'); - - helpMenu.add(about); - about.addActionListener(this); - about.setMnemonic('A'); - - updateMenu(); - } - - public void updateMenu() { - String file = getLastSelectedRomFileName(); - if ("".equals(file)) { - saveImage.setEnabled(false); - saveAsRepository.setEnabled(false); - closeImage.setEnabled(false); - //closeAll.setEnabled(false); - romProperties.setEnabled(false); - saveImage.setText("Save As..."); - saveAsRepository.setText("Save As Repository..."); - compareImages.setEnabled(false); - convertRom.setEnabled(false); - } else { - saveImage.setEnabled(true); - saveAsRepository.setEnabled(true); - closeImage.setEnabled(true); - //closeAll.setEnabled(true); - romProperties.setEnabled(true); - saveImage.setText("Save " + file + " As..."); - saveAsRepository.setText("Save "+ file +" As Repository..."); - compareImages.setEnabled(true); - convertRom.setEnabled(true); - } - refreshImage.setText("Refresh " + file); - closeImage.setText("Close " + file); - romProperties.setText(file + "Properties"); - - int lastSelectedRomSize = 0; - Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom(); - if(null != lastSelectedRom) { - lastSelectedRomSize = lastSelectedRom.getRealFileSize(); - } - - if(Settings.SIXTEENBIT_SMALL_SIZE == lastSelectedRomSize) { - convertIncrease.setEnabled(true); - convertDecrease.setEnabled(false); - } else if (Settings.SIXTEENBIT_LARGE_SIZE == lastSelectedRomSize) { - convertIncrease.setEnabled(false); - convertDecrease.setEnabled(true); - } else { - convertIncrease.setEnabled(false); - convertDecrease.setEnabled(false); - } - - openImages.setEnabled(false); - editDefinition.setEnabled(false); - revalidate(); - } - - @Override - public void actionPerformed(ActionEvent e) { - ECUEditor parent = ECUEditorManager.getECUEditor(); - if (e.getSource() == openImage) { - try { - openImageDialog(); - } catch (Exception ex) { - showMessageDialog(parent, - new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE); - } - - } else if (e.getSource() == openImages) { - try { - openImagesDialog(); - } catch (Exception ex) { - showMessageDialog(parent, - new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE); - } - - } else if (e.getSource() == saveImage) { - try { - this.saveImage(); - } catch (Exception ex) { - showMessageDialog(parent, - new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE); - } - } else if (e.getSource() == saveAsRepository) { - try { - this.saveAsRepository(); - } catch(Exception ex) { - showMessageDialog(parent, - new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE); - } - } else if (e.getSource() == closeImage) { - parent.closeImage(); - - } else if (e.getSource() == closeAll) { - parent.closeAllImages(); - - } else if (e.getSource() == exit) { - parent.handleExit(); - System.exit(0); - - } else if (e.getSource() == romProperties) { - showMessageDialog(parent, new RomPropertyPanel(parent.getLastSelectedRom()), - parent.getLastSelectedRom().getRomIDString() + " Properties", INFORMATION_MESSAGE); - - } else if (e.getSource() == refreshImage) { - try { - refreshImage(); - } catch (Exception ex) { - showMessageDialog(parent, new DebugPanel(ex, - getSettings().getSupportURL()), "Exception", ERROR_MESSAGE); - } - - } else if (e.getSource() == settings) { - SettingsForm form = new SettingsForm(); - form.setLocationRelativeTo(parent); - form.setVisible(true); - - } else if (e.getSource() == compareImages){ - CompareImagesForm form = new CompareImagesForm(parent.getImages(), parent.getIconImage()); - form.setLocationRelativeTo(parent); - form.setVisible(true); - - } else if (e.getSource() == convertIncrease) { - try { - increaseRomSize(); - refreshImage(); - } catch (Exception ex) { - showMessageDialog(parent, - new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE); - } - - } else if (e.getSource() == convertDecrease) { - try { - decreaseRomSize(); - refreshImage(); - } catch (Exception ex) { - showMessageDialog(parent, - new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE); - } - - } else if (e.getSource() == defManager) { - DefinitionManager form = new DefinitionManager(); - form.setLocationRelativeTo(parent); - form.setVisible(true); - - } else if (e.getSource() == level1) { - parent.setUserLevel(1); - - } else if (e.getSource() == level2) { - parent.setUserLevel(2); - - } else if (e.getSource() == level3) { - parent.setUserLevel(3); - - } else if (e.getSource() == level4) { - parent.setUserLevel(4); - - } else if (e.getSource() == level5) { - parent.setUserLevel(5); - - } else if (e.getSource() == openLogger) { - parent.launchLogger(); - } else if (e.getSource() == updateDefinition) { - BrowserControl.displayURL(ECU_DEFS_URL); - - } else if (e.getSource() == launchRamTuneTestApp) { - RamTuneTestApp.startTestApp(DISPOSE_ON_CLOSE); - - } else if (e.getSource() == about) { - //TODO: change this to use com.romraider.swing.menubar.action.AboutAction - String message = PRODUCT_NAME + " - ECU Editor\n" - + "Version: " + VERSION + "\n" - + "Build #: " + BUILDNUMBER + "\n" - + SUPPORT_URL; - String title = "About " + PRODUCT_NAME; - showMessageDialog(parent, message, title, INFORMATION_MESSAGE, ABOUT_ICON); - } - } - - public void refreshImage() throws Exception { - ECUEditor parent = ECUEditorManager.getECUEditor(); - if (parent.getLastSelectedRom() != null) { - File file = parent.getLastSelectedRom().getFullFileName(); - parent.closeImage(); - parent.openImage(file); - } - } - - public void openImageDialog() throws Exception { - ECUEditor parent = ECUEditorManager.getECUEditor(); - JFileChooser fc = new JFileChooser(SettingsManager.getSettings().getLastImageDir()); - fc.setFileFilter(new ECUImageFilter()); - fc.setDialogTitle("Open Image"); - - if (fc.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) { - parent.openImage(fc.getSelectedFile()); - SettingsManager.getSettings().setLastImageDir(fc.getCurrentDirectory()); - } - } - - public void openImagesDialog() throws Exception { - ECUEditor parent = ECUEditorManager.getECUEditor(); - JFileChooser fc = new JFileChooser(getSettings().getLastImageDir()); - fc.setFileFilter(new ECUImageFilter()); - fc.setMultiSelectionEnabled(true); - fc.setDialogTitle("Open Image(s)"); - - if(fc.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) { - parent.openImages(fc.getSelectedFiles()); - SettingsManager.getSettings().setLastImageDir(fc.getCurrentDirectory()); - } - } - - public void saveImage() throws Exception { - Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom(); - if (lastSelectedRom != null) { - File selectedFile = getImageOutputFile(); - if(null != selectedFile){ - byte[] output = lastSelectedRom.saveFile(); - this.writeImage(output, selectedFile); - } - } - } - - private File getImageOutputFile() throws Exception { - ECUEditor parent = ECUEditorManager.getECUEditor(); - JFileChooser fc = new JFileChooser(SettingsManager.getSettings().getLastImageDir()); - fc.setFileFilter(new ECUImageFilter()); - if (fc.showSaveDialog(parent) == JFileChooser.APPROVE_OPTION) { - File selectedFile = fc.getSelectedFile(); - if (selectedFile.exists()) { - int option = showConfirmDialog(parent, selectedFile.getName() + " already exists! Overwrite?"); - - // option: 0 = Cancel, 1 = No - if (option == CANCEL_OPTION || option == 1) { - return null; - } - } - return selectedFile; - } - return null; - } - - private void writeImage(byte[] output, File selectedFile) throws Exception { - ECUEditor parent = ECUEditorManager.getECUEditor(); - FileOutputStream fos = new FileOutputStream(selectedFile); - try { - fos.write(output); - } finally { - fos.close(); - } - parent.getLastSelectedRom().setFullFileName(selectedFile.getAbsoluteFile()); - parent.setLastSelectedRom(parent.getLastSelectedRom()); - SettingsManager.getSettings().setLastImageDir(selectedFile.getParentFile()); - } - - private File getRepositoryOutputDir() { - JFileChooser fc = new JFileChooser(); - fc.setCurrentDirectory(getSettings().getLastRepositoryDir()); - fc.setDialogTitle("Select Repository Directory"); - fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - - // disable the "All files" option - fc.setAcceptAllFileFilterUsed(false); - - if (fc.showSaveDialog(ECUEditorManager.getECUEditor()) == JFileChooser.APPROVE_OPTION) { - File selectedDir = fc.getSelectedFile(); - if (selectedDir.exists()) { - int option = showConfirmDialog(ECUEditorManager.getECUEditor(), selectedDir.getName() + " already exists! Overwrite?"); - - // option: 0 = Cancel, 1 = No - if (option == CANCEL_OPTION || option == 1) { - return null; - } - } - return selectedDir; - } - return null; - } - - private void saveAsRepository() throws Exception { - File selectedDir = getRepositoryOutputDir(); - String separator = System.getProperty("file.separator"); - - if(null != selectedDir) { - for(TableTreeNode treeNode : ECUEditorManager.getECUEditor().getLastSelectedRom().getTableNodes()) - { - Table table = treeNode.getTable(); - String category = table.getCategory(); - String tableName = table.getName(); - String tableDirString = selectedDir.getAbsolutePath() + separator + category; - File tableDir = new File(tableDirString.replace('/', '-')); - tableDir.mkdirs(); - String tableFileString = tableDir.getAbsolutePath() + separator + tableName+".txt"; - File tableFile = new File(tableFileString.replace('/', '-')); - - if(tableFile.exists()) - { - tableFile.delete(); - } - - tableFile.createNewFile(); - StringBuffer tableData = table.getTableAsString(); - BufferedWriter out = new BufferedWriter(new FileWriter(tableFile)); - try { - out.write(tableData.toString()); - } finally { - try { - out.close(); - } catch(Exception ex) { - ;// Do Nothing. - } - } - } - getSettings().setLastRepositoryDir(selectedDir); - } - } - - private void increaseRomSize() throws Exception{ - Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom(); - if (lastSelectedRom != null) { - File selectedFile = getImageOutputFile(); - if(null != selectedFile){ - if(lastSelectedRom.getRealFileSize() != Settings.SIXTEENBIT_SMALL_SIZE) - { - showMessageDialog(ECUEditorManager.getECUEditor(), "Error converting image. Image size is invalid."); - } else { - byte[] output = lastSelectedRom.saveFile(); - byte[] incOutput = new byte[Settings.SIXTEENBIT_LARGE_SIZE]; - System.arraycopy(output, 0, incOutput, 0, Settings.SIXTEENBIT_START_ADDRESS); - System.arraycopy(output, Settings.SIXTEENBIT_START_ADDRESS, incOutput, Settings.SIXTEENBIT_END_ADDRESS, Settings.SIXTEENBIT_SEGMENT_SIZE); - for(int i = Settings.SIXTEENBIT_START_ADDRESS; i < Settings.SIXTEENBIT_END_ADDRESS; i++) { - // Fill space. - incOutput[i] = Settings.SIXTEENBIT_SEGMENT_VALUE; - } - this.writeImage(incOutput, selectedFile); - } - } - } - } - - private void decreaseRomSize() throws Exception { - Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom(); - if (lastSelectedRom != null) { - File selectedFile = getImageOutputFile(); - if(null != selectedFile){ - if(lastSelectedRom.getRealFileSize() != Settings.SIXTEENBIT_LARGE_SIZE) - { - showMessageDialog(ECUEditorManager.getECUEditor(), "Error converting image. Image size is invalid."); - } else { - byte[] output =lastSelectedRom.saveFile(); - byte[] decOutput = new byte[Settings.SIXTEENBIT_SMALL_SIZE]; - System.arraycopy(output, 0, decOutput, 0, Settings.SIXTEENBIT_START_ADDRESS); - System.arraycopy(output, Settings.SIXTEENBIT_END_ADDRESS, decOutput, Settings.SIXTEENBIT_START_ADDRESS, Settings.SIXTEENBIT_SEGMENT_SIZE); - this.writeImage(decOutput, selectedFile); - } - } - } - } - - private String getLastSelectedRomFileName() { - Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom(); - return lastSelectedRom == null ? "" : lastSelectedRom.getFileName() + " "; - } - - private Settings getSettings() { - return SettingsManager.getSettings(); - } + private static final long serialVersionUID = -4777040428837855236L; + private static final ResourceBundle rb = new ResourceUtil().getBundle(ECUEditorMenuBar.class.getName()); + private final JMenu fileMenu = new JMenu(rb.getString("FILE")); + private final JMenuItem openImage = new JMenuItem(rb.getString("OPENIMG")); + private final JMenuItem quickSaveImage = new JMenuItem(rb.getString("SAVE")); + private final JMenuItem saveImage = new JMenuItem(rb.getString("SAVEAS")); + private final JMenuItem saveAsRepository = new JMenuItem(rb.getString("SAVEREPO")); + private final JMenuItem refreshImage = new JMenuItem(rb.getString("REFRESH")); + private final JMenuItem closeImage = new JMenuItem(rb.getString("CLOSE")); + private final JMenuItem closeAll = new JMenuItem(rb.getString("CLOSEALL")); + private final JMenuItem exit = new JMenuItem(rb.getString("EXIT")); + private final JMenuItem exportDef = new JMenuItem(rb.getString("EXPORTDEF")); + + private final JMenu definitionMenu = new JMenu(rb.getString("ECUDEF")); + private final JMenuItem defManager = new JMenuItem(rb.getString("ECUDEFMAN")); + private final JMenuItem editDefinition = new JMenuItem(rb.getString("EDITDEF")); + private final JMenuItem updateDefinition = new JMenuItem(rb.getString("GETDEF")); + + private final JMenu editMenu = new JMenu(rb.getString("EDIT")); + private final JMenuItem settings = new JMenuItem(MessageFormat.format(rb.getString("SETTINGS"), PRODUCT_NAME)); + private final JMenuItem compareImages = new JMenuItem(rb.getString("COMPARE")); + private final JMenu convertRom = new JMenu(rb.getString("CONVERT")); + private final JMenuItem convertIncrease = new JMenuItem(rb.getString("ONE60")); + private final JMenuItem convertDecrease = new JMenuItem(rb.getString("ONE92")); + private final ButtonGroup convertGroup = new ButtonGroup(); + + private final JMenu viewMenu = new JMenu(rb.getString("VIEW")); + private final JMenuItem romProperties = new JMenuItem(rb.getString("PROPERTIES")); + private final ButtonGroup levelGroup = new ButtonGroup(); + private final JMenu levelMenu = new JMenu(rb.getString("USERLVL")); + private final JRadioButtonMenuItem level1 = new JRadioButtonMenuItem(rb.getString("BEGIN")); + private final JRadioButtonMenuItem level2 = new JRadioButtonMenuItem(rb.getString("INTER")); + private final JRadioButtonMenuItem level3 = new JRadioButtonMenuItem(rb.getString("ADVND")); + private final JRadioButtonMenuItem level4 = new JRadioButtonMenuItem(rb.getString("HIGH")); + private final JRadioButtonMenuItem level5 = new JRadioButtonMenuItem(rb.getString("DEBUG")); + + private final JMenu loggerMenu = new JMenu(rb.getString("LOGGER")); + private final JMenuItem openLogger = new JMenuItem(rb.getString("LLOGGER")); + + private final JMenu toolMenu = new JMenu(rb.getString("TOOLS")); + private final JMenuItem launchRamTuneTestApp = new JMenuItem(rb.getString("TESTAPP")); + private final JMenuItem launchDataflowViews = new JMenu(rb.getString("DATAFLOW")); + + private final JMenu helpMenu = new JMenu(rb.getString("HELP")); + private final JMenuItem about = new JMenuItem(MessageFormat.format(rb.getString("ABOUT"), PRODUCT_NAME)); + + public ECUEditorMenuBar() { + // file menu items + add(fileMenu); + fileMenu.setMnemonic('F'); + + fileMenu.add(openImage); + openImage.addActionListener(this); + openImage.setMnemonic('O'); + + fileMenu.add(saveImage); + saveImage.addActionListener(this); + saveImage.setMnemonic('S'); + + fileMenu.add(saveAsRepository); + saveAsRepository.setMnemonic('D'); + saveAsRepository.addActionListener(this); + + fileMenu.add(quickSaveImage); + quickSaveImage.addActionListener(this); + quickSaveImage.setMnemonic('q'); + + fileMenu.add(refreshImage); + refreshImage.addActionListener(this); + refreshImage.setMnemonic('R'); + + fileMenu.add(new JSeparator()); + + fileMenu.add(exportDef); + exportDef.addActionListener(this); + // exportDef.setMnemonic('C'); + fileMenu.add(new JSeparator()); + + fileMenu.add(closeImage); + closeImage.addActionListener(this); + closeImage.setMnemonic('C'); + + // fileMenu.add(closeAll); + // closeAll.addActionListener(this); + // closeAll.setMnemonic('A'); + + fileMenu.add(new JSeparator()); + + fileMenu.add(exit); + exit.addActionListener(this); + exit.setMnemonic('X'); + + // edit menu items + add(editMenu); + editMenu.setMnemonic('E'); + + editMenu.add(settings); + settings.addActionListener(this); + settings.setMnemonic('S'); + + editMenu.add(compareImages); + compareImages.addActionListener(this); + compareImages.setMnemonic('C'); + + editMenu.add(convertRom); + convertRom.setMnemonic('O'); + + convertRom.add(convertIncrease); + convertIncrease.addActionListener(this); + convertIncrease.setMnemonic('I'); + + convertRom.add(convertDecrease); + convertDecrease.addActionListener(this); + convertDecrease.setMnemonic('D'); + + convertGroup.add(convertIncrease); + convertGroup.add(convertDecrease); + + // ecu def menu items + add(definitionMenu); + definitionMenu.setMnemonic('D'); + + definitionMenu.add(defManager); + defManager.addActionListener(this); + defManager.setMnemonic('D'); + + definitionMenu.add(updateDefinition); + updateDefinition.addActionListener(this); + updateDefinition.setMnemonic('U'); + + // definitionMenu.add(editDefinition); + // editDefinition.setMnemonic('E'); + // editDefinition.addActionListener(this); + + // view menu items + add(viewMenu); + viewMenu.setMnemonic('V'); + + viewMenu.add(romProperties); + romProperties.addActionListener(this); + romProperties.setMnemonic('P'); + + viewMenu.add(levelMenu); + levelMenu.setMnemonic('U'); + + levelMenu.add(level1); + level1.addActionListener(this); + level1.setMnemonic('1'); + + levelMenu.add(level2); + level2.addActionListener(this); + level2.setMnemonic('2'); + + levelMenu.add(level3); + level3.addActionListener(this); + level3.setMnemonic('3'); + + levelMenu.add(level4); + level4.addActionListener(this); + level4.setMnemonic('4'); + + levelMenu.add(level5); + level5.addActionListener(this); + level5.setMnemonic('5'); + + levelGroup.add(level1); + levelGroup.add(level2); + levelGroup.add(level3); + levelGroup.add(level4); + levelGroup.add(level5); + + // select correct userlevel button + if (getSettings().getUserLevel() == 1) { + level1.setSelected(true); + } else if (getSettings().getUserLevel() == 2) { + level2.setSelected(true); + } else if (getSettings().getUserLevel() == 3) { + level3.setSelected(true); + } else if (getSettings().getUserLevel() == 4) { + level4.setSelected(true); + } else if (getSettings().getUserLevel() == 5) { + level5.setSelected(true); + } + + // logger menu items + add(loggerMenu); + loggerMenu.setMnemonic('L'); + + loggerMenu.add(openLogger); + openLogger.addActionListener(this); + openLogger.setMnemonic('O'); + + // ramtune menu items + add(toolMenu); + toolMenu.setMnemonic('R'); + + toolMenu.add(launchRamTuneTestApp); + launchRamTuneTestApp.addActionListener(this); + launchRamTuneTestApp.setMnemonic('L'); + + toolMenu.add(launchDataflowViews); + + // help menu items + add(helpMenu); + helpMenu.setMnemonic('H'); + + helpMenu.add(about); + about.addActionListener(this); + about.setMnemonic('A'); + + updateMenu(); + } + + public void updateMenu() { + Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom(); + String file = lastSelectedRom == null ? "" : lastSelectedRom.getFileName(); + + if ("".equals(file)) { + quickSaveImage.setEnabled(false); + saveImage.setEnabled(false); + saveAsRepository.setEnabled(false); + exportDef.setEnabled(false); + closeImage.setEnabled(false); + // closeAll.setEnabled(false); + romProperties.setEnabled(false); + quickSaveImage.setText(MessageFormat.format(rb.getString("SAVE"), file)); + saveImage.setText(rb.getString("SAVEAS")); + saveAsRepository.setText(rb.getString("SAVEREPO")); + exportDef.setText(rb.getString("EXPORTDEFF")); + compareImages.setEnabled(false); + convertRom.setEnabled(false); + } else { + saveImage.setEnabled(true); + quickSaveImage.setEnabled(true); + saveAsRepository.setEnabled(true); + closeImage.setEnabled(true); + exportDef.setEnabled(true); + // closeAll.setEnabled(true); + romProperties.setEnabled(true); + quickSaveImage.setText(MessageFormat.format(rb.getString("QUICKSAVE"), file)); + saveImage.setText(MessageFormat.format(rb.getString("SAVEFAS"), file)); + saveAsRepository.setText(MessageFormat.format(rb.getString("SAVEFREPO"), file)); + exportDef.setText(MessageFormat.format(rb.getString("EXPORTDEF"), file)); + compareImages.setEnabled(true); + convertRom.setEnabled(true); + } + refreshImage.setText(MessageFormat.format(rb.getString("REFRESHF"), file)); + closeImage.setText(MessageFormat.format(rb.getString("CLOSEF"), file)); + romProperties.setText(MessageFormat.format(rb.getString("PROPERTIESF"), file)); + + updateDataflowSimulations(lastSelectedRom); + int lastSelectedRomSize = 0; + if (null != lastSelectedRom) { + lastSelectedRomSize = lastSelectedRom.getRealFileSize(); + } + + if (Settings.SIXTEENBIT_SMALL_SIZE == lastSelectedRomSize) { + convertIncrease.setEnabled(true); + convertDecrease.setEnabled(false); + } else if (Settings.SIXTEENBIT_LARGE_SIZE == lastSelectedRomSize) { + convertIncrease.setEnabled(false); + convertDecrease.setEnabled(true); + } else { + convertIncrease.setEnabled(false); + convertDecrease.setEnabled(false); + } + + editDefinition.setEnabled(false); + revalidate(); + } + + @Override + public void actionPerformed(ActionEvent e) { + ECUEditor parent = ECUEditorManager.getECUEditor(); + if (e.getSource() == openImage) { + try { + openImageDialog(); + } catch (Exception ex) { + showMessageDialog(parent, new DebugPanel(ex, getSettings().getSupportURL()), rb.getString("EXCEPTN"), + ERROR_MESSAGE); + } + } else if (e.getSource() == saveImage) { + try { + this.saveImage(false); + } catch (Exception ex) { + showMessageDialog(parent, new DebugPanel(ex, getSettings().getSupportURL()), rb.getString("EXCEPTN"), + ERROR_MESSAGE); + } + } else if (e.getSource() == quickSaveImage) { + try { + this.saveImage(true); + } catch (Exception ex) { + showMessageDialog(parent, new DebugPanel(ex, getSettings().getSupportURL()), rb.getString("EXCEPTN"), + ERROR_MESSAGE); + } + } else if (e.getSource() == saveAsRepository) { + try { + this.saveAsRepository(); + } catch (Exception ex) { + showMessageDialog(parent, new DebugPanel(ex, getSettings().getSupportURL()), rb.getString("EXCEPTN"), + ERROR_MESSAGE); + } + } else if (e.getSource() == closeImage) { + parent.closeImage(); + } else if (e.getSource() == closeAll) { + parent.closeAllImages(); + } else if (e.getSource() == exportDef) { + parent.handleExportDefinition(); + } else if (e.getSource() == exit) { + parent.handleExit(); + System.exit(0); + + } else if (e.getSource() == romProperties) { + showMessageDialog(parent, new RomPropertyPanel(parent.getLastSelectedRom()), + MessageFormat.format(rb.getString("PROPERTIESF"), parent.getLastSelectedRom().getRomIDString()), + INFORMATION_MESSAGE); + + } else if (e.getSource() == refreshImage) { + try { + refreshImage(); + } catch (Exception ex) { + showMessageDialog(parent, new DebugPanel(ex, getSettings().getSupportURL()), rb.getString("EXCEPTN"), + ERROR_MESSAGE); + } + + } else if (e.getSource() == settings) { + SettingsForm form = new SettingsForm(); + form.setLocationRelativeTo(parent); + form.setVisible(true); + + } else if (e.getSource() == compareImages) { + CompareImagesForm form = new CompareImagesForm(parent.getImages(), parent.getIconImage()); + form.setLocationRelativeTo(parent); + form.setVisible(true); + + } else if (e.getSource() == convertIncrease) { + try { + increaseRomSize(); + refreshImage(); + } catch (Exception ex) { + showMessageDialog(parent, new DebugPanel(ex, getSettings().getSupportURL()), rb.getString("EXCEPTN"), + ERROR_MESSAGE); + } + + } else if (e.getSource() == convertDecrease) { + try { + decreaseRomSize(); + refreshImage(); + } catch (Exception ex) { + showMessageDialog(parent, new DebugPanel(ex, getSettings().getSupportURL()), rb.getString("EXCEPTN"), + ERROR_MESSAGE); + } + + } else if (e.getSource() == defManager) { + DefinitionManager form = new DefinitionManager(); + form.setLocationRelativeTo(parent); + form.setVisible(true); + + } else if (e.getSource() == level1) { + parent.setUserLevel(1); + + } else if (e.getSource() == level2) { + parent.setUserLevel(2); + + } else if (e.getSource() == level3) { + parent.setUserLevel(3); + + } else if (e.getSource() == level4) { + parent.setUserLevel(4); + + } else if (e.getSource() == level5) { + parent.setUserLevel(5); + + } else if (e.getSource() == openLogger) { + parent.launchLogger(); + } else if (e.getSource() == updateDefinition) { + BrowserControl.displayURL(ECU_DEFS_URL); + + } else if (e.getSource() == launchRamTuneTestApp) { + RamTuneTestApp.startTestApp(DISPOSE_ON_CLOSE); + } else if (e.getSource() == about) { + showMessageDialog(parent, + MessageFormat.format(rb.getString("ABOUTMSG"), PRODUCT_NAME, VERSION, BUILDNUMBER, SUPPORT_URL, + System.getProperty("java.vendor"), System.getProperty("java.runtime.version"), + System.getProperty("os.arch")), + MessageFormat.format(rb.getString("ABOUT"), PRODUCT_NAME), INFORMATION_MESSAGE, ABOUT_ICON); + } + } + + private void updateDataflowSimulations(Rom rom) { + launchDataflowViews.removeAll(); + if (rom == null) { + launchDataflowViews.setEnabled(false); + } else { + List sims = rom.getSimulations(); + if (sims.isEmpty()) { + launchDataflowViews.setEnabled(false); + } else { + launchDataflowViews.setEnabled(true); + for (final DataflowSimulation sim : sims) { + JMenuItem item = new JMenuItem(sim.getName()); + item.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + DataflowFrame.openWindow(sim); + } + }); + launchDataflowViews.add(item); + } + } + } + } + + public void refreshImage() throws Exception { + ECUEditor parent = ECUEditorManager.getECUEditor(); + if (parent.getLastSelectedRom() != null) { + File file = parent.getLastSelectedRom().getFullFileName(); + parent.closeImage(); + parent.openImage(file); + } + } + + public void openImageDialog() throws Exception { + ECUEditor parent = ECUEditorManager.getECUEditor(); + JFileChooser fc = new JFileChooser(SettingsManager.getSettings().getLastImageDir()); + fc.setFileFilter(new ECUImageFilter()); + fc.setMultiSelectionEnabled(true); + fc.setDialogTitle(rb.getString("OPENIMG")); + + if (fc.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) { + parent.openImages(fc.getSelectedFiles()); + SettingsManager.getSettings().setLastImageDir(fc.getCurrentDirectory()); + } + } + + public void saveImage(boolean quickSave) throws Exception { + Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom(); + if (lastSelectedRom != null) { + + File selectedFile = lastSelectedRom.getFullFileName(); + if (!quickSave) + selectedFile = getImageOutputFile(); + + if (null != selectedFile) { + byte[] output = lastSelectedRom.saveFile(); + this.writeImage(output, selectedFile); + } + } + } + + private File getImageOutputFile() throws Exception { + ECUEditor parent = ECUEditorManager.getECUEditor(); + + JFileChooser fc = new JFileChooser(SettingsManager.getSettings().getLastImageDir()); + fc.setFileFilter(new ECUImageFilter()); + if (fc.showSaveDialog(parent) == JFileChooser.APPROVE_OPTION) { + File selectedFile = fc.getSelectedFile(); + + // Append suffix if user didn't set anything + if (!selectedFile.getName().contains(".")) { + Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom(); + String lastFile = lastSelectedRom.getFileName().toLowerCase(); + String format = ".bin"; + if (lastFile.endsWith(".hex")) + format = ".hex"; + selectedFile = new File(selectedFile + format); + } + + if (selectedFile.exists()) { + int option = showConfirmDialog(parent, + MessageFormat.format(rb.getString("OVERWRITE"), selectedFile.getName())); + + // option: 0 = Cancel, 1 = No + if (option == CANCEL_OPTION || option == 1) { + return null; + } + } + + return selectedFile; + } + return null; + } + + private void writeImage(byte[] output, File selectedFile) throws Exception { + ECUEditor parent = ECUEditorManager.getECUEditor(); + FileOutputStream fos = new FileOutputStream(selectedFile); + try { + fos.write(output); + } finally { + fos.close(); + } + parent.getLastSelectedRom().setFullFileName(selectedFile.getAbsoluteFile()); + parent.setLastSelectedRom(parent.getLastSelectedRom()); + SettingsManager.getSettings().setLastImageDir(selectedFile.getParentFile()); + } + + private File getRepositoryOutputDir() { + JFileChooser fc = new JFileChooser(); + fc.setCurrentDirectory(getSettings().getLastRepositoryDir()); + fc.setDialogTitle(rb.getString("SELECTDIR")); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + // disable the "All files" option + fc.setAcceptAllFileFilterUsed(false); + + if (fc.showSaveDialog(ECUEditorManager.getECUEditor()) == JFileChooser.APPROVE_OPTION) { + File selectedDir = fc.getSelectedFile(); + if (selectedDir.exists()) { + int option = showConfirmDialog(ECUEditorManager.getECUEditor(), + MessageFormat.format(rb.getString("OVERWRITE"), selectedDir.getName())); + + // option: 0 = Cancel, 1 = No + if (option == CANCEL_OPTION || option == 1) { + return null; + } + } + return selectedDir; + } + return null; + } + + private void saveAsRepository() throws Exception { + File selectedDir = getRepositoryOutputDir(); + String separator = System.getProperty("file.separator"); + + if (null != selectedDir) { + for (TableTreeNode treeNode : ECUEditorManager.getECUEditor().getLastSelectedRom().getTableNodes() + .values()) { + Table table = treeNode.getTable(); + String category = table.getCategory(); + String tableName = table.getName(); + String tableDirString = selectedDir.getAbsolutePath() + separator + category; + File tableDir = new File(tableDirString.replace('/', '-')); + tableDir.mkdirs(); + String tableFileString = tableDir.getAbsolutePath() + separator + tableName + ".txt"; + File tableFile = new File(tableFileString.replace('/', '-')); + + if (tableFile.exists()) { + tableFile.delete(); + } + + tableFile.createNewFile(); + StringBuffer tableData = table.getTableAsString(); + BufferedWriter out = new BufferedWriter(new FileWriter(tableFile)); + try { + out.write(tableData.toString()); + } finally { + try { + out.close(); + } catch (Exception ex) { + // Do Nothing. + } + } + } + getSettings().setLastRepositoryDir(selectedDir); + } + } + + private void increaseRomSize() throws Exception { + Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom(); + if (lastSelectedRom != null) { + File selectedFile = getImageOutputFile(); + if (null != selectedFile) { + if (lastSelectedRom.getRealFileSize() != Settings.SIXTEENBIT_SMALL_SIZE) { + showMessageDialog(ECUEditorManager.getECUEditor(), rb.getString("CONVERTERR")); + } else { + byte[] output = lastSelectedRom.saveFile(); + byte[] incOutput = new byte[Settings.SIXTEENBIT_LARGE_SIZE]; + System.arraycopy(output, 0, incOutput, 0, Settings.SIXTEENBIT_START_ADDRESS); + System.arraycopy(output, Settings.SIXTEENBIT_START_ADDRESS, incOutput, + Settings.SIXTEENBIT_END_ADDRESS, Settings.SIXTEENBIT_SEGMENT_SIZE); + for (int i = Settings.SIXTEENBIT_START_ADDRESS; i < Settings.SIXTEENBIT_END_ADDRESS; i++) { + // Fill space. + incOutput[i] = Settings.SIXTEENBIT_SEGMENT_VALUE; + } + this.writeImage(incOutput, selectedFile); + } + } + } + } + + private void decreaseRomSize() throws Exception { + Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom(); + if (lastSelectedRom != null) { + File selectedFile = getImageOutputFile(); + if (null != selectedFile) { + if (lastSelectedRom.getRealFileSize() != Settings.SIXTEENBIT_LARGE_SIZE) { + showMessageDialog(ECUEditorManager.getECUEditor(), rb.getString("CONVERTERR")); + } else { + byte[] output = lastSelectedRom.saveFile(); + byte[] decOutput = new byte[Settings.SIXTEENBIT_SMALL_SIZE]; + System.arraycopy(output, 0, decOutput, 0, Settings.SIXTEENBIT_START_ADDRESS); + System.arraycopy(output, Settings.SIXTEENBIT_END_ADDRESS, decOutput, + Settings.SIXTEENBIT_START_ADDRESS, Settings.SIXTEENBIT_SEGMENT_SIZE); + this.writeImage(decOutput, selectedFile); + } + } + } + } + + private Settings getSettings() { + return SettingsManager.getSettings(); + } } \ No newline at end of file diff --git a/src/main/java/com/romraider/swing/ECUEditorNumberField.java b/src/main/java/com/romraider/swing/ECUEditorNumberField.java new file mode 100644 index 000000000..9b3fb65df --- /dev/null +++ b/src/main/java/com/romraider/swing/ECUEditorNumberField.java @@ -0,0 +1,81 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2017 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.swing; + +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.text.DecimalFormat; +import javax.swing.JFormattedTextField; + +import com.romraider.util.NumberUtil; + +public class ECUEditorNumberField extends JFormattedTextField { + private static final long serialVersionUID = 4756399956045598977L; + + static DecimalFormat format = new DecimalFormat("#.####"); + + public ECUEditorNumberField(){ + super(format); + + format.setMinimumFractionDigits(0); + format.setMaximumFractionDigits(4); + + this.addKeyListener(new KeyListener(){ + + public void keyTyped(KeyEvent e) { + char c = e.getKeyChar(); + + //Get separator for the defined locale + char seperator = NumberUtil.getSeperator(); + + //Replace , with . or vice versa + if ((c == ',' || c == '.') && seperator != c) + e.setKeyChar(seperator); + + ECUEditorNumberField field = ECUEditorNumberField.this; + + String textValue = field.getText(); + int dotCount = textValue.length() - textValue.replace(seperator + "", "").length(); + + //Only allow one dot + if(e.getKeyChar() == seperator && (dotCount == 0 || field.getSelectionStart() == 0)) return; + + //Only one dash allowed at the start + else if(e.getKeyChar()== '-' && (field.getCaretPosition() == 0 || field.getSelectionStart() == 0)) return; + + //Only allow numbers + else if(c >= '0' && c <= '9') return; + + //Don't allow if input doesn't meet these rules + else e.consume(); + } + + @Override + public void keyPressed(KeyEvent arg0) { + } + @Override + public void keyReleased(KeyEvent arg0) { + } + }); + + } + + +} diff --git a/src/main/java/com/romraider/swing/ECUEditorToolBar.java b/src/main/java/com/romraider/swing/ECUEditorToolBar.java index f95303a31..640230a89 100644 --- a/src/main/java/com/romraider/swing/ECUEditorToolBar.java +++ b/src/main/java/com/romraider/swing/ECUEditorToolBar.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,8 @@ import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.text.MessageFormat; +import java.util.ResourceBundle; import javax.swing.ImageIcon; import javax.swing.JButton; @@ -36,11 +38,14 @@ import com.romraider.Settings; import com.romraider.editor.ecu.ECUEditor; import com.romraider.editor.ecu.ECUEditorManager; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; public class ECUEditorToolBar extends JToolBar implements ActionListener { private static final long serialVersionUID = 7778170684606193919L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + ECUEditorToolBar.class.getName()); private final JButton openImage = new JButton(); private final JButton saveImage = new JButton(); private final JButton refreshImage = new JButton(); @@ -101,10 +106,13 @@ private ImageIcon rescaleImageIcon(ImageIcon imageIcon, int percentOfOriginal) { public void updateButtons() { String file = getEditor().getLastSelectedRomFileName(); - openImage.setToolTipText("Open Image"); - saveImage.setToolTipText("Save " + file + " As New Image..."); - refreshImage.setToolTipText("Refresh " + file + " from saved copy"); - closeImage.setToolTipText("Close " + file); + openImage.setToolTipText(rb.getString("OPEN")); + saveImage.setToolTipText(MessageFormat.format( + rb.getString("SAVEAS"), file)); + refreshImage.setToolTipText(MessageFormat.format( + rb.getString("REFRESH"), file)); + closeImage.setToolTipText(MessageFormat.format( + rb.getString("CLOSE"), file)); if ("".equals(file)) { saveImage.setEnabled(false); @@ -125,15 +133,17 @@ public void actionPerformed(ActionEvent e) { ((ECUEditorMenuBar) getEditor().getJMenuBar()).openImageDialog(); } catch (Exception ex) { JOptionPane.showMessageDialog(getEditor(), new DebugPanel(ex, - getSettings().getSupportURL()), "Exception", JOptionPane.ERROR_MESSAGE); + getSettings().getSupportURL()), + rb.getString("EXCEPTION"), JOptionPane.ERROR_MESSAGE); } } else if (e.getSource() == saveImage) { try { - ((ECUEditorMenuBar) getEditor().getJMenuBar()).saveImage(); + ((ECUEditorMenuBar) getEditor().getJMenuBar()).saveImage(false); getEditor().refreshUI(); } catch (Exception ex) { JOptionPane.showMessageDialog(getEditor(), new DebugPanel(ex, - getSettings().getSupportURL()), "Exception", JOptionPane.ERROR_MESSAGE); + getSettings().getSupportURL()), + rb.getString("EXCEPTION"), JOptionPane.ERROR_MESSAGE); } } else if (e.getSource() == closeImage) { getEditor().closeImage(); @@ -142,7 +152,8 @@ public void actionPerformed(ActionEvent e) { ((ECUEditorMenuBar) getEditor().getJMenuBar()).refreshImage(); } catch (Exception ex) { JOptionPane.showMessageDialog(getEditor(), new DebugPanel(ex, - getSettings().getSupportURL()), "Exception", JOptionPane.ERROR_MESSAGE); + getSettings().getSupportURL()), + rb.getString("EXCEPTION"), JOptionPane.ERROR_MESSAGE); } } } diff --git a/src/main/java/com/romraider/swing/ECUImageFilter.java b/src/main/java/com/romraider/swing/ECUImageFilter.java index 118a02c51..84c801d0c 100644 --- a/src/main/java/com/romraider/swing/ECUImageFilter.java +++ b/src/main/java/com/romraider/swing/ECUImageFilter.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,11 +20,18 @@ package com.romraider.swing; import javax.swing.filechooser.FileFilter; + +import com.romraider.util.ResourceUtil; + import java.io.File; +import java.util.ResourceBundle; public class ECUImageFilter extends FileFilter { + private static final ResourceBundle rb = new ResourceUtil().getBundle( + ECUImageFilter.class.getName()); - private final FileFilter filter = new GenericFileFilter("ECU Image Files", "bin", "hex"); + private final FileFilter filter = new GenericFileFilter( + rb.getString("IMAGEFILE"), "bin", "hex"); public boolean accept(File file) { return filter.accept(file); @@ -33,4 +40,4 @@ public boolean accept(File file) { public String getDescription() { return filter.getDescription(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/swing/JProgressPane.java b/src/main/java/com/romraider/swing/JProgressPane.java index 106062a59..11f94c09c 100644 --- a/src/main/java/com/romraider/swing/JProgressPane.java +++ b/src/main/java/com/romraider/swing/JProgressPane.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,14 +24,19 @@ import java.awt.Font; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.ResourceBundle; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; +import com.romraider.util.ResourceUtil; + public class JProgressPane extends JPanel implements PropertyChangeListener{ private static final long serialVersionUID = -6827936662738014543L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + JProgressPane.class.getName()); JLabel label = new JLabel(); JProgressBar progressBar = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100); String status = "ready"; @@ -42,7 +47,7 @@ public JProgressPane() { this.setPreferredSize(new Dimension(500, 18)); this.setLayout(new BorderLayout(1, 2)); label.setHorizontalAlignment(JLabel.CENTER); - label.setText(" Ready..."); + label.setText(rb.getString("READY")); label.setFont(new Font("Tahoma", Font.PLAIN, 11)); label.setHorizontalAlignment(JLabel.LEFT); progressBar.setMinimumSize(new Dimension(200, 50)); @@ -54,18 +59,19 @@ public JProgressPane() { } public void update(String status, int percent) { - label.setText(" " + status); + setStatus(status); progressBar.setValue(percent); } public void setStatus(String status) { this.status = status; + label.setText(" " + status); } public JProgressBar getProgressBar() { return this.progressBar; } - + @Override public void propertyChange(PropertyChangeEvent evt) { if("progress" == evt.getPropertyName()) { @@ -73,8 +79,5 @@ public void propertyChange(PropertyChangeEvent evt) { progressBar.setValue(progress); label.setText(" " + status); } - else{ - ;// do nothing - } } } \ No newline at end of file diff --git a/src/main/java/com/romraider/swing/JTableChooser.java b/src/main/java/com/romraider/swing/JTableChooser.java index 09f59f311..0cfc1282c 100644 --- a/src/main/java/com/romraider/swing/JTableChooser.java +++ b/src/main/java/com/romraider/swing/JTableChooser.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,10 +20,14 @@ package com.romraider.swing; import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.util.ResourceBundle; import java.util.Vector; +import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -33,37 +37,47 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; +import com.romraider.Settings; import com.romraider.editor.ecu.ECUEditorManager; import com.romraider.maps.Rom; import com.romraider.maps.Table; +import com.romraider.util.ResourceUtil; +import com.romraider.util.SettingsManager; public class JTableChooser extends JOptionPane implements MouseListener { - public JTableChooser() { - } private static final long serialVersionUID = 5611729002131147882L; - JPanel displayPanel = new JPanel(); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + JTableChooser.class.getName()); + + final JPanel displayPanel = new JPanel(); DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Open Images"); - JTree displayTree = new JTree(rootNode); + final JTree displayTree = new JTree(rootNode); + final JButton compareButton = new JButton(rb.getString("COMPARE")); JScrollPane displayScrollPane; + private final Settings settings = SettingsManager.getSettings(); + + public JTableChooser() { + } public Table showChooser(Table targetTable) { - Vector roms = ECUEditorManager.getECUEditor().getImages(); + final Vector roms = ECUEditorManager.getECUEditor().getImages(); int nameLength = 0; for (int i = 0; i < roms.size(); i++) { - Rom rom = roms.get(i); - DefaultMutableTreeNode romNode = new DefaultMutableTreeNode(rom.getFileName()); + final Rom rom = roms.get(i); + rom.getTableNodes().values(); + final DefaultMutableTreeNode romNode = new DefaultMutableTreeNode(rom.getFileName()); rootNode.add(romNode); - for (TableTreeNode tableTreeNode : rom.getTableNodes()) { - Table table = tableTreeNode.getTable(); + for (TableTreeNode tableTreeNode : rom.getTableNodes().values()) { + final Table table = tableTreeNode.getTable(); // use the length of the table name to set the width of the displayTree // so the entire name can be read without being cut off on the right if (table.getName().length() > nameLength) { nameLength = table.getName().length(); } - TableChooserTreeNode tableNode = new TableChooserTreeNode(table.getName(), table); + final TableChooserTreeNode tableNode = new TableChooserTreeNode(table.getName(), table); // categories boolean categoryExists = false; @@ -76,29 +90,44 @@ public Table showChooser(Table targetTable) { } if (!categoryExists) { - DefaultMutableTreeNode categoryNode = new DefaultMutableTreeNode(table.getCategory()); + final DefaultMutableTreeNode categoryNode = new DefaultMutableTreeNode(table.getCategory()); romNode.add(categoryNode); categoryNode.add(tableNode); } } } - displayTree.setPreferredSize(new Dimension(nameLength*7, 400)); - displayTree.setMinimumSize(new Dimension(nameLength*7, 400)); + if (settings.isTableTreeSorted()) + rootNode = sortTableChooser(rootNode); + + displayTree.setPreferredSize(new Dimension(nameLength * 9, 400)); + displayTree.setMinimumSize(new Dimension(nameLength * 9, 400)); displayTree.expandPath(new TreePath(rootNode.getPath())); - displayTree.setRootVisible(false); displayTree.addMouseListener(this); displayScrollPane = new JScrollPane(displayTree); displayScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); displayPanel.add(displayScrollPane); - Object[] values = {"Compare", "Cancel"}; + Object[] values = {compareButton, rb.getString("CANCEL")}; + compareButton.setEnabled(false); + compareButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + final JOptionPane pane = (JOptionPane)((JButton) (e.getSource())).getParent().getParent(); + pane.setValue(compareButton); + } + }); + + int result = showOptionDialog(SwingUtilities.windowForComponent(targetTable.getTableView()), + displayPanel, + rb.getString("SELECT"), JOptionPane.DEFAULT_OPTION, + JOptionPane.PLAIN_MESSAGE, null, values, values[0]); - if ((showOptionDialog(SwingUtilities.windowForComponent(targetTable), displayPanel, "Select a Map", JOptionPane.DEFAULT_OPTION, - JOptionPane.PLAIN_MESSAGE, null, values, values[0]) == 0 - && (displayTree.getLastSelectedPathComponent() instanceof TableChooserTreeNode))) { + if (result == 0 && displayTree.getLastSelectedPathComponent() instanceof TableChooserTreeNode) { return ((TableChooserTreeNode) displayTree.getLastSelectedPathComponent()).getTable(); } else { return null; @@ -107,8 +136,16 @@ public Table showChooser(Table targetTable) { @Override public void mouseReleased(MouseEvent e) { - displayTree.setPreferredSize(new Dimension(displayTree.getWidth(), (displayTree.getRowCount()*displayTree.getRowHeight()))); + displayTree.setPreferredSize(new Dimension(displayTree.getWidth(), + (displayTree.getRowCount()*displayTree.getRowHeight()))); displayTree.revalidate(); + + if(displayTree.getLastSelectedPathComponent() instanceof TableChooserTreeNode) { + compareButton.setEnabled(true); + } + else { + compareButton.setEnabled(false); + } } @Override public void mouseClicked(MouseEvent e){} @@ -119,4 +156,27 @@ public void mouseExited(MouseEvent e){} @Override public void mousePressed(MouseEvent e){} -} \ No newline at end of file + /** + * Sort the ROMs, categories and tables in the Compare table chooser JTree. + * @param root - the current root node + * @return - the sorted node tree + */ + public DefaultMutableTreeNode sortTableChooser(DefaultMutableTreeNode root) { + for (int i = 0; i < root.getChildCount(); i++) { + DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) root.getChildAt(i); + final String nodeString = childNode.getUserObject().toString(); + for (int j = 0; j < i; j++) { + final DefaultMutableTreeNode prevNode = (DefaultMutableTreeNode) root.getChildAt(j); + final String prevNodeString = prevNode.getUserObject().toString(); + if (nodeString.compareToIgnoreCase(prevNodeString) < 0) { + root.insert(childNode, j); + break; + } + } + if (childNode.getChildCount() > 0) { + childNode = sortTableChooser(childNode); + } + } + return root; + } +} diff --git a/src/main/java/com/romraider/swing/MDIDesktopPane.java b/src/main/java/com/romraider/swing/MDIDesktopPane.java index 6e0516ffc..b2bbe95f5 100644 --- a/src/main/java/com/romraider/swing/MDIDesktopPane.java +++ b/src/main/java/com/romraider/swing/MDIDesktopPane.java @@ -88,8 +88,6 @@ public Component add(JInternalFrame frame) { Component retval = super.add(frame); frame.setLocation(p.x, p.y); - checkDesktopSize(); - if (frame.isResizable()) { w = getWidth() - (getWidth() / 3); h = getHeight() - (getHeight() / 3); @@ -104,9 +102,9 @@ public Component add(JInternalFrame frame) { moveToFront(frame); frame.setVisible(true); - + frame.pack(); + if(frame instanceof TableFrame) { - getEditor().getTableToolBar().updateTableToolBar(); ((TableFrame) frame).RegisterTable(); } @@ -115,14 +113,19 @@ public Component add(JInternalFrame frame) { } catch (PropertyVetoException e) { frame.toBack(); } - + + checkDesktopSize(); return retval; } @Override public void remove(Component c) { super.remove(c); - getEditor().getTableToolBar().updateTableToolBar(); + + if(c instanceof TableFrame) { + ((TableFrame) c).DeregisterTable(); + } + checkDesktopSize(); } diff --git a/src/main/java/com/romraider/swing/RomCellRenderer.java b/src/main/java/com/romraider/swing/RomCellRenderer.java index 95412f771..fff592ac1 100644 --- a/src/main/java/com/romraider/swing/RomCellRenderer.java +++ b/src/main/java/com/romraider/swing/RomCellRenderer.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,12 +31,11 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTree; -import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeCellRenderer; -import com.romraider.Settings; import com.romraider.maps.Rom; +import com.romraider.maps.RomID; import com.romraider.maps.Table; public class RomCellRenderer implements TreeCellRenderer { @@ -44,7 +43,12 @@ public class RomCellRenderer implements TreeCellRenderer { JLabel fileName; JLabel carInfo; DefaultTreeCellRenderer defaultRenderer = new DefaultTreeCellRenderer(); - + + static ImageIcon icon1D = new ImageIcon(RomCellRenderer.class.getResource("/graphics/1d.gif")); + static ImageIcon icon2D = new ImageIcon(RomCellRenderer.class.getResource("/graphics/2d.gif")); + static ImageIcon icon3D = new ImageIcon(RomCellRenderer.class.getResource("/graphics/3d.gif")); + static ImageIcon iconSwitch = new ImageIcon(RomCellRenderer.class.getResource("/graphics/switch.gif")); + public RomCellRenderer() { fileName = new JLabel(" "); fileName.setFont(new Font("Tahoma", Font.BOLD, 11)); @@ -53,9 +57,62 @@ public RomCellRenderer() { carInfo = new JLabel(" "); carInfo.setFont(new Font("Tahoma", Font.PLAIN, 10)); carInfo.setHorizontalAlignment(JLabel.CENTER); - } - + + public static ImageIcon getIconForTable(Table t) { + // display icon + if (t.getType() == Table.TableType.TABLE_1D) { + return icon1D; + } else if (t.getType() == Table.TableType.TABLE_2D) { + return icon2D; + } else if (t.getType() == Table.TableType.TABLE_3D) { + return icon3D; + } else if (t.getType() == Table.TableType.SWITCH) { + return iconSwitch; + } + + return null; + } + + private String buildCarInfoText(Rom rom) { + String carInfoText = ""; + RomID id = rom.getRomID(); + + if(id.getVersion() != null) + carInfoText+= "" + id.getVersion() + " "; + + if(rom.getRomIDString() != null) + carInfoText+=rom.getRomIDString() + ", "; + + if(id.getCaseId() != null) + carInfoText+=id.getCaseId() + "; "; + + if(id.getYear() != null) + carInfoText+=id.getYear() + " "; + + if(id.getMake() != null) + carInfoText+=id.getMake() + " "; + + if(id.getModel() != null) + carInfoText+=id.getModel() + " "; + + if(id.getSubModel() != null) + carInfoText+=id.getSubModel(); + + if(id.getTransmission() != null) + carInfoText+=", " + id.getTransmission(); + + if(carInfoText.endsWith(", ") || carInfoText.endsWith("; ")) + carInfoText = carInfoText.substring(0, carInfoText.length() - 2); + + if(id.getAuthor() != null) + carInfoText+=" by " + id.getAuthor(); + + carInfoText+= ""; + + return carInfoText; + } + @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, @@ -71,17 +128,9 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, } else { fileName.setText("+ " + rom.getFileName()); } - - - carInfo.setText(rom.getRomIDString() + ", " + - rom.getRomID().getCaseId() + "; " + - rom.getRomID().getYear() + " " + - rom.getRomID().getMake() + " " + - rom.getRomID().getModel() + " " + - rom.getRomID().getSubModel() + ", " + - rom.getRomID().getTransmission() - ); - + + carInfo.setText(buildCarInfoText(rom)); + JPanel renderer = new JPanel(new GridLayout(2, 1)); renderer.add(fileName); renderer.add(carInfo); @@ -101,22 +150,13 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, returnValue = renderer; } else if (value != null && value instanceof TableTreeNode) { - Table table = ((TableFrame)((DefaultMutableTreeNode) value).getUserObject()).getTable(); + Table table = (Table) (((TableTreeNode)(value)).getUserObject()); JPanel renderer = new JPanel(new GridLayout(1, 1)); renderer.setBorder(createLineBorder(Color.WHITE)); JLabel tableName = new JLabel(""); renderer.setBackground(Color.WHITE); - - // display icon - if (table.getType() == Settings.TABLE_1D) { - tableName = new JLabel(table.getName() + " ", new ImageIcon(getClass().getResource("/graphics/1d.gif")), JLabel.LEFT); - } else if (table.getType() == Settings.TABLE_2D) { - tableName = new JLabel(table.getName() + " ", new ImageIcon(getClass().getResource("/graphics/2d.gif")), JLabel.LEFT); - } else if (table.getType() == Settings.TABLE_3D) { - tableName = new JLabel(table.getName() + " ", new ImageIcon(getClass().getResource("/graphics/3d.gif")), JLabel.LEFT); - } else if (table.getType() == Settings.TABLE_SWITCH) { - tableName = new JLabel(table.getName() + " ", new ImageIcon(getClass().getResource("/graphics/switch.gif")), JLabel.LEFT); - } + + tableName = new JLabel (table.getName() + " ", getIconForTable(table), JLabel.LEFT); // set color renderer.add(tableName); diff --git a/src/main/java/com/romraider/swing/RomFilterPanel.java b/src/main/java/com/romraider/swing/RomFilterPanel.java new file mode 100644 index 000000000..3188f004c --- /dev/null +++ b/src/main/java/com/romraider/swing/RomFilterPanel.java @@ -0,0 +1,93 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2025 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.swing; + +import javax.swing.BorderFactory; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; + +import java.awt.*; +import java.util.Enumeration; +import java.util.List; +import java.util.ResourceBundle; + +import com.romraider.maps.Rom; +import com.romraider.swing.RomTree; +import com.romraider.util.ResourceUtil; + +public class RomFilterPanel extends JPanel { + + private static final long serialVersionUID = 1L; + + private static final ResourceBundle rb = new ResourceUtil().getBundle( + RomFilterPanel.class.getName()); + + public RomFilterPanel(final DefaultMutableTreeNode imageRoot, final RomTree imageList) { + super(new BorderLayout()); + + final JTextField filterField; + + JLabel label = new JLabel(rb.getString("LBLFILTER")); + label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + filterField = new JTextField(20); + filterField.setToolTipText(rb.getString("LBLTOOLTIP")); + + add(label, BorderLayout.WEST); + add(filterField, BorderLayout.CENTER); + + filterField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { filter(); } + @Override + public void removeUpdate(DocumentEvent e) { filter(); } + @Override + public void changedUpdate(DocumentEvent e) { filter(); } + + private void filter() { + String text = filterField.getText().trim(); + + final Enumeration children = imageRoot.children(); + while (children.hasMoreElements()) { + Object child = children.nextElement(); + if (child instanceof Rom) { + Rom rom = (Rom) child; + List pathsToExpand = rom.refreshDisplayedTables(text); + + DefaultTreeModel model = (DefaultTreeModel) imageList.getModel(); + model.reload(rom); + + for (TreePath path : pathsToExpand) { + imageList.expandPath(path); + } + + } + } + + imageList.repaint(); + } + }); + } +} diff --git a/src/main/java/com/romraider/swing/RomPropertyPanel.java b/src/main/java/com/romraider/swing/RomPropertyPanel.java index 898ba5382..452d300ed 100644 --- a/src/main/java/com/romraider/swing/RomPropertyPanel.java +++ b/src/main/java/com/romraider/swing/RomPropertyPanel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,287 +19,277 @@ package com.romraider.swing; +import java.util.ResourceBundle; import com.romraider.maps.Rom; +import com.romraider.maps.RomID; +import com.romraider.util.ResourceUtil; -public class RomPropertyPanel extends javax.swing.JPanel { +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.LayoutStyle.ComponentPlacement; + +public class RomPropertyPanel extends JPanel { private static final long serialVersionUID = 5583360728106071942L; - Rom rom = new Rom(); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + RomPropertyPanel.class.getName()); + Rom rom; public RomPropertyPanel(Rom rom) { initComponents(); + RomID romID = rom.getRomID(); // populate fields fileName.setText(rom.getFileName()); - xmlID.setText(rom.getRomID().getXmlid()); - ecuVersion.setText(rom.getRomID().getCaseId()); - fileSize.setText((rom.getRealFileSize() / 1024) + "kb"); - internalID.setText(rom.getRomID().getInternalIdString()); - storageAddress.setText("0x" + Integer.toHexString(rom.getRomID().getInternalIdAddress())); - - make.setText(rom.getRomID().getMake()); - market.setText(rom.getRomID().getMarket()); - year.setText(rom.getRomID().getYear() + ""); - model.setText(rom.getRomID().getModel()); - submodel.setText(rom.getRomID().getSubModel()); - transmission.setText(rom.getRomID().getTransmission()); - editStamp.setText(rom.getRomID().getEditStamp()); - + xmlID.setText(romID.getXmlid()); + ecuVersion.setText(romID.getCaseId()); + if (rom.getRealFileSize() > 1024) { + fileSize.setText((rom.getRealFileSize() / 1024) + "kB"); + } + else { + fileSize.setText(rom.getRealFileSize() + "B"); + } + internalID.setText(romID.getInternalIdString()); + storageAddress.setText("0x" + Integer.toHexString(romID.getInternalIdAddress())); + + make.setText(romID.getMake()); + market.setText(romID.getMarket()); + year.setText(romID.getYear()); + model.setText(romID.getModel()); + submodel.setText(romID.getSubModel()); + transmission.setText(romID.getTransmission()); + editStamp.setText(romID.getEditStamp()); + checksum.setText(romID.getChecksum()); + version.setText(romID.getVersion()); + author.setText(romID.getAuthor()); + lblTables.setText(String.format(rb.getString("LBLTBLS"), rom.getTables().size())); tableList.setListData(rom.getTables()); } // //GEN-BEGIN:initComponents private void initComponents() { - lblFilename = new javax.swing.JLabel(); - fileName = new javax.swing.JLabel(); - lblECURevision = new javax.swing.JLabel(); - xmlID = new javax.swing.JLabel(); - lblFilesize = new javax.swing.JLabel(); - fileSize = new javax.swing.JLabel(); - lblEcuVersion = new javax.swing.JLabel(); - ecuVersion = new javax.swing.JLabel(); - lblInternalId = new javax.swing.JLabel(); - internalID = new javax.swing.JLabel(); - lblStorageAddress = new javax.swing.JLabel(); - storageAddress = new javax.swing.JLabel(); - lblMake = new javax.swing.JLabel(); - lblMarket = new javax.swing.JLabel(); - lblTransmission = new javax.swing.JLabel(); - lblModel = new javax.swing.JLabel(); - lblSubmodel = new javax.swing.JLabel(); - lblYear = new javax.swing.JLabel(); - make = new javax.swing.JLabel(); - market = new javax.swing.JLabel(); - year = new javax.swing.JLabel(); - model = new javax.swing.JLabel(); - submodel = new javax.swing.JLabel(); - transmission = new javax.swing.JLabel(); - jScrollPane1 = new javax.swing.JScrollPane(); - tableList = new javax.swing.JList(); - lblTables = new javax.swing.JLabel(); - lblEditStamp = new javax.swing.JLabel(); - editStamp = new javax.swing.JLabel(); - - lblEditStamp.setText("Edit Stamp:"); - - editStamp.setText("stamp"); - - lblFilename.setText("Filename:"); - - fileName.setText("Filename"); - - lblECURevision.setText("ECU Revision:"); - - xmlID.setText("XMLID"); - - lblFilesize.setText("Filesize:"); - - fileSize.setText("999kb"); - - lblEcuVersion.setText("ECU Version:"); - - ecuVersion.setText("ECUVER"); - - lblInternalId.setText("Internal ID:"); - - internalID.setText("INTERNAL"); - - lblStorageAddress.setText("ID Storage Address:"); - - storageAddress.setText("0x00"); - - lblMake.setText("Make:"); - - lblMarket.setText("Market:"); - - lblTransmission.setText("Transmission:"); - - lblModel.setText("Model:"); - - lblSubmodel.setText("Submodel:"); - - lblYear.setText("Year:"); - - make.setText("Make"); - - market.setText("Market"); - - year.setText("Year"); - - model.setText("Model"); - - submodel.setText("Submodel"); - - transmission.setText("Transmission"); - - tableList.setModel(new javax.swing.AbstractListModel() { - /** - * - */ - private static final long serialVersionUID = -8498656966410761726L; - String[] strings = {"Item 1", "Item 2", "Item 3", "Item 4", "Item 5"}; - - public int getSize() { - return strings.length; - } - - public Object getElementAt(int i) { - return strings[i]; - } - }); + lblFilename = new JLabel(); + fileName = new JLabel(); + lblECURevision = new JLabel(); + xmlID = new JLabel(); + lblFilesize = new JLabel(); + fileSize = new JLabel(); + lblEcuVersion = new JLabel(); + ecuVersion = new JLabel(); + lblInternalId = new JLabel(); + internalID = new JLabel(); + lblStorageAddress = new JLabel(); + storageAddress = new JLabel(); + lblMake = new JLabel(); + lblMarket = new JLabel(); + lblTransmission = new JLabel(); + lblModel = new JLabel(); + lblSubmodel = new JLabel(); + lblYear = new JLabel(); + lblVersion = new JLabel(); + lblAuthor = new JLabel(); + version = new JLabel(); + author = new JLabel(); + make = new JLabel(); + market = new JLabel(); + year = new JLabel(); + model = new JLabel(); + submodel = new JLabel(); + transmission = new JLabel(); + jScrollPane1 = new JScrollPane(); + tableList = new JList(); + lblTables = new JLabel(); + lblEditStamp = new JLabel(); + editStamp = new JLabel(); + lblChecksum = new JLabel(); + checksum = new JLabel(); + + lblChecksum.setText(rb.getString("LBLCHKSUM")); + lblEditStamp.setText(rb.getString("LBLEDIT")); + lblFilename.setText(rb.getString("LBLFN")); + lblECURevision.setText(rb.getString("LBLECU")); + lblFilesize.setText(rb.getString("LBLFS")); + lblEcuVersion.setText(rb.getString("LBLVER")); + lblInternalId.setText(rb.getString("LBLID")); + lblStorageAddress.setText(rb.getString("LBLADDR")); + lblMake.setText(rb.getString("LBLMAKE")); + lblMarket.setText(rb.getString("LBLMRKT")); + lblTransmission.setText(rb.getString("LBLTRANS")); + lblModel.setText(rb.getString("LBLMDL")); + lblSubmodel.setText(rb.getString("LBLSMDL")); + lblYear.setText(rb.getString("LBLYR")); + lblAuthor.setText(rb.getString("LBLAUT")); + lblVersion.setText(rb.getString("LBLDEFVER")); jScrollPane1.setViewportView(tableList); - lblTables.setText("Tables:"); - - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); - this.setLayout(layout); + GroupLayout layout = new GroupLayout(this); layout.setHorizontalGroup( - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(layout.createSequentialGroup() - .addContainerGap() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(layout.createSequentialGroup() - .add(lblFilename) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(fileName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 302, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(layout.createSequentialGroup() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(layout.createSequentialGroup() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(lblECURevision) - .add(lblEcuVersion) - .add(lblFilesize)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(fileSize) - .add(ecuVersion) - .add(xmlID))) - .add(layout.createSequentialGroup() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(lblYear) - .add(lblModel) - .add(lblSubmodel) - .add(lblTransmission) - .add(lblMarket) - .add(lblMake)) - .add(7, 7, 7) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(make) - .add(market) - .add(year) - .add(layout.createSequentialGroup() - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(transmission) - .add(submodel))) - .add(model)))) - .add(32, 32, 32) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(layout.createSequentialGroup() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(lblInternalId) - .add(lblStorageAddress) - .add(lblEditStamp)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 53, Short.MAX_VALUE) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(internalID) - .add(storageAddress) - .add(editStamp)) - .add(36, 36, 36)) - .add(lblTables) - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 226, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))) - .addContainerGap()) + layout.createParallelGroup(Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(lblFilename) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(fileName, GroupLayout.PREFERRED_SIZE, 302, GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(lblAuthor) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(author, GroupLayout.PREFERRED_SIZE, 302, GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(lblVersion) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(version, GroupLayout.PREFERRED_SIZE, 302, GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblECURevision) + .addComponent(lblEcuVersion) + .addComponent(lblFilesize) + .addComponent(lblChecksum) + .addComponent(lblMake) + .addComponent(lblMarket) + .addComponent(lblYear) + .addComponent(lblModel) + .addComponent(lblSubmodel) + .addComponent(lblTransmission)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(transmission) + .addComponent(submodel) + .addComponent(model) + .addComponent(year) + .addComponent(market) + .addComponent(make) + .addComponent(checksum, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) + .addComponent(fileSize) + .addComponent(ecuVersion) + .addComponent(xmlID)) + .addGap(20) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblTables) + .addComponent(lblEditStamp) + .addComponent(lblStorageAddress) + .addComponent(lblInternalId)) + .addGap(18) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(editStamp) + .addComponent(storageAddress) + .addComponent(internalID))) + .addGroup(layout.createSequentialGroup() + .addGap(163) + .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 226, GroupLayout.PREFERRED_SIZE))) + .addContainerGap(51, Short.MAX_VALUE)) ); layout.setVerticalGroup( - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() - .add(21, 21, 21) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblFilename) - .add(fileName)) - .add(layout.createSequentialGroup() - .add(40, 40, 40) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblECURevision) - .add(xmlID) - .add(lblInternalId) - .add(internalID)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(ecuVersion) - .add(lblEcuVersion) - .add(storageAddress) - .add(lblStorageAddress)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblFilesize) - .add(fileSize) - .add(lblEditStamp) - .add(editStamp)))) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(lblTables) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(layout.createSequentialGroup() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblMake) - .add(make)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblMarket) - .add(market)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblYear) - .add(year)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblModel) - .add(model)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblSubmodel) - .add(submodel)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblTransmission) - .add(transmission))) - .add(jScrollPane1, 0, 0, Short.MAX_VALUE)) - .addContainerGap()) + layout.createParallelGroup(Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addGap(21) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblFilename) + .addComponent(fileName)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblAuthor) + .addComponent(author)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblVersion) + .addComponent(version)) + .addGap(26) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblECURevision) + .addComponent(xmlID) + .addComponent(lblInternalId) + .addComponent(internalID)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblEcuVersion) + .addComponent(ecuVersion) + .addComponent(lblStorageAddress) + .addComponent(storageAddress)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblFilesize) + .addComponent(fileSize) + .addComponent(lblEditStamp) + .addComponent(editStamp)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblChecksum) + .addComponent(checksum) + .addComponent(lblTables)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblMake) + .addComponent(make)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblMarket) + .addComponent(market)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblYear) + .addComponent(year)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblModel) + .addComponent(model)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblSubmodel) + .addComponent(submodel)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblTransmission) + .addComponent(transmission))) + .addComponent(jScrollPane1, 0, 0, Short.MAX_VALUE)) + .addContainerGap()) ); + this.setLayout(layout); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JLabel ecuVersion; - private javax.swing.JLabel fileName; - private javax.swing.JLabel fileSize; - private javax.swing.JLabel internalID; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JLabel lblECURevision; - private javax.swing.JLabel lblEcuVersion; - private javax.swing.JLabel lblFilename; - private javax.swing.JLabel lblFilesize; - private javax.swing.JLabel lblInternalId; - private javax.swing.JLabel lblMake; - private javax.swing.JLabel lblMarket; - private javax.swing.JLabel lblModel; - private javax.swing.JLabel lblStorageAddress; - private javax.swing.JLabel lblSubmodel; - private javax.swing.JLabel lblTables; - private javax.swing.JLabel lblTransmission; - private javax.swing.JLabel lblYear; - private javax.swing.JLabel make; - private javax.swing.JLabel market; - private javax.swing.JLabel model; - private javax.swing.JLabel storageAddress; - private javax.swing.JLabel submodel; - private javax.swing.JList tableList; - private javax.swing.JLabel transmission; - private javax.swing.JLabel xmlID; - private javax.swing.JLabel year; - private javax.swing.JLabel lblEditStamp; - private javax.swing.JLabel editStamp; + private JLabel ecuVersion; + private JLabel fileName; + private JLabel fileSize; + private JLabel internalID; + private JScrollPane jScrollPane1; + private JLabel lblECURevision; + private JLabel lblEcuVersion; + private JLabel lblFilename; + private JLabel lblFilesize; + private JLabel lblInternalId; + private JLabel lblMake; + private JLabel lblMarket; + private JLabel lblModel; + private JLabel lblStorageAddress; + private JLabel lblSubmodel; + private JLabel lblTables; + private JLabel lblTransmission; + private JLabel lblYear; + private JLabel make; + private JLabel market; + private JLabel model; + private JLabel storageAddress; + private JLabel submodel; + private JList tableList; + private JLabel transmission; + private JLabel xmlID; + private JLabel year; + private JLabel lblEditStamp; + private JLabel editStamp; + private JLabel lblChecksum; + private JLabel checksum; + private JLabel lblVersion; + private JLabel version; + private JLabel author; + private JLabel lblAuthor; // End of variables declaration//GEN-END:variables } \ No newline at end of file diff --git a/src/main/java/com/romraider/swing/RomTree.java b/src/main/java/com/romraider/swing/RomTree.java index ea5231e56..42378e885 100644 --- a/src/main/java/com/romraider/swing/RomTree.java +++ b/src/main/java/com/romraider/swing/RomTree.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2015 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ import javax.swing.JTree; import javax.swing.KeyStroke; import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; import com.romraider.editor.ecu.ECUEditor; import com.romraider.editor.ecu.ECUEditorManager; @@ -47,19 +48,24 @@ public RomTree(DefaultMutableTreeNode input) { addMouseListener(this); setCellRenderer(new RomCellRenderer()); setFont(new Font("Tahoma", Font.PLAIN, 11)); + setToggleClickCount(SettingsManager.getSettings().getTableClickCount()); // key binding actions Action tableSelectAction = new AbstractAction() { - private static final long serialVersionUID = -6008026264821746092L; + private static final long serialVersionUID = -6007532264821746092L; @Override public void actionPerformed(ActionEvent e) { - try{ - Object selectedRow = getSelectionPath().getLastPathComponent(); - showTable(selectedRow); - setLastSelectedRom(selectedRow); - }catch(NullPointerException ex) { + Object selectedRow = getLastSelectedPathComponent(); + /* if nothing is selected */ + if (selectedRow == null) { + return; } + + if (selectedRow instanceof TableTreeNode) { + showTable((TableTreeNode)selectedRow); + } + setLastSelectedRom(selectedRow); } }; @@ -75,54 +81,54 @@ public ECUEditor getEditor() { @Override public void mouseClicked(MouseEvent e) { - try{ - Object selectedRow = getPathForLocation(e.getX(), e.getY()).getLastPathComponent(); - - if(selectedRow instanceof TableTreeNode) { - if (e.getClickCount() >= SettingsManager.getSettings().getTableClickCount()) { - showTable(selectedRow); - } - } else if(selectedRow instanceof Rom || selectedRow instanceof CategoryTreeNode) { - if (e.getClickCount() >= SettingsManager.getSettings().getTableClickCount()) { - if(isCollapsed(getRowForLocation(e.getX(),e.getY()))) { - expandRow(getRowForLocation(e.getX(),e.getY())); - } - else { - collapseRow(getRowForLocation(e.getX(),e.getY())); - } - } - } + TreePath treePath = getPathForLocation(e.getX(), e.getY()); + if (treePath == null) + return; // this happens if we click in the empty area + Object selectedRow = treePath.getLastPathComponent(); + /* if nothing is selected */ + if (selectedRow == null) { + return; + } - setLastSelectedRom(selectedRow); - }catch(NullPointerException ex) { + if (e.getClickCount() >= SettingsManager.getSettings().getTableClickCount() + && selectedRow instanceof TableTreeNode && getRomNode((TableTreeNode)selectedRow) != null) { + showTable((TableTreeNode)selectedRow); } + + setLastSelectedRom(selectedRow); } - private void showTable(Object selectedRow) { - try{ - if(selectedRow instanceof TableTreeNode) { - TableTreeNode node = (TableTreeNode) selectedRow; - if(null != node) { - getEditor().displayTable(node.getFrame()); - } - } - } catch (NullPointerException ex) { - } + private void showTable(TableTreeNode selectedRow) { + getEditor().displayTable(selectedRow); } private void setLastSelectedRom(Object selectedNode) { - if (selectedNode instanceof TableTreeNode || selectedNode instanceof CategoryTreeNode || selectedNode instanceof Rom) { - Object lastSelectedPathComponent = getLastSelectedPathComponent(); - if(lastSelectedPathComponent instanceof Rom) { - Rom node = (Rom) lastSelectedPathComponent; - if(null != node) { - getEditor().setLastSelectedRom(node); - } - } + if (selectedNode == null || selectedNode instanceof RomTreeRootNode) { + return; } + + Rom romNode = getRomNode(selectedNode); + if (romNode == null) { + return; + } + getEditor().setLastSelectedRom(romNode); getEditor().refreshUI(); } + public static Rom getRomNode(Object currentNode){ + if (currentNode == null) { + return null; + } else if(currentNode instanceof Rom) { + return (Rom)currentNode; + } else if(currentNode instanceof TableTreeNode) { + return getRomNode(((TableTreeNode)currentNode).getParent()); + } else if(currentNode instanceof CategoryTreeNode) { + return getRomNode(((CategoryTreeNode)currentNode).getParent()); + } else { + return null; + } + } + @Override public void mousePressed(MouseEvent e) { } diff --git a/src/main/java/com/romraider/swing/ScalesTableModel.java b/src/main/java/com/romraider/swing/ScalesTableModel.java index 63397d1de..f8ffd5cd3 100644 --- a/src/main/java/com/romraider/swing/ScalesTableModel.java +++ b/src/main/java/com/romraider/swing/ScalesTableModel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,42 +28,47 @@ public final class ScalesTableModel extends DefaultTableModel { private static final long serialVersionUID = -5967359776053559125L; private static final String[] colNames = { - "Name", "Expression", "Byte Expression", + "Category", "Name", "Expression", "Byte Expression", "Unit", "Format", "Coarse", "Fine", "Min", "Max"}; private Vector scales; - + @Override public final int getColumnCount() { return colNames.length; } - + @Override public final String getColumnName(int column) { return colNames[column].toString(); } - + @Override public final Object getValueAt(int row, int column) { if (null != scales) { final Scale scale = scales.get(row); switch (column) { case 0: + return scale.getCategory(); + case 1: return scale.getName(); - case 1: + case 2: return scale.getExpression(); - case 2: - return scale.getByteExpression(); case 3: + if(scale.getByteExpression() == null) + return "Automatic"; + else + return scale.getByteExpression(); + case 4: return scale.getUnit(); - case 4: + case 5: return scale.getFormat(); - case 5: - return scale.getCoarseIncrement(); case 6: + return scale.getCoarseIncrement(); + case 7: return scale.getFineIncrement(); - case 7: + case 8: return scale.getMin(); - case 8: + case 9: return scale.getMax(); default: return null; @@ -73,12 +78,12 @@ public final Object getValueAt(int row, int column) { return null; } } - + @Override public final int getRowCount() { return (null != scales) ? scales.size() : 0; } - + @Override public final Class getColumnClass(int column) { return getValueAt(0, column).getClass(); @@ -88,7 +93,7 @@ public final Class getColumnClass(int column) { public final boolean isCellEditable(int row, int column) { return false; } - + public final void setScalesList(Vector scales) { this.scales = scales; } diff --git a/src/main/java/com/romraider/swing/SettingsForm.java b/src/main/java/com/romraider/swing/SettingsForm.java index 71a37a9c0..e4888dc2e 100644 --- a/src/main/java/com/romraider/swing/SettingsForm.java +++ b/src/main/java/com/romraider/swing/SettingsForm.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,14 +20,15 @@ package com.romraider.swing; import static com.romraider.Version.PRODUCT_NAME; -import static java.io.File.separator; +import static javax.swing.JOptionPane.INFORMATION_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; import java.awt.Color; import java.awt.Dimension; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.io.File; -import java.util.StringTokenizer; +import java.text.MessageFormat; +import java.util.ResourceBundle; import javax.swing.ButtonGroup; import javax.swing.DefaultComboBoxModel; @@ -38,7 +39,6 @@ import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; @@ -46,17 +46,19 @@ import javax.swing.UIManager; import javax.swing.border.TitledBorder; -import ZoeloeSoft.projects.JFontChooser.JFontChooser; - import com.romraider.Settings; import com.romraider.editor.ecu.ECUEditor; import com.romraider.editor.ecu.ECUEditorManager; -import com.romraider.util.FileAssociator; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; +import ZoeloeSoft.projects.JFontChooser.JFontChooser; + public class SettingsForm extends JFrame implements MouseListener { private static final long serialVersionUID = 3910602424260147767L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + SettingsForm.class.getName()); public SettingsForm() { this.setIconImage(getEditor().getIconImage()); @@ -71,32 +73,24 @@ public SettingsForm() { increaseColor.addMouseListener(this); decreaseColor.addMouseListener(this); warningColor.addMouseListener(this); + liveValueColor.addMouseListener(this); + curLiveValueColor.addMouseListener(this); btnOk.addMouseListener(this); btnApply.addMouseListener(this); btnCancel.addMouseListener(this); btnChooseFont.addMouseListener(this); reset.addMouseListener(this); - btnAddAssocs.addMouseListener(this); - btnRemoveAssocs.addMouseListener(this); tableClickCount.setBackground(Color.WHITE); tableClickBehavior.setBackground(Color.WHITE); - - // disable file association buttons if user is not in Windows - StringTokenizer osName = new StringTokenizer(System.getProperties().getProperty("os.name")); - if (!osName.nextToken().equalsIgnoreCase("windows")) { - btnAddAssocs.setEnabled(false); - btnRemoveAssocs.setEnabled(false); - extensionHex.setEnabled(false); - extensionBin.setEnabled(false); - } - } private void initSettings() { Settings settings = getSettings(); obsoleteWarning.setSelected(settings.isObsoleteWarning()); + oldLocale = settings.getLocale(); + localeFormatCheckBox.setSelected(oldLocale.equals("en_US")); calcConflictWarning.setSelected(settings.isCalcConflictWarning()); displayHighTables.setSelected(settings.isDisplayHighTables()); saveDebugTables.setSelected(settings.isSaveDebugTables()); @@ -109,6 +103,10 @@ private void initSettings() { axisColor.setBackground(settings.getAxisColor()); increaseColor.setBackground(settings.getIncreaseBorder()); decreaseColor.setBackground(settings.getDecreaseBorder()); + liveValueColor.setBackground(settings.getliveValueColor()); + liveValueColor.setToolTipText(rb.getString("CLROVERLAYV")); + curLiveValueColor.setBackground(settings.getCurLiveValueColor()); + curLiveValueColor.setToolTipText(rb.getString("CLROVERLAYLIVE")); cellWidth.setText(((int) settings.getCellSize().getWidth()) + ""); cellHeight.setText(((int) settings.getCellSize().getHeight()) + ""); @@ -127,6 +125,7 @@ private void initSettings() { } else { // open/close tableClickBehavior.setSelectedIndex(0); } + chckbxSortTree.setSelected(settings.isTableTreeSorted()); valueLimitWarning.setSelected(settings.isValueLimitWarning()); warningColor.setBackground(settings.getWarningColor()); @@ -166,6 +165,7 @@ private void initSettings() { private void initComponents() { obsoleteWarning = new javax.swing.JCheckBox(); calcConflictWarning = new javax.swing.JCheckBox(); + localeFormatCheckBox = new javax.swing.JCheckBox(); debug = new javax.swing.JCheckBox(); btnCancel = new javax.swing.JButton(); btnOk = new javax.swing.JButton(); @@ -195,6 +195,10 @@ private void initComponents() { increaseColor = new javax.swing.JLabel(); decreaseColor = new javax.swing.JLabel(); lblDecrease = new javax.swing.JLabel(); + liveValueColor = new javax.swing.JLabel(); + lblLiveValue = new javax.swing.JLabel(); + curLiveValueColor = new javax.swing.JLabel(); + lblCurLiveValue = new javax.swing.JLabel(); lblCellHeight = new javax.swing.JLabel(); cellHeight = new javax.swing.JTextField(); cellWidth = new javax.swing.JTextField(); @@ -205,65 +209,68 @@ private void initComponents() { displayHighTables = new javax.swing.JCheckBox(); valueLimitWarning = new javax.swing.JCheckBox(); chckbxColorAxis = new javax.swing.JCheckBox(); - jPanel4 = new javax.swing.JPanel(); - extensionHex = new javax.swing.JCheckBox(); - extensionBin = new javax.swing.JCheckBox(); - btnAddAssocs = new javax.swing.JButton(); - btnRemoveAssocs = new javax.swing.JButton(); editorIconsPanel = new javax.swing.JPanel(); tableIconsPanel = new javax.swing.JPanel(); tableClickBehavior = new javax.swing.JComboBox(); labelTableClick = new javax.swing.JLabel(); tableClickCount = new javax.swing.JComboBox(); + chckbxSortTree = new javax.swing.JCheckBox(); defaultScale = new javax.swing.JTextField(); comboBoxDefaultScale = new javax.swing.JComboBox(); cbScaleHeaderAndData = new javax.swing.JCheckBox(); clipboardButtonGroup = new ButtonGroup(); - rdbtnDefault = new JRadioButton("RomRaider Default"); - rdbtnAirboys = new JRadioButton("Airboys Spreadsheet"); - rdbtnCustom = new JRadioButton("Custom (manually specify formats in settings.xml)"); + rdbtnDefault = new JRadioButton(rb.getString("RRDEFAULT")); + rdbtnAirboys = new JRadioButton(rb.getString("ABSS")); + rdbtnCustom = new JRadioButton(rb.getString("CUSTOM")); clipboardButtonGroup.add(this.rdbtnDefault); clipboardButtonGroup.add(this.rdbtnAirboys); clipboardButtonGroup.add(this.rdbtnCustom); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle(PRODUCT_NAME + " Settings"); + setTitle(MessageFormat.format( + rb.getString("RRSETTINGS"), PRODUCT_NAME)); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setFont(new java.awt.Font("Tahoma", 0, 12)); - obsoleteWarning.setText("Warn me when opening out of date ECU image revision"); + + obsoleteWarning.setText(rb.getString("WARNOOD")); obsoleteWarning.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); obsoleteWarning.setMargin(new java.awt.Insets(0, 0, 0, 0)); - calcConflictWarning.setText("Warn me when real and byte value calculations conflict"); + localeFormatCheckBox.setText(rb.getString("USNUMBER")); + localeFormatCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); + localeFormatCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0)); + + calcConflictWarning.setText(rb.getString("WARNREAL")); calcConflictWarning.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); calcConflictWarning.setMargin(new java.awt.Insets(0, 0, 0, 0)); - debug.setText("Debug mode"); + debug.setText(rb.getString("DEBUG")); debug.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); debug.setEnabled(false); debug.setMargin(new java.awt.Insets(0, 0, 0, 0)); btnCancel.setMnemonic('C'); - btnCancel.setText("Cancel"); + btnCancel.setText(rb.getString("CANCEL")); btnOk.setMnemonic('O'); - btnOk.setText("OK"); + btnOk.setText(rb.getString("OK")); btnApply.setMnemonic('A'); - btnApply.setText("Apply"); + btnApply.setText(rb.getString("APPLY")); - reset.setText("Restore Defaults"); + reset.setText(rb.getString("RESTOREDEF")); - jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Background")); - lblAxis.setText("Axis Cell:"); + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder( + rb.getString("BAKGND"))); + lblAxis.setText(rb.getString("AXIS")); - lblHighlight.setText("Highlighted Cell:"); - lblSelect.setText("Selected Cell:"); + lblHighlight.setText(rb.getString("HLTCELL")); + lblSelect.setText(rb.getString("SLTDCELL")); - lblMin.setText("Minimum Value:"); + lblMin.setText(rb.getString("MINVALUE")); - lblMax.setText("Maximum Value:"); + lblMax.setText(rb.getString("MAXVALUE")); maxColor.setBackground(new java.awt.Color(255, 0, 0)); maxColor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); @@ -289,7 +296,7 @@ private void initComponents() { warningColor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); warningColor.setOpaque(true); - lblWarning.setText("Warning:"); + lblWarning.setText(rb.getString("WARNING")); GroupLayout jPanel2Layout = new GroupLayout(jPanel2); jPanel2Layout.setHorizontalGroup( @@ -351,8 +358,8 @@ private void initComponents() { ); jPanel2.setLayout(jPanel2Layout); - jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Cell Borders")); - lblIncrease.setText("Increased:"); + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(rb.getString("CELLBDR"))); + lblIncrease.setText(rb.getString("INCRSD")); increaseColor.setBackground(new java.awt.Color(255, 0, 0)); increaseColor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); @@ -362,108 +369,99 @@ private void initComponents() { decreaseColor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); decreaseColor.setOpaque(true); - lblDecrease.setText("Decreased:"); + lblDecrease.setText(rb.getString("DECRSD")); - org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup() - .addContainerGap() - .add(lblIncrease) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(increaseColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 59, Short.MAX_VALUE) - .add(lblDecrease) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(decreaseColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); - jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(decreaseColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(lblDecrease) - .add(lblIncrease) - .add(increaseColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - ); - - lblCellHeight.setText("Cell Height:"); + liveValueColor.setBackground(new java.awt.Color(255, 0, 0)); + liveValueColor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); + liveValueColor.setOpaque(true); - lblCellWidth.setText("Cell Width:"); + lblLiveValue.setText(rb.getString("STLLIVE")); - lblFont.setText("Font:"); + curLiveValueColor.setBackground(new java.awt.Color(255, 0, 0)); + curLiveValueColor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); + curLiveValueColor.setOpaque(true); - btnChooseFont.setText("Choose"); + lblCurLiveValue.setText(rb.getString("CNTLIVE")); - saveDebugTables.setText("Save changes made on tables in debug mode"); + GroupLayout jPanel3Layout = new GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(Alignment.TRAILING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + + .addGroup(jPanel3Layout.createParallelGroup(Alignment.TRAILING) + .addComponent(lblLiveValue) + .addComponent(lblIncrease)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(Alignment.TRAILING) + .addComponent(increaseColor, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE) + .addComponent(liveValueColor, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED, 110, Short.MAX_VALUE) + .addGroup(jPanel3Layout.createParallelGroup(Alignment.LEADING) + .addGroup(Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addComponent(lblCurLiveValue) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(curLiveValueColor, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)) + .addGroup(Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addComponent(lblDecrease) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(decreaseColor, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(Alignment.LEADING) + .addGroup(jPanel3Layout.createParallelGroup(Alignment.BASELINE) + .addComponent(decreaseColor, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE) + .addComponent(lblDecrease) + .addComponent(lblIncrease)) + .addComponent(increaseColor, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel3Layout.createParallelGroup(Alignment.BASELINE) + .addComponent(lblLiveValue) + .addComponent(liveValueColor, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE) + .addComponent(lblCurLiveValue) + .addComponent(curLiveValueColor, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))) + ); + + lblCellHeight.setText(rb.getString("CELLHT")); + + lblCellWidth.setText(rb.getString("CELLWD")); + + lblFont.setText(rb.getString("FONT")); + + btnChooseFont.setText(rb.getString("CHOOSE")); + + saveDebugTables.setText(rb.getString("SAVEDEBUG")); saveDebugTables.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); saveDebugTables.setMargin(new java.awt.Insets(0, 0, 0, 0)); - displayHighTables.setText("List tables that are above my userlevel"); + displayHighTables.setText(rb.getString("LISTTBLS")); displayHighTables.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); displayHighTables.setMargin(new java.awt.Insets(0, 0, 0, 0)); - valueLimitWarning.setText("Warn when values exceed limits"); + valueLimitWarning.setText(rb.getString("WARNUSER")); valueLimitWarning.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); valueLimitWarning.setMargin(new java.awt.Insets(0, 0, 0, 0)); - chckbxColorAxis.setText("Color Axis"); + chckbxColorAxis.setText(rb.getString("CLRAXIS")); chckbxColorAxis.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); chckbxColorAxis.setMargin(new java.awt.Insets(0, 0, 0, 0)); - jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("File Associations")); - extensionHex.setText("HEX"); - extensionHex.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); - extensionHex.setMargin(new java.awt.Insets(0, 0, 0, 0)); - - extensionBin.setText("BIN"); - extensionBin.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); - extensionBin.setMargin(new java.awt.Insets(0, 0, 0, 0)); - - btnAddAssocs.setText("Add Associations"); - - btnRemoveAssocs.setText("Remove Associations"); - - org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup() - .addContainerGap() - .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(extensionBin) - .add(extensionHex)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 93, Short.MAX_VALUE) - .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) - .add(btnAddAssocs, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(btnRemoveAssocs)) - .add(25, 25, 25)) - ); - jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel4Layout.createSequentialGroup() - .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(btnAddAssocs) - .add(extensionHex)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(btnRemoveAssocs) - .add(extensionBin))) - ); - initTabs(); - settingsTabbedPane.addTab("General", jPanelDefault); - settingsTabbedPane.addTab("Table Display", jPanelTableDisplay); - settingsTabbedPane.addTab("Clipboard", jPanelClipboard); - settingsTabbedPane.addTab("Icons", jPanelIcons); - settingsTabbedPane.addTab("Scale", jPanelScale); + settingsTabbedPane.addTab(rb.getString("TABGEN"), jPanelDefault); + settingsTabbedPane.addTab(rb.getString("TABTABL"), jPanelTableDisplay); + settingsTabbedPane.addTab(rb.getString("TABCLIP"), jPanelClipboard); + settingsTabbedPane.addTab(rb.getString("TABICON"), jPanelIcons); + settingsTabbedPane.addTab(rb.getString("TABSCAL"), jPanelScale); - this.cbScaleHeaderAndData = new JCheckBox("Scale Headers and Data."); - this.cbScaleHeaderAndData.setToolTipText("If checked, the header scale will change when the data scale is selected. Otherwise click on a header row or column to select the scale."); + this.cbScaleHeaderAndData = new JCheckBox(rb.getString("SCLHEADER")); + this.cbScaleHeaderAndData.setToolTipText(rb.getString("SCLHEADERTT")); - JLabel lblDefaultScale = new JLabel("Default Scale:"); + JLabel lblDefaultScale = new JLabel(rb.getString("DEFSCALE")); comboBoxDefaultScale.setModel(new DefaultComboBoxModel(new String[] { Settings.DEFAULT_SCALE, Settings.METRIC_SCALE, Settings.STANDARD_SCALE})); @@ -533,7 +531,10 @@ private void initComponents() { private void initTabs() { JPanel panelUISettings = new JPanel(); - panelUISettings.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "UI Settings", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panelUISettings.setBorder(new TitledBorder(UIManager.getBorder( + "TitledBorder.border"), + rb.getString("UISETTINGS"), + TitledBorder.LEADING, TitledBorder.TOP, null, null)); // Init Default Tab Panel GroupLayout jPanelDefaultLayout = new GroupLayout(jPanelDefault); jPanelDefaultLayout.setHorizontalGroup( @@ -544,6 +545,7 @@ private void initTabs() { .addComponent(panelUISettings, GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE) .addComponent(obsoleteWarning) .addComponent(calcConflictWarning) + .addComponent(localeFormatCheckBox) .addComponent(debug)) .addContainerGap()) ); @@ -555,19 +557,22 @@ private void initTabs() { .addPreferredGap(ComponentPlacement.RELATED) .addComponent(calcConflictWarning) .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(localeFormatCheckBox) + .addPreferredGap(ComponentPlacement.RELATED) .addComponent(debug) .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(panelUISettings, GroupLayout.PREFERRED_SIZE, 173, GroupLayout.PREFERRED_SIZE) + .addComponent(panelUISettings, GroupLayout.PREFERRED_SIZE, 190, GroupLayout.PREFERRED_SIZE) .addContainerGap(267, Short.MAX_VALUE)) ); - chckbxOpenRomNode = new JCheckBox("Open rom node expanded"); + chckbxOpenRomNode = new JCheckBox(rb.getString("ORNE")); - chckbxShowTableToolbar = new JCheckBox("Show table toolbar border"); + chckbxShowTableToolbar = new JCheckBox(rb.getString("STTB")); panelTreeSettings = new JPanel(); - panelTreeSettings.setBorder(new TitledBorder(null, "Rom Tree Settings", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panelTreeSettings.setBorder(new TitledBorder(null, rb.getString("RTS"), + TitledBorder.LEADING, TitledBorder.TOP, null, null)); - chckbxOpenTablesAt = new JCheckBox("Always open tables at [0,0]"); + chckbxOpenTablesAt = new JCheckBox(rb.getString("AOA00")); GroupLayout gl_panelUISettings = new GroupLayout(panelUISettings); gl_panelUISettings.setHorizontalGroup( gl_panelUISettings.createParallelGroup(Alignment.LEADING) @@ -590,38 +595,50 @@ private void initTabs() { .addPreferredGap(ComponentPlacement.RELATED) .addComponent(chckbxOpenTablesAt) .addPreferredGap(ComponentPlacement.RELATED, 12, Short.MAX_VALUE) - .addComponent(panelTreeSettings, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE)) + .addComponent(panelTreeSettings, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE)) ); - labelTableClick.setText("Click to open tables"); - tableClickCount.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Single", "Double"})); - tableClickBehavior.setModel(new DefaultComboBoxModel(new String[] {"open/close", "open/focus"})); + labelTableClick.setText(rb.getString("CTOT")); + tableClickCount.setModel(new javax.swing.DefaultComboBoxModel( + new String[]{rb.getString("SINGLE"), rb.getString("DOUBLE")})); + tableClickBehavior.setModel(new DefaultComboBoxModel( + new String[] {rb.getString("OPENCLOSE"), rb.getString("OPENFOCUS")})); + chckbxSortTree.setText(rb.getString("STLABEL")); + chckbxSortTree.setToolTipText(rb.getString("STLABELTT")); - lblClickBehavior = new JLabel("Table click behavior"); + lblClickBehavior = new JLabel(rb.getString("TCB")); GroupLayout gl_panelTreeSettings = new GroupLayout(panelTreeSettings); gl_panelTreeSettings.setHorizontalGroup( gl_panelTreeSettings.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTreeSettings.createSequentialGroup() .addGroup(gl_panelTreeSettings.createParallelGroup(Alignment.LEADING) .addComponent(tableClickCount, 0, 72, Short.MAX_VALUE) - .addComponent(tableClickBehavior, 0, 86, Short.MAX_VALUE)) + .addComponent(tableClickBehavior, 0, 86, Short.MAX_VALUE) + + ) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelTreeSettings.createParallelGroup(Alignment.LEADING) .addComponent(labelTableClick) - .addComponent(lblClickBehavior)) - .addGap(200)) - ); + .addComponent(lblClickBehavior) + .addGap(200) + ) + ).addComponent(chckbxSortTree, 0, 100, Short.MAX_VALUE) + ); gl_panelTreeSettings.setVerticalGroup( gl_panelTreeSettings.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTreeSettings.createSequentialGroup() .addGroup(gl_panelTreeSettings.createParallelGroup(Alignment.BASELINE) .addComponent(labelTableClick) - .addComponent(tableClickCount, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)) + .addComponent(tableClickCount, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE) + ) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelTreeSettings.createParallelGroup(Alignment.BASELINE) .addComponent(lblClickBehavior) - .addComponent(tableClickBehavior, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addContainerGap(23, Short.MAX_VALUE)) + .addComponent(tableClickBehavior, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + ) + .addContainerGap(23, Short.MAX_VALUE) + .addComponent(chckbxSortTree, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE) + ) ); panelTreeSettings.setLayout(gl_panelTreeSettings); panelUISettings.setLayout(gl_panelUISettings); @@ -647,28 +664,25 @@ private void initTabs() { .addComponent(cellWidth, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE))) .addGap(47)) .addGroup(jPanelTableDisplayLayout.createSequentialGroup() - .addComponent(jPanel4, GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE) + .addComponent(jPanel3, GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE) .addContainerGap()) + .addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanelTableDisplayLayout.createSequentialGroup() - .addComponent(jPanel3, GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE) - .addContainerGap()) - .addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap() + .addComponent(saveDebugTables) + .addContainerGap(184, Short.MAX_VALUE)) .addGroup(jPanelTableDisplayLayout.createSequentialGroup() .addContainerGap() - .addComponent(saveDebugTables) - .addContainerGap(184, Short.MAX_VALUE)) + .addComponent(displayHighTables) + .addContainerGap(214, Short.MAX_VALUE)) .addGroup(jPanelTableDisplayLayout.createSequentialGroup() .addContainerGap() - .addComponent(displayHighTables) - .addContainerGap(214, Short.MAX_VALUE)) + .addComponent(valueLimitWarning) + .addContainerGap(246, Short.MAX_VALUE)) .addGroup(jPanelTableDisplayLayout.createSequentialGroup() .addContainerGap() - .addComponent(valueLimitWarning) - .addContainerGap(246, Short.MAX_VALUE)) - .addGroup(jPanelTableDisplayLayout.createSequentialGroup() - .addContainerGap() - .addComponent(chckbxColorAxis) - .addContainerGap(324, Short.MAX_VALUE)) + .addComponent(chckbxColorAxis) + .addContainerGap(324, Short.MAX_VALUE)) ); jPanelTableDisplayLayout.setVerticalGroup( jPanelTableDisplayLayout.createParallelGroup(Alignment.LEADING) @@ -678,8 +692,6 @@ private void initTabs() { .addPreferredGap(ComponentPlacement.RELATED) .addComponent(jPanel3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jPanel4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(ComponentPlacement.RELATED) .addComponent(saveDebugTables) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(displayHighTables) @@ -731,8 +743,10 @@ private void initTabs() { jPanelClipboard.setLayout(jPanelClipboardLayout); // Init Icons Tab panel - editorIconsPanel.setBorder(new TitledBorder(null, "Editor Toolbar Icons", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - tableIconsPanel.setBorder(new TitledBorder(null, "Table Toolbar Icons", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + editorIconsPanel.setBorder(new TitledBorder(null, rb.getString("ETI"), + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + tableIconsPanel.setBorder(new TitledBorder(null, rb.getString("TTI"), + TitledBorder.LEADING, TitledBorder.TOP, null, null)); GroupLayout jPanelIconsLayout = new GroupLayout(jPanelIcons); jPanelIconsLayout.setHorizontalGroup( @@ -754,10 +768,10 @@ private void initTabs() { .addContainerGap(367, Short.MAX_VALUE)) ); - JLabel lblTableIconScale = new JLabel("Scale:"); + JLabel lblTableIconScale = new JLabel(rb.getString("SCALE")); textFieldTableIconScale = new JTextField(); - textFieldTableIconScale.setToolTipText("The percentage of the icons original size."); + textFieldTableIconScale.setToolTipText(rb.getString("SCALEPER")); textFieldTableIconScale.setColumns(10); JLabel labelTableScalePercent = new JLabel("%"); @@ -785,10 +799,10 @@ private void initTabs() { ); tableIconsPanel.setLayout(tableIconsPanelLayout); - JLabel lblEditorIconScale = new JLabel("Scale:"); + JLabel lblEditorIconScale = new JLabel(rb.getString("SCALE")); textFieldEditorIconScale = new JTextField(); - textFieldEditorIconScale.setToolTipText("The percentage of the icons original size."); + textFieldEditorIconScale.setToolTipText(rb.getString("SCALEPER")); textFieldEditorIconScale.setColumns(10); JLabel labelEditorScalePercent = new JLabel("%"); @@ -824,49 +838,61 @@ public void mouseClicked(MouseEvent e) { Settings settings = getSettings(); if (e.getSource() == maxColor) { Color color = JColorChooser.showDialog(this.getContentPane(), - "Background Color", settings.getMaxColor()); + rb.getString("BGCOLOR"), settings.getMaxColor()); if (color != null) { maxColor.setBackground(color); } } else if (e.getSource() == minColor) { Color color = JColorChooser.showDialog(this.getContentPane(), - "Background Color", settings.getMinColor()); + rb.getString("BGCOLOR"), settings.getMinColor()); if (color != null) { minColor.setBackground(color); } } else if (e.getSource() == highlightColor) { Color color = JColorChooser.showDialog(this.getContentPane(), - "Background Color", settings.getHighlightColor()); + rb.getString("BGCOLOR"), settings.getHighlightColor()); if (color != null) { highlightColor.setBackground(color); } } else if (e.getSource() == selectColor) { Color color = JColorChooser.showDialog(this.getContentPane(), - "Background Color", settings.getSelectColor()); + rb.getString("BGCOLOR"), settings.getSelectColor()); if (color != null) { selectColor.setBackground(color); } } else if (e.getSource() == axisColor) { Color color = JColorChooser.showDialog(this.getContentPane(), - "Background Color", settings.getAxisColor()); + rb.getString("BGCOLOR"), settings.getAxisColor()); if (color != null) { axisColor.setBackground(color); } } else if (e.getSource() == increaseColor) { Color color = JColorChooser.showDialog(this.getContentPane(), - "Background Color", settings.getIncreaseBorder()); + rb.getString("BGCOLOR"), settings.getIncreaseBorder()); if (color != null) { increaseColor.setBackground(color); } } else if (e.getSource() == decreaseColor) { Color color = JColorChooser.showDialog(this.getContentPane(), - "Background Color", settings.getDecreaseBorder()); + rb.getString("BGCOLOR"), settings.getDecreaseBorder()); if (color != null) { decreaseColor.setBackground(color); } + } else if (e.getSource() == liveValueColor) { + Color color = JColorChooser.showDialog(this.getContentPane(), + rb.getString("BGCOLOR"), settings.getliveValueColor()); + if (color != null) { + liveValueColor.setBackground(color); + } + } else if (e.getSource() == curLiveValueColor) { + Color color = JColorChooser.showDialog(this.getContentPane(), + rb.getString("BGCOLOR"), settings.getCurLiveValueColor()); + if (color != null) { + curLiveValueColor.setBackground(color); + } } else if (e.getSource() == warningColor) { Color color = JColorChooser.showDialog(this.getContentPane(), - "Warning Color", settings.getWarningColor()); + rb.getString("WARNCOLOR"), settings.getWarningColor()); if (color != null) { warningColor.setBackground(color); } @@ -903,45 +929,6 @@ public void mouseClicked(MouseEvent e) { SettingsManager.save(newSettings); initSettings(); - } else if (e.getSource() == btnAddAssocs) { - // add file associations for selected file types - boolean added = false; - try { - if (extensionHex.isSelected()) { - FileAssociator.addAssociation("HEX", new File(".").getCanonicalPath() + separator + PRODUCT_NAME + ".exe", "ECU Image"); - added = true; - } - - if (extensionBin.isSelected()) { - FileAssociator.addAssociation("BIN", new File(".").getCanonicalPath() + separator + PRODUCT_NAME + ".exe", "ECU Image"); - added = true; - } - } catch (Exception ex) { - added = false; - } finally { - if(added) { - JOptionPane.showMessageDialog(null, "Association(s) added.", "Add Association Success", JOptionPane.INFORMATION_MESSAGE); - } else { - JOptionPane.showMessageDialog(null, "Failed to add association(s).", "Add Association Failure", JOptionPane.ERROR_MESSAGE); - } - } - - } else if (e.getSource() == btnRemoveAssocs) { - // remove file associations for selected file types - boolean removed = false; - if (extensionHex.isSelected()) { - removed = FileAssociator.removeAssociation("HEX"); - } - - if (extensionBin.isSelected()) { - removed = FileAssociator.removeAssociation("BIN"); - } - - if(removed) { - JOptionPane.showMessageDialog(null, "Association removed.", "Remove Association Success", JOptionPane.INFORMATION_MESSAGE); - } else { - JOptionPane.showMessageDialog(null, "Failed to remove association.", "Remove Association Failure", JOptionPane.ERROR_MESSAGE); - } } } @@ -955,11 +942,26 @@ public void applySettings() { try { Integer.parseInt(cellWidth.getText()); } catch (NumberFormatException ex) { - // number formatted imporperly, reset + // number formatted improperly, reset cellWidth.setText((int) (getSettings().getCellSize().getWidth()) + ""); } getSettings().setObsoleteWarning(obsoleteWarning.isSelected()); + + //Apply locale settings + if (localeFormatCheckBox.isSelected()) + getSettings().setLocale("en_US"); + else + getSettings().setLocale("system"); + + //Show Info if locale changed + if(!oldLocale.equals(getSettings().getLocale())){ + showMessageDialog(this, MessageFormat.format( + rb.getString("LOCALEMSG"), + getSettings().getLocale()), + rb.getString("LOCALETITLE"), INFORMATION_MESSAGE); + } + getSettings().setCalcConflictWarning(calcConflictWarning.isSelected()); getSettings().setDisplayHighTables(displayHighTables.isSelected()); getSettings().setSaveDebugTables(saveDebugTables.isSelected()); @@ -975,6 +977,8 @@ public void applySettings() { getSettings().setAxisColor(axisColor.getBackground()); getSettings().setIncreaseBorder(increaseColor.getBackground()); getSettings().setDecreaseBorder(decreaseColor.getBackground()); + getSettings().setLiveValueColor(liveValueColor.getBackground()); + getSettings().setCurLiveValueColor(curLiveValueColor.getBackground()); getSettings().setScaleHeadersAndData(this.cbScaleHeaderAndData.isSelected()); @@ -989,11 +993,14 @@ public void applySettings() { getSettings().setTableClickCount(2); } + getEditor().getImageList().setToggleClickCount(getSettings().getTableClickCount()); + if(1 == tableClickBehavior.getSelectedIndex()) { // open/close frame getSettings().setTableClickBehavior(1); } else { // open/focus frame getSettings().setTableClickBehavior(0); } + getSettings().setTableTreeSorted(chckbxSortTree.isSelected()); getSettings().setValueLimitWarning(valueLimitWarning.isSelected()); getSettings().setWarningColor(warningColor.getBackground()); @@ -1054,7 +1061,7 @@ private void drawVisibleTables() { for(JInternalFrame frame : getEditor().getRightPanel().getAllFrames()) { if(frame instanceof TableFrame && frame.isVisible()) { TableFrame tableFrame = (TableFrame) frame; - tableFrame.getTable().drawTable(); + tableFrame.getTable().getTableView().drawTable(); } } } @@ -1077,20 +1084,17 @@ public void mouseExited(MouseEvent e) { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel axisColor; - private javax.swing.JButton btnAddAssocs; private javax.swing.JButton btnApply; private javax.swing.JButton btnCancel; private javax.swing.JButton btnChooseFont; private javax.swing.JButton btnOk; - private javax.swing.JButton btnRemoveAssocs; private javax.swing.JCheckBox calcConflictWarning; private javax.swing.JTextField cellHeight; private javax.swing.JTextField cellWidth; + private javax.swing.JLabel curLiveValueColor; private javax.swing.JCheckBox debug; private javax.swing.JLabel decreaseColor; private javax.swing.JCheckBox displayHighTables; - private javax.swing.JCheckBox extensionBin; - private javax.swing.JCheckBox extensionHex; private javax.swing.JLabel highlightColor; private javax.swing.JLabel selectColor; private javax.swing.JLabel increaseColor; @@ -1104,18 +1108,20 @@ public void mouseExited(MouseEvent e) { private javax.swing.JPanel jPanelScale; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel4; private javax.swing.JLabel lblAxis; private javax.swing.JLabel lblCellHeight; private javax.swing.JLabel lblCellWidth; + private javax.swing.JLabel lblCurLiveValue; private javax.swing.JLabel lblDecrease; private javax.swing.JLabel lblFont; private javax.swing.JLabel lblHighlight; private javax.swing.JLabel lblSelect; private javax.swing.JLabel lblIncrease; + private javax.swing.JLabel lblLiveValue; private javax.swing.JLabel lblMax; private javax.swing.JLabel lblMin; private javax.swing.JLabel lblWarning; + private javax.swing.JLabel liveValueColor; private javax.swing.JLabel maxColor; private javax.swing.JLabel minColor; private javax.swing.JCheckBox obsoleteWarning; @@ -1141,4 +1147,7 @@ public void mouseExited(MouseEvent e) { private javax.swing.JTextField defaultScale; private javax.swing.JComboBox comboBoxDefaultScale; private javax.swing.JCheckBox cbScaleHeaderAndData; -} \ No newline at end of file + private javax.swing.JCheckBox localeFormatCheckBox; + private String oldLocale; + private javax.swing.JCheckBox chckbxSortTree; +} diff --git a/src/main/java/com/romraider/swing/TableFrame.java b/src/main/java/com/romraider/swing/TableFrame.java index 53d08e9ed..460064672 100644 --- a/src/main/java/com/romraider/swing/TableFrame.java +++ b/src/main/java/com/romraider/swing/TableFrame.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +23,11 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.text.MessageFormat; +import java.util.ResourceBundle; +import java.util.Vector; +import javax.swing.Icon; import javax.swing.JInternalFrame; import javax.swing.JMenu; import javax.swing.JOptionPane; @@ -37,18 +41,29 @@ import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler; import com.romraider.maps.Rom; import com.romraider.maps.Table; +import com.romraider.maps.TableView; +import com.romraider.maps.UserLevelException; +import com.romraider.util.ResourceUtil; public class TableFrame extends JInternalFrame implements InternalFrameListener, ActionListener { private static final long serialVersionUID = -2651279694660392351L; - private final Table table; - private TableMenuBar tableMenuBar = null; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + TableFrame.class.getName()); + private TableView tableView; + private final TableMenuBar tableMenuBar; - public TableFrame(String title, Table table) { + public TableFrame(String title, TableView tableView) { super(title, true, true); - this.table = table; - add(table); - setFrameIcon(null); + this.tableView = tableView; + Table t = tableView.getTable(); + + Icon icon = RomCellRenderer.getIconForTable(t); + setFrameIcon(icon); + + t.setTableFrame(this); + add(tableView); + setBorder(createBevelBorder(0)); if (System.getProperty("os.name").startsWith("Mac OS")) putClientProperty("JInternalFrame.isPalette", true); @@ -59,50 +74,55 @@ public TableFrame(String title, Table table) { addInternalFrameListener(this); } - @Override - public void internalFrameActivated(InternalFrameEvent e) { + public void RegisterTable() { + TableUpdateHandler.getInstance().registerTable(this.getTable()); + } + + public void DeregisterTable() { + TableUpdateHandler.getInstance().deregisterTable(this.getTable()); + } + + private void updateToolbar(Table t) { ECUEditor parent = getEditor(); - parent.getTableToolBar().updateTableToolBar(); + parent.getTableToolBar().updateTableToolBar(t); parent.getToolBar().updateButtons(); parent.getEditorMenuBar().updateMenu(); } @Override - public void internalFrameOpened(InternalFrameEvent e) { - RegisterTable(); + public void internalFrameActivated(InternalFrameEvent e) { + updateToolbar(getTable()); } @Override - public void internalFrameClosing(InternalFrameEvent e) { - TableUpdateHandler.getInstance().deregisterTable(this.getTable()); + public void internalFrameDeactivated(InternalFrameEvent e) { + updateToolbar(null); } @Override - public void internalFrameClosed(InternalFrameEvent e) { - getEditor().getTableToolBar().updateTableToolBar(); - } + public void internalFrameClosing(InternalFrameEvent e) {} @Override - public void internalFrameIconified(InternalFrameEvent e) { - ; - } + public void internalFrameOpened(InternalFrameEvent e) {} @Override - public void internalFrameDeiconified(InternalFrameEvent e) { - ; - } - + public void internalFrameClosed(InternalFrameEvent e) {} @Override - public void internalFrameDeactivated(InternalFrameEvent e) { - getEditor().getTableToolBar().updateTableToolBar(); - } + public void internalFrameIconified(InternalFrameEvent e) {} + @Override + public void internalFrameDeiconified(InternalFrameEvent e) {} - public void RegisterTable() { - TableUpdateHandler.getInstance().registerTable(this.getTable()); + public Table getTable() { + if(tableView == null) return null; + + return tableView.getTable(); + } + public TableView getTableView() { + return tableView; } - public Table getTable() { - return table; + public void setTableView(TableView v) { + tableView = v; } public ECUEditor getEditor() { @@ -116,119 +136,133 @@ public TableMenuBar getTableMenuBar() { @Override public void actionPerformed(ActionEvent e) { TableMenuBar menu = getTableMenuBar(); + Table t = getTable(); + try { if (e.getSource() == menu.getUndoAll()) { - getTable().undoAll(); + t.undoAll(); } else if (e.getSource() == menu.getRevert()) { - getTable().setRevertPoint(); + t.setRevertPoint(); } else if (e.getSource() == menu.getUndoSel()) { - getTable().undoSelected(); + getTableView().undoSelected(); } else if (e.getSource() == menu.getClose()) { ECUEditorManager.getECUEditor().removeDisplayTable(this); } else if (e.getSource() == menu.getTableProperties()) { - JOptionPane.showMessageDialog(getTable(), new TablePropertyPanel(getTable()), - getTable().getName() + " Table Properties", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(getTableView(), + new TablePropertyPanel(t), + MessageFormat.format( + rb.getString("TBLPROP"), getTable().getName()), + JOptionPane.INFORMATION_MESSAGE); } else if (e.getSource() == menu.getCopySel()) { - getTable().copySelection(); + getTableView().copySelection(); } else if (e.getSource() == menu.getCopyTable()) { - getTable().copyTable(); + getTableView().copyTable(); } else if (e.getSource() == menu.getPaste()) { - getTable().paste(); + getTableView().paste(); } else if (e.getSource() == menu.getCompareOff()) { - getTable().setCompareTable(null); - getTable().setCompareValueType(Settings.DATA_TYPE_BIN); + t.setCompareTable(null); + t.setCompareValueType(Settings.DataType.BIN); getTableMenuBar().getCompareToBin().setSelected(true); } else if (e.getSource() == menu.getCompareAbsolute()) { - getTable().setCompareDisplay(Settings.COMPARE_DISPLAY_ABSOLUTE); + getTableView().setCompareDisplay(Settings.CompareDisplay.ABSOLUTE); } else if (e.getSource() == menu.getComparePercent()) { - getTable().setCompareDisplay(Settings.COMPARE_DISPLAY_PERCENT); + getTableView().setCompareDisplay(Settings.CompareDisplay.PERCENT); } else if (e.getSource() == menu.getCompareOriginal()) { - getTable().setCompareValueType(Settings.DATA_TYPE_ORIGINAL); + t.setCompareValueType(Settings.DataType.ORIGINAL); getTableMenuBar().getCompareToOriginal().setSelected(true); - compareByTable(getTable()); + compareByTable(t); } else if (e.getSource() == menu.getCompareMap()) { JTableChooser chooser = new JTableChooser(); - Table selectedTable = chooser.showChooser(getTable()); + Table selectedTable = chooser.showChooser(t); if(null != selectedTable) { compareByTable(selectedTable); } + else { + // User closed/cancelled Chooser window + menu.getCompareOff().setSelected(true); + } } else if (e.getSource() instanceof TableMenuItem) { - Table selectedTable = findSimilarTable((TableMenuItem)e.getSource()); + Table selectedTable = ((TableMenuItem) e.getSource()).getTable(); if(null != e.getSource()) { compareByTable(selectedTable); } } else if (e.getSource() == menu.getCompareToOriginal()) { - getTable().setCompareValueType(Settings.DATA_TYPE_ORIGINAL); - getTable().refreshCompare(); + t.setCompareValueType(Settings.DataType.ORIGINAL); + t.refreshCompare(); } else if (e.getSource() == menu.getCompareToBin()) { - getTable().setCompareValueType(Settings.DATA_TYPE_BIN); - getTable().refreshCompare(); + t.setCompareValueType(Settings.DataType.BIN); + t.refreshCompare(); } else if (e.getSource() == menu.getInterp()) { getTable().interpolate(); } else if (e.getSource() == menu.getVertInterp()) { - getTable().verticalInterpolate(); + getTable().verticalInterpolate(); } else if (e.getSource() == menu.getHorizInterp()) { - getTable().horizontalInterpolate(); + getTable().horizontalInterpolate(); + } + } + catch(UserLevelException ex) { + TableView.showInvalidUserLevelPopup(ex); } } public void compareByTable(Table selectedTable) { + Table t = getTable(); + if(null == selectedTable) { return; } - getTable().setCompareTable(selectedTable); - ECUEditorManager.getECUEditor().getTableToolBar().updateTableToolBar(getTable()); - getTable().populateCompareValues(selectedTable); + + t.setCompareTable(selectedTable); + ECUEditorManager.getECUEditor().getTableToolBar().updateTableToolBar(t); + t.populateCompareValues(selectedTable); } public void refreshSimilarOpenTables() { JMenu similarTables = getTableMenuBar().getSimilarOpenTables(); similarTables.removeAll(); - for(Rom rom : ECUEditorManager.getECUEditor().getImages()) { - for(TableTreeNode tableNode : rom.getTableNodes()) { - if(tableNode.getTable().getName().equalsIgnoreCase(getTable().getName())) { - JRadioButtonMenuItem similarTable = new TableMenuItem(rom.getFileName()); - similarTable.setToolTipText(tableNode.getFrame().getTable().getName()); + Vector images = ECUEditorManager.getECUEditor().getImages(); + boolean addedTable = false; + + if(images.size() > 1) { + for(Rom rom : images) { + if (rom == getTable().getRom()) continue; + if(rom.getTableNodes().containsKey(getTable().getName().toLowerCase())) { + TableTreeNode tableNode = rom.getTableNodes().get(getTable().getName().toLowerCase()); + JRadioButtonMenuItem similarTable = new TableMenuItem(tableNode.getTable()); + similarTable.setToolTipText(tableNode.getTable().getName()); similarTable.addActionListener(this); similarTables.add(similarTable); - break; - } - } + addedTable = true; + continue; + } + } } - getTableMenuBar().initCompareGroup(); - getTableMenuBar().repaint(); - } + if(addedTable) + similarTables.setEnabled(true); + else + similarTables.setEnabled(false); - private Table findSimilarTable(TableMenuItem menuItem) { - for(Rom rom : ECUEditorManager.getECUEditor().getImages()) { - if(menuItem.getText().equalsIgnoreCase(rom.getFileName())) { - for(TableTreeNode treeNode : rom.getTableNodes()) { - if(menuItem.getToolTipText().equalsIgnoreCase(treeNode.getFrame().getTable().getName())) { - return treeNode.getFrame().getTable(); - } - } - } - } - return null; + getTableMenuBar().initCompareGroup(this); + getTableMenuBar().repaint(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/swing/TableMenuBar.java b/src/main/java/com/romraider/swing/TableMenuBar.java index 3e14fd128..ec2f52572 100644 --- a/src/main/java/com/romraider/swing/TableMenuBar.java +++ b/src/main/java/com/romraider/swing/TableMenuBar.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,9 @@ package com.romraider.swing; +import java.text.MessageFormat; +import java.util.ResourceBundle; + import javax.swing.ButtonGroup; import javax.swing.JMenu; import javax.swing.JMenuBar; @@ -26,40 +29,43 @@ import javax.swing.JRadioButtonMenuItem; import javax.swing.JSeparator; -import com.romraider.Settings; +import com.romraider.maps.Table; import com.romraider.maps.Table3D; +import com.romraider.util.ResourceUtil; public class TableMenuBar extends JMenuBar { private static final long serialVersionUID = -695692646459410510L; - private JMenu fileMenu; - private JMenuItem graph; - - private JMenu compareMenu; - private JRadioButtonMenuItem compareOriginal; - private JRadioButtonMenuItem compareMap; - private JMenu similarOpenTables; - private JRadioButtonMenuItem compareOff; - private JMenu compareDisplay; - private JRadioButtonMenuItem comparePercent; - private JRadioButtonMenuItem compareAbsolute; - private JMenu compareToValue; - private JRadioButtonMenuItem compareToOriginal; - private JRadioButtonMenuItem compareToBin; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + TableMenuBar.class.getName()); + private JMenu fileMenu = new JMenu(rb.getString("TABLE")); + private JMenuItem graph = new JMenuItem(rb.getString("VIEWGRAPH")); + + private JMenu compareMenu = new JMenu(rb.getString("COMPARE")); + private JRadioButtonMenuItem compareOriginal = new JRadioButtonMenuItem(rb.getString("SHOWCHNG")); + private JRadioButtonMenuItem compareMap = new JRadioButtonMenuItem(rb.getString("COMPAREMAP")); + private JMenu similarOpenTables = new JMenu(rb.getString("COMPARETBL")); + private JRadioButtonMenuItem compareOff = new JRadioButtonMenuItem(rb.getString("OFF")); + private JMenu compareDisplay = new JMenu(rb.getString("DISPLAY")); + private JRadioButtonMenuItem comparePercent = new JRadioButtonMenuItem(rb.getString("PERDIFF")); + private JRadioButtonMenuItem compareAbsolute = new JRadioButtonMenuItem(rb.getString("ABSDIFF")); + private JMenu compareToValue = new JMenu(rb.getString("COMAPRETO")); + private JRadioButtonMenuItem compareToOriginal = new JRadioButtonMenuItem(rb.getString("COMPARETOOV")); + private JRadioButtonMenuItem compareToBin = new JRadioButtonMenuItem(rb.getString("COMPARETOBV")); private JMenuItem close; - private JMenu editMenu; - private JMenuItem undoSel; - private JMenuItem undoAll; - private JMenuItem revert; - private JMenuItem copySel; - private JMenuItem copyTable; - private JMenuItem paste; - private JMenuItem interp; - private JMenuItem vertInterp; - private JMenuItem horizInterp; - private JMenu viewMenu; - private JMenuItem tableProperties; + private JMenu editMenu = new JMenu(rb.getString("EDIT")); + private JMenuItem undoSel = new JMenuItem(rb.getString("UNDOCHNGS")); + private JMenuItem undoAll = new JMenuItem(rb.getString("UNDOALL")); + private JMenuItem revert = new JMenuItem(rb.getString("SETREVERT")); + private JMenuItem copySel = new JMenuItem(rb.getString("COPYSEL")); + private JMenuItem copyTable = new JMenuItem(rb.getString("COPYTBL")); + private JMenuItem paste = new JMenuItem(rb.getString("PASTE")); + private JMenuItem interp = new JMenuItem(rb.getString("INTERP")); + private JMenuItem vertInterp = new JMenuItem(rb.getString("VINTERP")); + private JMenuItem horizInterp = new JMenuItem(rb.getString("HINTERP")); + private JMenu viewMenu = new JMenu(rb.getString("VIEW")); + private JMenuItem tableProperties = new JMenuItem(rb.getString("TBLPROP")); private ButtonGroup compareGroup; private ButtonGroup compareDisplayGroup; @@ -73,13 +79,11 @@ public TableMenuBar(TableFrame frame) { } private void initFileMenu(TableFrame frame) { - fileMenu = new JMenu("Table"); - graph = new JMenuItem("View Graph"); - compareMenu = new JMenu("Compare"); - setClose(new JMenuItem("Close Table")); + close = new JMenuItem(rb.getString("CLOSETBL")); initCompareMenu(frame); - getClose().setText("Close " + frame.getTable().getName()); + getClose().setText(MessageFormat.format( + rb.getString("CLOSEFRM"), frame.getTable().getName())); graph.addActionListener(frame); getClose().addActionListener(frame); @@ -97,17 +101,6 @@ private void initFileMenu(TableFrame frame) { } private void initEditMenu(TableFrame frame) { - editMenu = new JMenu("Edit"); - setUndoSel(new JMenuItem("Undo Selected Changes")); - setUndoAll(new JMenuItem("Undo All Changes")); - setRevert(new JMenuItem("Set Revert Point")); - setCopySel(new JMenuItem("Copy Selection")); - setCopyTable(new JMenuItem("Copy Table")); - setPaste(new JMenuItem("Paste")); - setVertInterp(new JMenuItem("Vertical Interpolate")); - setHorizInterp(new JMenuItem("Horizontal Interpolate")); - setInterp(new JMenuItem("Interpolate")); - editMenu.add(getUndoSel()); editMenu.add(getUndoAll()); editMenu.add(getRevert()); @@ -147,12 +140,9 @@ private void initEditMenu(TableFrame frame) { } private void initViewMenu(TableFrame frame) { - - viewMenu = new JMenu("View"); viewMenu.setMnemonic('V'); - setTableProperties(new JMenuItem("Table Properties")); - getTableProperties().setToolTipText("Select to view the table properties."); + getTableProperties().setToolTipText(rb.getString("TBLPROPTT")); getTableProperties().setMnemonic('P'); getTableProperties().addActionListener(frame); @@ -165,32 +155,22 @@ private void initViewMenu(TableFrame frame) { } private void initCompareMenu(TableFrame frame) { - setCompareOriginal(new JRadioButtonMenuItem("Show Changes")); - getCompareOriginal().setToolTipText("Compares the current values to the original or revert point values."); - setCompareMap(new JRadioButtonMenuItem("Compare to Another Map")); - getCompareMap().setToolTipText("Compares this table and a selected table."); - setSimilarOpenTables(new JMenu("Compare to Table")); - getSimilarOpenTables().setToolTipText("Compares this table to a similar table."); - - setCompareOff(new JRadioButtonMenuItem("Off")); - - setComparePercent(new JRadioButtonMenuItem("Percent Difference")); - setCompareAbsolute(new JRadioButtonMenuItem("Absolute Difference")); + getCompareOriginal().setToolTipText(rb.getString("COMPARETT")); + getCompareMap().setToolTipText(rb.getString("COMPARETBLTT")); + getSimilarOpenTables().setToolTipText(rb.getString("COMPARESIMTT")); + getSimilarOpenTables().setEnabled(false); + compareDisplayGroup = new ButtonGroup(); compareDisplayGroup.add(getComparePercent()); compareDisplayGroup.add(getCompareAbsolute()); - compareDisplay = new JMenu("Display"); compareDisplay.add(getComparePercent()); compareDisplay.add(getCompareAbsolute()); - setCompareToOriginal(new JRadioButtonMenuItem("Compare to Original Value")); - getCompareToOriginal().setToolTipText("Compares this table to the selected table's original or revert point values."); - setCompareToBin(new JRadioButtonMenuItem("Compare to Bin Value")); - getCompareToBin().setToolTipText("Compares this table to the selected table's current values."); + getCompareToOriginal().setToolTipText(rb.getString("COMPARETHIS")); + getCompareToBin().setToolTipText(rb.getString("COMPARECURRENT")); compareToGroup = new ButtonGroup(); compareToGroup.add(getCompareToOriginal()); compareToGroup.add(getCompareToBin()); - compareToValue = new JMenu("Compare to"); compareToValue.add(getCompareToOriginal()); compareToValue.add(getCompareToBin()); @@ -219,8 +199,6 @@ private void initCompareMenu(TableFrame frame) { getCompareAbsolute().setSelected(true); getCompareToOriginal().setSelected(true); - initCompareGroup(); - getCompareOriginal().addActionListener(frame); getCompareMap().addActionListener(frame); getCompareOff().addActionListener(frame); @@ -230,13 +208,13 @@ private void initCompareMenu(TableFrame frame) { getCompareToBin().addActionListener(frame); } - public void initCompareGroup() { + public void initCompareGroup(TableFrame frame) { compareGroup = new ButtonGroup(); compareGroup.add(getCompareOriginal()); compareGroup.add(getCompareMap()); compareGroup.add(getCompareOff()); - + for(int i = 0; i< getSimilarOpenTables().getItemCount(); i++) { compareGroup.add(getSimilarOpenTables().getItem(i)); } @@ -244,7 +222,7 @@ public void initCompareGroup() { private void applyTableTypeRules(TableFrame frame) { // Hide items that don't work with a DTC tables. - if(frame.getTable().getType() == Settings.TABLE_SWITCH) { + if(frame.getTable().getType() == Table.TableType.SWITCH) { editMenu.setEnabled(false); getCompareOriginal().setEnabled(false); getComparePercent().setEnabled(false); @@ -258,150 +236,76 @@ public JMenuItem getUndoAll() { return undoAll; } - public void setUndoAll(JMenuItem undoAll) { - this.undoAll = undoAll; - } - public JMenuItem getRevert() { return revert; } - public void setRevert(JMenuItem revert) { - this.revert = revert; - } - public JMenuItem getUndoSel() { return undoSel; } - public void setUndoSel(JMenuItem undoSel) { - this.undoSel = undoSel; - } - public JMenuItem getClose() { return close; } - public void setClose(JMenuItem close) { - this.close = close; - } - public JMenuItem getTableProperties() { return tableProperties; } - public void setTableProperties(JMenuItem tableProperties) { - this.tableProperties = tableProperties; - } public JMenuItem getCopySel() { return copySel; } - public void setCopySel(JMenuItem copySel) { - this.copySel = copySel; - } - public JMenuItem getCopyTable() { return copyTable; } - public void setCopyTable(JMenuItem copyTable) { - this.copyTable = copyTable; - } - public JMenuItem getPaste() { return paste; } - public void setPaste(JMenuItem paste) { - this.paste = paste; - } - public JRadioButtonMenuItem getCompareOff() { return compareOff; } - public void setCompareOff(JRadioButtonMenuItem compareOff) { - this.compareOff = compareOff; - } - public JRadioButtonMenuItem getCompareAbsolute() { return compareAbsolute; } - public void setCompareAbsolute(JRadioButtonMenuItem compareAbsolute) { - this.compareAbsolute = compareAbsolute; - } - public JRadioButtonMenuItem getComparePercent() { return comparePercent; } - public void setComparePercent(JRadioButtonMenuItem comparePercent) { - this.comparePercent = comparePercent; - } - public JRadioButtonMenuItem getCompareOriginal() { return compareOriginal; } - public void setCompareOriginal(JRadioButtonMenuItem compareOriginal) { - this.compareOriginal = compareOriginal; - } - public JRadioButtonMenuItem getCompareToOriginal() { return compareToOriginal; } - public void setCompareToOriginal(JRadioButtonMenuItem compareToOriginal) { - this.compareToOriginal = compareToOriginal; - } - public JRadioButtonMenuItem getCompareMap() { return compareMap; } - public void setCompareMap(JRadioButtonMenuItem compareMap) { - this.compareMap = compareMap; - } - public JRadioButtonMenuItem getCompareToBin() { return compareToBin; } - public void setCompareToBin(JRadioButtonMenuItem compareToBin) { - this.compareToBin = compareToBin; - } - public JMenu getSimilarOpenTables() { return similarOpenTables; } - public void setSimilarOpenTables(JMenu similarOpenTables) { - this.similarOpenTables = similarOpenTables; - } - public JMenuItem getInterp() { return interp; } - public void setInterp(JMenuItem interp) { - this.interp = interp; - } - public JMenuItem getHorizInterp() { return this.horizInterp; } - public void setHorizInterp(JMenuItem horizInterp) { - this.horizInterp = horizInterp; - } - public JMenuItem getVertInterp() { return this.vertInterp; } - public void setVertInterp(JMenuItem vertInterp) { - this.vertInterp = vertInterp; - } } \ No newline at end of file diff --git a/src/main/java/com/romraider/swing/TableMenuItem.java b/src/main/java/com/romraider/swing/TableMenuItem.java index 52bfaf514..a77c49f89 100644 --- a/src/main/java/com/romraider/swing/TableMenuItem.java +++ b/src/main/java/com/romraider/swing/TableMenuItem.java @@ -2,11 +2,19 @@ import javax.swing.JRadioButtonMenuItem; +import com.romraider.maps.Table; + public class TableMenuItem extends JRadioButtonMenuItem{ private static final long serialVersionUID = -3618983591185294967L; - - public TableMenuItem(String itemName) { - super(itemName); + Table table; + + public TableMenuItem(Table t) { + super(t.getRom().getFileName()); + this.table = t; + } + + public Table getTable() { + return table; } } diff --git a/src/main/java/com/romraider/swing/TablePropertyPanel.java b/src/main/java/com/romraider/swing/TablePropertyPanel.java index cee0f9cb0..c5c7d48bb 100644 --- a/src/main/java/com/romraider/swing/TablePropertyPanel.java +++ b/src/main/java/com/romraider/swing/TablePropertyPanel.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,15 +19,14 @@ package com.romraider.swing; +import java.awt.Cursor; import java.util.HashMap; import java.util.Map; +import java.util.ResourceBundle; import java.util.Vector; -import javax.swing.GroupLayout; +import javax.swing.*; import javax.swing.GroupLayout.Alignment; -import javax.swing.JLabel; -import javax.swing.JScrollPane; -import javax.swing.JTable; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumn; @@ -35,11 +34,13 @@ import com.romraider.Settings; import com.romraider.maps.Scale; import com.romraider.maps.Table; -import com.romraider.maps.TableSwitch; +import com.romraider.util.ResourceUtil; public class TablePropertyPanel extends javax.swing.JPanel { private static final long serialVersionUID = -5817685772039277602L; + private static final ResourceBundle rb = new ResourceUtil().getBundle( + TablePropertyPanel.class.getName()); public TablePropertyPanel(Table table) { initComponents(); @@ -48,16 +49,20 @@ public TablePropertyPanel(Table table) { category.setText(table.getCategory()); int dim; - if (Settings.TABLE_SWITCH == table.getType()) { + if (Table.TableType.SWITCH == table.getType()) { dim = 1; storageSize.setText("switch"); - scrollPane.setViewportView(populateScalesTable( - ((TableSwitch) table).getSwitchStates())); } else { if (Settings.STORAGE_TYPE_FLOAT == table.getStorageType()) { storageSize.setText("float"); } + else if (table.getStorageType() == Settings.STORAGE_TYPE_MOVI20) { + storageSize.setText("int20"); + } + else if (table.getStorageType() == Settings.STORAGE_TYPE_MOVI20S) { + storageSize.setText("int28"); + } else { String dataType; if (table.isSignedData()) { @@ -68,14 +73,14 @@ public TablePropertyPanel(Table table) { } storageSize.setText(dataType + (table.getStorageType() * 8)); } - dim = table.getType(); + dim = table.getType().getDimension(); scrollPane.setViewportView(populateScalesTable(table.getScales())); } tableName.setText(String.format("%s (%dD)", table.getName(), dim)); storageAddress.setText("0x" + Integer.toHexString(table.getStorageAddress())); - if (table.getEndian() == Settings.ENDIAN_BIG) { + if (table.getEndian() == Settings.Endian.BIG) { endian.setText("big"); } else { endian.setText("little"); @@ -84,15 +89,15 @@ public TablePropertyPanel(Table table) { description.setText(table.getDescription()); if (table.getUserLevel() == 1) { - userLevel.setText("Beginner"); + userLevel.setText(rb.getString("LVL1")); } else if (table.getUserLevel() == 2) { - userLevel.setText("Intermediate"); + userLevel.setText(rb.getString("LVL2")); } else if (table.getUserLevel() == 3) { - userLevel.setText("Advanced"); + userLevel.setText(rb.getString("LVL3")); } else if (table.getUserLevel() == 4) { - userLevel.setText("All"); + userLevel.setText(rb.getString("LVL4")); } else if (table.getUserLevel() == 5) { - userLevel.setText("Debug"); + userLevel.setText(rb.getString("LVL5")); } logIDscrollPane.setViewportView(populateLogParamTable(table.getLogParamString())); @@ -119,23 +124,24 @@ private void initComponents() { userLevel = new javax.swing.JLabel(); scrollPane = new JScrollPane(); logIDscrollPane = new JScrollPane(); - + setAutoscrolls(true); setFont(new java.awt.Font("Tahoma", 0, 12)); setInheritsPopupMenu(true); - lblTable.setText("Table:"); + lblTable.setText(rb.getString("TABLE")); lblTable.setFocusable(false); tableName.setText("Tablename (3D)"); tableName.setFocusable(false); - lblCategory.setText("Category:"); + lblCategory.setText(rb.getString("CATEGORY")); lblCategory.setFocusable(false); category.setText("Category"); category.setFocusable(false); - jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Conversions"))); + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( + javax.swing.BorderFactory.createTitledBorder(rb.getString("CONV")))); GroupLayout jPanel1Layout = new GroupLayout(jPanel1); jPanel1Layout.setHorizontalGroup( @@ -149,14 +155,15 @@ private void initComponents() { jPanel1.setLayout(jPanel1Layout); - jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Storage")); - lblStorageAddress.setText("Storage Address:"); + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder( + rb.getString("STORAGE"))); + lblStorageAddress.setText(rb.getString("STORAGEADDR")); lblStorageAddress.setFocusable(false); - lblStorageSize.setText("Data Type:"); + lblStorageSize.setText(rb.getString("DATATYPE")); lblStorageSize.setFocusable(false); - lblEndian.setText("Endian:"); + lblEndian.setText(rb.getString("ENDIAN")); lblEndian.setFocusable(false); endian.setText("little"); @@ -168,73 +175,73 @@ private void initComponents() { storageAddress.setText("0x00"); storageAddress.setFocusable(false); - org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); + GroupLayout jPanel2Layout = new GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel2Layout.createSequentialGroup() + jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() - .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(lblStorageAddress) - .add(lblStorageSize) - .add(lblEndian)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(endian) - .add(storageSize) - .add(storageAddress)) - .addContainerGap(28, Short.MAX_VALUE)) + .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(lblStorageAddress) + .addComponent(lblStorageSize) + .addComponent(lblEndian)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(endian) + .addComponent(storageSize) + .addComponent(storageAddress)) + .addContainerGap(28, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel2Layout.createSequentialGroup() - .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblStorageSize) - .add(storageSize)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblStorageAddress) - .add(storageAddress)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblEndian) - .add(endian)) - .addContainerGap(37, Short.MAX_VALUE)) + jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(lblStorageSize) + .addComponent(storageSize)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(lblStorageAddress) + .addComponent(storageAddress)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(lblEndian) + .addComponent(endian)) + .addContainerGap(37, Short.MAX_VALUE)) ); - jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Description")); + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder( + rb.getString("DESC"))); jScrollPane1.setBorder(null); description.setBackground(new java.awt.Color(236, 233, 216)); description.setColumns(20); description.setEditable(false); + description.setCursor(new Cursor(Cursor.TEXT_CURSOR)); description.setFont(new java.awt.Font("Tahoma", 0, 11)); description.setLineWrap(true); - description.setRows(5); description.setText("Description"); description.setWrapStyleWord(true); description.setBorder(null); description.setOpaque(false); - description.setRequestFocusEnabled(false); jScrollPane1.setViewportView(description); - org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); + GroupLayout jPanel3Layout = new GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 360, Short.MAX_VALUE) + jPanel3Layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 360, Short.MAX_VALUE) ); jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel3Layout.createSequentialGroup() - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE) + jPanel3Layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE) .addContainerGap()) ); - jLabel5.setText("User Level:"); + jLabel5.setText(rb.getString("USERLVL")); userLevel.setText("Beginner"); - lblLogId = new JLabel("Log Param:"); + lblLogId = new JLabel(rb.getString("LOGPARAM")); GroupLayout layout = new GroupLayout(this); layout.setHorizontalGroup( @@ -317,12 +324,6 @@ private JTable populateScalesTable(Vector scales) { return createScalesTable(scalesModel); } - private JTable populateScalesTable(Map switchStates) { - final SwitchStateTableModel scalesModel = new SwitchStateTableModel(); - scalesModel.setScalesList(switchStates); - return createScalesTable(scalesModel); - } - private JTable createScalesTable(DefaultTableModel tableModel) { final JTable table = new JTable(tableModel); table.setAutoCreateRowSorter(false); @@ -337,7 +338,7 @@ private JTable populateLogParamTable(String logParams) { final String[] paramEntries = logParams.split(", "); for (String entry : paramEntries) { final String[] entries = entry.split(":"); - if(!paramMap.containsKey(entries[0])){ + if(entries.length > 0 && !paramMap.containsKey(entries[0])){ paramMap.put(entries[0], entries.length > 1 ? entries[1] : "n/a"); } } diff --git a/src/main/java/com/romraider/swing/TableToolBar.java b/src/main/java/com/romraider/swing/TableToolBar.java index 90cad29ed..e5079551c 100644 --- a/src/main/java/com/romraider/swing/TableToolBar.java +++ b/src/main/java/com/romraider/swing/TableToolBar.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ package com.romraider.swing; +import static com.romraider.Settings.COMMA; import static javax.swing.BorderFactory.createLineBorder; import java.awt.Color; @@ -35,8 +36,8 @@ import java.beans.PropertyVetoException; import java.math.BigDecimal; import java.net.URL; -import java.text.DecimalFormat; import java.text.ParseException; +import java.util.ResourceBundle; import java.util.Vector; import javax.naming.NameNotFoundException; @@ -48,7 +49,6 @@ import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; -import javax.swing.JFormattedTextField; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JPanel; @@ -69,13 +69,20 @@ import com.romraider.maps.Scale; import com.romraider.maps.Table; import com.romraider.maps.Table1D; +import com.romraider.maps.Table1DView; import com.romraider.maps.Table3D; +import com.romraider.maps.TableView; +import com.romraider.maps.UserLevelException; +import com.romraider.util.NumberUtil; +import com.romraider.util.ResourceUtil; import com.romraider.util.SettingsManager; public class TableToolBar extends JToolBar implements MouseListener, ItemListener, ActionListener, GraphDataListener { private static final long serialVersionUID = 8697645329367637930L; private static final Logger LOGGER = Logger.getLogger(TableToolBar.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + TableToolBar.class.getName()); private final JButton incrementFine = new JButton(); private final JButton decrementFine = new JButton(); private final JButton incrementCoarse = new JButton(); @@ -84,18 +91,18 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene private final JButton colorCells = new JButton(); private final JButton refreshCompare = new JButton(); - private final JButton setValue = new JButton("Set"); - private final JButton multiply = new JButton("Mul"); + private final JButton setValue = new JButton(rb.getString("SET")); + private final JButton multiply = new JButton(rb.getString("MUL")); - private final JFormattedTextField incrementByFine = new JFormattedTextField(new DecimalFormat("#.####")); - private final JFormattedTextField incrementByCoarse = new JFormattedTextField(new DecimalFormat("#.####")); - private final JFormattedTextField setValueText = new JFormattedTextField(new DecimalFormat("#.####")); + private final ECUEditorNumberField incrementByFine = new ECUEditorNumberField(); + private final ECUEditorNumberField incrementByCoarse = new ECUEditorNumberField(); + private final ECUEditorNumberField setValueText = new ECUEditorNumberField(); private final JComboBox scaleSelection = new JComboBox(); private final JPanel liveDataPanel = new JPanel(); - private final JCheckBox overlayLog = new JCheckBox("Overlay Log"); - private final JButton clearOverlay = new JButton("Clear Overlay"); + private final JCheckBox overlayLog = new JCheckBox(rb.getString("OVERLAYLOG")); + private final JButton clearOverlay = new JButton(rb.getString("CLEAROVERLAY")); private final JLabel liveDataValue = new JLabel(); private final URL incrementFineImage = getClass().getResource("/graphics/icon-incfine.png"); @@ -182,20 +189,20 @@ public TableToolBar() { setValueText.setAlignmentY(JTextArea.CENTER_ALIGNMENT); setValueText.setPreferredSize(new Dimension(45, 23)); - incrementFine.setToolTipText("Increment Value (Fine)"); - decrementFine.setToolTipText("Decrement Value (Fine)"); - incrementCoarse.setToolTipText("Increment Value (Coarse)"); - decrementCoarse.setToolTipText("Decrement Value (Coarse)"); - enable3d.setToolTipText("Render data in 3d"); - setValue.setToolTipText("Set Absolute Value"); - setValueText.setToolTipText("Set Absolute Value"); - incrementByFine.setToolTipText("Fine Value Adjustment"); - incrementByCoarse.setToolTipText("Coarse Value Adjustment"); - multiply.setToolTipText("Multiply Value"); - overlayLog.setToolTipText("Enable Overlay Of Real Time Log Data"); - clearOverlay.setToolTipText("Clear Log Data Overlay Highlights"); - colorCells.setToolTipText("Color Table Cells"); - refreshCompare.setToolTipText("Refresh Table Compare"); + incrementFine.setToolTipText(rb.getString("INCFTT")); + decrementFine.setToolTipText(rb.getString("DECFTT")); + incrementCoarse.setToolTipText(rb.getString("INCCTT")); + decrementCoarse.setToolTipText(rb.getString("DECCTT")); + enable3d.setToolTipText(rb.getString("RENDERTT")); + setValue.setToolTipText(rb.getString("SETABSTT")); + setValueText.setToolTipText(rb.getString("SETABSTT")); + incrementByFine.setToolTipText(rb.getString("FINEVALUETT")); + incrementByCoarse.setToolTipText(rb.getString("COURSEVALUETT")); + multiply.setToolTipText(rb.getString("MULTVALUETT")); + overlayLog.setToolTipText(rb.getString("OVERLAYLOGTT")); + clearOverlay.setToolTipText(rb.getString("CLEAROVERLAYTT")); + colorCells.setToolTipText(rb.getString("CTCTT")); + refreshCompare.setToolTipText(rb.getString("RTCTT")); incrementFine.addMouseListener(this); decrementFine.addMouseListener(this); @@ -227,7 +234,12 @@ public void actionPerformed(ActionEvent e) { } catch (PropertyVetoException ex) { } frame.requestFocusInWindow(); - setValue(frame.getTable()); + + try { + setValue(frame.getTable()); + } catch (UserLevelException e1) { + e1.printStackTrace(); + } } }; @@ -256,6 +268,7 @@ public void actionPerformed(ActionEvent e) { setValue.getInputMap().put(enter, "enterAction"); this.setEnabled(true); + toggleTableToolBar(null); } public void updateIcons() { @@ -277,20 +290,6 @@ private ImageIcon rescaleImageIcon(ImageIcon imageIcon, int percentOfOriginal) { return imageIcon; } - public Table getTable() { - JInternalFrame frame = ECUEditorManager.getECUEditor().getRightPanel().getSelectedFrame(); - if(null == frame) { - return null; - } - - if( !(frame instanceof TableFrame) ) { - return null; - } - - - return ((TableFrame)frame).getTable(); - } - @Override public void setBorder(Border border) { if(SettingsManager.getSettings().isShowTableToolbarBorder()) { @@ -300,11 +299,49 @@ public void setBorder(Border border) { } } - public void updateTableToolBar() { - this.updateTableToolBar(getTable()); + private void saveFineCourseValuesInTable(Table t) { + if(t == null || t.getCurrentScale() == null) return; + + double incCoarse = 0; + double incFine = 0; + + try { + //Commit the value which was typed (if field still has focus) + incrementByCoarse.commitEdit(); + incrementByFine.commitEdit(); + + incCoarse = Double.parseDouble(String.valueOf(incrementByCoarse.getValue())); + incFine = Double.parseDouble(String.valueOf(incrementByFine.getValue())); + } + //Current value in the inc/dec field are not valid + catch(ParseException e) { + return; + } + //Should not happen since ParseException would happen before that + catch(NumberFormatException e) { + return; + } + + //Save current inc/dec values in table before we switch + if(incCoarse!=0 && incFine != 0) { + t.updateIncrementDecrementValues(incFine,incCoarse); + } } public void updateTableToolBar(Table selectedTable) { + + // If the table is a 1D table, we might select an axis + // but we want to change the scales of the entire table + if(selectedTable instanceof Table1D) + { + Table t = ((Table1D)selectedTable).getAxisParent(); + // Table will not have a parent if its a standalone 1D table + if(t != null) + { + selectedTable = t; + } + } + if(selectedTable == null && this.selectedTable == null) { // Skip if the table is the same to avoid multiple updates return; @@ -315,6 +352,9 @@ public void updateTableToolBar(Table selectedTable) { return; } + + //Save the current inc/dec values in the table + saveFineCourseValuesInTable(this.selectedTable); this.selectedTable = selectedTable; setBorder(toolbarBorder); @@ -327,9 +367,10 @@ public void updateTableToolBar(Table selectedTable) { } updateToolbarIncrementDecrementValues(); - - this.overlayLog.setSelected(selectedTable.getOverlayLog()); - this.enable3d.setEnabled(selectedTable.getType() == Settings.TABLE_3D); + + if(selectedTable.getTableView() != null) + this.overlayLog.setSelected(selectedTable.getTableView().getOverlayLog()); + this.enable3d.setEnabled(selectedTable.getType() == Table.TableType.TABLE_3D); setScales(selectedTable.getScales()); @@ -337,7 +378,7 @@ public void updateTableToolBar(Table selectedTable) { { this.scaleSelection.setSelectedItem("Default"); } else { - this.scaleSelection.setSelectedItem(selectedTable.getCurrentScale().getName()); + this.scaleSelection.setSelectedItem(selectedTable.getCurrentScale().getCategory()); } toggleTableToolBar(selectedTable); @@ -372,7 +413,7 @@ private void toggleTableToolBar(Table currentTable) { } else { if(currentTable instanceof Table1D) { Table1D cur1DTable = (Table1D)currentTable; - if(cur1DTable.isAxis()) { + if(cur1DTable.getTableView() != null && (((Table1DView)(cur1DTable.getTableView())).isAxis())) { newTitle = cur1DTable.getAxisParent().getName() + " ("+ cur1DTable.getName() +")"; } else { newTitle = currentTable.getName(); @@ -406,7 +447,7 @@ private void toggleTableToolBar(Table currentTable) { refreshCompare.setEnabled(enabled); //Only enable the 3d button if table includes 3d data - if (null != currentTable && currentTable.getType() == Settings.TABLE_3D && enabled) { + if (null != currentTable && currentTable.getType() == Table.TableType.TABLE_3D && enabled) { enable3d.setEnabled(true); } else{ @@ -462,7 +503,7 @@ public void setScales(Vector scales) { scaleSelection.removeAllItems(); for (Scale scale : scales) { - scaleSelection.addItem(scale.getName()); + scaleSelection.addItem(scale.getCategory()); } // and put it back @@ -476,33 +517,37 @@ public void mouseClicked(MouseEvent e) { { return; } + try { + if (e.getSource() == incrementCoarse) { + incrementCoarse(curTable); + } else if (e.getSource() == decrementCoarse) { + decrementCoarse(curTable); + } else if (e.getSource() == enable3d) { + enable3d(curTable); + } else if (e.getSource() == incrementFine) { + incrementFine(curTable); + } else if (e.getSource() == decrementFine) { + decrementFine(curTable); + } else if (e.getSource() == multiply) { + multiply(curTable); + } else if (e.getSource() == setValue) { + setValue(curTable); + } else if (e.getSource() == colorCells) { + colorCells(curTable); + } else if (e.getSource() == refreshCompare) { + refreshCompare(curTable); + } + } + catch(UserLevelException ex) { + TableView.showInvalidUserLevelPopup(ex); + } + } - if (e.getSource() == incrementCoarse) { - incrementCoarse(curTable); - } else if (e.getSource() == decrementCoarse) { - decrementCoarse(curTable); - } else if (e.getSource() == enable3d) { - enable3d(curTable); - } else if (e.getSource() == incrementFine) { - incrementFine(curTable); - } else if (e.getSource() == decrementFine) { - decrementFine(curTable); - } else if (e.getSource() == multiply) { - multiply(curTable); - } else if (e.getSource() == setValue) { - setValue(curTable); - } else if (e.getSource() == colorCells) { - colorCells(curTable); - } else if (e.getSource() == refreshCompare) { - refreshCompare(curTable); - } - } - - public void setValue(Table currentTable) { + public void setValue(Table currentTable) throws UserLevelException { currentTable.setRealValue(setValueText.getText()); } - public void multiply() { + public void multiply() throws UserLevelException { Table curTable = getSelectedTable(); if(null == curTable) { return; @@ -510,15 +555,15 @@ public void multiply() { multiply(curTable); } - public void multiply(Table currentTable) { + public void multiply(Table currentTable) throws UserLevelException { try{ - currentTable.multiply(Double.parseDouble(setValueText.getText())); - }catch(NumberFormatException nex) { - // Do Nothing. setValueText is null or not a valid double. + currentTable.multiply(NumberUtil.doubleValue(setValueText.getText())); + }catch(ParseException nex) { + LOGGER.error(this.getClass().getName() + ".multiply(" + currentTable + ") " + nex); } } - public void incrementFine() { + public void incrementFine() throws NumberFormatException, UserLevelException { Table curTable = getSelectedTable(); if(null == curTable) { return; @@ -526,11 +571,11 @@ public void incrementFine() { incrementFine(curTable); } - public void incrementFine(Table currentTable) { + public void incrementFine(Table currentTable) throws NumberFormatException, UserLevelException { currentTable.increment(Double.parseDouble(String.valueOf(incrementByFine.getValue()))); } - public void decrementFine() { + public void decrementFine() throws NumberFormatException, UserLevelException { Table curTable = getSelectedTable(); if(null == curTable) { return; @@ -538,11 +583,11 @@ public void decrementFine() { decrementFine(curTable); } - public void decrementFine(Table currentTable) { + public void decrementFine(Table currentTable) throws NumberFormatException, UserLevelException { currentTable.increment(0 - Double.parseDouble(String.valueOf(incrementByFine.getValue()))); } - public void incrementCoarse() { + public void incrementCoarse() throws NumberFormatException, UserLevelException { Table curTable = getSelectedTable(); if(null == curTable) { return; @@ -550,11 +595,11 @@ public void incrementCoarse() { incrementCoarse(curTable); } - public void incrementCoarse(Table currentTable) { + public void incrementCoarse(Table currentTable) throws NumberFormatException, UserLevelException { currentTable.increment(Double.parseDouble(String.valueOf(incrementByCoarse.getValue()))); } - public void decrementCoarse() { + public void decrementCoarse() throws NumberFormatException, UserLevelException { Table curTable = getSelectedTable(); if(null == curTable) { return; @@ -562,7 +607,7 @@ public void decrementCoarse() { decrementCoarse(curTable); } - public void decrementCoarse(Table currentTable) { + public void decrementCoarse(Table currentTable) throws NumberFormatException, UserLevelException { currentTable.increment(0 - Double.parseDouble(String.valueOf(incrementByCoarse.getValue()))); } @@ -577,7 +622,7 @@ public void enable3d(Table currentTable) { Vector graphValues = new Vector(); graphValues.clear(); - if (currentTable.getType() == Settings.TABLE_3D) { + if (currentTable.getType() == Table.TableType.TABLE_3D) { Table3D table3d = (Table3D) currentTable; DataCell[][] tableData = table3d.get3dData(); valueCount = tableData.length; @@ -645,7 +690,8 @@ public void enable3d(Table currentTable) { //*********** /*minV = 0.0; maxV = 13.01;*/ - LOGGER.debug("Scale: " + maxV + "," + minV); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Scale: " + maxV + COMMA + minV); //*********** Graph3dFrameManager.openGraph3dFrame(graphValues, minV, maxV, xValues, yValues, xLabel, yLabel, zLabel, currentTable.getName()); @@ -716,15 +762,14 @@ public void itemStateChanged(ItemEvent e) { if (e.getSource() == scaleSelection) { // scale changed try { - - curTable.setScaleByName((String)scaleSelection.getSelectedItem()); + curTable.setScaleByCategory((String)scaleSelection.getSelectedItem()); updateToolbarIncrementDecrementValues(); } catch (NameNotFoundException e1) { e1.printStackTrace(); } } else if (e.getSource() == overlayLog) { // enable/disable log overlay and live data display - curTable.setOverlayLog(overlayLog.isSelected()); + curTable.getTableView().setOverlayLog(overlayLog.isSelected()); } } @@ -738,7 +783,7 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == clearOverlay) { // clear log overlay - curTable.clearLiveDataTrace(); + curTable.getTableView().clearLiveDataTrace(); } } @@ -758,12 +803,16 @@ public void newGraphData(int x, int z, float value) { return; } - if(curTable.getType() == Settings.TABLE_3D) { + if(curTable.getType() == Table.TableType.TABLE_3D) { Table3D table3d = (Table3D) curTable; table3d.selectCellAt(x, table3d.getSizeY() - z - 1); //Set the value - table3d.setRealValue(String.valueOf(value)); + try { + table3d.setRealValue(String.valueOf(value)); + } catch (UserLevelException e) { + e.printStackTrace(); + } } } @@ -774,7 +823,7 @@ public void selectStateChange(int x, int z, boolean value) { return; } - if(curTable.getType() == Settings.TABLE_3D) { + if(curTable.getType() == Table.TableType.TABLE_3D) { if (value) { Table3D table3d = (Table3D) curTable; table3d.selectCellAtWithoutClear(x, table3d.getSizeY() - z - 1); @@ -788,4 +837,4 @@ public void selectStateChange(int x, int z, boolean value) { public Table getSelectedTable() { return this.selectedTable; } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/swing/TableTreeNode.java b/src/main/java/com/romraider/swing/TableTreeNode.java index 0d35d8095..7beeebac9 100644 --- a/src/main/java/com/romraider/swing/TableTreeNode.java +++ b/src/main/java/com/romraider/swing/TableTreeNode.java @@ -25,26 +25,25 @@ public class TableTreeNode extends DefaultMutableTreeNode { + private final Table table; private static final long serialVersionUID = 2824050968863990871L; private String toolTip; - public TableTreeNode(TableFrame tableFrame) { - super(tableFrame); + public TableTreeNode(Table t) { + super(t); + this.table = t; } public TableFrame getFrame() { - if(getUserObject() instanceof TableFrame) { - return (TableFrame)getUserObject(); - } - return null; + return table.getTableFrame(); } - - public void setFrame(TableFrame tableFrame) { - this.setUserObject(tableFrame); + + public void setTable(Table t) { + this.setUserObject(t); } public Table getTable() { - return this.getFrame().getTable(); + return table; } public void setToolTipText(String input) { diff --git a/src/main/java/com/romraider/swing/XMLFilter.java b/src/main/java/com/romraider/swing/XMLFilter.java deleted file mode 100644 index d0d65e90a..000000000 --- a/src/main/java/com/romraider/swing/XMLFilter.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.swing; - -import javax.swing.filechooser.FileFilter; -import java.io.File; -import java.util.Enumeration; -import java.util.Hashtable; - -public class XMLFilter extends FileFilter { - - private Hashtable filters = null; - private String description = null; - private String fullDescription = null; - private boolean useExtensionsInDescription = true; - - public XMLFilter() { - this.filters = new Hashtable(); - this.addExtension("xml"); - this.setDescription("ECU Definition Files"); - } - - public boolean accept(File f) { - if (f != null) { - if (f.isDirectory()) { - return true; - } - String extension = getExtension(f); - if (extension != null && filters.get(getExtension(f)) != null) { - return true; - } - ; - } - return false; - } - - public String getExtension(File f) { - if (f != null) { - String filename = f.getName(); - int i = filename.lastIndexOf('.'); - if (i > 0 && i < filename.length() - 1) { - return filename.substring(i + 1).toLowerCase(); - } - ; - } - return null; - } - - public void addExtension(String extension) { - filters.put(extension.toLowerCase(), this); - fullDescription = null; - } - - public String getDescription() { - if (fullDescription == null) { - if (description == null || isExtensionListInDescription()) { - fullDescription = description == null ? "(" : description - + " ("; - // build the description from the extension list - Enumeration extensions = filters.keys(); - if (extensions != null) { - fullDescription += "." + extensions.nextElement(); - while (extensions.hasMoreElements()) { - fullDescription += ", ." - + extensions.nextElement(); - } - } - fullDescription += ")"; - } else { - fullDescription = description; - } - } - return fullDescription; - } - - public void setDescription(String description) { - this.description = description; - fullDescription = null; - } - - public void setExtensionListInDescription(boolean b) { - useExtensionsInDescription = b; - fullDescription = null; - } - - public boolean isExtensionListInDescription() { - return useExtensionsInDescription; - } -} \ No newline at end of file diff --git a/src/main/java/com/romraider/swing/menubar/action/AboutAction.java b/src/main/java/com/romraider/swing/menubar/action/AboutAction.java index 92909029b..2f5c57e52 100644 --- a/src/main/java/com/romraider/swing/menubar/action/AboutAction.java +++ b/src/main/java/com/romraider/swing/menubar/action/AboutAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2020 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; - +import java.text.MessageFormat; import com.romraider.Version; import com.romraider.logger.ecu.EcuLogger; @@ -34,14 +34,18 @@ public AboutAction(final EcuLogger logger) { } public void actionPerformed(final ActionEvent actionEvent) { - final String message = String.format( - "%s - ECU Logger%nVersion: %s%nBuild #: %s%n%s%nLogger Def Version: %s", + final String message = MessageFormat.format( + rb.getString("VERSIONSTR"), Version.PRODUCT_NAME, Version.VERSION, Version.BUILDNUMBER, Version.SUPPORT_URL, - logger.getDefVersion()); - final String title = "About " + Version.PRODUCT_NAME; + logger.getDefVersion(), + System.getProperty("java.vendor"), + System.getProperty("java.runtime.version"), + System.getProperty("os.arch")); + final String title = MessageFormat.format( + rb.getString("ABOUT"), Version.PRODUCT_NAME); showMessageDialog(logger, message, title, INFORMATION_MESSAGE, Version.ABOUT_ICON); } diff --git a/src/main/java/com/romraider/swing/menubar/action/AbstractAction.java b/src/main/java/com/romraider/swing/menubar/action/AbstractAction.java index d85baaf50..33cb59492 100644 --- a/src/main/java/com/romraider/swing/menubar/action/AbstractAction.java +++ b/src/main/java/com/romraider/swing/menubar/action/AbstractAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,12 +20,17 @@ package com.romraider.swing.menubar.action; import com.romraider.logger.ecu.EcuLogger; +import com.romraider.util.ResourceUtil; + import javax.swing.Action; import java.beans.PropertyChangeListener; import java.util.HashMap; import java.util.Map; +import java.util.ResourceBundle; public abstract class AbstractAction implements Action { + protected static final ResourceBundle rb = new ResourceUtil().getBundle( + AbstractAction.class.getName()); public static final String SELECTED_KEY = "selected"; private final Map valueMap = new HashMap(); private boolean enabled = true; diff --git a/src/main/java/com/romraider/swing/util/NumberVerifier.java b/src/main/java/com/romraider/swing/util/NumberVerifier.java new file mode 100644 index 000000000..a18fb9164 --- /dev/null +++ b/src/main/java/com/romraider/swing/util/NumberVerifier.java @@ -0,0 +1,80 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.swing.util; + +import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; + +import java.text.MessageFormat; +import java.util.ResourceBundle; +import java.util.Scanner; + +import javax.swing.InputVerifier; +import javax.swing.JComponent; +import javax.swing.JTextField; + +import com.romraider.util.ResourceUtil; + + +/** + * NumberVerifier checks a text field to ensure that the user has entered + * a valid entry. It errors if the field is left empty or if a locale specific + * number cannot be parsed. + */ +public class NumberVerifier extends InputVerifier { + private static final ResourceBundle rb = new ResourceUtil().getBundle( + NumberVerifier.class.getName()); + private String fieldName; + + /** + * NumberVerifier takes the field name to use in the messages to the user. + * @param fieldName - String name of the field being verified. + */ + public NumberVerifier(final String fieldName) { + this.fieldName = fieldName; + } + + @Override + public boolean verify(final JComponent input) { + if (!(input instanceof JTextField)) { + return true; + } + final JTextField inputField = (JTextField) input; + final String itemSel = inputField.getText(); + if (itemSel.isEmpty()) { + showMessageDialog(null, + MessageFormat.format( + rb.getString("EMPTY"), fieldName), + rb.getString("ERROR"), ERROR_MESSAGE); + return false; + } + final Scanner s = new Scanner(itemSel); + if (s.hasNextDouble()) { + return true; + } + else { + showMessageDialog(null, + MessageFormat.format( + rb.getString("INVALID"), fieldName), + rb.getString("ERROR"), ERROR_MESSAGE); + return false; + } + } +} diff --git a/src/main/java/com/romraider/swing/util/SelectionVerifier.java b/src/main/java/com/romraider/swing/util/SelectionVerifier.java new file mode 100644 index 000000000..a56efb277 --- /dev/null +++ b/src/main/java/com/romraider/swing/util/SelectionVerifier.java @@ -0,0 +1,50 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.swing.util; + +import javax.swing.InputVerifier; +import javax.swing.JComboBox; +import javax.swing.JComponent; + + +/** + * SelectionVerifier checks the field value to be true or false allowing + * focus transfer or not. + */ +public class SelectionVerifier extends InputVerifier { + private boolean selectionValid; + + /** + * The set method allows an external validity check to change the field + * value to allowing focus transfer or not. + * @param valid boolean value + */ + public void set(final boolean valid) { + selectionValid = valid; + } + + @Override + public boolean verify(final JComponent input) { + if (!(input instanceof JComboBox)) { + return true; + } + return selectionValid; + } +} diff --git a/src/main/java/com/romraider/tts/Speaker.java b/src/main/java/com/romraider/tts/Speaker.java deleted file mode 100644 index a5d5076cf..000000000 --- a/src/main/java/com/romraider/tts/Speaker.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.tts; - -import static com.romraider.util.ThreadUtil.runAsDaemon; -import com.sun.speech.freetts.Voice; -import com.sun.speech.freetts.VoiceManager; - -public class Speaker { - private static final String VOICE_NAME = "kevin16"; - private static final VoiceManager VOICE_MANAGER = VoiceManager.getInstance(); - private static final Voice VOICE = VOICE_MANAGER.getVoice(VOICE_NAME); - - static { - VOICE.allocate(); - } - - private Speaker() { - throw new UnsupportedOperationException(); - } - - public static void say(final String message) { - runAsDaemon(new Runnable() { - public void run() { - try { - VOICE.speak(message); - } catch (Exception e) { - // ignore - } - } - }); - } - - public static void end() { - VOICE.deallocate(); - } -} diff --git a/src/main/java/com/romraider/util/BitWise.java b/src/main/java/com/romraider/util/BitWise.java new file mode 100644 index 000000000..cfb89b247 --- /dev/null +++ b/src/main/java/com/romraider/util/BitWise.java @@ -0,0 +1,111 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2015 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.util; + +import java.util.Stack; + +import org.nfunk.jep.ParseException; +import org.nfunk.jep.function.PostfixMathCommand; + +/** + * Performs a bitwise operation on the inStack variables. The parameters are popped + * off the inStack and then processed. + *

+ * These bitwise operations are supported:
+ * 1 - bitwise AND &
+ * 2 - bitwise inclusive OR |
+ * 3 - bitwise exclusive OR ^
+ * 4 - signed left shift <<
+ * 5 - signed right shift >>
+ * 6 - unsigned right shift >>>
+ * 7 - unary bitwise complement ~ + *

+ *

+ *
Usage:
+ *
Three parameters must be passed in the BitWise function. + * The first parameter is a value such as the mask used by the operation + * (this value is required but ignored when selecting the unary bitwise + * complement operation). The second parameter is the variable 'x' to + * perform the operation on and the third parameter is the index number from + * the above list to select the operation to be performed.
+ *
Syntax:
+ *
BitWise(Number mask, Number variable, Number operation)
+ *
Example:
+ *
Perform the AND operation on the variable 'x' using a mask of 0x18
+ *
BitWise(24, x, 1)
+ *
Note: the values must be specified in decimal format since using hex format + * 0x18 will cause a parsing error
+ *
+ * @param mask - a value such as the mask or count of bits for Shift + * @param variable - the variable 'x' + * @param operation - the index number from the above list to select the operation + * + * @return the resulting value is pushed back to the top of inStack + * + * @exception ParseException is thrown when parse errors are encountered + */ +class BitWise extends PostfixMathCommand { + + public BitWise() { + numberOfParameters = 3; + } + + /** + * Runs a bitwise operation on the inStack variables. The parameters are popped + * off the inStack, processed and the resulting value is + * pushed back to the top of inStack. + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void run(Stack inStack) throws ParseException { + + checkStack(inStack); + + Object operation = inStack.pop(); + Object variable = inStack.pop(); + Object mask = inStack.pop(); + + if (mask instanceof Double) { + double r = 0; + switch (((Double) operation).intValue()) { + case 1: r = ((Double) variable).intValue() & ((Double) mask).intValue(); + break; + case 2: r = ((Double) variable).intValue() | ((Double) mask).intValue(); + break; + case 3: r = ((Double) variable).intValue() ^ ((Double) mask).intValue(); + break; + case 4: r = ((Double) variable).intValue() << ((Double) mask).intValue(); + break; + case 5: r = ((Double) variable).intValue() >> ((Double) mask).intValue(); + break; + case 6: r = ((Double) variable).intValue() >>> ((Double) mask).intValue(); + break; + case 7: r = ~((Double) variable).intValue(); + break; + default: + break; + } + inStack.push(new Double(r)); + } + else { + throw new ParseException("Invalid parameter type"); + } + } +} diff --git a/src/main/java/com/romraider/util/ByteUtil.java b/src/main/java/com/romraider/util/ByteUtil.java index b8a5f8b48..77f9e5b18 100644 --- a/src/main/java/com/romraider/util/ByteUtil.java +++ b/src/main/java/com/romraider/util/ByteUtil.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,6 +100,53 @@ public static int indexOfBytes(byte[] bytes, byte[] pattern) { } return -1; } + public static boolean isBitSet(byte b, int position) { + return (b & 1 << position) != 0; + } + + public static boolean[] byteToBoolArr(byte b) { + boolean boolArr[] = new boolean[8]; + for(int i=0;i<8;i++) boolArr[i] = (b & (byte)(128 / Math.pow(2, i))) != 0; + return boolArr; + } + + public static byte booleanArrayToBit(boolean[] arr){ + byte val = 0; + for (boolean b: arr) { + val <<= 1; + if (b) val |= 1; + } + return val; + } + + public static byte firstOneOfMask(int mask) { + byte index = (byte) 0xFF; + + for(byte i=0; i < 32; i++) { + if(((mask >> i) & 1) == 1) { + index = i; + break; + } + } + + return index; + } + + public static byte lengthOfMask(int mask) { + byte counter = 0; + + for(byte i=0; i < 32; i++) { + if(((mask >> i) & 1) == 1) { + counter++; + } + } + + return counter; + } + + public static int bitToMask(int bit) { + return 1 << bit; + } private static int[] computeFailure(byte[] pattern) { int[] failure = new int[pattern.length]; @@ -115,4 +162,35 @@ private static int[] computeFailure(byte[] pattern) { } return failure; } + + //Java 9 Method + public static int parseUnsignedInt(String s, int radix) throws NumberFormatException { + if (s == null) { + throw new NumberFormatException("null"); + } + + int len = s.length(); + if (len > 0) { + char firstChar = s.charAt(0); + if (firstChar == '-') { + throw new + NumberFormatException(String.format("Illegal leading minus sign " + + "on unsigned string %s.", s)); + } else { + if (len <= 5 ||(radix == 10 && len <= 9) ) { + return Integer.parseInt(s, radix); + } else { + long ell = Long.parseLong(s, radix); + if ((ell & 0xffffffff00000000L) == 0) { + return (int) ell; + } else { + throw new + NumberFormatException(String.format("String value %s exceeds " + "range of unsigned int.", s)); + } + } + } + } else { + throw new NumberFormatException(s); + } + } } diff --git a/src/main/java/com/romraider/util/FileAssociator.java b/src/main/java/com/romraider/util/FileAssociator.java deleted file mode 100644 index 20183652e..000000000 --- a/src/main/java/com/romraider/util/FileAssociator.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.util; - -import org.apache.log4j.Logger; -import org.jdesktop.jdic.filetypes.Action; -import org.jdesktop.jdic.filetypes.Association; -import org.jdesktop.jdic.filetypes.AssociationNotRegisteredException; -import org.jdesktop.jdic.filetypes.AssociationService; - - -public final class FileAssociator { - private static final Logger LOGGER = Logger.getLogger(FileAssociator.class); - - private FileAssociator() { - throw new UnsupportedOperationException(); - } - - public static boolean addAssociation(String extension, String command, /*String iconFileName,*/ String description) { - // Add association - // StringTokenizer osName = new StringTokenizer(System.getProperties().getProperty("os.name")); - - // remove association if it already exists - - LOGGER.debug("Removing 1..."); - removeAssociation(extension); - LOGGER.debug("Removing 2..."); - - AssociationService serv = new AssociationService(); - Association logassoc = new Association(); - - logassoc.addFileExtension(extension.toUpperCase()); - logassoc.setDescription(description); - logassoc.addAction(new Action("open", command + " %1")); - logassoc.setIconFileName(FileAssociator.class.getClass().getResource("/graphics/romraider-ico.ico").toString()); - - LOGGER.debug("Adding ...\n" + logassoc + "\n\n\n"); - - try { - serv.registerUserAssociation(logassoc); - } catch (Exception e) { - LOGGER.error("Error adding association", e); - } - - return true; - } - - - public static boolean removeAssociation(String extension) { - AssociationService serv = new AssociationService(); - Association logassoc = serv.getFileExtensionAssociation(extension.toUpperCase()); - - if(null == logassoc) { - LOGGER.debug("Association(s) do not exist. Skipping remove...\n\n\n"); - return true; - } - - LOGGER.debug("Removing ...\n" + logassoc + "\n\n\n"); - - try { - serv.unregisterUserAssociation(logassoc); - } catch (AssociationNotRegisteredException anre) { - LOGGER.debug("Association(s) do not exist. Skipping remove...\n\n\n"); - } catch (Exception e) { - LOGGER.error("Error removing association", e); - return false; - } - return true; - } -} diff --git a/src/main/java/com/romraider/util/HexUtil.java b/src/main/java/com/romraider/util/HexUtil.java index d40c7ead1..6173a7d8d 100644 --- a/src/main/java/com/romraider/util/HexUtil.java +++ b/src/main/java/com/romraider/util/HexUtil.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,30 +24,64 @@ public final class HexUtil { private HexUtil() { } + /** + * Convert a hexadecimal byte to a character representation. + * @param b - byte to convert + * @return string representing the byte value + */ public static String asHex(byte b) { return asHex(new byte[]{b}); } + /** + * Convert a hexadecimal byte array to a character representation. + * @param in - byte array to convert + * @return upper case string representing the byte array value + */ public static String asHex(byte[] in) { return bytesToHex(in).toUpperCase(); } + /** + * Convert a string representing a hexadecimal value into an array of + * hexadecimal bytes. + * @param hex - string to convert, with or without preceding 0x + * @return array of hexadecimal byte values + */ public static byte[] asBytes(String hex) { + if (null == hex) return new byte[0]; if (hex.indexOf(' ') >= 0) { hex = hex.replaceAll(" ", ""); } - if (hex.startsWith("0x")) { - hex = hex.substring(2); + if (hex.toLowerCase().indexOf("0x") >= 0) { + hex = hex.replaceAll("(?i)0x", ""); } return hexToBytes(hex); } + /** + * Convert a hexadecimal byte array to a character representation given the + * starting offset and length to convert. + * @param bs - byte array to convert + * @param off - starting offset + * @param length - number of bytes to convert + * @return string representing the bytes in the array converted + */ public static String bytesToHex(byte[] bs, int off, int length) { StringBuffer sb = new StringBuffer(length * 2); bytesToHexAppend(bs, off, length, sb); return sb.toString(); } + /** + * Convert a hexadecimal byte array to a character representation given the + * starting offset and length to convert and append them to the provided + * string buffer. + * @param bs - byte array to convert + * @param off - starting offset + * @param length - number of bytes to convert + * @param sb - string buffer to append the converted bytes to + */ public static void bytesToHexAppend(byte[] bs, int off, int length, StringBuffer sb) { sb.ensureCapacity(sb.length() + length * 2); for (int i = off; (i < (off + length)) && (i < bs.length); i++) { @@ -56,20 +90,49 @@ public static void bytesToHexAppend(byte[] bs, int off, int length, StringBuffer } } + /** + * Convert a hexadecimal byte array to a character representation. + * @param bs - byte array to convert + * @return string representing the byte array value + */ public static String bytesToHex(byte[] bs) { return bytesToHex(bs, 0, bs.length); } + /** + * Convert a string representing a hexadecimal value into an array of + * hexadecimal bytes. + * @param s - string to convert without preceding 0x + * @return array of hexadecimal byte values + */ public static byte[] hexToBytes(String s) { return hexToBytes(s, 0); } + /** + * Convert a string representing a hexadecimal value into an array of + * hexadecimal bytes. + * @param s - string to convert without preceding 0x. If the string starts + * with 0x, use the method asBytes(s) to convert the string + * @param off - starting offset for byte conversion + * @return array of hexadecimal byte values + */ public static byte[] hexToBytes(String s, int off) { byte[] bs = new byte[off + (1 + s.length()) / 2]; hexToBytes(s, bs, off); return bs; } + /** + * Convert a string representing a hexadecimal value into an array of + * hexadecimal bytes. + * @param s - string to convert without preceding 0x. If the string starts + * with 0x, use the method asBytes(s) to convert the string + * @param out - the byte array write the converted string into + * @param off - starting offset for byte conversion + * @throws NumberFormatException + * @throws IndexOutOfBoundsException + */ public static void hexToBytes(String s, byte[] out, int off) throws NumberFormatException, IndexOutOfBoundsException { int slen = s.length(); if ((slen % 2) != 0) { @@ -90,14 +153,21 @@ public static void hexToBytes(String s, byte[] out, int off) throws NumberFormat } } + /** + * Convert a string representing a hexadecimal value into an integer. + * @param input - string to convert with or without the leading 0x + * @return integer value + */ public static int hexToInt(String input) { - if (input.length() > 2 && input.substring(0, 2).equalsIgnoreCase("0x")) { - return Integer.parseInt(input.substring(2), 16); - } else { - return Integer.parseInt(input, 16); - } + return Integer.parseInt(input.replace("0x",""), 16); } + /** + * Convert an integer value to a string representation of the integer + * value as an unsigned integer in base 16. + * @param input - integer value to convert + * @return string representation of the integer starting with 0x + */ public static String intToHexString(int input) { return "0x" + Integer.toHexString(input).toUpperCase(); } diff --git a/src/main/java/com/romraider/util/JEPUtil.java b/src/main/java/com/romraider/util/JEPUtil.java index bb7f12871..8663bad89 100644 --- a/src/main/java/com/romraider/util/JEPUtil.java +++ b/src/main/java/com/romraider/util/JEPUtil.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2016 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,29 +20,64 @@ package com.romraider.util; import org.nfunk.jep.JEP; + +import java.util.Collections; import java.util.Map; +import java.util.LinkedHashMap; public final class JEPUtil { + @SuppressWarnings("serial") + static class LRUCache extends LinkedHashMap { + private int cacheSize; + + public LRUCache(int cacheSize) { + super(32, 0.75f, true); + this.cacheSize = cacheSize; + } + + @Override + protected boolean removeEldestEntry(Map.Entry eldest) { + return size() >= cacheSize; + } + }; + + private static final Map parserCache = Collections.synchronizedMap(new LRUCache(32)); + + public static synchronized double evaluate(String expression, double value) { + JEP parser = parserCache.get(expression); + if (parser == null) { + parser = new JEP(); + parser.addStandardFunctions(); + parser.addFunction("BitWise", new BitWise()); + parser.initSymTab(); // clear the contents of the symbol table + parser.addVariable("x", value); + parser.parseExpression(expression); + parserCache.put(expression, parser); + } else { + parser.setVarValue("x", value); + } + return parser.getValue(); + } + + public static synchronized double evaluate(String expression, Map valueMap) { + JEP parser = parserCache.get(expression); + if (parser == null) { + parser = new JEP(); + parser.initSymTab(); // clear the contents of the symbol table + for (String id : valueMap.keySet()) { + parser.addVariable(id, valueMap.get(id)); + } + parser.parseExpression(expression); + parserCache.put(expression, parser); + } else { + + for (String id : valueMap.keySet()) { + if (parser.getSymbolTable().containsKey(id)) { + parser.setVarValue(id, valueMap.get(id)); + } + } - private JEPUtil() { - } - - public static double evaluate(String expression, double value) { - final JEP parser = new JEP(); - parser.addStandardFunctions(); - parser.initSymTab(); // clear the contents of the symbol table - parser.addVariable("x", value); - parser.parseExpression(expression); - return parser.getValue(); - } - - public static double evaluate(String expression, Map valueMap) { - final JEP parser = new JEP(); - parser.initSymTab(); // clear the contents of the symbol table - for (String id : valueMap.keySet()) { - parser.addVariable(id, valueMap.get(id)); - } - parser.parseExpression(expression); - return parser.getValue(); - } + } + return parser.getValue(); + } } diff --git a/src/main/java/com/romraider/util/JREChecker.java b/src/main/java/com/romraider/util/JREChecker.java deleted file mode 100644 index 571af836c..000000000 --- a/src/main/java/com/romraider/util/JREChecker.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.util; - -/** - * @author Steve Wadsworth - * @since 2012-12-30 - * - * This class is intended to contain utility methods needed to determine various - * parameters of the JVM in which the application is running. - * - */ - -public final class JREChecker { - - /** - * Check to see if the JVM is 32-bit - * - * @return true if JVM is 32-bit - */ - public static boolean is32bit() { - // determine if we're running in a 32-bit JVM - // this may need to be extended for other JVM providers and versions - String bitness = System.getProperty("sun.arch.data.model", "unknown"); - // if we don't know, try harder - additional tests can be added here as - // necessary - if (bitness.equals("unknown")) { - // if sun.arch.data.model isn't found, we may be on a non-Sun - // (Oracle) VM try some other properties - if (System.getProperty("java.vm.name").indexOf("64") >= 0 || - System.getProperty("sun.cpu.isalist").indexOf("64") >= 0) { - bitness = "64"; - } - } - // should be either 32, 64, or still unknown. only known 32 should - // return true - if (bitness.equals("32")) { - return true; - } - return false; - } -} diff --git a/src/main/java/com/romraider/util/LogManager.java b/src/main/java/com/romraider/util/LogManager.java index 4d3834ed1..c1f17af32 100644 --- a/src/main/java/com/romraider/util/LogManager.java +++ b/src/main/java/com/romraider/util/LogManager.java @@ -28,6 +28,6 @@ private LogManager() { } public static void initDebugLogging() { - configureAndWatch("log4j.properties"); + configureAndWatch("lib/log4j.properties"); } } diff --git a/src/main/java/com/romraider/util/MD5Checksum.java b/src/main/java/com/romraider/util/MD5Checksum.java index d283355b3..ad186e42e 100644 --- a/src/main/java/com/romraider/util/MD5Checksum.java +++ b/src/main/java/com/romraider/util/MD5Checksum.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2023 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,18 +26,24 @@ public class MD5Checksum { public static byte[] createChecksum(String filename) throws Exception { - InputStream fis = new FileInputStream(filename); + InputStream fis = null; + MessageDigest complete = null; + try { + fis = new FileInputStream(filename); - byte[] buffer = new byte[1024]; - MessageDigest complete = MessageDigest.getInstance("MD5"); - int numRead; - do { - numRead = fis.read(buffer); - if (numRead > 0) { - complete.update(buffer, 0, numRead); - } - } while (numRead != -1); - fis.close(); + byte[] buffer = new byte[1024]; + complete = MessageDigest.getInstance("MD5"); + int numRead; + do { + numRead = fis.read(buffer); + if (numRead > 0) { + complete.update(buffer, 0, numRead); + } + } while (numRead != -1); + } + finally { + if (fis != null) fis.close(); + } return complete.digest(); } diff --git a/src/main/java/com/romraider/util/NumberUtil.java b/src/main/java/com/romraider/util/NumberUtil.java new file mode 100644 index 000000000..03772739c --- /dev/null +++ b/src/main/java/com/romraider/util/NumberUtil.java @@ -0,0 +1,67 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2017 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.util; + +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.ParseException; +import java.util.Locale; + +/** + * This class provides Number conversion utilities based on the default Locale. + */ +public final class NumberUtil { + private static final NumberFormat NUM_FORMATTER = NumberFormat.getInstance(Locale.getDefault()); + private static final String NAN = "NaN"; + static { + ((DecimalFormat) NUM_FORMATTER).applyPattern("0.0#################"); + } + + private NumberUtil() { + } + + /** + * Returns the separator based on the current locale (. or ,) + * @return The separation character + */ + public static char getSeperator(){ + return ((DecimalFormat) NUM_FORMATTER).getDecimalFormatSymbols().getDecimalSeparator(); + } + + /** + * Returns the value of the specified number in the default locale as a double. + * @param str - string to be converted. + * @return the numeric value represented by this object after conversion + * to type double. + * @exception ParseException is thrown when parse errors are encountered. + */ + public static double doubleValue(String str) throws ParseException { + return NUM_FORMATTER.parse(str).doubleValue(); + } + + /** + * Format a double using the current Locale + * @param value to format + * @return the number as a String + */ + public static String stringValue(double value) { + return Double.isNaN(value) ? NAN : NUM_FORMATTER.format(value); + } +} diff --git a/src/main/java/com/romraider/util/ResourceUtil.java b/src/main/java/com/romraider/util/ResourceUtil.java new file mode 100644 index 000000000..2222c0aa3 --- /dev/null +++ b/src/main/java/com/romraider/util/ResourceUtil.java @@ -0,0 +1,49 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2019 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.util; + +import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.showMessageDialog; + +import java.io.File; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Locale; +import java.util.ResourceBundle; + +public final class ResourceUtil { + + public ResourceBundle getBundle(final String bundle) { + final File file = new File("i18n"); + try { + final URL[] urls = {file.toURI().toURL()}; + final ClassLoader loader = new URLClassLoader(urls); + final ResourceBundle rb = ResourceBundle.getBundle( + bundle, Locale.getDefault(), loader); + return rb; + } catch (Exception e) { + showMessageDialog(null, + e.getLocalizedMessage(), + "Error", + ERROR_MESSAGE); + } + return null; + } +} diff --git a/src/main/java/com/romraider/util/RomServer.java b/src/main/java/com/romraider/util/RomServer.java deleted file mode 100644 index 6d689eb1b..000000000 --- a/src/main/java/com/romraider/util/RomServer.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.util; - -import org.apache.log4j.Logger; -import static org.apache.log4j.Logger.getLogger; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.ServerSocket; -import java.net.Socket; - -public final class RomServer { - private static final Logger LOGGER = getLogger(RomServer.class); - private static final String HOST = "localhost"; - private static final int PORT = 50001; - - public static boolean isRunning() { - try { - ServerSocket sock = new ServerSocket(PORT); - sock.close(); - return false; - } catch (Exception ex) { - return true; - } - } - - public static String waitForRom() throws IOException { - ServerSocket sock = new ServerSocket(PORT); - try { - return waitForRom(sock); - } finally { - sock.close(); - } - } - - public static void sendRomToOpenInstance(String rom) { - try { - Socket socket = new Socket(HOST, PORT); - OutputStream os = socket.getOutputStream(); - try { - write(os, rom); - } finally { - socket.close(); - } - } catch (Throwable e) { - LOGGER.error("Error occurred", e); - } - } - - private static void write(OutputStream os, String rom) { - PrintWriter pw = new PrintWriter(os, true); - try { - pw.println(rom); - } finally { - pw.close(); - } - } - - private static String waitForRom(ServerSocket sock) throws IOException { - Socket client = sock.accept(); - try { - return getRom(client); - } finally { - client.close(); - } - } - - private static String getRom(Socket client) throws IOException { - BufferedReader br = new BufferedReader(new InputStreamReader(client.getInputStream())); - try { - return br.readLine(); - } finally { - br.close(); - } - } -} diff --git a/src/main/java/com/romraider/util/SaxParserFactory.java b/src/main/java/com/romraider/util/SaxParserFactory.java index 843c7fb75..0f0af301a 100644 --- a/src/main/java/com/romraider/util/SaxParserFactory.java +++ b/src/main/java/com/romraider/util/SaxParserFactory.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,13 +20,9 @@ package com.romraider.util; import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; public final class SaxParserFactory { @@ -36,22 +32,9 @@ private SaxParserFactory() { public static SAXParser getSaxParser() throws ParserConfigurationException, SAXException { SAXParserFactory parserFactory = SAXParserFactory.newInstance(); - parserFactory.setNamespaceAware(false); + parserFactory.setNamespaceAware(true); parserFactory.setValidating(true); - parserFactory.setXIncludeAware(false); + parserFactory.setXIncludeAware(true); return parserFactory.newSAXParser(); } - - public static void main(String args[]) { - try { - SAXParser parser = SaxParserFactory.getSaxParser(); - BufferedInputStream b = new BufferedInputStream(new FileInputStream(new File("/ecu_defs.xml"))); - System.out.println(b.available()); - parser.parse(b, new DefaultHandler()); - System.out.println(parser.isValidating()); - - } catch (Exception ex) { - System.err.println(ex); - } - } } diff --git a/src/main/java/com/romraider/util/SettingsManager.java b/src/main/java/com/romraider/util/SettingsManager.java index 9c98e166c..20798e0e1 100644 --- a/src/main/java/com/romraider/util/SettingsManager.java +++ b/src/main/java/com/romraider/util/SettingsManager.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,7 +26,12 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.util.ResourceBundle; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.apache.log4j.Logger; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -34,9 +39,12 @@ import com.romraider.swing.JProgressPane; import com.romraider.xml.DOMSettingsBuilder; import com.romraider.xml.DOMSettingsUnmarshaller; -import com.sun.org.apache.xerces.internal.parsers.DOMParser; public class SettingsManager { + private static final Logger LOGGER = + Logger.getLogger(SettingsManager.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + SettingsManager.class.getName()); private static final String SETTINGS_FILE = "/settings.xml"; private static final String USER_HOME = System.getProperty("user.home") + "/.RomRaider"; @@ -44,6 +52,7 @@ public class SettingsManager { private static String settingsDir = USER_HOME; private static Settings settings = null; + private static boolean testing = false; public static Settings getSettings() { if(null == settings) { @@ -52,29 +61,47 @@ public static Settings getSettings() { return settings; } + public static void setTesting(boolean b) { + testing = b; + } + + public static boolean getTesting() { + return testing; + } + private static Settings load() { Settings loadedSettings; try { FileInputStream settingsFileIn = null; - try { - final File sf = new File(USER_HOME + SETTINGS_FILE); + File sf = new File(START_DIR + SETTINGS_FILE); + if (sf.exists()) { settingsFileIn = new FileInputStream(sf); + settingsDir = START_DIR; } - catch (Exception e) { - final File sf = new File(START_DIR + SETTINGS_FILE); + else { + sf = new File(USER_HOME + SETTINGS_FILE); settingsFileIn = new FileInputStream(sf); - settingsDir = START_DIR; } - final InputSource src = new InputSource(settingsFileIn); - final DOMSettingsUnmarshaller domUms = new DOMSettingsUnmarshaller(); - final DOMParser parser = new DOMParser(); - parser.parse(src); - final Document doc = parser.getDocument(); - loadedSettings = domUms.unmarshallSettings(doc.getDocumentElement()); + LOGGER.info("Loaded settings from file: " + settingsDir.replace("\\", "/") + SETTINGS_FILE); + + if (sf.length() > 0) { + final InputSource src = new InputSource(settingsFileIn); + final DOMSettingsUnmarshaller domUms = new DOMSettingsUnmarshaller(); + final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + final DocumentBuilder builder = dbf.newDocumentBuilder(); + final Document doc = builder.parse(src); + loadedSettings = domUms.unmarshallSettings(doc.getDocumentElement()); + settingsFileIn.close(); + } + else { + if (settingsFileIn != null) + settingsFileIn.close(); + throw new FileNotFoundException("file length is 0"); + } } catch (FileNotFoundException e) { showMessageDialog(null, - "Settings file not found.\nUsing default settings.", - "Error Loading Settings", INFORMATION_MESSAGE); + rb.getString("FNF"), + rb.getString("ERROR"), INFORMATION_MESSAGE); loadedSettings = new Settings(); } catch (Exception e) { throw new RuntimeException(e); @@ -87,16 +114,19 @@ public static void save(Settings newSettings) { } public static void save(Settings newSettings, JProgressPane progress) { + if(testing) return; + final DOMSettingsBuilder builder = new DOMSettingsBuilder(); try { final File newDir = new File(settingsDir); - newDir.mkdir(); // Creates directory if it does not exist + newDir.mkdir(); // Creates directory if it does not exist final File sf = new File(settingsDir + SETTINGS_FILE); builder.buildSettings(newSettings, sf, progress, VERSION); settings = newSettings; + if (sf.length() == 0) + throw new RuntimeException("Settings file write failed"); } catch (Exception e) { - // Load the settings from disk. - settings = load(); + settings = newSettings; throw new RuntimeException(e); } } diff --git a/src/main/java/com/romraider/util/ThreadUtil.java b/src/main/java/com/romraider/util/ThreadUtil.java index dcc374a1f..2c161c148 100644 --- a/src/main/java/com/romraider/util/ThreadUtil.java +++ b/src/main/java/com/romraider/util/ThreadUtil.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,7 +33,8 @@ public static void sleep(long millis) { try { TimeUnit.MILLISECONDS.sleep(millis); } catch (InterruptedException e) { - LOGGER.trace("Sleep interrupted", e); + if (LOGGER.isTraceEnabled()) + LOGGER.trace("Sleep interrupted", e); } } diff --git a/src/main/java/com/romraider/xml/ConversionLayer/BMWCodingConversionLayer.java b/src/main/java/com/romraider/xml/ConversionLayer/BMWCodingConversionLayer.java new file mode 100644 index 000000000..bf6666fb9 --- /dev/null +++ b/src/main/java/com/romraider/xml/ConversionLayer/BMWCodingConversionLayer.java @@ -0,0 +1,670 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.xml.ConversionLayer; + +import static com.romraider.editor.ecu.ECUEditorManager.getECUEditor; +import static com.romraider.swing.LookAndFeelManager.initLookAndFeel; +import static com.romraider.util.LogManager.initDebugLogging; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.ResourceBundle; +import java.util.Set; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +import com.romraider.Settings; +import com.romraider.editor.ecu.ECUEditor; +import com.romraider.editor.ecu.OpenImageWorker; +import com.romraider.util.ByteUtil; +import com.romraider.util.ResourceUtil; +import com.romraider.util.SettingsManager; + +public class BMWCodingConversionLayer extends ConversionLayer { + protected static final ResourceBundle rb = new ResourceUtil().getBundle(BMWCodingConversionLayer.class.getName()); + + private int splitAddress = 0; + boolean guessChecksums = false; + + HashMap fswMap; + HashMap pswMap; + HashMap aswMap; + HashMap csvMap; + HashMap transMap; + + BMWConversionRomNodeManager[] romManagers; + ByteBuffer dataBuffer; + int dataIndex; + + String currentCategory = ""; + int currentFSW; + Node currentTable; + + String memoryLayout = "uint8"; + String endian = "little"; + + int unusedCounter = 0; + + // Naming stays german, because the file is also german + static final int TYPE_DATEINAME = 0x0000; // Filename + static final int SGID_CODIERINDEX = 0x0001; // Codingindex + static final int SGID_HARDWARENUMMER = 0x0002; // Hardware number + static final int SGID_SWNUMMER = 0x0003; // Software number + static final int SPEICHERORG = 0x0004; // Memory layout + static final int ANLIEFERZUSTAND = 0x0005; // State of delivery when new (?) + static final int CODIERDATENBLOCK = 0x0006; // Coding data block (like a group) + static final int HERSTELLERDATENBLOCK = 0x0007; // Manufacturer data block (like a group) + static final int RESERVIERTDATENBLOCK = 0x0008; // Reserved data (like a group) + static final int UNBELEGT1 = 0x0009; // Unused (Not actually sometimes) + static final int UNBELEGT2 = 0x000A; // Unused (Not actually sometimes) + static final int KENNUNG_K = 0x000B; // ? + static final int KENNUNG_D = 0x000C; // ? + static final int KENNUNG_X = 0x000D; // ? + static final int KENNUNG_ALL = 0x000E; // ? + static final int PARZUWEISUNG_PSW2 = 0x000F; // Coding data preset information + static final int PARZUWEISUNG_PSW1 = 0x0010; // Coding data preset information + static final int PARZUWEISUNG_DIR = 0x0011; // ? + static final int PARZUWEISUNG_FSW = 0x0012; // Coding data memory storage information + + // Gets called when ROM is opened directly + public BMWCodingConversionLayer() { + this(0, false); + } + + // Gets called from the toolbar with more options + public BMWCodingConversionLayer(int splitAddress, boolean guessChecksums) { + this.splitAddress = splitAddress; + this.guessChecksums = guessChecksums; + } + + @Override + public String getRegexFileNameFilter() { + return "^.*\\.C\\d\\d$"; + } + + // Reads a string in an array until zero byte + private static String readString(byte[] input, int offset) { + StringBuilder s = new StringBuilder(); + + while ((char) (input[offset]) != 0) { + s.append((char) input[offset]); + offset++; + } + + return s.toString(); + } + + // Reads the optional translation file from NCS Dummy + private HashMap readTranslationFile(File transF) { + HashMap map = new HashMap(); + + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(transF)); + String line; + + while ((line = br.readLine()) != null) { + final String[] values = line.split(","); + if (values.length == 2) { + map.put(values[0], values[1]); + } + } + + } catch (final FileNotFoundException e) { + return null; + } catch (final IOException e) { + return null; + } finally { + try { + if (br != null) { + br.close(); + } + } catch (final IOException e) { + e.printStackTrace(); + } + } + + return map; + } + + private static HashMap createMapFromNCSDict(File f) { + // Parse name dictionary + HashMap map = new HashMap(); + byte[] fswInput; + + try { + fswInput = ECUEditor.readFile(f); + } catch (IOException e) { + return null; + } + + ByteBuffer fswBuffer = ByteBuffer.wrap(fswInput); + fswBuffer = fswBuffer.order(ByteOrder.LITTLE_ENDIAN); + + for (int i = getStartOfFile(fswBuffer); i < fswInput.length;) { + int oldIndex = i; + + int length = fswBuffer.get(i); + int frameType = fswBuffer.getShort(i + 1); + i += 3; + + switch (frameType) { + // Name + case 0x0000: + break; + // SWT Entry + case 0x0001: + int keyId = fswBuffer.getShort(i); + String name = readString(fswInput, i + 2); + map.put(keyId, name); + break; + } + + i = oldIndex + length + 4; + } + + return map; + } + + private static HashMap createMapFromCVT(File f, HashMap aswMap) { + // Parse name dictionary + HashMap map = new HashMap(); + byte[] fswInput; + + try { + fswInput = ECUEditor.readFile(f); + } catch (IOException e) { + return null; + } + + ByteBuffer cvtBuffer = ByteBuffer.wrap(fswInput); + cvtBuffer = cvtBuffer.order(ByteOrder.LITTLE_ENDIAN); + + /* + * 0000 - DATEINAME - S - NAME 0001 - GRUPPE - {S} - NAME 0002 - INDIVID - {S} - + * NAME 0003 - AUFTRAGSAUSDRUCK - A - AUFTRAGSAUSDRUCK 0004 - FSW_PSW - WW - + * FSWINDEX,PSWINDEX 0005 - FSW - W - FSWINDEX + */ + + String currentOption = ""; + for (int i = getStartOfFile(cvtBuffer); i < fswInput.length;) { + int oldIndex = i; + + int length = cvtBuffer.get(i); + int frameType = cvtBuffer.getShort(i + 1); + i += 3; + + switch (frameType) { + // Name + case 0x0000: + break; + // Option/Auftrag + case 0x0003: + int lengthOption = cvtBuffer.get(i); + i++; + String optionCode = ""; + + for (int j = 0; j < lengthOption;) { + if (cvtBuffer.get(j + i) == 0x53) { + int keyId = cvtBuffer.getShort(j + i + 1); + currentOption = aswMap.get(keyId); + optionCode = optionCode + currentOption; + j += 3; + } else { + optionCode += (char) cvtBuffer.get(j + i); + j++; + } + } + + currentOption = optionCode; + break; + + // Link FSW/PSW combination to option + case 0x0004: + int fsw = cvtBuffer.getShort(i); + int psw = cvtBuffer.getShort(i + 2); + map.put(fsw << 16 | psw, currentOption); + break; + } + + i = oldIndex + length + 4; + } + + return map; + } + + // Look for 0xFFFF in the file to skip the header + private static int getStartOfFile(ByteBuffer b) { + for (int i = 0; i < b.capacity(); i++) { + int value = b.getShort(i); + if (value == -1) { + return i + 2; + } + } + + return -1; + } + + public Document convertToDocumentTree(File f) throws SAXException { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = null; + + try { + builder = dbf.newDocumentBuilder(); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } + + Document doc = builder.newDocument(); + + // Check first if naming conversion files are there + File[] listOfFiles = f.getParentFile().listFiles(); + + File fswF = new File(""); + File pswF = new File(""); + File aswF = new File(""); + File csvF = new File(f.getParent(), f.getParentFile().getName() + "CVT.000"); + + for (int i = 0; i < listOfFiles.length; i++) { + File fList = listOfFiles[i]; + if (fList.isFile()) { + if (fList.getName().matches("(?i)SWTFSW\\d\\d\\.dat")) + fswF = fList; + else if (fList.getName().matches("(?i)SWTPSW\\d\\d\\.dat")) + pswF = fList; + else if (fList.getName().matches("(?i)SWTASW\\d\\d\\.dat")) + aswF = fList; + } + } + + if (!fswF.exists()) { + throw new SAXException(rb.getString("MISSINGFILE") + "SWTFSW.dat. " + rb.getString("NCSHINT")); + } + if (!pswF.exists()) { + throw new SAXException(rb.getString("MISSINGFILE") + "SWTPSW.dat. " + rb.getString("NCSHINT")); + } + if (!aswF.exists()) { + throw new SAXException(rb.getString("MISSINGFILE") + "SWTASW.dat. " + rb.getString("NCSHINT")); + } + if (!csvF.exists()) { + throw new SAXException(rb.getString("MISSINGFILE") + "CVT.000. " + rb.getString("NCSHINT")); + } + + fswMap = createMapFromNCSDict(fswF); + pswMap = createMapFromNCSDict(pswF); + aswMap = createMapFromNCSDict(aswF); + csvMap = createMapFromCVT(csvF, aswMap); + + // Optional translation file that has to be in the DATEN folder + // Created from NCSDummy developers + File transF = new File(f, "../../Translations.csv"); + if (transF.exists()) + transMap = readTranslationFile(transF); + + byte[] input; + + try { + input = ECUEditor.readFile(f); + } catch (IOException e) { + throw new SAXException(rb.getString("ERRORFILE") + f); + } + + dataBuffer = ByteBuffer.wrap(input); + dataBuffer = dataBuffer.order(ByteOrder.LITTLE_ENDIAN); + + Node roms = doc.createElement("roms"); + doc.appendChild(roms); + + // Create one manager if no splitting + // Create two otherwise + if (splitAddress == 0) + romManagers = new BMWConversionRomNodeManager[] { new BMWConversionRomNodeManager(0, doc, roms) }; + else + romManagers = new BMWConversionRomNodeManager[] { new BMWConversionRomNodeManager(0, doc, roms), + new BMWConversionRomNodeManager(splitAddress, doc, roms) }; + + /* + * 0000 - DATEINAME - S - NAME 0001 - SGID_CODIERINDEX - B(B) - WERT,WERT2 0002 + * - SGID_HARDWARENUMMER - S(S) - WERT,WERT2 0003 - SGID_SWNUMMER - S(S) - + * WERT,WERT2 0004 - SPEICHERORG - SS - STRUKTUR,TYP 0005 - ANLIEFERZUSTAND - + * (B) - WERT 0006 - CODIERDATENBLOCK - {L}LWS - + * BLOCKNR,WORTADR,BYTEADR,BEZEICHNUNG 0007 - HERSTELLERDATENBLOCK - {L}LWS - + * BLOCKNR,WORTADR,BYTEADR,BEZEICHNUNG 0008 - RESERVIERTDATENBLOCK - {L}LWS - + * BLOCKNR,WORTADR,BYTEADR,BEZEICHNUNG 0009 - UNBELEGT1 - {L}LW{B}(B) - + * BLOCKNR,WORTADR,BYTEADR,INDEX,MASKE 000A - UNBELEGT2 - (B) - WERT 000B - + * KENNUNG_K - SS(S) - IDENT,WERT1,WERTN 000C - KENNUNG_D - WW(WW) - + * HEXWERT1,HEXWERT2,HEXWERTN1,HEXWERTN2 000D - KENNUNG_X - WW(WW) - + * HEXWERT1,HEXWERT2,HEXWERTN1,HEXWERTN2 000E - KENNUNG_ALL - SW(W) - + * KENNUNG,HEXWERT1,HEXWERTN 000F - PARZUWEISUNG_PSW2 - (B) - DATUM 0010 - + * PARZUWEISUNG_PSW1 - W(B) - PSW,DATUM 0011 - PARZUWEISUNG_DIR - + * {L}LWW{B}(B)(A)B - BLOCKNR,WORTADR,BYTEADR,FSW,INDEX,MASKE,OPERATION,EINHEIT + * 0012 - PARZUWEISUNG_FSW - {L}LWW{B}(B){B}{B} - + * BLOCKNR,WORTADR,BYTEADR,FSW,INDEX,MASKE,EINHEIT,INDIVID + */ + + // Look for 0xFFFF in the file to skip the header + dataIndex = getStartOfFile(dataBuffer); + + if (dataIndex == 0) { + throw new SAXException(rb.getString("ERRORFILESTART") + f.toString()); + } + + while (dataIndex < input.length) { + int oldIndex = dataIndex; + + int length = 0xFFFF & dataBuffer.get(dataIndex); + int frameType = 0xFFFF & dataBuffer.getShort(dataIndex + 1); + dataIndex += 2; + + switch (frameType) { + case SPEICHERORG: + parseMemoryOrg(); + break; + case TYPE_DATEINAME: + // String fileNameInFile = readString(input, i+1); + break; + // "Unused" Data, which often contains hidden data + case UNBELEGT1: + parseUnused(); + break; + // Not sure what to do with this + case UNBELEGT2: + break; + // Coding Block (=category) + // Fall-Through! + case CODIERDATENBLOCK: + case HERSTELLERDATENBLOCK: + case RESERVIERTDATENBLOCK: + parseGroup(); + break; + case PARZUWEISUNG_DIR: + parseFSWValues(false); + break; + case PARZUWEISUNG_FSW: + parseFSWValues(false); + break; + + case PARZUWEISUNG_PSW1: + parsePresetValues(true); + break; + case PARZUWEISUNG_PSW2: + parsePresetValues(false); + break; + } + + // No matter what the index points to, always go by length + // Skip frameType, checksum and go to next + dataIndex = oldIndex + length + 4; + } + + for (BMWConversionRomNodeManager man : romManagers) { + man.calculateRomID(f, "BMW"); + } + + return doc; + } + + private void parseMemoryOrg() { + String layout = readString(dataBuffer.array(), dataIndex + 1); + + /* + * if(layout.equalsIgnoreCase("byte")) memoryLayout = "uint8"; else + * if(layout.equalsIgnoreCase("wordmsb")) { memoryLayout = "uint16"; endian = + * "big"; } else if(layout.equalsIgnoreCase("wordlsb")) { memoryLayout = + * "uint16"; endian = "little"; } + */ + dataIndex += layout.length() + 2; + // String blockType = readString(input, i); //? What does it do? + // isBlock = blockType.equals("BLOCK"); + } + + private void parseUnused() { + short blockU = dataBuffer.getShort(dataIndex); + dataIndex += 2; + + if (blockU != 0) { + // int blockNumber = dataBuffer.getInt(i); //Whats it for? + dataIndex += 4; + } + + int storageAddressU = dataBuffer.getInt(dataIndex); + int byteCountU = dataBuffer.getShort(dataIndex + 4); + + byte indexU = dataBuffer.get(dataIndex + 6); + dataIndex += indexU; + + int maskLengthU = 0xFFFF & dataBuffer.getShort(dataIndex + 7); + byte[] maskU = new byte[maskLengthU]; + + for (int j = 0; j < maskLengthU; j++) { + maskU[j] = dataBuffer.get(dataIndex + 9 + j); + } + + dataIndex = dataIndex + 9 + maskLengthU; + + // Create actual node in rom + for (BMWConversionRomNodeManager man : romManagers) { + Element table = man.createTable("UNUSED_" + unusedCounter, currentCategory, memoryLayout, endian, + storageAddressU, byteCountU, maskU); + + if (table != null) + currentTable = table; + } + + unusedCounter++; + } + + private void parseGroup() { + short blockR = dataBuffer.getShort(dataIndex); + dataIndex += 2; + + if (blockR != 0) { + // int blockNumber = dataBuffer.getInt(i); //Whats it for? + dataIndex += 4; + } + + // Not used in our case, since only used as category + // int storageAddressBlock = dataBuffer.getInt(i); + // int byteCountBlock = dataBuffer.getShort(i+4); + + currentCategory = readString(dataBuffer.array(), dataIndex + 6); + + // Add optional translation + if (transMap != null && transMap.containsKey(currentCategory)) { + currentCategory = currentCategory + " | " + transMap.get(currentCategory); + } + } + + private void parseFSWValues(boolean isDIR) { + short blockD = dataBuffer.getShort(dataIndex); + dataIndex += 2; + + if (blockD != 0) { + // int blockNumber = dataBuffer.getInt(i); //Whats it for? + dataIndex += 4; + } + + int storageAddressD = dataBuffer.getInt(dataIndex); + int byteCountD = dataBuffer.getShort(dataIndex + 4); + + int functionKeywordD = dataBuffer.getShort(dataIndex + 6); + currentFSW = functionKeywordD; + + String nameFSWD = fswMap.get(functionKeywordD); + + // Add optional translation + if (transMap != null && transMap.containsKey(nameFSWD)) { + nameFSWD = nameFSWD + " | " + transMap.get(nameFSWD); + } + + byte indexD = dataBuffer.get(dataIndex + 8); + dataIndex += indexD; + + int maskLengthD = 0xFFFF & dataBuffer.getShort(dataIndex + 9); + byte[] maskD = new byte[maskLengthD]; + + for (int j = 0; j < maskLengthD; j++) { + maskD[j] = dataBuffer.get(dataIndex + 11 + j); + } + + dataIndex = dataIndex + 11 + maskLengthD; + + if (isDIR) { + // Whats operation? + int operationLen = 0xFFFF & dataBuffer.getShort(dataIndex); + dataIndex += operationLen; + // byte unit = dataBuffer.get(i+2); + } + + // Create actual node in rom + for (BMWConversionRomNodeManager man : romManagers) { + Element table = man.createTable(nameFSWD, currentCategory, memoryLayout, endian, storageAddressD, + byteCountD, maskD); + + if (table != null) + currentTable = table; + } + } + + private void parsePresetValues(boolean parsePSW) { + dataIndex += 1; + + int functionKeywordPSW = 0; + + if (parsePSW) { + functionKeywordPSW = dataBuffer.getShort(dataIndex); + dataIndex += 2; + } + + int numValuesPSW1 = dataBuffer.getShort(dataIndex); + dataIndex += 2; + + String namePSW = "Unamed"; + String PSW1_s = ""; + + byte[] presetValuesPSW1 = new byte[numValuesPSW1]; + + for (int j = 0; j < numValuesPSW1; j++) { + presetValuesPSW1[j] = dataBuffer.get(dataIndex + j); + PSW1_s += " " + String.format("%02X", (ByteUtil.asUnsignedInt(presetValuesPSW1[j]))); + } + + if (parsePSW) { + namePSW = pswMap.get(functionKeywordPSW); + + // Add optional translation + if (transMap != null && transMap.containsKey(namePSW)) { + namePSW += " | " + transMap.get(namePSW); + } + + // Add option combinations + int key = currentFSW << 16 | functionKeywordPSW; + if (csvMap.containsKey(key)) + namePSW += " | " + csvMap.get(key); + } + + for (BMWConversionRomNodeManager man : romManagers) { + man.addPreset(PSW1_s.trim(), namePSW.trim(), currentTable); + } + } + + // Used for test code only + // Gets all files within folder + private static Collection listFileTree(File dir) { + Set fileTree = new HashSet(); + if (dir == null || dir.listFiles() == null) { + return fileTree; + } + for (File entry : dir.listFiles()) { + if (entry.isFile()) + fileTree.add(entry); + else + fileTree.addAll(listFileTree(entry)); + } + return fileTree; + } + + // Test Code + public static void main(String args[]) { + initDebugLogging(); + initLookAndFeel(); + ECUEditor editor = getECUEditor(); + editor.initializeEditorUI(); + editor.checkDefinitions(); + + // Make sure we dont override any settings + SettingsManager.setTesting(true); + Settings settings = SettingsManager.getSettings(); + + settings.getEcuDefinitionFiles().clear(); + // settings.getEcuDefinitionFiles().add(new + // File("C:\\NCSEXPER\\DATEN\\E46\\KMB_E46.C08")); + // settings.getEcuDefinitionFiles().add(new + // File("C:\\NCSEXPER\\DATEN\\E46\\IHK_E46.C17")); + // settings.getEcuDefinitionFiles().add(new + // File("C:\\NCSEXPER\\DATEN\\E46\\GM5.C04")); + + File folder = new File("C:\\NCSEXPER\\DATEN\\"); + Collection listOfFiles = listFileTree(folder); + + ConversionLayer l = new BMWCodingConversionLayer(); + + for (File f : listOfFiles) { + if (l.isFileSupported(f)) { + settings.getEcuDefinitionFiles().add(f); + } + } + + // settings.getEcuDefinitionFiles().add(new + // File("C:\\NCSEXPER\\DATEN\\E36\\KMB_E36.C25")); + OpenImageWorker w = new OpenImageWorker( + new File("E:\\google_drive\\ECU_Tuning\\maps\\Tacho\\Tacho Grau\\C25_352k_248_oil_6Cyl.hex")); + // OpenImageWorker w = new OpenImageWorker(new + // File("E:\\Downloads\\ZKE_eep.bin")); + // OpenImageWorker w = new OpenImageWorker(new + // File("E:\\Downloads\\A-C_eep.bin")); + // OpenImageWorker w = new OpenImageWorker(new + // File("E:\\Downloads\\MFL_0000-1000.bin")); + // OpenImageWorker w = new OpenImageWorker(new + // File("E:\\Downloads\\IKE_eep.bin")); + + w.execute(); + } + + @Override + public String getDefinitionPickerInfo() { + return rb.getString("LOADINGWARNING"); + } +} diff --git a/src/main/java/com/romraider/xml/ConversionLayer/BMWConversionRomNodeManager.java b/src/main/java/com/romraider/xml/ConversionLayer/BMWConversionRomNodeManager.java new file mode 100644 index 000000000..c67d23705 --- /dev/null +++ b/src/main/java/com/romraider/xml/ConversionLayer/BMWConversionRomNodeManager.java @@ -0,0 +1,178 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.xml.ConversionLayer; + +import java.io.File; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import com.romraider.util.ByteUtil; + +class BMWConversionRomNodeManager{ + int offsetAddress = 0; + + Document doc; + Element romNode; + + Element lastTable; + int lastStorageAddress; + int maxStorageAddress; + + //Variables to find the best ID settings + int bestIDFitAddress; + String bestIDFitData = ""; + int bestIDFitAddressTemp; + String bestIDFitDataTemp = ""; + int lastPresetCount = 0; + + BMWConversionRomNodeManager(int offsetAddress, Document doc, Node root){ + this.doc = doc; + this.offsetAddress = offsetAddress; + this.romNode = doc.createElement("rom"); + root.appendChild(romNode); + } + + public Element getRomNode() { + return romNode; + } + + public Element createTable(String name, String category, String storageType, String endian, + int storageAddress, int byteCount, byte[] mask) { + + //This handles the correct rom splitting + if(offsetAddress == 0 || storageAddress >= offsetAddress) { + + if(!bestIDFitDataTemp.equals("") && lastPresetCount == 1) { + bestIDFitData = bestIDFitDataTemp; + bestIDFitAddress = bestIDFitAddressTemp; + } + + lastPresetCount = 0; + + int divisor = 1; + if(storageType.contains("int16")) divisor = 2; + else if (storageType.contains("int32")) divisor = 4; + + int sizey = byteCount / divisor; + + Element table = doc.createElement("table"); + table.setAttribute("name", name); + table.setAttribute("category", category); + table.setAttribute("storagetype", storageType); + table.setAttribute("storageaddress", "0x" + + Integer.toHexString(storageAddress - offsetAddress)); + table.setAttribute("endian", endian); + table.setAttribute("sizey", Integer.toString(sizey)); + table.setAttribute("type", "1D"); + table.setAttribute("mask", Integer.toHexString(ByteUtil.asUnsignedInt(mask[0]))); + + romNode.appendChild(table); + lastTable = table; + + lastStorageAddress = storageAddress - offsetAddress; + if(lastStorageAddress > maxStorageAddress) maxStorageAddress = lastStorageAddress; + + return table; + } + else { + return null; + } + } + + public Element addPreset(String data, String name, Node table) { + if(offsetAddress == 0 || this.lastTable == table) { + Element statePSW1 = doc.createElement("state"); + statePSW1.setAttribute("data", data); + statePSW1.setAttribute("name", name); + lastTable.appendChild(statePSW1); + + data = data.replace(" ", ""); + + + //Try to find the best fitting preset that only appears once + //and has the longest memory footprint for best identification + if(lastPresetCount >= 1) { + bestIDFitDataTemp = ""; + } + else if(data.length() >= 2 && bestIDFitData.length() <= data.length() && + !data.replace("0", "").equals("") && !data.replace("F", "").equals("")){ + bestIDFitDataTemp = data; + bestIDFitAddressTemp = lastStorageAddress; + } + + lastPresetCount++; + + return statePSW1; + } + else { + return null; + } + } + + public void calculateRomID(File f, String make) { + Element romIDNode = doc.createElement("romid"); + + Node idAddress = doc.createElement("internalidaddress"); + idAddress.setTextContent("0x" + Integer.toHexString(bestIDFitAddress)); + + Node idString = doc.createElement("internalidstring"); + idString.setTextContent("0x" + bestIDFitData.replace(" ", "")); + + //This can be used to force a definition file for a bin + //idString.setTextContent("force"); + //idAddress.setTextContent("-1"); + + Node ramoffset = doc.createElement("noramoffset"); + + //Set filesize based on largest address and round up to a power of 2 + Node fileSize = doc.createElement("filesize"); + String fileS = ((int)Math.pow(2, 32 - Integer.numberOfLeadingZeros(lastStorageAddress - 1)) + "b"); + fileSize.setTextContent(fileS); + + Node makeN = doc.createElement("make"); + makeN.setTextContent(make); + + Node model = doc.createElement("model"); + model.setTextContent(f.getParentFile().getName()); + + Node ecuID = doc.createElement("ecuid"); + String[] nameSplit = f.getName().split("\\."); + ecuID.setTextContent(nameSplit[1]); + + Node subModel = doc.createElement("submodel"); + subModel.setTextContent(f.getName()); + + romIDNode.appendChild(makeN); + romIDNode.appendChild(ecuID); + romIDNode.appendChild(model); + romIDNode.appendChild(subModel); + romIDNode.appendChild(ramoffset); + romIDNode.appendChild(fileSize); + romIDNode.appendChild(idAddress); + romIDNode.appendChild(idString); + romIDNode.appendChild(doc.createElement("year")); + romIDNode.appendChild(doc.createElement("market")); + romIDNode.appendChild(doc.createElement("transmission")); + romIDNode.appendChild(doc.createElement("xmlid")); + romNode.appendChild(romIDNode); + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/xml/ConversionLayer/ConversionLayer.java b/src/main/java/com/romraider/xml/ConversionLayer/ConversionLayer.java new file mode 100644 index 000000000..666be8480 --- /dev/null +++ b/src/main/java/com/romraider/xml/ConversionLayer/ConversionLayer.java @@ -0,0 +1,77 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.xml.ConversionLayer; +import java.io.File; +import java.io.StringWriter; + +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +public abstract class ConversionLayer { + + public final static String xmlRegexFileNameFilter = "^.*\\.(xml|XML)$"; + + public abstract String getDefinitionPickerInfo(); + + public abstract String getRegexFileNameFilter(); + + /* + * The actual conversion method. It receives the file and creates a DOM structure + * compatible to the default RR structure. + */ + public abstract Document convertToDocumentTree(File f) throws Exception; + + /* + * This method receives a file and checks if this converter supports this file + * extension. + */ + public boolean isFileSupported(File f) { + return f.getName().matches(getRegexFileNameFilter()); + } + + public static String convertDocumentToString(Document doc) { + StringWriter sw = new StringWriter(); + + try { + TransformerFactory tf = TransformerFactory.newInstance(); + tf.setAttribute("indent-number", 4); + + Transformer trans = tf.newTransformer(); + trans.setOutputProperty(OutputKeys.ENCODING, "ASCII"); + trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + trans.setOutputProperty(OutputKeys.INDENT, "yes"); + trans.transform(new DOMSource(doc), new StreamResult(sw)); + } + catch(Exception e) { + e.printStackTrace(); + return null; + } + + return sw.toString(); + } + +} diff --git a/src/main/java/com/romraider/xml/ConversionLayer/ConversionLayerFactory.java b/src/main/java/com/romraider/xml/ConversionLayer/ConversionLayerFactory.java new file mode 100644 index 000000000..882d30d77 --- /dev/null +++ b/src/main/java/com/romraider/xml/ConversionLayer/ConversionLayerFactory.java @@ -0,0 +1,46 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.xml.ConversionLayer; + +import java.io.File; + +public class ConversionLayerFactory { + + // Check if its an .xml file + public static boolean requiresConversionLayer(File f) { + return !f.getName().matches(ConversionLayer.xmlRegexFileNameFilter); + } + + public static ConversionLayer getConversionLayerForFile(File f) { + // Create them on the stack, so they are instantiated fresh each time + final ConversionLayer[] convLayers = { + new BMWCodingConversionLayer(), + new XDFConversionLayer(), + new VDFConversionLayer() }; + + for (ConversionLayer l : convLayers) { + if (l.isFileSupported(f)) { + return l; + } + } + + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/xml/ConversionLayer/VDFConversionLayer.java b/src/main/java/com/romraider/xml/ConversionLayer/VDFConversionLayer.java new file mode 100644 index 000000000..f1de32299 --- /dev/null +++ b/src/main/java/com/romraider/xml/ConversionLayer/VDFConversionLayer.java @@ -0,0 +1,633 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2023 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.xml.ConversionLayer; + +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import com.romraider.Settings.Endian; +import com.romraider.xml.RomAttributeParser; + +public class VDFConversionLayer extends ConversionLayer { + // protected static final ResourceBundle rb = new ResourceUtil().getBundle( + // VDFConversionLayer.class.getName()); + private static final Logger LOGGER = Logger.getLogger(VDFConversionLayer.class); + Node romIDNode; + Node romNode; + + final private static byte TYPE_SWITCH = 0x1; // 0x230 Size + final private static byte TYPE_SCALAR = 0x2; // 0x279 Size + final private static byte TYPE_3D_TABLE = 0x4; // 0x2BC Size, Short Unsigned? + final private static byte TYPE_3D_TABLE_BYTE_SIGNED = 0x6; // 0x2BC Size + final private static byte TYPE_3D_TABLE_SHORT_SIGNED = 0x7; // 0x2BC Size + final private static byte TYPE_3D_TABLE_FLOAT = 0xE; // 0x2BC Size + final private static byte TYPE_3D_TABLE_BYTE_UNSIGNED = 0x3; // 0x2BC Size + final private static byte TYPE_DTC = 0x9; // 0x234 + + private static int START_FILE_OFFSET = 0x1ED; + private static int START_OFFSET = 0x25E0; + private static int START_OFFSET_TTFNAME = 0x20E; + private static int SWITCHES_CATEGORY_START_OFFSET = 0x222; + private static int CONSTANT_CATEGORY_START_OFFSET = 0x60A; + private static int TABLE_CATEGORY_START_OFFSET = 0x9F2; + private static int DIAGNOSTICS_CATEGORY_START_OFFSET = 0xDDA; + + private static int START_CATEGORY_COUNT = 0x11C2; + + ArrayList allAxis = new ArrayList(); + private LinkedList switchCategories = new LinkedList(); + private LinkedList constantCategories = new LinkedList(); + private LinkedList tableCategories = new LinkedList(); + private LinkedList diagnosticCategories = new LinkedList(); + + private ArrayList switchCategoriesCount = new ArrayList(); + private ArrayList constantCategoriesCount = new ArrayList(); + private ArrayList diagnosticCategoriesCount = new ArrayList(); + + int countSwitches = 0; + int countScalars = 0; + int countDTCs = 0; + int lastTableAddress = 0; + + private LinkedList createdTables = new LinkedList(); + + @Override + public String getDefinitionPickerInfo() { + return ""; + // return rb.getString("LOADINGWARNING"); + } + + @Override + public String getRegexFileNameFilter() { + return "^.*(vdf|jdf)"; + } + + @Override + public Document convertToDocumentTree(File f) throws Exception { + // Read file into byte array + byte[] fileData = new byte[(int) f.length()]; + DataInputStream dis = new DataInputStream(new FileInputStream(f)); + dis.readFully(fileData); + dis.close(); + + // Create new RR document + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); + Document doc = docBuilder.newDocument(); + FileInputStream fileStream = null; + + try { + fileStream = new FileInputStream(f); + doc = parseVDFFile(f, fileData, doc); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (fileStream != null) + fileStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return doc; + } + + private Node createStartDocument(byte[] data, Document doc) throws IOException { + Node roms = doc.createElement("roms"); + romNode = doc.createElement("rom"); + romIDNode = doc.createElement("romid"); + + Node idAddress = doc.createElement("internalidaddress"); + Node idString = doc.createElement("internalidstring"); + idString.setTextContent("force"); + idAddress.setTextContent("-1"); + + Node offset = doc.createElement("offset"); + offset.setTextContent("0x" + Integer.toHexString( + (int) RomAttributeParser.parseByteValue(data, Endian.LITTLE, START_FILE_OFFSET, 2, false))); + + // Read the definition name + byte[] nameArray = Arrays.copyOfRange(data, 0x8, 0x8 + 0xF); + String definitionName = new String(nameArray).trim(); + Node xmlID = doc.createElement("xmlid"); + xmlID.setTextContent(definitionName); + + romIDNode.appendChild(idAddress); + romIDNode.appendChild(idString); + romIDNode.appendChild(offset); + romIDNode.appendChild(xmlID); + + romNode.appendChild(romIDNode); + roms.appendChild(romNode); + doc.appendChild(roms); + + return romNode; + } + + private String getCurrentCategory(LinkedList categories, ArrayList categoryCount, int index) { + + for (int i = 0; i < categoryCount.size(); i++) { + if (index < categoryCount.get(i)) { + return categories.get(i); + } + } + return ""; + + } + + private Node parseSwitch(Document doc, byte[] data) { + long adr = RomAttributeParser.parseByteValue(data, Endian.LITTLE, 54, 0x4, false); + // long mask = RomAttributeParser.parseByteValue(data, Endian.LITTLE, 58, 0x1, + // false); + // long offValue = RomAttributeParser.parseByteValue(data, Endian.LITTLE, 59, + // 0x1, false); + String name = new String(data, 4, 0x32).trim(); + + if (name.isEmpty()) + return null; + + Element table = doc.createElement("table"); + + table.setAttribute("name", name); + table.setAttribute("category", + "Switches//" + getCurrentCategory(switchCategories, switchCategoriesCount, countSwitches)); + table.setAttribute("storageaddress", "0x" + Long.toHexString(adr)); + table.setAttribute("endian", "big"); + table.setAttribute("storagetype", "uint8"); + table.setAttribute("sizey", "1"); + table.setAttribute("type", "Switch"); + // table.setAttribute("mask", Long.toHexString(mask)); + + Element enable = doc.createElement("state"); + enable.setAttribute("name", "On"); + enable.setAttribute("data", "1"); + + Element disable = doc.createElement("state"); + disable.setAttribute("name", "0ff"); + disable.setAttribute("data", "0"); + + table.appendChild(enable); + table.appendChild(disable); + + countSwitches++; + return table; + + } + + private String constructExpression(float scalar, float offset) { + String scalarString = (scalar > 0.99 && scalar < 1.01) ? "" : (" * " + scalar); + String offsetString = offset == 0.0 ? "" : (" + " + offset); + + return "x" + scalarString + offsetString; + } + + private Node parseScalar(Document doc, byte[] data) { + String name = new String(data, 4, 0x32).trim(); + String unit = new String(data, 52, 0xF).trim(); + + if (name.isEmpty()) + return null; + + long adr = RomAttributeParser.parseByteValue(data, Endian.LITTLE, 81, 0x4, false); + // float exponential = RomAttributeParser.byteToFloat(Arrays.copyOfRange(data, + // 69, 73), Endian.LITTLE, Endian.LITTLE); + float scalar = RomAttributeParser.byteToFloat(Arrays.copyOfRange(data, 73, 77), Endian.LITTLE, Endian.LITTLE); + float offset = RomAttributeParser.byteToFloat(Arrays.copyOfRange(data, 77, 81), Endian.LITTLE, Endian.LITTLE); + String expression = constructExpression(scalar, offset); + + int type = (int) RomAttributeParser.parseByteValue(data, Endian.LITTLE, 2, 1, false); + + String datatype = ""; + switch (type) { + case 0x0: + datatype = "uint8"; + break; + case 0xF: + datatype = "float"; + break; + case 0x1: + case 0x2: + case 0x4: + datatype = "uint16"; + break; + case 11: + datatype = "uint32"; + break; + default: + System.out.println("Received unknown data scalar type " + type); + return null; + } + Element table = doc.createElement("table"); + + table.setAttribute("name", name); + table.setAttribute("category", + "Scalars//" + getCurrentCategory(constantCategories, constantCategoriesCount, countScalars)); + table.setAttribute("storagetype", datatype); + table.setAttribute("storageaddress", "0x" + Long.toHexString(adr)); + table.setAttribute("endian", "big"); + table.setAttribute("sizey", "1"); + table.setAttribute("type", "1D"); + + Element scaling = doc.createElement("scaling"); + scaling.setAttribute("expression", expression); + scaling.setAttribute("units", unit); + scaling.setAttribute("format", "0.##"); + table.appendChild(scaling); + + countScalars++; + return table; + } + + private Node parseDTC(Document doc, byte[] data) { + long adr = RomAttributeParser.parseByteValue(data, Endian.LITTLE, 0x36, 0x4, false); + String name = new String(data, 4, 0x32).trim(); + + if (name.isEmpty()) + return null; + + // For easy of life: Cut out the P-Code and put it in the front so its sorted + // correctly + Pattern pattern = Pattern.compile("(\\(\\w?.*\\))"); + Matcher matcher = pattern.matcher(name); + if (matcher.find()) { + name = matcher.group(1) + " " + name.replace(matcher.group(1), ""); + name = name.trim(); + } + + Element table = doc.createElement("table"); + + table.setAttribute("name", name); + table.setAttribute("category", + "DTC//" + getCurrentCategory(diagnosticCategories, diagnosticCategoriesCount, countDTCs)); + table.setAttribute("storageaddress", "0x" + Long.toHexString(adr)); + table.setAttribute("endian", "big"); + table.setAttribute("storagetype", "uint8"); + table.setAttribute("sizey", "1"); + table.setAttribute("type", "Switch"); + + // How is the following encoded in the file? Is it? + Element state0 = doc.createElement("state"); + state0.setAttribute("name", "Not reported / No MIL"); + state0.setAttribute("data", "0"); + + Element state1 = doc.createElement("state"); + state1.setAttribute("name", "Type A / No MIL"); + state1.setAttribute("data", "1"); + + Element state2 = doc.createElement("state"); + state2.setAttribute("name", "Type B / No MIL"); + state2.setAttribute("data", "2"); + + Element state3 = doc.createElement("state"); + state3.setAttribute("name", "Type C / No MIL"); + state3.setAttribute("data", "3"); + + Element state4 = doc.createElement("state"); + state4.setAttribute("name", "Not reported / MIL"); + state4.setAttribute("data", "4"); + + Element state5 = doc.createElement("state"); + state5.setAttribute("name", "Type A / MIL"); + state5.setAttribute("data", "5"); + + Element state6 = doc.createElement("state"); + state6.setAttribute("name", "Type B / MIL"); + state6.setAttribute("data", "6"); + + Element state7 = doc.createElement("state"); + state7.setAttribute("name", "Type C / MIL"); + state7.setAttribute("data", "7"); + + table.appendChild(state0); + table.appendChild(state1); + table.appendChild(state2); + table.appendChild(state3); + table.appendChild(state4); + table.appendChild(state5); + table.appendChild(state6); + table.appendChild(state7); + + countDTCs++; + return table; + } + + private void fillAxisData(Document doc, Node parentTable, long size, int axisRef) { + String[] splitValues = { " " }; + if (axisRef > 0) { + // If the TTF failed loading add empty cells + if (allAxis.size() == 0) { + splitValues = new String[(int) size]; + Collections.nCopies((int) size, String.valueOf(" ")).toArray(splitValues); + } else { + splitValues = allAxis.get(axisRef - 1).split(","); + } + } + + for (int i = 0; i < size; i++) { + Element data = doc.createElement("data"); + data.setTextContent(splitValues[i]); + parentTable.appendChild(data); + } + } + + private Node parse3DTable(Document doc, byte[] data, int type) { + String name = new String(data, 0x40, 0x3C); + name = name.trim(); + + if (name.isEmpty()) + return null; + + String nameAxis1 = new String(data, 0x7C, 0x28); + nameAxis1 = nameAxis1.trim(); + String nameAxis2 = new String(data, 0xA4, 0x12); + nameAxis2 = nameAxis2.trim(); + + String datatype = ""; + + // Whats uint32_t? + switch (type) { + case TYPE_3D_TABLE_BYTE_SIGNED: + datatype = "int8"; + break; + case TYPE_3D_TABLE_FLOAT: + datatype = "float"; + break; + case TYPE_3D_TABLE_BYTE_UNSIGNED: + datatype = "uint8"; + break; + case TYPE_3D_TABLE_SHORT_SIGNED: + datatype = "int16"; + break; + default: + datatype = "uint16"; + } + + long adr = RomAttributeParser.parseByteValue(data, Endian.LITTLE, 6, 0x4, false); + long sizeX = RomAttributeParser.parseByteValue(data, Endian.LITTLE, 10, 0x1, false); + long sizeY = RomAttributeParser.parseByteValue(data, Endian.LITTLE, 12, 0x1, false); + + // float exponential = + // RomAttributeParser.byteToFloat(Arrays.copyOfRange(data,14, 18), + // Endian.LITTLE, Endian.LITTLE); + float scalar = RomAttributeParser.byteToFloat(Arrays.copyOfRange(data, 18, 22), Endian.LITTLE, Endian.LITTLE); + float offset = RomAttributeParser.byteToFloat(Arrays.copyOfRange(data, 22, 26), Endian.LITTLE, Endian.LITTLE); + String expression = constructExpression(scalar, offset); + + boolean swapXY = RomAttributeParser.parseByteValue(data, Endian.LITTLE, 62, 0x1, false) > 0; + int axisRefX = (int) RomAttributeParser.parseByteValue(data, Endian.LITTLE, 0xB8, 0x2, false); + int axisRefY = (int) RomAttributeParser.parseByteValue(data, Endian.LITTLE, 0xBA, 0x2, false); + int skipCells = (int) RomAttributeParser.parseByteValue(data, Endian.LITTLE, 0xC8, 0x2, false); + skipCells = skipCells / (datatype.contains("int8") ? 1 : 2); // I assume the offset is in bytes? + + Element table = doc.createElement("table"); + + table.setAttribute("name", name); + table.setAttribute("storagetype", datatype); + table.setAttribute("storageaddress", "0x" + Long.toHexString(adr)); + table.setAttribute("endian", "big"); + table.setAttribute("swapxy", swapXY ? "true" : "false"); + + boolean is2DTable = sizeY == 1 || sizeX == 1; + long table2DSize = sizeY > sizeX ? sizeY : sizeX; + + if(is2DTable) + { + table.setAttribute("sizey", Long.toString(table2DSize)); + table.setAttribute("type", "2D"); + } + else + { + table.setAttribute("sizey", Long.toString(sizeY)); + table.setAttribute("sizex", Long.toString(sizeX)); + table.setAttribute("type", "3D"); + } + + if (skipCells > 0) + table.setAttribute("skipCells", Integer.toString(skipCells)); + + Element scaling = doc.createElement("scaling"); + scaling.setAttribute("expression", expression); + scaling.setAttribute("units", is2DTable ? (sizeX == 1 ? nameAxis1 : nameAxis2) : ""); + scaling.setAttribute("format", "0.##"); + table.appendChild(scaling); + + if(!is2DTable) + { + Element tableX = doc.createElement("table"); + tableX.setAttribute("name", nameAxis1); + tableX.setAttribute("sizex", Long.toString(sizeX)); + tableX.setAttribute("type", "Static X Axis"); + fillAxisData(doc, tableX, sizeX, axisRefX); + table.appendChild(tableX); + } + + // If its a 2D table pick the larger size, otherwise use the normal X + long YSizeToLoad = is2DTable ? table2DSize : sizeY; + + Element tableY = doc.createElement("table"); + tableY.setAttribute("name", nameAxis2); + tableY.setAttribute("sizey", Long.toString(YSizeToLoad)); + tableY.setAttribute("type", "Static Y Axis"); + fillAxisData(doc, tableY, YSizeToLoad, axisRefY); + table.appendChild(tableY); + + createdTables.add(table); + return table; + } + + private void createTables(byte[] data, Document doc, Node romNode) throws IOException { + boolean dataToRead = true; + int currentAdr = START_OFFSET; + + while (dataToRead) { + Node newTable = null; + int type = data[currentAdr]; + switch (type) { + case TYPE_SWITCH: + newTable = parseSwitch(doc, Arrays.copyOfRange(data, currentAdr, currentAdr + 0x230)); + currentAdr += 0x230; + break; + case TYPE_SCALAR: + newTable = parseScalar(doc, Arrays.copyOfRange(data, currentAdr, currentAdr + 0x279)); + currentAdr += 0x279; + break; + case TYPE_3D_TABLE: + newTable = parse3DTable(doc, Arrays.copyOfRange(data, currentAdr, currentAdr + 0x2BC), type); + currentAdr += 0x2BC; + break; + case TYPE_3D_TABLE_BYTE_SIGNED: + newTable = parse3DTable(doc, Arrays.copyOfRange(data, currentAdr, currentAdr + 0x2BC), type); + currentAdr += 0x2BC; + break; + case TYPE_3D_TABLE_SHORT_SIGNED: + newTable = parse3DTable(doc, Arrays.copyOfRange(data, currentAdr, currentAdr + 0x2BC), type); + currentAdr += 0x2BC; + break; + case TYPE_3D_TABLE_FLOAT: + newTable = parse3DTable(doc, Arrays.copyOfRange(data, currentAdr, currentAdr + 0x2BC), type); + currentAdr += 0x2BC; + break; + case TYPE_3D_TABLE_BYTE_UNSIGNED: + newTable = parse3DTable(doc, Arrays.copyOfRange(data, currentAdr, currentAdr + 0x2BC), type); + currentAdr += 0x2BC; + break; + case TYPE_DTC: + newTable = parseDTC(doc, Arrays.copyOfRange(data, currentAdr, currentAdr + 0x234)); + currentAdr += 0x234; + break; + default: + dataToRead = false; + } + + if (newTable != null) { + romNode.appendChild(newTable); + } + } + lastTableAddress = currentAdr; + } + + private void parsePackedStrings(byte[] data, int start, LinkedList output) { + int currentOffset = start; + while (true) { + String newCategory = new String(data, currentOffset, 0x28).trim(); + currentOffset += 0x28; + + if (!newCategory.isEmpty()) { + output.add(newCategory); + } else { + break; + } + } + } + + private void parseCategories(byte[] data) { + parsePackedStrings(data, SWITCHES_CATEGORY_START_OFFSET, switchCategories); + parsePackedStrings(data, CONSTANT_CATEGORY_START_OFFSET, constantCategories); + parsePackedStrings(data, TABLE_CATEGORY_START_OFFSET, tableCategories); + parsePackedStrings(data, DIAGNOSTICS_CATEGORY_START_OFFSET, diagnosticCategories); + + for (int i = 0; i < switchCategories.size(); i++) { + switchCategoriesCount.add((int) RomAttributeParser.parseByteValue(data, Endian.LITTLE, + START_CATEGORY_COUNT + i * 2, 0x2, false)); + if (i > 0) { + switchCategoriesCount.set(i, switchCategoriesCount.get(i) + switchCategoriesCount.get(i - 1)); + } + } + + for (int i = 0; i < constantCategories.size(); i++) { + constantCategoriesCount.add((int) RomAttributeParser.parseByteValue(data, Endian.LITTLE, + START_CATEGORY_COUNT + 0x32 + i * 2, 0x2, false)); + if (i > 0) { + constantCategoriesCount.set(i, constantCategoriesCount.get(i) + constantCategoriesCount.get(i - 1)); + } + } + + for (int i = 0; i < diagnosticCategories.size(); i++) { + diagnosticCategoriesCount.add((int) RomAttributeParser.parseByteValue(data, Endian.LITTLE, + START_CATEGORY_COUNT + 0x32 * 2 + i * 2, 0x2, false)); + if (i > 0) { + diagnosticCategoriesCount.set(i, + diagnosticCategoriesCount.get(i) + diagnosticCategoriesCount.get(i - 1)); + } + } + } + + private void updateTableCategories(byte[] data) { + // Find the last empty block of 32 times 0x20 from the end of the file + int currentOffset = data.length - 1; + while (true) { + boolean allEmpty = true; + for (int i = 0; i < 32; i++) { + if (data[currentOffset - i] != 0x20) { + allEmpty = false; + break; + } + } + + if (allEmpty) + break; + else + currentOffset -= 32; + } + + // Go forward until we find the start of the mapping table + while (data[currentOffset] == 0x20) { + currentOffset++; + } + + int tableCount = 0; + for (Element n : createdTables) { + String cat = tableCategories.get(data[currentOffset + tableCount * 2] - 1); + n.setAttribute("category", "Tables//" + cat); + tableCount++; + } + + } + + private void loadAxisData(File f, byte[] data) { + String ttfName = new String(data, START_OFFSET_TTFNAME, 0x14).trim() + ".tff"; + File ttfFile = new File(f.getParent(), ttfName); + + LOGGER.info("Trying to load TTF file " + ttfFile.getAbsolutePath()); + + byte[] fileData = new byte[(int) ttfFile.length()]; + DataInputStream dis = null; + + try { + dis = new DataInputStream(new FileInputStream(ttfFile)); + dis.readFully(fileData); + dis.close(); + + // Length is 0x200 + for (int i = 0; i < fileData.length; i += 0x200) { + allAxis.add(new String(fileData, i, 0x200).trim()); + } + + } catch (IOException e) { + LOGGER.warn("Failed to load TTF file!"); + } + } + + private Document parseVDFFile(File f, byte[] data, Document doc) throws IOException { + romNode = createStartDocument(data, doc); + loadAxisData(f, data); + parseCategories(data); + createTables(data, doc, romNode); + updateTableCategories(data); + + return doc; + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/xml/ConversionLayer/XDFConversionLayer.java b/src/main/java/com/romraider/xml/ConversionLayer/XDFConversionLayer.java new file mode 100644 index 000000000..81c9af78d --- /dev/null +++ b/src/main/java/com/romraider/xml/ConversionLayer/XDFConversionLayer.java @@ -0,0 +1,632 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2025 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.xml.ConversionLayer; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.ResourceBundle; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.log4j.Logger; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +import com.romraider.util.HexUtil; +import com.romraider.util.ResourceUtil; +import com.romraider.xml.RomAttributeParser; + +public class XDFConversionLayer extends ConversionLayer { + protected static final ResourceBundle rb = new ResourceUtil().getBundle( + XDFConversionLayer.class.getName()); + private static final Logger LOGGER = Logger.getLogger(XDFConversionLayer.class); + + private HashMap < Integer, String > categoryMap = new HashMap < Integer, String > (); + private HashMap < Integer, Element > tableMap = new HashMap < Integer, Element > (); + private LinkedList < EmbedInfoData > embedsToSolve = new LinkedList < EmbedInfoData > (); + + int bitCount; + private boolean signed; + private int offset; + private int numDigits; + // private String dataType; + private boolean lsbFirst; + + // Defaults + String defaultDataType; + + private class EmbedInfoData { + Element tableNodeRR; + Node axisNode; + Node flagsNodeTable; + } + + @Override + public String getDefinitionPickerInfo() { + return rb.getString("LOADINGWARNING"); + } + + @Override + public String getRegexFileNameFilter() { + return "^.*xdf"; + } + + @Override + public Document convertToDocumentTree(File f) throws Exception { + Document doc = null; + FileInputStream fileStream = null; + BufferedReader br = null; + + try { + // Check first if its an older definition + // which is not xml based + br = new BufferedReader(new FileReader(f)); + String firstLine = br.readLine(); + + if (firstLine.equalsIgnoreCase("XDF")) { + br.close(); + throw new SAXException(rb.getString("ONLYXML")); + } else { + br.close(); + } + + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + factory.setXIncludeAware(true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); + + fileStream = new FileInputStream(f); + Document XMLdoc = docBuilder.parse(fileStream, f.getAbsolutePath()); + doc = convertXDFDocument(XMLdoc); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (fileStream != null) + fileStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return doc; + } + + private Element solveLinkObj(int key, Node targetTable) { + if (tableMap.containsKey(key)) { + Element sourceTableRR = tableMap.get(key); + return (Element) sourceTableRR.cloneNode(true); + } else { + return null; + } + } + + private Element parseAxis(Document doc, Element tableNodeRR, Node axisNode, Node flagsNodeTable) { + Node idNode = axisNode.getAttributes().getNamedItem("id"); + String id = ""; + + if (idNode != null) { + id = idNode.getNodeValue(); + } + + Element targetTable = null; + Element scaling = null; + + boolean hasEmbedInfo = false; + String staticTable = ""; + + int nodeCountAxis = axisNode.getChildNodes().getLength(); + Node n; + + // Check first if we need to copy attributes from the base table + for (int i = 0; i < nodeCountAxis; i++) { + n = axisNode.getChildNodes().item(i); + + if (n.getNodeName().equalsIgnoreCase("embedinfo") && n.getAttributes().getNamedItem("linkobjid") != null) { + + Integer key = HexUtil.hexToInt(n.getAttributes().getNamedItem("linkobjid").getNodeValue()); + Element refTable = solveLinkObj(key, targetTable); + + // Table was already parsed + if (refTable != null) { + targetTable = refTable; + + int nodeCountRefTable = targetTable.getChildNodes().getLength(); + targetTable.removeAttribute("type"); + targetTable.removeAttribute("category"); + + // Find scaling child and delete child tables + LinkedList < Node > nodesToRemove = new LinkedList (); + for (int j = 0; j < nodeCountRefTable; j++) { + Node tN = targetTable.getChildNodes().item(j); + + if (tN.getNodeName().equalsIgnoreCase("table") || + tN.getNodeName().equalsIgnoreCase("description")) { + nodesToRemove.add(tN); + } else if (tN.getNodeName().equalsIgnoreCase("scaling")) { + scaling = (Element) tN; + } + } + for (Node nodeToRemove: nodesToRemove) + targetTable.removeChild(nodeToRemove); + } + // Referenced Table is not yet parsed + else { + EmbedInfoData e = new EmbedInfoData(); + e.axisNode = axisNode; + e.flagsNodeTable = flagsNodeTable; + e.tableNodeRR = tableNodeRR; + embedsToSolve.add(e); + + return null; + } + + hasEmbedInfo = true; + break; + } + } + + if (targetTable == null) { + targetTable = id.equalsIgnoreCase("z") || id.isEmpty() ? tableNodeRR : doc.createElement("table"); + } + + if (scaling == null) { + scaling = doc.createElement("scaling"); + targetTable.appendChild(scaling); + } + + Node addressNode = null; + LinkedList staticCells = new LinkedList(); + int indexCount = -1; + int numDigitsStatic = -1; + int localNumDigits = -1; + + for (int i = 0; i < nodeCountAxis; i++) { + n = axisNode.getChildNodes().item(i); + + if (n.getNodeName().equalsIgnoreCase("units")) { + scaling.setAttribute("units", n.getTextContent()); + } else if (n.getNodeName().equalsIgnoreCase("indexcount")) { + indexCount = Integer.parseInt(n.getTextContent()); + targetTable.setAttribute("size" + id.toLowerCase(), "" + indexCount); + } + + if (!hasEmbedInfo) { + if (n.getNodeName().equalsIgnoreCase("embeddeddata")) { + + addressNode = n.getAttributes().getNamedItem("mmedaddress"); + if (addressNode != null) { + String address = addressNode.getNodeValue(); + targetTable.setAttribute("storageaddress", address); + } + + Node flagsNode = n.getAttributes().getNamedItem("mmedtypeflags"); + Node sizeBitsNode = n.getAttributes().getNamedItem("mmedelementsizebits"); + + boolean signedLocal = signed; + boolean lsbFirstLocal = lsbFirst; + int flags = 0; + int sizeBits = 0; + + if (flagsNode == null) + flagsNode = flagsNodeTable; + + if (flagsNode != null) { + try { + flags = HexUtil.hexToInt(flagsNode.getNodeValue()); + + if ((flags & (0x01)) > 0) { + signedLocal = true; + } else if ((flags & 0x01) == 0) { + signedLocal = false; + } + + if ((flags & 0x02) > 0) { + lsbFirstLocal = false; + } else { + lsbFirstLocal = true; + } + + if ((flags & 0x04) > 0) { + targetTable.setAttribute("swapxy", "true"); + } + } catch (NumberFormatException e) { + // TODO: Not sure how to handle this yet... + LOGGER.error("Failed to parse flag " + flagsNode.getNodeValue()); + } + } + + if (sizeBitsNode != null) { + sizeBits = Integer.parseInt(sizeBitsNode.getNodeValue()); + } else { + sizeBits = bitCount; + } + + targetTable.setAttribute("storagetype", (signedLocal ? "" : "u") + "int" + sizeBits); + targetTable.setAttribute("endian", lsbFirstLocal ? "big" : "little"); + } else if (!hasEmbedInfo && n.getNodeName().equalsIgnoreCase("math")) { + String formula = n.getAttributes().getNamedItem("equation").getNodeValue(); + formula = formula.replace("X", "x").replace(",", "."); + scaling.setAttribute("expression", formula); + } else if (n.getNodeName().equalsIgnoreCase("decimalpl")) { + try { + localNumDigits = Math.abs(Integer.parseInt(n.getTextContent())); + } catch (NumberFormatException e) { + //Do nothing + } + } else if (n.getNodeName().equalsIgnoreCase("label")) { + String label = n.getAttributes().getNamedItem("value").getNodeValue(); + staticCells.add(label); + } + } + } + + boolean isStatic = staticCells.size() == indexCount && indexCount > 1; + if (isStatic) { + staticTable = "Static "; + targetTable.setAttribute("size" + id, "" + staticCells.size()); + targetTable.removeAttribute("endian"); + targetTable.removeAttribute("storagetype"); + + for(String label : staticCells) + { + Element data = doc.createElement("data"); + data.setTextContent(label); + targetTable.appendChild(data); + + if (numDigitsStatic == -1) { + // Assume the format from the static data + String split[] = label.split("\\."); + if (split.length > 1) { + numDigitsStatic = split[1].length(); + } else { + numDigitsStatic = 0; + } + } + } + + } + + // Case 1: Static table and no num digits set == Deduce from text + // Case 2: Non static table and digits are set + // Case 3: Non static table and digits arent sent --> use defaults + int digits = isStatic && localNumDigits == -1 ? numDigitsStatic : (localNumDigits == -1 ? numDigits : localNumDigits); + if (digits == 0) + scaling.setAttribute("format", "0"); + else + scaling.setAttribute("format", "0." + new String(new char[digits]).replace("\0", "0")); + + if (id.equalsIgnoreCase("z")) + return null; + else { + if (!id.isEmpty()) + targetTable.setAttribute("type", staticTable + id.toUpperCase() + " Axis"); + return targetTable; + } + } + + private Element parseTable(Document doc, Node romNode, Node tableNode) { + int nodeCountTable = tableNode.getChildNodes().getLength(); + Node n; + Element tableNodeRR = doc.createElement("table"); + + Node uniqueIDNode = tableNode.getAttributes().getNamedItem("uniqueid"); + Node flagsNode = tableNode.getAttributes().getNamedItem("flags"); + + if (uniqueIDNode != null) { + tableMap.put(HexUtil.hexToInt(uniqueIDNode.getNodeValue()), tableNodeRR); + } + + LinkedList < String > categories = new LinkedList < String > (); + + for (int i = 0; i < nodeCountTable; i++) { + n = tableNode.getChildNodes().item(i); + + if (n.getNodeName().equalsIgnoreCase("title")) { + // TunerPro can currently not edit axis directly, but we can + // These tables contain the axis, which we can skip + if (n.getTextContent().endsWith("(autogen)")) { + return null; + } + + tableNodeRR.setAttribute("name", n.getTextContent()); + } + if (n.getNodeName().equalsIgnoreCase("description")) { + Element desc = doc.createElement("description"); + desc.setTextContent(n.getTextContent()); + tableNodeRR.appendChild(desc); + } else if (n.getNodeName().equalsIgnoreCase("categorymem")) { + int category = Integer.parseInt(n.getAttributes().getNamedItem("category").getNodeValue()); + + if (categoryMap.containsKey(category - 1)) { + categories.add(categoryMap.get(category - 1)); + } + } else if (n.getNodeName().equalsIgnoreCase("xdfaxis")) { + Element axis = parseAxis(doc, tableNodeRR, n, flagsNode); + + if (axis != null) { + tableNodeRR.appendChild(axis); + } + } + } + + tableNodeRR.setAttribute("category", convertToRRCategoryString(categories)); + return tableNodeRR; + } + + private Element getScalingNodeForTable(Element tableNodeRR) { + for (int i = 0; i < tableNodeRR.getChildNodes().getLength(); i++) { + Element n = (Element) tableNodeRR.getChildNodes().item(i); + + if (n.getNodeName().equalsIgnoreCase("scaling")) { + return n; + } + } + + return null; + } + + private void postProcessTable(Element tableNodeRR) { + int validAxis = 0; + int nodeCountTable = tableNodeRR.getChildNodes().getLength(); + + LinkedList nodesToRemove = new LinkedList (); + for (int i = 0; i < nodeCountTable; i++) { + Element n = (Element) tableNodeRR.getChildNodes().item(i); + if (n.getNodeName().equalsIgnoreCase("table")) { + if (n.hasAttribute("storageaddress") || n.getAttributeNode("type").getValue().contains("Static")) { + validAxis++; + + // Use the sizes of the X and Y axis + // for the main table + Attr sizex = n.getAttributeNode("sizex"); + Attr sizey = n.getAttributeNode("sizey"); + if (sizex != null) + tableNodeRR.setAttributeNode((Attr) sizex.cloneNode(false)); + else if (sizey != null) + tableNodeRR.setAttributeNode((Attr) sizey.cloneNode(false)); + } else { + Element scalingNode = getScalingNodeForTable(tableNodeRR); + Element axisScalingNode = getScalingNodeForTable(n); + + // 2D Tables work different in XDFs + // We have to use the unit of the "missing" axis for the main table + if (scalingNode != null && axisScalingNode != null && !scalingNode.hasAttribute("units")) { + scalingNode.setAttribute("units", axisScalingNode.getAttribute("units")); + } + nodesToRemove.add(n); + } + } + } + + for (Element n: nodesToRemove) { + tableNodeRR.removeChild(n); + } + + tableNodeRR.setAttribute("type", (validAxis + 1) + "D"); + } + + + private String convertToRRCategoryString(List < String > categories) { + String category = ""; + for (int i = 0; i < categories.size(); i++) { + String cat = categories.get(i); + category += cat; + + if (i < categories.size() - 1) + category += "//"; + } + + return category; + } + + private Node parseXDFHeader(Document doc, Node romNode, Node header) { + int nodeCountHeader = header.getChildNodes().getLength(); + Node n; + Node romIDNode = doc.createElement("romid"); + + for (int i = 0; i < nodeCountHeader; i++) { + n = header.getChildNodes().item(i); + + if (n.getNodeName().equalsIgnoreCase("CATEGORY")) { + categoryMap.put(HexUtil.hexToInt(n.getAttributes().getNamedItem("index").getNodeValue()), + n.getAttributes().getNamedItem("name").getNodeValue()); + } else if (n.getNodeName().equalsIgnoreCase("flags")) { + // TODO + } else if (n.getNodeName().equalsIgnoreCase("author")) { + String author = n.getTextContent(); + Node ecuID = doc.createElement("author"); + ecuID.setTextContent(author); + romIDNode.appendChild(ecuID); + } else if (n.getNodeName().equalsIgnoreCase("fileversion")) { + String version = n.getTextContent(); + Node ecuID = doc.createElement("version"); + ecuID.setTextContent(version); + romIDNode.appendChild(ecuID); + } else if (n.getNodeName().equalsIgnoreCase("deftitle")) { + String title = n.getTextContent(); + Node ecuID = doc.createElement("xmlid"); + ecuID.setTextContent(title); + romIDNode.appendChild(ecuID); + } else if (n.getNodeName().equalsIgnoreCase("description")) { + // TODO + } else if (n.getNodeName().equalsIgnoreCase("BASEOFFSET")) { + Node offsetNode = n.getAttributes().getNamedItem("offset"); + + if (offsetNode != null) { + String nv = offsetNode.getNodeValue(); + if (nv.length() > 2 && nv.substring(0, 2).equalsIgnoreCase("0x")) { + // node value is hex in string format + offset = RomAttributeParser.parseHexString(nv); + } else { + // node value is decimal in string format + offset = Integer.parseInt(nv); + } + + if (!n.getAttributes().getNamedItem("subtract").getNodeValue().equals("0")) { + offset *= -1; + } + } + } else if (n.getNodeName().equalsIgnoreCase("DEFAULTS")) { + if (!n.getAttributes().getNamedItem("float").getNodeValue().equalsIgnoreCase("0")) { + // dataType = "float"; + } else { + bitCount = Integer.parseInt(n.getAttributes().getNamedItem("datasizeinbits").getNodeValue()); + signed = !n.getAttributes().getNamedItem("signed").getNodeValue().equalsIgnoreCase("0"); + + // dataType = (signed ? "" : "u") + "int" + bitCount; + lsbFirst = !n.getAttributes().getNamedItem("lsbfirst").getNodeValue().equalsIgnoreCase("0"); + numDigits = HexUtil.hexToInt(n.getAttributes().getNamedItem("sigdigits").getNodeValue()); + } + } else if (n.getNodeName().equalsIgnoreCase("REGION")) { + // Ignored currently: type, startAddress, regionFlags, name, desc + // TODO: Start address probably matters.... + int fileSize = HexUtil.hexToInt(n.getAttributes().getNamedItem("size").getNodeValue()); + Node fileSizeN = doc.createElement("filesize"); + fileSizeN.setTextContent(fileSize + "b"); + } + } + + // XDFs dont have an identification component + // So we just load it, no questions asked + Node idAddress = doc.createElement("internalidaddress"); + Node idString = doc.createElement("internalidstring"); + idString.setTextContent("force"); + idAddress.setTextContent("-1"); + + Element offsetNode = doc.createElement("offset"); + offsetNode.setTextContent("0x" + Integer.toString(offset, 16)); + + romIDNode.appendChild(offsetNode); + romIDNode.appendChild(idAddress); + romIDNode.appendChild(idString); + + return romIDNode; + } + + private Document convertXDFDocument(Document xdfDoc) throws SAXException { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = null; + + try { + builder = dbf.newDocumentBuilder(); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } + + // New RomRaider document + Document doc = builder.newDocument(); + + Node baseNode = xdfDoc; + Node romNode = null; + int nodeCount = 0; + int nodeCountBase = baseNode.getChildNodes().getLength(); + + for (int i = 0; i < nodeCountBase; i++) { + Node n = baseNode.getChildNodes().item(i); + if (n.getNodeName().equalsIgnoreCase("XDFFORMAT")) { + baseNode = n; + break; + } + } + + if (baseNode == xdfDoc) { + throw new SAXException(rb.getString("NOXDFFORMAT")); + } + + nodeCount = baseNode.getChildNodes().getLength(); + Node header = null; + + // Find XDF Header first + for (int i = 0; i < nodeCount; i++) { + Node n = baseNode.getChildNodes().item(i); + if (n.getNodeName().equalsIgnoreCase("XDFHEADER")) { + + // Create the initial document + Node roms = doc.createElement("roms"); + romNode = doc.createElement("rom"); + + doc.appendChild(roms); + roms.appendChild(romNode); + + header = n; + Node headerNode = parseXDFHeader(doc, romNode, header); + romNode.appendChild(headerNode); + break; + } + } + + if (header == null) { + throw new SAXException(rb.getString("NOXDFHEADER")); + } + + LinkedList tables = new LinkedList (); + + // Go through all tables and create RR tables + for (int i = 0; i < nodeCount; i++) { + Node n = baseNode.getChildNodes().item(i); + if (n.getNodeName().equalsIgnoreCase("XDFTABLE")) { + Element table = parseTable(doc, romNode, n); + + if (table != null) { + tables.add(table); + } + } + // A constant is a mix between a table and an axis + // So parse it as both + else if (n.getNodeName().equalsIgnoreCase("XDFCONSTANT")) { + Element table = parseTable(doc, romNode, n); + parseAxis(doc, table, n, null); + if (table != null) { + tables.add(table); + } + } + } + + // Some references could not be solved because we didnt parse the table yet + // So we have to do these now + for (EmbedInfoData e: embedsToSolve) { + Element axis = parseAxis(doc, e.tableNodeRR, e.axisNode, e.flagsNodeTable); + + if (axis != null) + e.tableNodeRR.appendChild(axis); + } + + // Final cleanup and add tables to ROM + for (Element t: tables) { + postProcessTable(t); + romNode.appendChild(t); + } + + return doc; + } +} \ No newline at end of file diff --git a/src/main/java/com/romraider/xml/DOMHelper.java b/src/main/java/com/romraider/xml/DOMHelper.java index ad84a1424..61d53f5a5 100644 --- a/src/main/java/com/romraider/xml/DOMHelper.java +++ b/src/main/java/com/romraider/xml/DOMHelper.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2021 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ public static String unmarshallText(Node textNode) { public static String unmarshallAttribute(Node node, String name, String defaultValue) { Node n = node.getAttributes().getNamedItem(name); - return (n != null) ? (n.getNodeValue()) : (defaultValue); + return (n != null && !n.getNodeValue().equals("NaN")) ? (n.getNodeValue()) : (defaultValue); } public static Double unmarshallAttribute(Node node, String name, double defaultValue) { diff --git a/src/main/java/com/romraider/xml/DOMRomUnmarshaller.java b/src/main/java/com/romraider/xml/DOMRomUnmarshaller.java index 9b60b6454..f71c44bf1 100644 --- a/src/main/java/com/romraider/xml/DOMRomUnmarshaller.java +++ b/src/main/java/com/romraider/xml/DOMRomUnmarshaller.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,69 +17,90 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -//DOM XML parser for ROMs - package com.romraider.xml; import static com.romraider.xml.DOMHelper.unmarshallAttribute; import static com.romraider.xml.DOMHelper.unmarshallText; import static org.w3c.dom.Node.ELEMENT_NODE; -import java.util.ArrayList; -import java.util.List; +import java.io.File; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.ResourceBundle; import javax.management.modelmbean.XMLParseException; -import javax.swing.JOptionPane; import org.apache.log4j.Logger; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import com.romraider.Settings; -import com.romraider.editor.ecu.ECUEditorManager; -import com.romraider.maps.DataCell; import com.romraider.maps.Rom; import com.romraider.maps.RomID; -import com.romraider.maps.Scale; import com.romraider.maps.Table; -import com.romraider.maps.Table1D; -import com.romraider.maps.Table2D; -import com.romraider.maps.Table3D; -import com.romraider.maps.TableSwitch; -import com.romraider.swing.DebugPanel; +import com.romraider.maps.checksum.ChecksumFactory; +import com.romraider.maps.checksum.ChecksumManager; import com.romraider.swing.JProgressPane; -import com.romraider.util.LogManager; -import com.romraider.util.ObjectCloner; -import com.romraider.util.SettingsManager; +import com.romraider.util.HexUtil; +import com.romraider.util.ResourceUtil; public final class DOMRomUnmarshaller { private static final Logger LOGGER = Logger .getLogger(DOMRomUnmarshaller.class); + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DOMRomUnmarshaller.class.getName()); private JProgressPane progress = null; - private final List scales = new ArrayList(); + private ChecksumManager checksumManager = null; + private TableScaleUnmarshaller tableScaleHandler = new TableScaleUnmarshaller(); - public DOMRomUnmarshaller() { + public Node checkDefinitionMatch(Node rootNode, byte[] input){ + Node n = findRomNodeMatch(rootNode, null, input); + return n; } - public Rom unmarshallXMLDefinition(Node rootNode, byte[] input, - JProgressPane progress) throws RomNotFoundException, + public Rom unmarshallXMLDefinition(File definition, Node rootNode, Node romNode, byte[] input, + JProgressPane progress) throws XMLParseException, StackOverflowError, Exception { this.progress = progress; + + // Unmarshall scales first + tableScaleHandler.unmarshallBaseScales(rootNode); + + Rom rom = new Rom(new RomID()); + Rom output = unmarshallRom(romNode, rom); + + //Set ram offset + output.getRomID().setRamOffset( + output.getRomID().getFileSize() + - input.length); + + return output; + } + + public static Node findFirstRomNode(Node rootNode) { Node n; NodeList nodes = rootNode.getChildNodes(); - // unmarshall scales first for (int i = 0; i < nodes.getLength(); i++) { n = nodes.item(i); if (n.getNodeType() == ELEMENT_NODE - && n.getNodeName().equalsIgnoreCase("scalingbase")) { - scales.add(unmarshallScale(n, new Scale())); - } + && n.getNodeName().equalsIgnoreCase("rom")) return n; } - // now unmarshall roms + return null; + } + + //Find the correct Rom Node either by xmlID or by input bytes + //Supplying both will return null + private Node findRomNodeMatch(Node rootNode, String xmlID, byte[] input) { + if(xmlID == null && input == null) return null; + if(xmlID != null && input != null) return null; + + Node n; + NodeList nodes = rootNode.getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { n = nodes.item(i); @@ -90,109 +111,40 @@ public Rom unmarshallXMLDefinition(Node rootNode, byte[] input, for (int z = 0; z < nodes2.getLength(); z++) { n2 = nodes2.item(z); + if (n2.getNodeType() == ELEMENT_NODE && n2.getNodeName().equalsIgnoreCase("romid")) { - RomID romID = unmarshallRomID(n2, new RomID()); - - if (romID.getInternalIdString().length() > 0 - && foundMatch(romID, input)) { - Rom output = unmarshallRom(n, new Rom()); + RomID romId = new RomID(); + romId = unmarshallRomID(n2, romId); - // set ram offset - output.getRomID().setRamOffset( - output.getRomID().getFileSize() - - input.length); - return output; + //Check if bytes match in file + if(input != null && romId.checkMatch(input)) { + return n; } - } - } - } - } - throw new RomNotFoundException(); - } - - public static boolean foundMatch(RomID romID, byte[] file) { - String idString = romID.getInternalIdString(); - - // romid is hex string - if (idString.length() > 2 - && idString.substring(0, 2).equalsIgnoreCase("0x")) { - - try { - // put romid in to byte array to check for match - idString = idString.substring(2); // remove "0x" - int[] romIDBytes = new int[idString.length() / 2]; - - for (int i = 0; i < romIDBytes.length; i++) { - // check to see if each byte matches - - if ((file[romID.getInternalIdAddress() + i] & 0xff) != Integer - .parseInt(idString.substring(i * 2, i * 2 + 2), 16)) { + //Check if the ID matches + else if(xmlID != null && romId.getXmlid().equalsIgnoreCase(xmlID)) { + return n; + } - return false; + break; } } - // if no mismatched bytes found, return true - return true; - } catch (Exception ex) { - // if any exception is encountered, names do not match - LOGGER.warn("Error finding match", ex); - return false; - } - - // else romid is NOT hex string - } else { - try { - String ecuID = new String(file, romID.getInternalIdAddress(), - romID.getInternalIdString().length()); - return foundMatchByString(romID, ecuID); - } catch (Exception ex) { - // if any exception is encountered, names do not match - return false; } } - } - - public static boolean foundMatchByString(RomID romID, String ecuID) { - try { - if (ecuID.equalsIgnoreCase(romID.getInternalIdString())) { - return true; - } else { - return false; - } - } catch (Exception ex) { - // if any exception is encountered, names do not match - return false; - } - } - - public static void main(String args[]) { - LogManager.initDebugLogging(); - RomID romID = new RomID(); - romID.setInternalIdString("Asdfd"); - - byte[] file = "Asdfd".getBytes(); - LOGGER.debug(foundMatch(romID, file)); - - file[0] = 1; - file[1] = 1; - file[2] = 1; - file[3] = 1; - LOGGER.debug(foundMatch(romID, file)); - - romID.setInternalIdString("0x010101"); - LOGGER.debug(foundMatch(romID, file)); + return null; } public Rom unmarshallRom(Node rootNode, Rom rom) throws XMLParseException, RomNotFoundException, StackOverflowError, Exception { Node n; NodeList nodes = rootNode.getChildNodes(); + tableScaleHandler.filterFoundRomTables(nodes); - progress.update("Creating tables...", 15); + progress.update(MessageFormat.format(rb.getString("CREATETABLES"), + rom.getRomID().getXmlid()), 0); if (!unmarshallAttribute(rootNode, "base", "none").equalsIgnoreCase( "none")) { @@ -205,8 +157,9 @@ public Rom unmarshallRom(Node rootNode, Rom rom) throws XMLParseException, n = nodes.item(i); // update progress - int currProgress = (int) ((double) i / (double) nodes.getLength() * 40); - progress.update("Creating tables...", 10 + currProgress); + int currProgress = (int) (i / (double) nodes.getLength() * 100); + progress.update(MessageFormat.format(rb.getString("CREATETABLES"), + rom.getRomID().getXmlid()), currProgress); if (n.getNodeType() == ELEMENT_NODE) { if (n.getNodeName().equalsIgnoreCase("romid")) { @@ -214,33 +167,29 @@ public Rom unmarshallRom(Node rootNode, Rom rom) throws XMLParseException, } else if (n.getNodeName().equalsIgnoreCase("table")) { Table table = null; - try { - table = rom.getTableByName(unmarshallAttribute(n, "name", - null)); - } catch (TableNotFoundException e) { - /* - * table does not - * already exist (do - * nothing) - */ - } catch (InvalidTableNameException iex) { - // Table name is null or empty. Do nothing. - } + table = rom.getTableByName(unmarshallAttribute(n, "name", null)); try { - table = unmarshallTable(n, table, rom); - //rom.addTableByName(table); - rom.addTable(table); + table = tableScaleHandler.unmarshallTable(n, table, rom); + if (table != null) { + rom.addTableByName(table); + } } catch (TableIsOmittedException ex) { // table is not supported in inherited def (skip) if (table != null) { - //rom.removeTableByName(table); - rom.removeTable(table); + rom.removeTableByName(table); } } catch (XMLParseException ex) { - LOGGER.error("Error unmarshalling rom", ex); + LOGGER.error(ex.getMessage()); } - + } else if (n.getNodeName().equalsIgnoreCase("checksum")) { + rom.getRomID().setChecksum(unmarshallAttribute(n, "type", "")); + checksumManager = unmarshallChecksum(rom, n); + rom.addChecksumManager(checksumManager); + } + else if (n.getNodeType() == ELEMENT_NODE + && n.getNodeName().equalsIgnoreCase("Simulation")) { + tableScaleHandler.unmarshallSimulation(rom, n); } else { /* unexpected element in Rom (skip) */ } } else { /* unexpected node-type in Rom (skip) */ @@ -252,32 +201,15 @@ public Rom unmarshallRom(Node rootNode, Rom rom) throws XMLParseException, public Rom getBaseRom(Node rootNode, String xmlID, Rom rom) throws XMLParseException, RomNotFoundException, StackOverflowError, Exception { - Node n; - NodeList nodes = rootNode.getChildNodes(); - - for (int i = 0; i < nodes.getLength(); i++) { - n = nodes.item(i); - - if (n.getNodeType() == ELEMENT_NODE - && n.getNodeName().equalsIgnoreCase("rom")) { - Node n2; - NodeList nodes2 = n.getChildNodes(); - for (int z = 0; z < nodes2.getLength(); z++) { - n2 = nodes2.item(z); - if (n2.getNodeType() == ELEMENT_NODE - && n2.getNodeName().equalsIgnoreCase("romid")) { + Node n = findRomNodeMatch(rootNode, xmlID, null); - RomID romID = unmarshallRomID(n2, new RomID()); - if (romID.getXmlid().equalsIgnoreCase(xmlID)) { - Rom returnrom = unmarshallRom(n, rom); - returnrom.getRomID().setObsolete(false); - return returnrom; - } - } - } + if(n != null) { + Rom returnrom = unmarshallRom(n, rom); + returnrom.getRomID().setObsolete(false); + return returnrom; } - } + throw new RomNotFoundException(); } @@ -289,56 +221,66 @@ public RomID unmarshallRomID(Node romIDNode, RomID romID) { n = nodes.item(i); if (n.getNodeType() == ELEMENT_NODE) { + String nodeName = n.getNodeName(); - if (n.getNodeName().equalsIgnoreCase("xmlid")) { + if (nodeName.equalsIgnoreCase("xmlid")) { romID.setXmlid(unmarshallText(n)); - } else if (n.getNodeName() - .equalsIgnoreCase("internalidaddress")) { + } else if (nodeName.equalsIgnoreCase("internalidaddress")) { romID.setInternalIdAddress(RomAttributeParser .parseHexString(unmarshallText(n))); - } else if (n.getNodeName().equalsIgnoreCase("internalidstring")) { + } else if (nodeName.equalsIgnoreCase("internalidstring")) { romID.setInternalIdString(unmarshallText(n)); - if (romID.getInternalIdString() == null) { - romID.setInternalIdString(""); - } - } else if (n.getNodeName().equalsIgnoreCase("caseid")) { + } else if (nodeName.equalsIgnoreCase("author")) { + romID.setAuthor(unmarshallText(n)); + + } else if (nodeName.equalsIgnoreCase("version")) { + romID.setVersion(unmarshallText(n)); + + } else if (nodeName.equalsIgnoreCase("caseid")) { romID.setCaseId(unmarshallText(n)); - } else if (n.getNodeName().equalsIgnoreCase("ecuid")) { + } else if (nodeName.equalsIgnoreCase("ecuid")) { romID.setEcuId(unmarshallText(n)); - } else if (n.getNodeName().equalsIgnoreCase("make")) { + } else if (nodeName.equalsIgnoreCase("make")) { romID.setMake(unmarshallText(n)); - } else if (n.getNodeName().equalsIgnoreCase("market")) { + } else if (nodeName.equalsIgnoreCase("market")) { romID.setMarket(unmarshallText(n)); - } else if (n.getNodeName().equalsIgnoreCase("model")) { + } else if (nodeName.equalsIgnoreCase("model")) { romID.setModel(unmarshallText(n)); - } else if (n.getNodeName().equalsIgnoreCase("submodel")) { + } else if (nodeName.equalsIgnoreCase("submodel")) { romID.setSubModel(unmarshallText(n)); - } else if (n.getNodeName().equalsIgnoreCase("transmission")) { + } else if (nodeName.equalsIgnoreCase("transmission")) { romID.setTransmission(unmarshallText(n)); - } else if (n.getNodeName().equalsIgnoreCase("year")) { + } else if (nodeName.equalsIgnoreCase("year")) { romID.setYear(unmarshallText(n)); - } else if (n.getNodeName().equalsIgnoreCase("flashmethod")) { + } else if (nodeName.equalsIgnoreCase("noramoffset")) { + romID.disableRamOffset(); + + } else if (nodeName.equalsIgnoreCase("offset")) { + romID.setOffset(HexUtil.hexToInt(unmarshallText(n))); + + } else if (nodeName.equalsIgnoreCase("flashmethod")) { romID.setFlashMethod(unmarshallText(n)); - } else if (n.getNodeName().equalsIgnoreCase("memmodel")) { + } else if (nodeName.equalsIgnoreCase("memmodel")) { romID.setMemModel(unmarshallText(n)); - } else if (n.getNodeName().equalsIgnoreCase("filesize")) { + tableScaleHandler.setMemModelEndian(unmarshallAttribute(n, "endian", null)); + } else if (nodeName.equalsIgnoreCase("filesize")) { romID.setFileSize(RomAttributeParser .parseFileSize(unmarshallText(n))); - } else if (n.getNodeName().equalsIgnoreCase("obsolete")) { + } else if (nodeName.equalsIgnoreCase("obsolete")) { romID.setObsolete(Boolean.parseBoolean(unmarshallText(n))); } else { /* unexpected element in RomID (skip) */ @@ -349,269 +291,20 @@ public RomID unmarshallRomID(Node romIDNode, RomID romID) { return romID; } - private Table unmarshallTable(Node tableNode, Table table, Rom rom) - throws XMLParseException, TableIsOmittedException, Exception { - - if (unmarshallAttribute(tableNode, "omit", "false").equalsIgnoreCase( - "true")) { // remove table if omitted - throw new TableIsOmittedException(); + /** + * Unmarshall the attributes of the checksum element and populate a + * CheckSumManager object to be assigned to the ROM. + * @param node - the checksum element node to process + * @return CheckSumManager object + */ + private ChecksumManager unmarshallChecksum(Rom rom, Node node) { + final Map attrs = new HashMap(); + + for (int i = 0; i < node.getAttributes().getLength(); i++) { + attrs.put(node.getAttributes().item(i).getNodeName().toLowerCase(), + node.getAttributes().item(i).getNodeValue()); } - - if (!unmarshallAttribute(tableNode, "base", "none").equalsIgnoreCase( - "none")) { // copy base table for inheritance - try { - table = (Table) ObjectCloner - .deepCopy(rom.getTableByName(unmarshallAttribute(tableNode, - "base", "none"))); - - } catch (TableNotFoundException ex) { /* table not found, do nothing */ - - } catch (InvalidTableNameException ex) { // Table name is invalid, do nothing. - - } catch (NullPointerException ex) { - JOptionPane.showMessageDialog(ECUEditorManager.getECUEditor(), - new DebugPanel(ex, SettingsManager.getSettings().getSupportURL()), "Exception", - JOptionPane.ERROR_MESSAGE); - - } - } - - try { - if (table.getType() < 1) { - } - } catch (NullPointerException ex) { // if type is null or less than 0, - // create new instance (otherwise it - // is inherited) - if (unmarshallAttribute(tableNode, "type", "unknown") - .equalsIgnoreCase("3D")) { - table = new Table3D(); - - } else if (unmarshallAttribute(tableNode, "type", "unknown") - .equalsIgnoreCase("2D")) { - table = new Table2D(); - - } else if (unmarshallAttribute(tableNode, "type", "unknown") - .equalsIgnoreCase("1D")) { - table = new Table1D(); - - } else if (unmarshallAttribute(tableNode, "type", "unknown") - .equalsIgnoreCase("X Axis") - || unmarshallAttribute(tableNode, "type", "unknown") - .equalsIgnoreCase("Y Axis")) { - table = new Table1D(); - - } else if (unmarshallAttribute(tableNode, "type", "unknown") - .equalsIgnoreCase("Static Y Axis") - || unmarshallAttribute(tableNode, "type", "unknown") - .equalsIgnoreCase("Static X Axis")) { - table = new Table1D(); - - } else if (unmarshallAttribute(tableNode, "type", "unknown") - .equalsIgnoreCase("Switch")) { - table = new TableSwitch(); - - } else { - throw new XMLParseException("Error loading table, " - + tableNode.getAttributes().getNamedItem("name")); - } - } - - // unmarshall table attributes - table.setName(unmarshallAttribute(tableNode, "name", table.getName())); - table.setType(RomAttributeParser.parseTableType(unmarshallAttribute( - tableNode, "type", String.valueOf(table.getType())))); - if (unmarshallAttribute(tableNode, "beforeram", "false") - .equalsIgnoreCase("true")) { - table.setBeforeRam(true); - } - - table.setCategory(unmarshallAttribute(tableNode, "category", - table.getCategory())); - if (table.getStorageType() < 1) { - table.setSignedData(RomAttributeParser - .parseStorageDataSign(unmarshallAttribute(tableNode, - "storagetype", - String.valueOf(table.getStorageType())))); - } - table.setStorageType(RomAttributeParser - .parseStorageType(unmarshallAttribute(tableNode, "storagetype", - String.valueOf(table.getStorageType())))); - table.setEndian(RomAttributeParser.parseEndian(unmarshallAttribute( - tableNode, "endian", String.valueOf(table.getEndian())))); - table.setStorageAddress(RomAttributeParser - .parseHexString(unmarshallAttribute(tableNode, - "storageaddress", - String.valueOf(table.getStorageAddress())))); - table.setDescription(unmarshallAttribute(tableNode, "description", - table.getDescription())); - table.setDataSize(unmarshallAttribute(tableNode, "sizey", - unmarshallAttribute(tableNode, "sizex", table.getDataSize()))); - table.setFlip(unmarshallAttribute(tableNode, "flipy", - unmarshallAttribute(tableNode, "flipx", table.getFlip()))); - table.setUserLevel(unmarshallAttribute(tableNode, "userlevel", - table.getUserLevel())); - table.setLocked(unmarshallAttribute(tableNode, "locked", - table.isLocked())); - table.setLogParam(unmarshallAttribute(tableNode, "logparam", - table.getLogParam())); - - if (table.getType() == Settings.TABLE_3D) { - ((Table3D) table).setSwapXY(unmarshallAttribute(tableNode, - "swapxy", ((Table3D) table).getSwapXY())); - ((Table3D) table).setFlipX(unmarshallAttribute(tableNode, "flipx", - ((Table3D) table).getFlipX())); - ((Table3D) table).setFlipY(unmarshallAttribute(tableNode, "flipy", - ((Table3D) table).getFlipY())); - ((Table3D) table).setSizeX(unmarshallAttribute(tableNode, "sizex", - ((Table3D) table).getSizeX())); - ((Table3D) table).setSizeY(unmarshallAttribute(tableNode, "sizey", - ((Table3D) table).getSizeY())); - } - - Node n; - NodeList nodes = tableNode.getChildNodes(); - - for (int i = 0; i < nodes.getLength(); i++) { - n = nodes.item(i); - - if (n.getNodeType() == ELEMENT_NODE) { - if (n.getNodeName().equalsIgnoreCase("table")) { - - if (table.getType() == Settings.TABLE_2D) { // if table is 2D, - // parse axis - - if (RomAttributeParser - .parseTableType(unmarshallAttribute(n, "type", - "unknown")) == Settings.TABLE_Y_AXIS - || RomAttributeParser - .parseTableType(unmarshallAttribute(n, - "type", "unknown")) == Settings.TABLE_X_AXIS) { - - Table1D tempTable = (Table1D) unmarshallTable(n, - ((Table2D) table).getAxis(), rom); - if (tempTable.getDataSize() != table.getDataSize()) { - tempTable.setDataSize(table.getDataSize()); - } - tempTable.setData(((Table2D) table).getAxis() - .getData()); - ((Table2D) table).setAxis(tempTable); - - } - } else if (table.getType() == Settings.TABLE_3D) { // if table - // is 3D, - // populate - // xAxis - if (RomAttributeParser - .parseTableType(unmarshallAttribute(n, "type", - "unknown")) == Settings.TABLE_X_AXIS) { - - Table1D tempTable = (Table1D) unmarshallTable(n, - ((Table3D) table).getXAxis(), rom); - if (tempTable.getDataSize() != ((Table3D) table) - .getSizeX()) { - tempTable.setDataSize(((Table3D) table) - .getSizeX()); - } - tempTable.setData(((Table3D) table).getXAxis() - .getData()); - ((Table3D) table).setXAxis(tempTable); - - } else if (RomAttributeParser - .parseTableType(unmarshallAttribute(n, "type", - "unknown")) == Settings.TABLE_Y_AXIS) { - - Table1D tempTable = (Table1D) unmarshallTable(n, - ((Table3D) table).getYAxis(), rom); - if (tempTable.getDataSize() != ((Table3D) table) - .getSizeY()) { - tempTable.setDataSize(((Table3D) table) - .getSizeY()); - } - tempTable.setData(((Table3D) table).getYAxis() - .getData()); - ((Table3D) table).setYAxis(tempTable); - - } - } - - } else if (n.getNodeName().equalsIgnoreCase("scaling")) { - // check whether scale already exists. if so, modify, else - // use new instance - Scale baseScale = table.getScale(unmarshallAttribute(n,"name", "Default")); - table.addScale(unmarshallScale(n, baseScale)); - - } else if (n.getNodeName().equalsIgnoreCase("data")) { - // parse and add data to table - DataCell dataCell = new DataCell(table, unmarshallText(n)); - if(table instanceof Table1D) { - ((Table1D)table).addStaticDataCell(dataCell); - } else { - // Why would this happen. Static should only be for axis. - LOGGER.error("Error adding static data cell."); - } - - } else if (n.getNodeName().equalsIgnoreCase("description")) { - table.setDescription(unmarshallText(n)); - - } else if (n.getNodeName().equalsIgnoreCase("state")) { - ((TableSwitch) table).setValues( - unmarshallAttribute(n, "name", ""), - unmarshallAttribute(n, "data", "0.0")); - - } else { /* unexpected element in Table (skip) */ - } - } else { /* unexpected node-type in Table (skip) */ - } - } - - return table; + return ChecksumFactory.getManager(rom, attrs); } - private Scale unmarshallScale(Node scaleNode, Scale scale) { - - // look for base scale first - String base = unmarshallAttribute(scaleNode, "base", "none"); - if (!base.equalsIgnoreCase("none")) { - for (Scale scaleItem : scales) { - - // check whether name matches base and set scale if so - if (scaleItem.getName().equalsIgnoreCase(base)) { - try { - scale = (Scale) ObjectCloner.deepCopy(scaleItem); - - } catch (Exception ex) { - JOptionPane.showMessageDialog( - ECUEditorManager.getECUEditor(), - new DebugPanel(ex, SettingsManager.getSettings() - .getSupportURL()), "Exception", - JOptionPane.ERROR_MESSAGE); - } - } - } - } - - // set remaining attributes - scale.setName(unmarshallAttribute(scaleNode, "name", "Default")); - scale.setUnit(unmarshallAttribute(scaleNode, "units", scale.getUnit())); - scale.setExpression(unmarshallAttribute(scaleNode, "expression", - scale.getExpression())); - scale.setByteExpression(unmarshallAttribute(scaleNode, "to_byte", - scale.getByteExpression())); - scale.setFormat(unmarshallAttribute(scaleNode, "format", "#")); - scale.setMax(unmarshallAttribute(scaleNode, "max", 0.0)); - scale.setMin(unmarshallAttribute(scaleNode, "min", 0.0)); - - // get coarse increment with new attribute name (coarseincrement), else - // look for old (increment) - scale.setCoarseIncrement(unmarshallAttribute( - scaleNode, - "coarseincrement", - unmarshallAttribute(scaleNode, "increment", - scale.getCoarseIncrement()))); - - scale.setFineIncrement(unmarshallAttribute(scaleNode, "fineincrement", - scale.getFineIncrement())); - - return scale; - } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/xml/DOMSettingsBuilder.java b/src/main/java/com/romraider/xml/DOMSettingsBuilder.java index 6bb161192..103872635 100644 --- a/src/main/java/com/romraider/xml/DOMSettingsBuilder.java +++ b/src/main/java/com/romraider/xml/DOMSettingsBuilder.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,54 +19,73 @@ package com.romraider.xml; +import static com.romraider.util.ParamChecker.isNullOrEmpty; + import java.io.File; -import java.io.FileOutputStream; +import java.io.FileWriter; import java.io.IOException; import java.util.Collection; import java.util.Map; +import java.util.ResourceBundle; import java.util.Vector; import javax.imageio.metadata.IIOMetadataNode; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import com.romraider.Settings; import com.romraider.logger.external.phidget.interfacekit.io.IntfKitSensor; import com.romraider.swing.JProgressPane; -import com.sun.org.apache.xml.internal.serialize.OutputFormat; -import com.sun.org.apache.xml.internal.serialize.XMLSerializer; +import com.romraider.util.ResourceUtil; public final class DOMSettingsBuilder { + private static final ResourceBundle rb = new ResourceUtil().getBundle( + DOMSettingsBuilder.class.getName()); public void buildSettings(Settings settings, File output, JProgressPane progress, String versionNumber) throws IOException { IIOMetadataNode settingsNode = new IIOMetadataNode("settings"); // create settings - progress.update("Saving window settings...", 15); + progress.update(rb.getString("SAVEWIN"), 15); settingsNode.appendChild(buildWindow(settings)); - progress.update("Saving file settings...", 30); + progress.update(rb.getString("SAVEFILE"), 30); settingsNode.appendChild(buildFiles(settings)); - progress.update("Saving options...", 45); + progress.update(rb.getString("SAVEOPTN"), 45); settingsNode.appendChild(buildOptions(settings, versionNumber)); - progress.update("Saving display settings...", 60); + progress.update(rb.getString("SAVEDISP"), 60); settingsNode.appendChild(buildTableDisplay(settings)); - progress.update("Saving logger settings...", 75); + progress.update(rb.getString("SAVELOGR"), 75); settingsNode.appendChild(buildLogger(settings)); - progress.update("Saving table clipboard format settings...", 80); + progress.update(rb.getString("SAVECLIP"), 80); settingsNode.appendChild(buildTableClipboardFormat(settings)); - progress.update("Saving icon scale settings...", 85); + progress.update(rb.getString("SAVEICON"), 85); settingsNode.appendChild(buildIcons(settings)); - OutputFormat of = new OutputFormat("XML", "ISO-8859-1", true); - of.setIndent(1); - of.setIndenting(true); - - progress.update("Writing to file...", 90); + progress.update(rb.getString("WTOF"), 90); - FileOutputStream fos = new FileOutputStream(output); + final FileWriter fos = new FileWriter(output); try { - XMLSerializer serializer = new XMLSerializer(fos, of); - serializer.serialize(settingsNode); + // https://xml.apache.org/xalan-j/usagepatterns.html + final TransformerFactory tFactory = TransformerFactory.newInstance(); + final Transformer transformer = tFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + final DOMSource dom = new DOMSource(settingsNode); + final StreamResult sr = new StreamResult(fos); + transformer.transform(dom, sr); // make sure attributes are not null before transforming fos.flush(); + } catch (TransformerConfigurationException e) { + throw new RuntimeException(e); + } catch (TransformerException e) { + throw new RuntimeException(e); } finally { fos.close(); } @@ -108,6 +127,10 @@ private IIOMetadataNode buildFiles(Settings settings) { imageDir.setAttribute("path", settings.getLastImageDir().getAbsolutePath()); files.appendChild(imageDir); + IIOMetadataNode defDir = new IIOMetadataNode("def_dir"); + defDir.setAttribute("path", settings.getLastDefinitionDir().getAbsolutePath()); + files.appendChild(defDir); + // repository directory IIOMetadataNode repositoryDir = new IIOMetadataNode(Settings.REPOSITORY_ELEMENT_NAME); repositoryDir.setAttribute(Settings.REPOSITORY_ATTRIBUTE_NAME, settings.getLastRepositoryDir().getAbsolutePath()); @@ -158,6 +181,11 @@ private IIOMetadataNode buildOptions(Settings settings, String versionNumber) { tableClickBehavior.setAttribute("value", String.valueOf(settings.getTableClickBehavior())); options.appendChild(tableClickBehavior); + // table tree sorting + IIOMetadataNode tableTreeSorted = new IIOMetadataNode("tabletreesorted"); + tableTreeSorted.setAttribute("value", String.valueOf(settings.isTableTreeSorted())); + options.appendChild(tableTreeSorted); + // last version used IIOMetadataNode version = new IIOMetadataNode("version"); version.setAttribute("value", versionNumber); @@ -277,6 +305,18 @@ private IIOMetadataNode buildTableDisplay(Settings settings) { warning.setAttribute("g", String.valueOf(settings.getWarningColor().getGreen())); warning.setAttribute("b", String.valueOf(settings.getWarningColor().getBlue())); colors.appendChild(warning); + // live cells visited + IIOMetadataNode oldlive = new IIOMetadataNode("livevalue"); + oldlive.setAttribute("r", String.valueOf(settings.getliveValueColor().getRed())); + oldlive.setAttribute("g", String.valueOf(settings.getliveValueColor().getGreen())); + oldlive.setAttribute("b", String.valueOf(settings.getliveValueColor().getBlue())); + colors.appendChild(oldlive); + // current live cell + IIOMetadataNode curlive = new IIOMetadataNode("curlivevalue"); + curlive.setAttribute("r", String.valueOf(settings.getCurLiveValueColor().getRed())); + curlive.setAttribute("g", String.valueOf(settings.getCurLiveValueColor().getGreen())); + curlive.setAttribute("b", String.valueOf(settings.getCurLiveValueColor().getBlue())); + colors.appendChild(curlive); tableDisplay.appendChild(colors); @@ -287,19 +327,24 @@ private IIOMetadataNode buildLogger(Settings settings) { IIOMetadataNode loggerSettings = new IIOMetadataNode("logger"); loggerSettings.setAttribute("locale", settings.getLocale()); + // Automatically connect the logger on startup + IIOMetadataNode autoConnect = new IIOMetadataNode("autoConnectOnStartup"); + autoConnect.setAttribute("value", "" + settings.getAutoConnectOnStartup()); + loggerSettings.appendChild(autoConnect); + // serial connection IIOMetadataNode serial = new IIOMetadataNode("serial"); - serial.setAttribute("port", settings.getLoggerPortDefault()); + serial.setAttribute("port", validateAttr(settings.getLoggerPortDefault())); serial.setAttribute("refresh", String.valueOf(settings.getRefreshMode())); - serial.setAttribute("ecuid", String.valueOf(settings.getDestinationId())); - serial.setAttribute("fastpoll", String.valueOf(settings.isFastPoll())); loggerSettings.appendChild(serial); // Protocol connection IIOMetadataNode protocol = new IIOMetadataNode("protocol"); protocol.setAttribute("name", settings.getLoggerProtocol()); protocol.setAttribute("transport", settings.getTransportProtocol()); - protocol.setAttribute("library", settings.getJ2534Device()); + protocol.setAttribute("module", settings.getTargetModule()); + protocol.setAttribute("fastpoll", String.valueOf(settings.isFastPoll())); + protocol.setAttribute("library", validateAttr(settings.getJ2534Device())); loggerSettings.appendChild(protocol); // window maximized @@ -333,7 +378,7 @@ private IIOMetadataNode buildLogger(Settings settings) { // profile path IIOMetadataNode profile = new IIOMetadataNode("profile"); - profile.setAttribute("path", settings.getLoggerProfileFilePath()); + profile.setAttribute("path", validateAttr(settings.getLoggerProfileFilePath())); loggerSettings.appendChild(profile); // file logging @@ -355,8 +400,8 @@ private IIOMetadataNode buildLogger(Settings settings) { IIOMetadataNode plugins = new IIOMetadataNode("plugins"); for (Map.Entry entry : pluginPorts.entrySet()) { IIOMetadataNode plugin = new IIOMetadataNode("plugin"); - plugin.setAttribute("id", entry.getKey()); - plugin.setAttribute("port", entry.getValue()); + plugin.setAttribute("id", (entry.getKey())); + plugin.setAttribute("port", (entry.getValue())); plugins.appendChild(plugin); } final Map phidgets = settings.getPhidgetSensors(); @@ -380,6 +425,19 @@ private IIOMetadataNode buildLogger(Settings settings) { loggerSettings.appendChild(plugins); } + // Dashboard Gauge Index + IIOMetadataNode gaugeindex = new IIOMetadataNode("gauge"); + gaugeindex.setAttribute("index", String.valueOf((settings.getLoggerSelectedGaugeIndex()))); + loggerSettings.appendChild(gaugeindex); + + // Dyno tab settings + IIOMetadataNode dyno = new IIOMetadataNode("dyno"); + dyno.setAttribute("car", (settings.getSelectedCar())); + dyno.setAttribute("gear", validateAttr(settings.getSelectedGear())); + dyno.setAttribute("threshold", (settings.getDynoThreshold())); + dyno.setAttribute("units", (settings.getDynoThrottle())); + loggerSettings.appendChild(dyno); + return loggerSettings; } @@ -398,7 +456,7 @@ private IIOMetadataNode buildTableClipboardFormat(Settings settings) { IIOMetadataNode table3DFormatSetting = new IIOMetadataNode(Settings.TABLE3D_ELEMENT); tableFormatSetting.setAttribute(Settings.TABLE_HEADER_ATTRIBUTE, settings.getTableHeader()); - table1DFormatSetting.setAttribute(Settings.TABLE_HEADER_ATTRIBUTE, settings.getTable1DHeader()); + table1DFormatSetting.setAttribute(Settings.TABLE_HEADER_ATTRIBUTE, validateAttr(settings.getTable1DHeader())); table2DFormatSetting.setAttribute(Settings.TABLE_HEADER_ATTRIBUTE, settings.getTable2DHeader()); table3DFormatSetting.setAttribute(Settings.TABLE_HEADER_ATTRIBUTE, settings.getTable3DHeader()); @@ -427,4 +485,11 @@ private IIOMetadataNode buildIcons(Settings settings) { return iconsSettings; } + + private String validateAttr(String attr) { + if (isNullOrEmpty(attr)) { + return ""; + } + return attr; + } } diff --git a/src/main/java/com/romraider/xml/DOMSettingsUnmarshaller.java b/src/main/java/com/romraider/xml/DOMSettingsUnmarshaller.java index b6cde8438..983b8f440 100644 --- a/src/main/java/com/romraider/xml/DOMSettingsUnmarshaller.java +++ b/src/main/java/com/romraider/xml/DOMSettingsUnmarshaller.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2022 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,7 +111,8 @@ private Settings unmarshallFiles(Node urlNode, Settings settings) { } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("image_dir")) { settings.setLastImageDir(new File(unmarshallAttribute(n, "path", "ecu_defs.xml"))); - + } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("def_dir")) { + settings.setLastDefinitionDir(new File(unmarshallAttribute(n, "path", "./"))); } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase(Settings.REPOSITORY_ELEMENT_NAME)) { settings.setLastRepositoryDir(new File(unmarshallAttribute(n, Settings.REPOSITORY_ATTRIBUTE_NAME, "repositories"))); @@ -145,6 +146,9 @@ private Settings unmarshallOptions(Node optionNode, Settings settings) { } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("tableclickbehavior")) { settings.setTableClickBehavior(unmarshallAttribute(n, "value", 0)); + } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("tabletreesorted")) { + settings.setTableTreeSorted(Boolean.parseBoolean(unmarshallAttribute(n, "value", "false"))); + } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("version")) { settings.setRecentVersion(unmarshallAttribute(n, "value", "")); @@ -235,6 +239,12 @@ private Settings unmarshallColors(Node colorNode, Settings settings) { } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("warning")) { settings.setWarningColor(unmarshallColor(n)); + } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("livevalue")) { + settings.setLiveValueColor(unmarshallColor(n)); + + } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("curlivevalue")) { + settings.setCurLiveValueColor(unmarshallColor(n)); + } } return settings; @@ -253,12 +263,13 @@ private Settings unmarshallLogger(Node loggerNode, Settings settings) { if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("serial")) { settings.setLoggerPortDefault(unmarshallAttribute(n, "port", "")); settings.setRefreshMode(unmarshallAttribute(n, "refresh", false)); - settings.setDestinationId((byte) unmarshallAttribute(n, "ecuid", (byte) 0x10)); - settings.setFastPoll(unmarshallAttribute(n, "fastpoll", true)); - + } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("autoConnectOnStartup")) { + settings.setAutoConnectOnStartup(unmarshallAttribute(n, "value", true)); } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("protocol")) { settings.setLoggerProtocol(unmarshallAttribute(n, "name", "SSM")); settings.setTransportProtocol(unmarshallAttribute(n, "transport", "ISO9141")); + settings.setTargetModule(unmarshallAttribute(n, "module", "ecu")); + settings.setFastPoll(unmarshallAttribute(n, "fastpoll", true)); settings.setJ2534Device(unmarshallAttribute(n, "library", null)); } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("maximized")) { @@ -292,6 +303,15 @@ private Settings unmarshallLogger(Node loggerNode, Settings settings) { } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("debug")) { settings.setLoggerDebuggingLevel(unmarshallAttribute(n, "level", "info")); + } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("gauge")) { + settings.setLoggerSelectedGaugeIndex(unmarshallAttribute(n, "index", 0)); + + } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("dyno")) { + settings.setSelectedCar(unmarshallAttribute(n, "car", "")); + settings.setSelectedGear(unmarshallAttribute(n, "gear", "3")); + settings.setDynoThreshold(unmarshallAttribute(n, "threshold", "98")); + settings.setDynoThrottle(unmarshallAttribute(n, "units", "%")); + } else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("plugins")) { Map pluginPorts = new HashMap(); NodeList pluginNodes = n.getChildNodes(); diff --git a/src/main/java/com/romraider/xml/InvalidTableNameException.java b/src/main/java/com/romraider/xml/InvalidTableNameException.java deleted file mode 100644 index 7ba33c51b..000000000 --- a/src/main/java/com/romraider/xml/InvalidTableNameException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.xml; - -public final class InvalidTableNameException extends Exception { - - private static final long serialVersionUID = 5189492974906792046L; - - @Override - public String getMessage() { - return "Invalid table name."; - } -} \ No newline at end of file diff --git a/src/main/java/com/romraider/xml/RomAttributeParser.java b/src/main/java/com/romraider/xml/RomAttributeParser.java index b914ebd60..63026cc9b 100644 --- a/src/main/java/com/romraider/xml/RomAttributeParser.java +++ b/src/main/java/com/romraider/xml/RomAttributeParser.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2025 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,38 +26,37 @@ import java.nio.ByteOrder; import com.romraider.Settings; +import com.romraider.maps.Table; +import com.romraider.maps.Table1DView; +import com.romraider.util.ByteUtil; +import com.romraider.util.HexUtil; public final class RomAttributeParser { - private RomAttributeParser() { - } - - public static int parseEndian(String input) { - if (input.equalsIgnoreCase("big") || input.equalsIgnoreCase(String.valueOf(Settings.ENDIAN_BIG))) { - return Settings.ENDIAN_BIG; + public static Settings.Endian parseEndian(String input) { + if (input.equalsIgnoreCase("big") || input.equalsIgnoreCase(Settings.Endian.BIG.getMarshallingString())) { + return Settings.Endian.BIG; } - else if (input.equalsIgnoreCase("little") || input.equalsIgnoreCase(String.valueOf(Settings.ENDIAN_LITTLE))) { - return Settings.ENDIAN_LITTLE; + else if (input.equalsIgnoreCase("little") || input.equalsIgnoreCase(Settings.Endian.LITTLE.getMarshallingString())) { + return Settings.Endian.LITTLE; } else { - return Settings.ENDIAN_LITTLE; + return Settings.Endian.LITTLE; } } public static int parseHexString(String input) { - if (input.equals("0")) { - return 0; - } - else if (input.length() > 2 && input.substring(0, 2).equalsIgnoreCase("0x")) { - return Integer.parseInt(input.substring(2), 16); - } - else { - return Integer.parseInt(input, 16); - } + return HexUtil.hexToInt(input); } public static int parseStorageType(String input) { - if (input.equalsIgnoreCase("float")) { + if (input.equalsIgnoreCase("movi20")) { // when data is in MOVI20 instruction + return Settings.STORAGE_TYPE_MOVI20; + } + else if (input.equalsIgnoreCase("movi20s")) { // when data is in MOVI20 instruction + return Settings.STORAGE_TYPE_MOVI20S; + } + else if (input.equalsIgnoreCase("float")) { return Settings.STORAGE_TYPE_FLOAT; } else if (input.startsWith("uint")) { @@ -72,7 +71,8 @@ else if (input.startsWith("int")) { } public static boolean parseStorageDataSign(String input) { - if (input.startsWith("int")) { + if (input.toLowerCase().startsWith("int") || + input.toLowerCase().startsWith("movi20")) { // when data is in MOVI20 instruction return true; } else { @@ -89,29 +89,57 @@ public static int parseScaleType(String input) { } } - public static int parseTableType(String input) { - if (input.equalsIgnoreCase("3D") || input.equalsIgnoreCase(String.valueOf(Settings.TABLE_3D))) { - return Settings.TABLE_3D; + public static Table1DView.Table1DType parseTableAxis(String input) { + //4 and 5 are only for backwards compatibilty, is anybody even using this? + if (input.equalsIgnoreCase("X Axis") || input.equalsIgnoreCase("Static X Axis") || input.equalsIgnoreCase("4")) { + return Table1DView.Table1DType.X_AXIS; + } + else if (input.equalsIgnoreCase("Y Axis") || input.equalsIgnoreCase("Static Y Axis") || input.equalsIgnoreCase("5")) { + return Table1DView.Table1DType.Y_AXIS; + } + else { + return Table1DView.Table1DType.NO_AXIS; + } + } + + public static Table.TableType parseTableType(String input) { + if (input.equalsIgnoreCase("3D") || input.equalsIgnoreCase(Table.TableType.TABLE_3D.getMarshallingString())) { + return Table.TableType.TABLE_3D; } - else if (input.equalsIgnoreCase("2D") || input.equalsIgnoreCase(String.valueOf(Settings.TABLE_2D))) { - return Settings.TABLE_2D; + else if (input.equalsIgnoreCase("2D") || input.equalsIgnoreCase(Table.TableType.TABLE_2D.getMarshallingString())) { + return Table.TableType.TABLE_2D; } - else if (input.equalsIgnoreCase("X Axis") || input.equalsIgnoreCase("Static X Axis") || input.equalsIgnoreCase(String.valueOf(Settings.TABLE_X_AXIS))) { - return Settings.TABLE_X_AXIS; + //4 and 5 are only for backwards compatibilty, is anybody even using this? + else if (input.equalsIgnoreCase("X Axis") || input.equalsIgnoreCase("Static X Axis") || input.equalsIgnoreCase("4")) { + return Table.TableType.TABLE_1D; } - else if (input.equalsIgnoreCase("Y Axis") || input.equalsIgnoreCase("Static Y Axis") || input.equalsIgnoreCase(String.valueOf(Settings.TABLE_Y_AXIS))) { - return Settings.TABLE_Y_AXIS; + else if (input.equalsIgnoreCase("Y Axis") || input.equalsIgnoreCase("Static Y Axis") || input.equalsIgnoreCase("5")) { + return Table.TableType.TABLE_1D; } else { - return Settings.TABLE_1D; + return Table.TableType.TABLE_1D; } } - public static long parseByteValue(byte[] input, int endian, int address, int length, boolean signed) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { + //This assumes the bits inside the mask aren't spread. OK = 11110000, Not OK = 11001100 + public static long parseByteValueMasked(byte[] input, Settings.Endian endian, int address, int length, boolean signed, int mask) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { + long tempValue = parseByteValue(input,endian,address,length,signed) & mask; + + byte index = ByteUtil.firstOneOfMask(mask); + + return tempValue >> index; + } + + public static long parseByteValue(byte[] input, Settings.Endian endian, int address, int length, boolean signed) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { try { long output = 0L; - ByteBuffer bb = ByteBuffer.wrap(input, address, length); - if (endian == Settings.ENDIAN_LITTLE) { + int llength = length; + if (length == Settings.STORAGE_TYPE_MOVI20 || + length == Settings.STORAGE_TYPE_MOVI20S) { + llength = 3; + } + final ByteBuffer bb = ByteBuffer.wrap(input, address, llength); + if (endian == Settings.Endian.LITTLE) { bb.order(ByteOrder.LITTLE_ENDIAN); } switch (length) { @@ -124,6 +152,11 @@ public static long parseByteValue(byte[] input, int endian, int address, int len case 4: output = bb.getInt(); break; + case Settings.STORAGE_TYPE_MOVI20: + case Settings.STORAGE_TYPE_MOVI20S: + bb.position(bb.position()-1); + output = getMovi20(bb.getInt()); + break; } if (!signed) { switch (length) { @@ -144,10 +177,28 @@ public static long parseByteValue(byte[] input, int endian, int address, int len } } - public static byte[] parseIntegerValue(int input, int endian, int length) { + // when data is in MOVI20 instruction + private static int getMovi20(int value) { + final int shift = value & 0x00010000; + value = ((value & 0x00f00000) >>> 4) + (value & 0x0000FFFF); + if ((value & 0x00080000) > 0) { + value = (value | 0xfff00000); + } + if (shift > 0) { //MOVI20S + return (value << 8); + } + return value; + } + + public static byte[] parseIntegerValue(int input, Settings.Endian endian, int length) { try { - ByteBuffer bb = ByteBuffer.allocate(length); - if (endian == Settings.ENDIAN_LITTLE) { + int llength = length; + if (length == Settings.STORAGE_TYPE_MOVI20 || + length == Settings.STORAGE_TYPE_MOVI20S) { + llength = 4; + } + final ByteBuffer bb = ByteBuffer.allocate(llength); + if (endian == Settings.Endian.LITTLE) { bb.order(ByteOrder.LITTLE_ENDIAN); } switch (length) { @@ -160,6 +211,10 @@ public static byte[] parseIntegerValue(int input, int endian, int length) { case 4: bb.putInt(input); break; + case Settings.STORAGE_TYPE_MOVI20: + return parseMovi20(bb.putInt(input).array(), length); + case Settings.STORAGE_TYPE_MOVI20S: + return parseMovi20(bb.putInt(input>>8).array(), length); } return bb.array(); } @@ -168,35 +223,65 @@ public static byte[] parseIntegerValue(int input, int endian, int length) { } } + // when data is in MOVI20 instruction + private static byte[] parseMovi20(byte[] bytes, int length) { + final byte[] output = {0,0,0}; + output[0] = (byte) (bytes[1] << 4); + if (length == Settings.STORAGE_TYPE_MOVI20S) { //MOVI20S + output[0] = (byte) ((bytes[1] << 4) | 0x01); + } + output[1] = bytes[2]; + output[2] = bytes[3]; + return output; + } + public static int parseFileSize(String input) throws NumberFormatException { - try { - return Integer.parseInt(input); - } catch (NumberFormatException ex) { - if (input.substring(input.length() - 2).equalsIgnoreCase("kb")) { - return Integer.parseInt(input.substring(0, input.length() - 2)) * 1024; - } - else if (input.substring(input.length() - 2).equalsIgnoreCase("mb")) { - return Integer.parseInt(input.substring(0, input.length() - 2)) * 1024 * 1024; - } - throw new NumberFormatException(); + if (input.substring(input.length() - 2).equalsIgnoreCase("kb")) { + return Integer.parseInt(input.substring(0, input.length() - 2)) * 1024; + } + else if (input.substring(input.length() - 2).equalsIgnoreCase("mb")) { + return Integer.parseInt(input.substring(0, input.length() - 2)) * 1024 * 1024; } + else if (input.substring(input.length() - 1).equalsIgnoreCase("b")) { + return Integer.parseInt(input.substring(0, input.length() - 1)); + } + + return Integer.parseInt(input); } - public static byte[] floatToByte(float input, int endian) { + public static byte[] floatToByte(float input, Settings.Endian endian, Settings.Endian memModelEndian) { byte[] output = new byte[4]; ByteBuffer bb = ByteBuffer.wrap(output, 0, 4); - if (endian == Settings.ENDIAN_LITTLE) { + if (memModelEndian == Settings.Endian.LITTLE) { + bb.order(ByteOrder.LITTLE_ENDIAN); + } + else if (memModelEndian == Settings.Endian.BIG) { bb.order(ByteOrder.BIG_ENDIAN); } + else { + // this case corrects improperly defined float table endian in legacy definition files + if (endian == Settings.Endian.LITTLE) { + bb.order(ByteOrder.BIG_ENDIAN); + } + } bb.putFloat(input); return bb.array(); } - public static float byteToFloat(byte[] input, int endian) { + public static float byteToFloat(byte[] input, Settings.Endian endian, Settings.Endian memModelEndian) { ByteBuffer bb = ByteBuffer.wrap(input, 0, 4); - if (endian == Settings.ENDIAN_LITTLE) { + if (memModelEndian == Settings.Endian.LITTLE) { + bb.order(ByteOrder.LITTLE_ENDIAN); + } + else if (memModelEndian == Settings.Endian.BIG) { bb.order(ByteOrder.BIG_ENDIAN); } + else { + // this case corrects improperly defined float table endian in legacy definition files + if (endian == Settings.Endian.LITTLE) { + bb.order(ByteOrder.BIG_ENDIAN); + } + } return bb.getFloat(); } } \ No newline at end of file diff --git a/src/main/java/com/romraider/xml/TableNotFoundException.java b/src/main/java/com/romraider/xml/TableNotFoundException.java deleted file mode 100644 index c1c6c32a2..000000000 --- a/src/main/java/com/romraider/xml/TableNotFoundException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package com.romraider.xml; - -public final class TableNotFoundException extends Exception { - - private static final long serialVersionUID = -7492075561444288417L; - - public String getMessage() { - return "Table not found."; - } -} \ No newline at end of file diff --git a/src/main/java/com/romraider/xml/TableScaleUnmarshaller.java b/src/main/java/com/romraider/xml/TableScaleUnmarshaller.java new file mode 100644 index 000000000..08138b657 --- /dev/null +++ b/src/main/java/com/romraider/xml/TableScaleUnmarshaller.java @@ -0,0 +1,469 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2022 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.xml; + +import static com.romraider.xml.DOMHelper.unmarshallAttribute; +import static com.romraider.xml.DOMHelper.unmarshallText; +import static org.w3c.dom.Node.ELEMENT_NODE; + +import java.util.HashMap; +import java.util.Map; + +import javax.management.modelmbean.XMLParseException; +import javax.swing.JOptionPane; + +import org.apache.log4j.Logger; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import com.romraider.Settings; +import com.romraider.editor.ecu.ECUEditorManager; +import com.romraider.logger.ecu.ui.handler.dataflow.DataflowSimulationHandler; +import com.romraider.dataflowSimulation.DataflowSimulation; +import com.romraider.dataflowSimulation.TableAction; +import com.romraider.dataflowSimulation.CalculationAction; +import com.romraider.maps.Rom; +import com.romraider.maps.Scale; +import com.romraider.maps.Table; +import com.romraider.maps.Table1D; +import com.romraider.maps.Table1DView.Table1DType; +import com.romraider.maps.Table2D; +import com.romraider.maps.Table3D; +import com.romraider.maps.TableBitwiseSwitch; +import com.romraider.maps.TableSwitch; +import com.romraider.swing.DebugPanel; +import com.romraider.util.ObjectCloner; +import com.romraider.util.SettingsManager; + +public class TableScaleUnmarshaller { + private static final Logger LOGGER = Logger.getLogger(TableScaleUnmarshaller.class); + private final Map tableNames = new HashMap(); + private final Map scales = new HashMap(); + private String memModelEndian = null; + + public void setMemModelEndian(String endian) { + memModelEndian = endian; + } + + public void unmarshallBaseScales(Node rootNode) { + NodeList nodes = rootNode.getChildNodes(); + Node n; + + for (int i = 0; i < nodes.getLength(); i++) { + n = nodes.item(i); + + if (n.getNodeType() == ELEMENT_NODE + && n.getNodeName().equalsIgnoreCase("scalingbase")) { + unmarshallScale(n, new Scale()); + } + } + } + + public Table unmarshallTable(Node tableNode, Table table, Rom rom) + throws XMLParseException, TableIsOmittedException, Exception { + + if (unmarshallAttribute(tableNode, "omit", "false").equalsIgnoreCase( + "true")) { // remove table if omitted + throw new TableIsOmittedException(); + } + + if (!unmarshallAttribute(tableNode, "base", "none").equalsIgnoreCase( + "none")) { // copy base table for inheritance + try { + table = (Table) ObjectCloner + .deepCopy(rom.getTableByName(unmarshallAttribute(tableNode, + "base", "none"))); + } catch (NullPointerException ex) { + JOptionPane.showMessageDialog(ECUEditorManager.getECUEditor(), + new DebugPanel(ex, SettingsManager.getSettings().getSupportURL()), "Exception", + JOptionPane.ERROR_MESSAGE); + } + } + + if (table == null) { + // create new instance (otherwise it is inherited) + final String tn = unmarshallAttribute(tableNode, "name", "unknown"); + final String type = unmarshallAttribute(tableNode, "type", "none"); + + if (tableNames.containsKey(tn) || type.contains("xis")) { + if (type.equalsIgnoreCase("3D")) { + table = new Table3D(); + + } else if (type.equalsIgnoreCase("2D")) { + table = new Table2D(); + + } else if (type.equalsIgnoreCase("1D")) { + table = new Table1D(); + + } else if (type.equalsIgnoreCase("X Axis") + || type.equalsIgnoreCase("Static X Axis")) { + table = new Table1D(); + + } else if (type.equalsIgnoreCase("Y Axis") + || type.equalsIgnoreCase("Static Y Axis")) { + table = new Table1D(); + } else if (type.equalsIgnoreCase("Switch")) { + table = new TableSwitch(); + + } else if (type.equalsIgnoreCase("BitwiseSwitch")) { + table = new TableBitwiseSwitch(); + } + else if (type.equalsIgnoreCase("none")){ + throw new XMLParseException("Table type unspecified for " + + tableNode.getAttributes().getNamedItem("name")); + } + else { + throw new XMLParseException("Table type " + type + " unknown for " + + tableNode.getAttributes().getNamedItem("name")); + } + } + else { + return table; + } + } + + // unmarshall table attributes + final String tn = unmarshallAttribute(tableNode, "name", table.getName()); + table.setName(tn); + if (unmarshallAttribute(tableNode, "beforeram", "false") + .equalsIgnoreCase("true")) { + table.setBeforeRam(true); + } + + table.setDataLayout(unmarshallAttribute(tableNode, "dataLayout", "")); + table.setCategory(unmarshallAttribute(tableNode, "category", + table.getCategory())); + if (table.getStorageType() < 1) { + table.setSignedData(RomAttributeParser + .parseStorageDataSign(unmarshallAttribute(tableNode, + "storagetype", + String.valueOf(table.getStorageType())))); + } + table.setStorageType(RomAttributeParser + .parseStorageType(unmarshallAttribute(tableNode, "storagetype", + String.valueOf(table.getStorageType())))); + if (memModelEndian == null) { + table.setEndian(RomAttributeParser.parseEndian(unmarshallAttribute( + tableNode, "endian", table.getEndian().getMarshallingString()))); + } + else { + final Settings.Endian endian = memModelEndian.equalsIgnoreCase("little") ? Settings.Endian.LITTLE : Settings.Endian.BIG; + table.setMemModelEndian(endian); + table.setEndian(endian); + } + if (tableNames.containsKey(tn)) { + table.setStorageAddress(tableNames.get(tn)); + } + else { + table.setStorageAddress(RomAttributeParser + .parseHexString(unmarshallAttribute(tableNode, + "storageaddress", + String.valueOf(table.getStorageAddress())))); + } + + table.setDescription(unmarshallAttribute(tableNode, "description", + table.getDescription())); + // Set axis size, if sizex is specified use it, if sizey is specified use it, + // if neither are specified use the base definition size + table.setDataSize(unmarshallAttribute(tableNode, "sizey", + unmarshallAttribute(tableNode, "sizex", table.getDataSize()))); + table.setFlip(unmarshallAttribute(tableNode, "flipy", + unmarshallAttribute(tableNode, "flipx", table.getFlip()))); + table.setUserLevel(unmarshallAttribute(tableNode, "userlevel", + table.getUserLevel())); + table.setLocked(unmarshallAttribute(tableNode, "locked", + table.isLocked())); + table.setLogParam(unmarshallAttribute(tableNode, "logparam", + table.getLogParam())); + table.setStringMask( + unmarshallAttribute(tableNode, "mask", "")); + + if (table.getType() == Table.TableType.TABLE_3D) { + ((Table3D) table).setSwapXY(unmarshallAttribute(tableNode, + "swapxy", ((Table3D) table).getSwapXY())); + ((Table3D) table).setFlipX(unmarshallAttribute(tableNode, "flipx", + ((Table3D) table).getFlipX())); + ((Table3D) table).setFlipY(unmarshallAttribute(tableNode, "flipy", + ((Table3D) table).getFlipY())); + ((Table3D) table).setSizeX(unmarshallAttribute(tableNode, "sizex", + ((Table3D) table).getSizeX())); + ((Table3D) table).setSizeY(unmarshallAttribute(tableNode, "sizey", + ((Table3D) table).getSizeY())); + ((Table3D) table).setSkipCells(unmarshallAttribute(tableNode, "skipCells", + ((Table3D) table).getSkipCells())); + } + + Node n; + NodeList nodes = tableNode.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + n = nodes.item(i); + + if (n.getNodeType() == ELEMENT_NODE) { + if (n.getNodeName().equalsIgnoreCase("table")) { + Table tempTable = null; + + if (table.getType() == Table.TableType.TABLE_2D) { // if table is 2D, + // parse axis + if (RomAttributeParser + .parseTableAxis(unmarshallAttribute(n, "type", + "unknown")) == Table1DType.Y_AXIS + || RomAttributeParser + .parseTableAxis(unmarshallAttribute(n, + "type", "unknown")) == Table1DType.X_AXIS) { + + + tempTable = unmarshallTable(n, ((Table2D) table).getAxis(), rom); + + if (tempTable.getDataSize() != table.getDataSize()) { + tempTable.setDataSize(table.getDataSize()); + } + + tempTable.setData(((Table2D) table).getAxis().getData()); + ((Table2D) table).setAxis((Table1D)tempTable); + } + } else if (table.getType() == Table.TableType.TABLE_3D) { // if table + // is 3D, populate xAxis + if (RomAttributeParser + .parseTableAxis(unmarshallAttribute(n, "type", + "unknown")) == Table1DType.X_AXIS) { + + tempTable = unmarshallTable(n, ((Table3D) table).getXAxis(), rom); + + if (tempTable.getDataSize() != ((Table3D) table).getSizeX()) { + tempTable.setDataSize(((Table3D) table).getSizeX()); + } + + tempTable.setData(((Table3D) table).getXAxis().getData()); + + ((Table3D) table).setXAxis((Table1D)tempTable); + } + else if (RomAttributeParser + .parseTableAxis(unmarshallAttribute(n, "type", + "unknown")) == Table1DType.Y_AXIS) { + + tempTable = unmarshallTable(n,((Table3D) table).getYAxis(), rom); + + if (tempTable.getDataSize() != ((Table3D) table).getSizeY()) { + tempTable.setDataSize(((Table3D) table).getSizeY()); + } + + tempTable.setData(((Table3D) table).getYAxis().getData()); + ((Table3D) table).setYAxis((Table1D)tempTable); + } + } + + } else if (n.getNodeName().equalsIgnoreCase("scaling")) { + // check whether scale already exists. if so, modify, else + // use new instance + Scale baseScale = table.getScale(unmarshallAttribute(n, "category", "Default")); + table.addScale(unmarshallScale(n, baseScale)); + + } else if (n.getNodeName().equalsIgnoreCase("data")) { + // parse and add data to table + if (table instanceof Table1D) { + ((Table1D)table).addStaticDataCell(unmarshallText(n)); + } else { + // Why would this happen. Static should only be for axis. + LOGGER.error("Error adding static data cell."); + } + + } else if (n.getNodeName().equalsIgnoreCase("description")) { + table.setDescription(unmarshallText(n)); + + } else if (n.getNodeName().equalsIgnoreCase("state")) { + //Check for duplicate names, then replace if exist or add otherwise + table.addPresetValue( + unmarshallAttribute(n, "name", ""), + unmarshallAttribute(n, "data", "0")); + } else if (n.getNodeName().equalsIgnoreCase("bit")) { + table.setPresetValues( + unmarshallAttribute(n, "name", ""), + unmarshallAttribute(n, "position", "")); + + } else { /* unexpected element in Table (skip) */ + } + } else { /* unexpected node-type in Table (skip) */ + } + } + return table; + } + + /** + * Create a list of table names to be used as a filter on the inherited + * tables to reduce unnecessary table object creation. + * @param nodes - the NodeList to filter + * @throws XMLParseException + * @throws TableIsOmittedException + * @throws Exception + */ + public void filterFoundRomTables (NodeList nodes) { + Node n; + + for (int i = 0; i < nodes.getLength(); i++) { + n = nodes.item(i); + if (n.getNodeType() == ELEMENT_NODE + && n.getNodeName().equalsIgnoreCase("table")) { + + final String name = unmarshallAttribute(n, "name", "unknown"); + final int address = RomAttributeParser + .parseHexString(unmarshallAttribute(n, + "storageaddress", "-1")); + + if (unmarshallAttribute(n, "omit", "false").equalsIgnoreCase( + "true")) { + return; + } + + if (!tableNames.containsKey(name) && address >= 0) { + tableNames.put(name, address); + } + else if (tableNames.containsKey(name)) { + if (tableNames.get(name) < 1 && address >= 0) { + tableNames.put(name, address); + } + } + } + } + } + + void unmarshallSimulation(Rom rom, Node simulationNode) { + + // look for base scaling attribute first + String name = unmarshallAttribute(simulationNode, "name", "Unnamed"); + DataflowSimulation sim = new DataflowSimulation(rom, name); + + Node n; + NodeList nodes = simulationNode.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + n = nodes.item(i); + + if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("inputs")) + { + Node nodeInput; + NodeList inputNodes = n.getChildNodes(); + + for (int j = 0; j < inputNodes.getLength(); j++) { + nodeInput = inputNodes.item(j); + + if (nodeInput.getNodeType() == ELEMENT_NODE && nodeInput.getNodeName().equalsIgnoreCase("input")) + { + String inputName = unmarshallAttribute(nodeInput, "name", ""); + String logParam = unmarshallAttribute(nodeInput, "logparam", ""); + sim.addInput(inputName, !logParam.isEmpty()); + + DataflowSimulationHandler.getInstance().registerInput(logParam, inputName, sim); + } + } + } + else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("dataflow")) + { + Node nodeAction; + NodeList dataflowNodes = n.getChildNodes(); + + for (int j = 0; j < dataflowNodes.getLength(); j++) { + nodeAction = dataflowNodes.item(j); + + if (nodeAction.getNodeType() == ELEMENT_NODE && nodeAction.getNodeName().equalsIgnoreCase("table")) + { + String referenceName = unmarshallAttribute(nodeAction, "reference", ""); + String input_x = unmarshallAttribute(nodeAction, "input_x", ""); + String input_y = unmarshallAttribute(nodeAction, "input_y", ""); + String output = unmarshallAttribute(nodeAction, "output", ""); + TableAction action = new TableAction(output, referenceName, input_x, input_y); + sim.addAction(action); + } + else if (nodeAction.getNodeType() == ELEMENT_NODE && nodeAction.getNodeName().equalsIgnoreCase("action")) + { + String expression = unmarshallAttribute(nodeAction, "expression", ""); + String output = unmarshallAttribute(nodeAction, "output", ""); + CalculationAction action = new CalculationAction(output, expression); + sim.addAction(action); + } + } + } + else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("description")) + { + sim.setDescription(n.getTextContent()); + } + } + + rom.addSimulation(sim); + } + + public Scale unmarshallScale(Node scaleNode, Scale scale) { + + // look for base scaling attribute first + String base = unmarshallAttribute(scaleNode, "base", "none"); + if (!base.equalsIgnoreCase("none")) { + // check whether base value matches the name of a an existing + // scalingbase, if so, inherit from scalingbase + if (scales.containsKey(base.toLowerCase())) { + try { + scale = (Scale) ObjectCloner.deepCopy(scales.get(base.toLowerCase())); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + // Set Category to Default if missing or not inherited from scalingbase + if (base.equalsIgnoreCase("none")) { + scale.setCategory(unmarshallAttribute(scaleNode, "category", "Default")); + } + + // Set scaling name, if a scaling has no name attribute (scaling is + // defined in a table element), try and use the units value as its + // name, otherwise use none + if (!scale.getCategory().equalsIgnoreCase("Raw Value") && + scale.getName().equalsIgnoreCase("Raw Value")) { + scale.setName(unmarshallAttribute(scaleNode, "name", + unmarshallAttribute(scaleNode, "units", "none"))); + } + + scale.setByteExpression(unmarshallAttribute(scaleNode, "to_byte", "")); + + // Iterate over other available attributes + for(int i=0; i < scaleNode.getAttributes().getLength(); i++) { + Node attr = scaleNode.getAttributes().item(i); + String name = attr.getNodeName(); + String value = attr.getNodeValue(); + + if (name.equalsIgnoreCase("units")) scale.setUnit(value); + else if (name.equalsIgnoreCase("expression")) scale.setExpression(value); + else if (name.equalsIgnoreCase("format")) scale.setFormat(value); + else if (name.equalsIgnoreCase("max")) scale.setMax(Double.parseDouble(value)); + else if (name.equalsIgnoreCase("min")) scale.setMin(Double.parseDouble(value)); + else if (name.equalsIgnoreCase("coarseincrement") || name.equalsIgnoreCase("increment")) + scale.setCoarseIncrement(Double.parseDouble(value)); + else if (name.equalsIgnoreCase("fineincrement")) scale.setFineIncrement(Double.parseDouble(value)); + } + + //Keep track of the scales if the base attribute is used later + scales.put(scale.getName().toLowerCase(), scale); + return scale; + } + + // for unit testing + public Map getScales() { + return scales; + } +} diff --git a/src/main/resources/graphics/1d.gif b/src/main/resources/graphics/1d.gif index 9b263a08c..fe1c14f90 100644 Binary files a/src/main/resources/graphics/1d.gif and b/src/main/resources/graphics/1d.gif differ diff --git a/src/main/resources/graphics/2d.gif b/src/main/resources/graphics/2d.gif index f925371da..2767aab55 100644 Binary files a/src/main/resources/graphics/2d.gif and b/src/main/resources/graphics/2d.gif differ diff --git a/src/main/resources/graphics/3d.gif b/src/main/resources/graphics/3d.gif index 11b2f1f96..5aac151ba 100644 Binary files a/src/main/resources/graphics/3d.gif and b/src/main/resources/graphics/3d.gif differ diff --git a/src/main/resources/graphics/switch.gif b/src/main/resources/graphics/switch.gif index 09f5a0966..3012444f4 100644 Binary files a/src/main/resources/graphics/switch.gif and b/src/main/resources/graphics/switch.gif differ diff --git a/src/test/definitions/LearningAirflowRanges.xml b/src/test/definitions/LearningAirflowRanges.xml new file mode 100644 index 000000000..b52b5b806 --- /dev/null +++ b/src/test/definitions/LearningAirflowRanges.xml @@ -0,0 +1,68 @@ + + + + 32BITBASE + USDM + Subaru + Impreza + STi + MT + 512kb + SH7055 + sti04 + +
+ +
+ Max Range A / Min Range B + Max Range B / Min Range C + Max Range C / Min Range D +
+ These are the airflow ranges in which the different long-term fuel trims are calculated in closed loop and applied to the same airflow ranges for both closed loop and open loop. + + + +
+ Max Range A / Min Range B + Max Range B / Min Range C + Max Range C / Min Range D +
+ These are the airflow ranges in which the different long-term fuel trims are calculated in closed loop and applied to the same airflow ranges for both closed loop and open loop. + + + + + A2WC510N + 2000 + A2WC510N + 2F12785206 + 05 + USDM + Subaru + Legacy + GT + MT + SH7058 + sti05 + 1024kb + + + + + + A2WC510S + 2000 + A2WC510S + 2F12795206 + 05 + USDM + Subaru + Outback + XT + MT + SH7058 + sti05 + 1024kb + + + \ No newline at end of file diff --git a/src/test/definitions/scalingbase_test.xml b/src/test/definitions/scalingbase_test.xml new file mode 100644 index 000000000..be1d72d5a --- /dev/null +++ b/src/test/definitions/scalingbase_test.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + 32BITBASE + USDM + Subaru + Impreza + STi + MT + 512kb + SH7055 + sti04 + +
+ + +
+ +
+ + +
+ This map contains the desired boost targets. Boost compensation tables can impact the final boost target. + + + Inherited Target Boost A +
+ + +
+ +
+ + +
+ These are the starting values for wastegate duty. Wastegate compensation tables are applied to initial and max wastegate duty values. + + + +
+ + +
+ + +
+ This is the compensation to the closed loop base fueling target based on coolant temp. Other compensations (some undefined), are also applied. + +
+ + + A2WC522S + 2000 + A2WC522S + 2F12795606 + 05 + USDM + Subaru + Outback + XT + MT + SH7058 + sti05 + 1024kb + + +
+
+
+ +
+
+
+ +
+
+
+
+ diff --git a/src/test/java/com/romraider/logger/ecu/comms/learning/EcuDefinitionInheritance/EcuDefinitionInheritanceTest.java b/src/test/java/com/romraider/logger/ecu/comms/learning/EcuDefinitionInheritance/EcuDefinitionInheritanceTest.java new file mode 100644 index 000000000..49bcadeee --- /dev/null +++ b/src/test/java/com/romraider/logger/ecu/comms/learning/EcuDefinitionInheritance/EcuDefinitionInheritanceTest.java @@ -0,0 +1,113 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.EcuDefinitionInheritance; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import com.romraider.logger.ecu.comms.learning.tableaxis.SSMTableAxisQueryParameterSet; +import com.romraider.logger.ecu.comms.query.EcuQuery; +import com.romraider.logger.ecu.definition.EcuDefinition; +import com.romraider.logger.ecu.definition.EcuDefinitionImpl; +import com.romraider.logger.ecu.definition.xml.EcuDefinitionDocumentLoader; +import com.romraider.logger.ecu.definition.xml.EcuDefinitionInheritanceList; +import com.romraider.logger.ecu.definition.xml.EcuTableDefinitionHandler; + + +public class EcuDefinitionInheritanceTest { + + /** Test the address manipulation needed to convert the def table + * address to the linear RAM read address. + */ + @Test + public void testAddress() { + List AF_TABLE_NAMES = Arrays.asList( + "A/F Learning #1 Airflow Ranges", + "A/F Learning #1 Airflow Ranges ", + "A/F Learning Airflow Ranges"); + Collection queries = new ArrayList(); + EcuDefinition ecuDef = new EcuDefinitionImpl("2F12795206", "A2WC510S", + "05 outback xt", "A2WC510N", new File("src/test/definitions/LearningAirflowRanges.xml")); + Document document = EcuDefinitionDocumentLoader.getDocument(ecuDef); + queries = getTableAxisRanges(document, ecuDef, AF_TABLE_NAMES); + assertEquals(3, queries.size()); + for (EcuQuery query : queries) { + System.out.println(query); + } + } + + /** + * Retrieve the table axis values from the ECU definition. First try the + * 4-cyl table names, if still empty try the 6-cyl table name. + */ + private final List getTableAxisRanges( + Document document, + EcuDefinition ecuDef, + List tableNames) { + + List tableAxis = new ArrayList(); + for (String tableName : tableNames) { + tableAxis = loadTable(document, ecuDef, tableName); + if (!tableAxis.isEmpty()) { + break; + } + } + return tableAxis; + } + + /** + * Build a List of EcuQueries to retrieve the axis and scaling of a table. + * A table is found when the storageaddress parameter has been identified. + */ + private final List loadTable( + Document document, + EcuDefinition ecuDef, + String tableName) { + + final List inheritanceList = + EcuDefinitionInheritanceList.getInheritanceList(document, ecuDef); + final Map tableMap = + EcuTableDefinitionHandler.getTableDefinition( + document, + inheritanceList, + tableName); + List tableAxisQuery = new ArrayList(); + if (tableMap.containsKey("storageaddress")) { + tableAxisQuery = SSMTableAxisQueryParameterSet.build( + tableMap.get("storageaddress"), + tableMap.get("storagetype"), + tableMap.get("expression"), + tableMap.get("units"), + tableMap.get("sizey") + ); + } + return tableAxisQuery; + } +} diff --git a/src/test/java/com/romraider/logger/ecu/comms/learning/tableaxis/DS2TableAxisQueryParameterSetTest.java b/src/test/java/com/romraider/logger/ecu/comms/learning/tableaxis/DS2TableAxisQueryParameterSetTest.java new file mode 100644 index 000000000..8a94a1c08 --- /dev/null +++ b/src/test/java/com/romraider/logger/ecu/comms/learning/tableaxis/DS2TableAxisQueryParameterSetTest.java @@ -0,0 +1,147 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2016 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.logger.ecu.comms.learning.tableaxis; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; + +import com.romraider.logger.ecu.comms.learning.tableaxis.DS2TableAxisQueryParameterSet; +import com.romraider.logger.ecu.comms.query.EcuQuery; + + +public class DS2TableAxisQueryParameterSetTest { + + /** Test the address manipulation needed to convert the def table + * address to the linear RAM read address. + */ + @Test + public void testAddress() { + //MS41 256kB - full + List tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x16001", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x12001", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x12002", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x12003", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x12004", tableAxisQuery.get(3).getAddresses()[0]); + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x16fff", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x12FFF", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x13000", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x13001", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x13002", tableAxisQuery.get(3).getAddresses()[0]); + + //MS41 24kB - partial + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x2001", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x12001", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x12002", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x12003", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x12004", tableAxisQuery.get(3).getAddresses()[0]); + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x2fff", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x12FFF", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x13000", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x13001", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x13002", tableAxisQuery.get(3).getAddresses()[0]); + + //MS42 512kB - full + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x48001", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x48001", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x48002", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x48003", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x48004", tableAxisQuery.get(3).getAddresses()[0]); + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x48fff", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x48FFF", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x49000", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x49001", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x49002", tableAxisQuery.get(3).getAddresses()[0]); + + //MS42 32kB - partial + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x801", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x48801", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x48802", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x48803", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x48804", tableAxisQuery.get(3).getAddresses()[0]); + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x8ff", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x488FF", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x48900", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x48901", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x48902", tableAxisQuery.get(3).getAddresses()[0]); + + //MS43 512kB - full + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x74001", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x74001", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x74002", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x74003", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x74004", tableAxisQuery.get(3).getAddresses()[0]); + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x740ff", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x740FF", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x74100", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x74101", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x74102", tableAxisQuery.get(3).getAddresses()[0]); + + //MS43 32kB - partial + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x4001", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x74001", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x74002", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x74003", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x74004", tableAxisQuery.get(3).getAddresses()[0]); + tableAxisQuery = DS2TableAxisQueryParameterSet.build( + "0x40ff", "uint8", "x*5.45", "mg/stroke", "4", + "0x06", "0x00", null, "little" + ); + assertEquals("0x740FF", tableAxisQuery.get(0).getAddresses()[0]); + assertEquals("0x74100", tableAxisQuery.get(1).getAddresses()[0]); + assertEquals("0x74101", tableAxisQuery.get(2).getAddresses()[0]); + assertEquals("0x74102", tableAxisQuery.get(3).getAddresses()[0]); + } +} diff --git a/src/test/java/com/romraider/maps/checksum/NcsCoDecTest.java b/src/test/java/com/romraider/maps/checksum/NcsCoDecTest.java new file mode 100644 index 000000000..4f715e41a --- /dev/null +++ b/src/test/java/com/romraider/maps/checksum/NcsCoDecTest.java @@ -0,0 +1,84 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.maps.checksum; + +import static org.junit.Assert.assertEquals; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; + +import org.junit.Test; + +import com.romraider.util.HexUtil; + +public class NcsCoDecTest { + final NcsCoDec codec = new NcsCoDec(); + final String text = "FFFF22E4000115F8000116A000011724000117C80002B9C4E00180F884F820088B1B62F0E7EC9625D91426209623656062637205645C60430274901D7501655C029C760560530624D20D420B75019013D60C029C9011A0040624E4AC644CB18BE5127F204F266EF66DF66CF66BF66AF6000B69F697B481050848035EFFFF22E4"; + final byte[] bin = HexUtil.asBytes(text); + final int scode = 0xC2C0823F; + final ByteBuffer data = ByteBuffer.allocate(bin.length).order(ByteOrder.BIG_ENDIAN).put(bin); + final String encoded = "118283C9B4953B9B63A23EE3EE224177089344AB4C466E96F606B2997EDEE9129E7B377498905B95D0C75576E88B5EBCBB0065BB03DFCB5279839C252FADBD8A8C1119449FBD8C25107BC5FB5961EB1E7FA50CC2A0BF7DC5B2414339FD0B213B321AAC721891B7AB6F0A837B0D088F7B185ADF86263BC56DBAB2D6D0118283C9"; + + @Test + public final void testEncodeData() { + final byte[] dataEncoded = codec.nisEncode(data, scode); + assertEquals(encoded, HexUtil.asHex(dataEncoded)); + } + + @Test + public final void testEncodedDataCrc() { + final byte[] dataEncoded = codec.nisEncode(data, scode); + assertEquals((short) 0xD10D, (short) codec.calcCrc(dataEncoded)); + } + + @Test + public final void testBitwiseComplementCrc() { + final byte[] dataEncoded = codec.nisEncode(data, scode); + assertEquals((short) 0x2EF2, (short) ~codec.calcCrc(dataEncoded)); + } + + @Test + public final void testBitwiseComplementCrcLitteEndian() { + final byte[] dataEncoded = codec.nisEncode(data, scode); + short bcCrc = (short) ~codec.calcCrc(dataEncoded); + short le = (short) (((bcCrc << 8) | ((bcCrc & 0xffff) >>> 8)) & 0xffff); + assertEquals((short) 0xF22E, le); + } + + @Test + public final void testResidue() { + final byte[] dataEncoded = codec.nisEncode(data, scode); + short bcCrc = (short) ~codec.calcCrc(dataEncoded); + final byte[] crcCheck = new byte[dataEncoded.length + 2]; + System.arraycopy(dataEncoded, 0, crcCheck, 0, dataEncoded.length); + crcCheck[crcCheck.length - 2] = (byte) (bcCrc & 0xff); + crcCheck[crcCheck.length - 1] = (byte) ((bcCrc & 0xffff) >>> 8); + assertEquals((short) 0xF0B8, (short) codec.calcCrc(crcCheck)); + } + + @Test + public final void testDecodeData() { + final byte[] dataEncoded = codec.nisEncode(data, scode); + final ByteBuffer bb = ByteBuffer.allocate(dataEncoded.length) + .order(ByteOrder.BIG_ENDIAN).put(dataEncoded); + final byte[] data = codec.nisDecode(bb, scode); + assertEquals(text, HexUtil.asHex(data)); + } +} diff --git a/src/test/java/com/romraider/xml/TableScaleUnmarshallerTest.java b/src/test/java/com/romraider/xml/TableScaleUnmarshallerTest.java new file mode 100644 index 000000000..c7db65b94 --- /dev/null +++ b/src/test/java/com/romraider/xml/TableScaleUnmarshallerTest.java @@ -0,0 +1,126 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.xml; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.w3c.dom.Document; +import com.romraider.logger.ecu.definition.EcuDefinition; +import com.romraider.logger.ecu.definition.EcuDefinitionImpl; +import com.romraider.logger.ecu.definition.xml.EcuDefinitionDocumentLoader; +import com.romraider.maps.Scale; + + +public class TableScaleUnmarshallerTest { + private final Document document = getDocument(); + private final TableScaleUnmarshaller tableScaleHandler = new TableScaleUnmarshaller(); + + /** Test creation of scales from XML definition file scalingbase. + */ + @Test + public void testScalingBase() { + final List expectedScales = buildExpectedScales(); + tableScaleHandler.unmarshallBaseScales(document.getDocumentElement()); + final Map scales = tableScaleHandler.getScales(); + for (final Scale scale : scales.values()) { + System.out.println(scale); + } + assertEquals(expectedScales.size(), scales.size()); + for (Scale expectedScale : expectedScales) { + assertEquals(true, scales.values().contains(expectedScale)); + } + } + + private Document getDocument() { + final EcuDefinition ecuDef = new EcuDefinitionImpl("2F12795606", "A2WC522S", + "05 Outback XT", "32BITBASE", new File("src/test/definitions/scalingbase_test.xml")); + final Document document = EcuDefinitionDocumentLoader.getDocument(ecuDef); + return document; + } + + private List buildExpectedScales() { + final List expectedScales = new ArrayList(); + + final Scale BoostTarget_barabsolute = new Scale(); + BoostTarget_barabsolute.setCategory("Metric"); + BoostTarget_barabsolute.setName("BoostTarget_barabsolute"); + BoostTarget_barabsolute.setExpression("x*.001333224"); + BoostTarget_barabsolute.setByteExpression("x/.001333224"); + BoostTarget_barabsolute.setUnit("Boost Target (bar absolute)"); + BoostTarget_barabsolute.setFormat("#0.000"); + BoostTarget_barabsolute.setCoarseIncrement(0.1); + BoostTarget_barabsolute.setFineIncrement(0.01); + expectedScales.add(BoostTarget_barabsolute); + + final Scale BoostTarget_psirelativesealevel = new Scale(); + BoostTarget_psirelativesealevel.setCategory("Standard"); + BoostTarget_psirelativesealevel.setName("BoostTarget_psirelativesealevel"); + BoostTarget_psirelativesealevel.setExpression("(x-760)*.01933677"); + BoostTarget_psirelativesealevel.setByteExpression("(x/.01933677)+760"); + BoostTarget_psirelativesealevel.setUnit("Boost Target (psi relative sea level)"); + BoostTarget_psirelativesealevel.setFormat("0.00"); + BoostTarget_psirelativesealevel.setCoarseIncrement(0.5); + BoostTarget_psirelativesealevel.setFineIncrement(0.01); + expectedScales.add(BoostTarget_psirelativesealevel); + + final Scale rpm = new Scale(); + rpm.setCategory("Default"); + rpm.setName("rpm"); + rpm.setExpression("x"); + rpm.setByteExpression("x"); + rpm.setUnit("RPM"); + rpm.setFormat("#"); + rpm.setCoarseIncrement(100.0); + rpm.setFineIncrement(50.0); + expectedScales.add(rpm); + + final Scale targetboostcomppercent = new Scale(); + targetboostcomppercent.setCategory("Default"); + targetboostcomppercent.setName("targetboostcomppercent"); + targetboostcomppercent.setExpression("(x*.78125)-100"); + targetboostcomppercent.setByteExpression("(x+100)/.78125"); + targetboostcomppercent.setUnit("raw value"); + targetboostcomppercent.setFormat("0.0"); + targetboostcomppercent.setCoarseIncrement(1.0); + targetboostcomppercent.setFineIncrement(0.4); + expectedScales.add(targetboostcomppercent); + + final Scale WastegateDutyCycle_ = new Scale(); + WastegateDutyCycle_.setCategory("Default"); + WastegateDutyCycle_.setName("WastegateDutyCycle_%"); + WastegateDutyCycle_.setExpression("x*.00390625"); + WastegateDutyCycle_.setByteExpression("x/.00390625"); + WastegateDutyCycle_.setUnit("Wastegate Duty Cycle (%)"); + WastegateDutyCycle_.setFormat("0.0"); + WastegateDutyCycle_.setCoarseIncrement(1.0); + WastegateDutyCycle_.setFineIncrement(0.2); + WastegateDutyCycle_.setMin(0.1); + WastegateDutyCycle_.setMax(99.9); + expectedScales.add(WastegateDutyCycle_); + + return expectedScales; + } +} diff --git a/src/test/java/com/romraider/xml/XDFConversionLayerTest.java b/src/test/java/com/romraider/xml/XDFConversionLayerTest.java new file mode 100644 index 000000000..82b993dab --- /dev/null +++ b/src/test/java/com/romraider/xml/XDFConversionLayerTest.java @@ -0,0 +1,127 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2021 RomRaider.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package com.romraider.xml; + +import static com.romraider.editor.ecu.ECUEditorManager.getECUEditor; +import static com.romraider.swing.LookAndFeelManager.initLookAndFeel; +import static com.romraider.util.LogManager.initDebugLogging; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +import java.io.File; +import java.util.Collection; +import java.util.LinkedList; +import java.util.Vector; + +import org.junit.Test; + +import com.romraider.Settings; +import com.romraider.editor.ecu.ECUEditor; +import com.romraider.editor.ecu.OpenImageWorker; +import com.romraider.maps.Rom; +import com.romraider.maps.Table; +import com.romraider.util.SettingsManager; +import com.romraider.xml.ConversionLayer.ConversionLayer; +import com.romraider.xml.ConversionLayer.XDFConversionLayer; + + +public class XDFConversionLayerTest{ + + private static LinkedList listFileTree(File dir) { + LinkedList fileTree = new LinkedList(); + if (dir == null || dir.listFiles() == null) { + return fileTree; + } + for (File entry : dir.listFiles()) { + if (entry.isFile()) + fileTree.add(entry); + else if (entry.isDirectory()) + fileTree.addAll(listFileTree(entry)); + } + return fileTree; + } + + @Test + public void loadXDFs() { + initDebugLogging(); + initLookAndFeel(); + ECUEditor editor = getECUEditor(); + editor.initializeEditorUI(); + editor.checkDefinitions(); + + // Make sure we dont override any settings + SettingsManager.setTesting(true); + Settings settings = SettingsManager.getSettings(); + + // https://github.com/dmacpro91/BMW-XDFs + // Download locally and unzip + File folder = new File("C:\\Users\\User\\Downloads\\BMW-XDFs-master\\"); + Collection listOfFiles = listFileTree(folder); + for (File f: listOfFiles) { + ConversionLayer l = new XDFConversionLayer(); + if (l.isFileSupported(f)) { + editor.closeAllImages(); + settings.getEcuDefinitionFiles().clear(); + settings.getEcuDefinitionFiles().add(f); + File bin = new File(f.getAbsolutePath().replace(".xdf", "_original.bin")); + + if (bin.exists()) { + OpenImageWorker w = new OpenImageWorker(bin); + w.execute(); + + //Wait until rom its loaded + while(!w.isDone()) + { + try { + Thread.sleep(10); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + Rom r = w.getRom(); + try + { + assertNotEquals(r, null); + assertEquals(r.getFaultyTables().size(), 0); + } + catch(AssertionError e) + { + if(r == null) + { + System.out.println(f + " failed to load completely"); + } + else + { + System.out.println(f + ": Faulty Tables " + r.getFaultyTables().size()); + } + continue; + } + // Populate tables visually + Vector tables = r.getTables(); + for (Table table:tables) + { + // editor.createTableView(table); + } + } + } + } + } +} diff --git a/templates/install-linux.xml.template b/templates/install-linux.xml.template index 5e35221f8..c175dc045 100644 --- a/templates/install-linux.xml.template +++ b/templates/install-linux.xml.template @@ -12,7 +12,6 @@ @supporturl@ - @@ -44,20 +43,17 @@ - - - - - - + - + + + @@ -67,15 +63,19 @@ + + - + + + @@ -85,6 +85,7 @@ + - + @name.package@ Source Files diff --git a/templates/install-windows.xml.template b/templates/install-windows.xml.template index fdfc23a93..bd9f2649a 100644 --- a/templates/install-windows.xml.template +++ b/templates/install-windows.xml.template @@ -8,33 +8,37 @@ @name.package@ @version.major@.@version.minor@.@version.patch@ @version.extra@ @version.extra1@ - + @supporturl@ - - + + + + + - + + - - - - + + + + - - - - - - - + + + + + + + @@ -45,37 +49,23 @@ - - - - - - - - + + - - - - - - - - - - - - - + + + - + + + @@ -86,6 +76,7 @@ + - + @name.package@ Source Files diff --git a/templates/shortcutSpec-linux.xml.template b/templates/shortcutSpec-linux.xml.template index 2970d7802..698602969 100644 --- a/templates/shortcutSpec-linux.xml.template +++ b/templates/shortcutSpec-linux.xml.template @@ -40,6 +40,42 @@ + + + + + + + + + + + + + + + + ${name.organization}
${name.package} -javadoc.footer=For support, go to ${supporturl}
${copyright-html}
+javadoc.footer=For support, visit ${supporturl}
${copyright-html}