Merge branch 'master' into ok_shortcut

This commit is contained in:
Chris H
2024-10-22 15:40:18 -04:00
committed by GitHub
230 changed files with 3068 additions and 1952 deletions

View File

@@ -9,17 +9,16 @@ java -version 1>nul 2>nul || (
)
for /f tokens^=2^ delims^=.-_^+^" %%j in ('java -fullversion 2^>^&1') do set "jver=%%j"
if %jver% LEQ 16 (
echo unsupported java
popd
exit /b 2
)
if %jver% GEQ 17 (
java --add-opens java.desktop/java.beans=ALL-UNNAMED --add-opens java.desktop/javax.swing.border=ALL-UNNAMED --add-opens java.desktop/javax.swing.event=ALL-UNNAMED --add-opens java.desktop/sun.swing=ALL-UNNAMED --add-opens java.desktop/java.awt.image=ALL-UNNAMED --add-opens java.desktop/java.awt.color=ALL-UNNAMED --add-opens java.desktop/sun.awt.image=ALL-UNNAMED --add-opens java.desktop/javax.swing=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true -Xmx4096m -Dfile.encoding=UTF-8 -jar $project.build.finalName$
java -Xmx4096m $mandatory.java.args$ -jar $project.build.finalName$
popd
exit /b 0
)
if %jver% GEQ 11 (
java --illegal-access=permit -Xmx4096m -Dfile.encoding=UTF-8 -jar $project.build.finalName$
popd
exit /b 0
)
java -Xmx4096m -Dfile.encoding=UTF-8 -jar $project.build.finalName$
popd

View File

@@ -1,3 +1,3 @@
#!/bin/sh
cd $(dirname "${0}")
java -Xmx4096m -Dfile.encoding=UTF-8 -jar $project.build.finalName$
java -Xmx4096m $mandatory.java.args$ -jar $project.build.finalName$

View File

@@ -1,52 +1,3 @@
#!/bin/bash
# returns the JDK version.
# 8 for 1.8.0_nn, 9 for 9-ea etc, and "no_java" for undetected
# Based on the code from this source: https://eed3si9n.com/detecting-java-version-bash
jdk_version() {
local result
local java_cmd
if [[ -n $(type -p java) ]]
then
java_cmd=java
elif [[ (-n "$JAVA_HOME") && (-x "$JAVA_HOME/bin/java") ]]
then
java_cmd="$JAVA_HOME/bin/java"
fi
local IFS=$'\n'
# remove \r for Cygwin
local lines=$("$java_cmd" -Xms32M -Xmx32M -version 2>&1 | tr '\r' '\n')
if [[ -z $java_cmd ]]
then
result=no_java
else
for line in $lines; do
if [[ (-z $result) && ($line = *"version \""*) ]]
then
local ver=$(echo $line | sed -e 's/.*version "\(.*\)"\(.*\)/\1/; 1q')
# on macOS, sed doesn't support '?'
if [[ $ver = "1."* ]]
then
result=$(echo $ver | sed -e 's/1\.\([0-9]*\)\(.*\)/\1/; 1q')
else
result=$(echo $ver | sed -e 's/\([0-9]*\)\(.*\)/\1/; 1q')
fi
fi
done
fi
echo "$result"
}
v="$(jdk_version)"
SHAREDPARAMS='-Xmx4096m -Dfile.encoding=UTF-8 -jar $project.build.finalName$ '"$@"
#!/bin/sh
cd $(dirname "${0}")
if [[ $v -ge 17 ]]
then
java --add-opens java.desktop/java.beans=ALL-UNNAMED --add-opens java.desktop/java.awt.color=ALL-UNNAMED --add-opens java.desktop/javax.swing.border=ALL-UNNAMED --add-opens java.desktop/javax.swing.event=ALL-UNNAMED --add-opens java.desktop/sun.awt.image=ALL-UNNAMED --add-opens java.desktop/sun.swing=ALL-UNNAMED --add-opens java.desktop/javax.swing=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens java.desktop/java.awt.image=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true $SHAREDPARAMS
elif [[ $v -ge 11 ]]
then
java --illegal-access=permit $SHAREDPARAMS
else
java $SHAREDPARAMS
fi
java -Xmx4096m $mandatory.java.args$ -jar $project.build.finalName$

View File

@@ -699,7 +699,8 @@ public class FCardImageRenderer {
}
} else {
fillColorBackground(g, colors, x, y, w, h);
SkinIcon icon = FSkin.getIcon(FSkinProp.ICO_LOGO);
//Card Art Logo
SkinIcon icon = FSkin.getIcon(FSkinProp.ICO_CARDART);
float artWidth = (float)icon.getSizeForPaint(g).getWidth();
float artHeight = (float)icon.getSizeForPaint(g).getHeight();
if (artWidth / artHeight >= (float)w / (float)h) {

View File

@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
*/
@@ -33,12 +33,14 @@ public final class Main {
* Main entry point for Forge
*/
public static void main(final String[] args) {
Sentry.init(options -> {
options.setEnableExternalConfiguration(true);
options.setRelease(BuildInfo.getVersionString());
options.setEnvironment(System.getProperty("os.name"));
options.setTag("Java Version", System.getProperty("java.version"));
options.setShutdownTimeoutMillis(5000);
if (options.getDsn() == null)
options.setDsn("https://87bc8d329e49441895502737c069067b@sentry.cardforge.org//3");
}, true);
// HACK - temporary solution to "Comparison method violates it's general contract!" crash
@@ -46,7 +48,7 @@ public final class Main {
//Turn off the Java 2D system's use of Direct3D to improve rendering speed (particularly when Full Screen)
System.setProperty("sun.java2d.d3d", "false");
//Turn on OpenGl acceleration to improve performance
//System.setProperty("sun.java2d.opengl", "True");
@@ -67,30 +69,30 @@ public final class Main {
// command line startup here
String mode = args[0].toLowerCase();
switch(mode) {
switch (mode) {
case "sim":
SimulateMatch.simulate(args);
break;
case "parse":
CardReaderExperiments.parseAllCards(args);
CardReaderExperiments.parseAllCards(args);
break;
case "server":
System.out.println("Dedicated server mode.\nNot implemented.");
break;
default:
System.out.println("Unknown mode.\nKnown mode is 'sim', 'parse' ");
break;
}
System.exit(0);
}
@SuppressWarnings("deprecation")
@Override
@Override
protected void finalize() throws Throwable {
try {
ExceptionHandler.unregisterErrorHandling();
@@ -100,5 +102,6 @@ public final class Main {
}
// disallow instantiation
private Main() { }
private Main() {
}
}

View File

@@ -16,9 +16,9 @@ import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.testng.PowerMockTestCase;
import org.testng.IObjectFactory;
//import org.testng.IObjectFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.ObjectFactory;
//import org.testng.annotations.ObjectFactory;
import forge.ImageCache;
import forge.ImageKeys;
@@ -184,8 +184,8 @@ public class CardMockTestCase extends PowerMockTestCase {
PowerMockito.when(FModel.getMagicDb()).thenReturn(data);
}
@ObjectFactory
/*@ObjectFactory
public IObjectFactory getObjectFactory() {
return new org.powermock.modules.testng.PowerMockObjectFactory();
}
}*/
}