diff --git a/forge-gui-android/libs/gdx-backend-android-sources.jar b/forge-gui-android/libs/gdx-backend-android-sources.jar index 414fa961cfd..d328206fb3a 100644 Binary files a/forge-gui-android/libs/gdx-backend-android-sources.jar and b/forge-gui-android/libs/gdx-backend-android-sources.jar differ diff --git a/forge-gui-android/libs/gdx-backend-android.jar b/forge-gui-android/libs/gdx-backend-android.jar index d780673aa6b..40af9131f01 100644 Binary files a/forge-gui-android/libs/gdx-backend-android.jar and b/forge-gui-android/libs/gdx-backend-android.jar differ diff --git a/forge-gui-android/libs/gdx-freetype.jar b/forge-gui-android/libs/gdx-freetype.jar index eda8b39b168..3181586a666 100644 Binary files a/forge-gui-android/libs/gdx-freetype.jar and b/forge-gui-android/libs/gdx-freetype.jar differ diff --git a/forge-gui-android/libs/gdx-sources.jar b/forge-gui-android/libs/gdx-sources.jar index 798fee80a7b..74b5aadb926 100644 Binary files a/forge-gui-android/libs/gdx-sources.jar and b/forge-gui-android/libs/gdx-sources.jar differ diff --git a/forge-gui-android/libs/gdx.jar b/forge-gui-android/libs/gdx.jar index 0ba4a3f2bb4..2c603b032c5 100644 Binary files a/forge-gui-android/libs/gdx.jar and b/forge-gui-android/libs/gdx.jar differ diff --git a/forge-gui-android/pom.xml b/forge-gui-android/pom.xml index 3067cde2874..a556f6c9698 100644 --- a/forge-gui-android/pom.xml +++ b/forge-gui-android/pom.xml @@ -104,24 +104,6 @@ gdx-backend-android 1.9.10 - - org.cache2k - cache2k-base-bom - 1.2.4.Final - pom - - - org.cache2k - cache2k-core - 1.2.4.Final - compile - - - org.cache2k - cache2k-api - 1.2.4.Final - compile - diff --git a/forge-gui-android/proguard.cfg b/forge-gui-android/proguard.cfg index 57fa2061f4d..563498b6aaa 100644 --- a/forge-gui-android/proguard.cfg +++ b/forge-gui-android/proguard.cfg @@ -30,20 +30,6 @@ -dontwarn org.apache.logging.log4j.** -dontwarn module-info -# mandatory proguard rules for cache2k to keep the core implementation --dontwarn org.cache2k.impl.xmlConfiguration.** --dontwarn org.cache2k.impl.serverSide.** --keep interface org.cache2k.spi.Cache2kCoreProvider --keep public class * extends org.cache2k.spi.Cache2kCoreProvider -# optional proguard rules for cache2k, to keep XML configuration code -# if only programmatic configuration is used, these rules may be ommitted --keep interface org.cache2k.core.spi.CacheConfigurationProvider --keep public class * extends org.cache2k.core.spi.CacheConfigurationProvider --keepclassmembers public class * extends org.cache2k.configuration.ConfigurationBean { - public void set*(...); - public ** get*(); -} - -keep class forge.** { *; } -keep class com.thoughtworks.xstream.** { *; } -keep class org.apache.commons.lang3.** { *; } diff --git a/forge-gui-ios/libs/gdx-backend-robovm-sources.jar b/forge-gui-ios/libs/gdx-backend-robovm-sources.jar index 1ed5c6f5486..7169ae4579b 100644 Binary files a/forge-gui-ios/libs/gdx-backend-robovm-sources.jar and b/forge-gui-ios/libs/gdx-backend-robovm-sources.jar differ diff --git a/forge-gui-ios/libs/gdx-backend-robovm.jar b/forge-gui-ios/libs/gdx-backend-robovm.jar index cbf789dd7b1..10cfefb0768 100644 Binary files a/forge-gui-ios/libs/gdx-backend-robovm.jar and b/forge-gui-ios/libs/gdx-backend-robovm.jar differ diff --git a/forge-gui-ios/libs/gdx-sources.jar b/forge-gui-ios/libs/gdx-sources.jar index 798fee80a7b..74b5aadb926 100644 Binary files a/forge-gui-ios/libs/gdx-sources.jar and b/forge-gui-ios/libs/gdx-sources.jar differ diff --git a/forge-gui-ios/libs/gdx.jar b/forge-gui-ios/libs/gdx.jar index 0ba4a3f2bb4..2c603b032c5 100644 Binary files a/forge-gui-ios/libs/gdx.jar and b/forge-gui-ios/libs/gdx.jar differ diff --git a/forge-gui-ios/libs/libObjectAL.a b/forge-gui-ios/libs/libObjectAL.a index 6113d44ffc9..289fd6ff6fb 100644 Binary files a/forge-gui-ios/libs/libObjectAL.a and b/forge-gui-ios/libs/libObjectAL.a differ diff --git a/forge-gui-ios/libs/libgdx-freetype.a b/forge-gui-ios/libs/libgdx-freetype.a index 67ed332cb29..371a1daee46 100644 Binary files a/forge-gui-ios/libs/libgdx-freetype.a and b/forge-gui-ios/libs/libgdx-freetype.a differ diff --git a/forge-gui-ios/libs/libgdx.a b/forge-gui-ios/libs/libgdx.a index 038693b6c84..82be25afbf9 100644 Binary files a/forge-gui-ios/libs/libgdx.a and b/forge-gui-ios/libs/libgdx.a differ diff --git a/forge-gui-ios/pom.xml b/forge-gui-ios/pom.xml index a36586a1536..a597b8484a0 100644 --- a/forge-gui-ios/pom.xml +++ b/forge-gui-ios/pom.xml @@ -75,23 +75,5 @@ gdx-backend-robovm 1.9.10 - - org.cache2k - cache2k-base-bom - 1.2.4.Final - pom - - - org.cache2k - cache2k-core - 1.2.4.Final - compile - - - org.cache2k - cache2k-api - 1.2.4.Final - compile - diff --git a/forge-gui-mobile-dev/libs/gdx-backend-lwjgl-sources.jar b/forge-gui-mobile-dev/libs/gdx-backend-lwjgl-sources.jar index f736a822dd8..45f4e0fdbd0 100644 Binary files a/forge-gui-mobile-dev/libs/gdx-backend-lwjgl-sources.jar and b/forge-gui-mobile-dev/libs/gdx-backend-lwjgl-sources.jar differ diff --git a/forge-gui-mobile-dev/libs/gdx-backend-lwjgl.jar b/forge-gui-mobile-dev/libs/gdx-backend-lwjgl.jar index d1699805b6d..96f39d65c17 100644 Binary files a/forge-gui-mobile-dev/libs/gdx-backend-lwjgl.jar and b/forge-gui-mobile-dev/libs/gdx-backend-lwjgl.jar differ diff --git a/forge-gui-mobile-dev/libs/gdx-freetype-natives.jar b/forge-gui-mobile-dev/libs/gdx-freetype-natives.jar index 025707e2973..74481284775 100644 Binary files a/forge-gui-mobile-dev/libs/gdx-freetype-natives.jar and b/forge-gui-mobile-dev/libs/gdx-freetype-natives.jar differ diff --git a/forge-gui-mobile-dev/libs/gdx-natives.jar b/forge-gui-mobile-dev/libs/gdx-natives.jar index 18f0fbc3dcf..cbd60119618 100644 Binary files a/forge-gui-mobile-dev/libs/gdx-natives.jar and b/forge-gui-mobile-dev/libs/gdx-natives.jar differ diff --git a/forge-gui-mobile-dev/pom.xml b/forge-gui-mobile-dev/pom.xml index 68270592ec9..0deaa787ba2 100644 --- a/forge-gui-mobile-dev/pom.xml +++ b/forge-gui-mobile-dev/pom.xml @@ -80,23 +80,5 @@ commons-cli 1.4 - - org.cache2k - cache2k-base-bom - 1.2.4.Final - pom - - - org.cache2k - cache2k-core - 1.2.4.Final - compile - - - org.cache2k - cache2k-api - 1.2.4.Final - compile - diff --git a/forge-gui-mobile/libs/gdx-freetype.jar b/forge-gui-mobile/libs/gdx-freetype.jar index eda8b39b168..3181586a666 100644 Binary files a/forge-gui-mobile/libs/gdx-freetype.jar and b/forge-gui-mobile/libs/gdx-freetype.jar differ diff --git a/forge-gui-mobile/libs/gdx-sources.jar b/forge-gui-mobile/libs/gdx-sources.jar index 798fee80a7b..74b5aadb926 100644 Binary files a/forge-gui-mobile/libs/gdx-sources.jar and b/forge-gui-mobile/libs/gdx-sources.jar differ diff --git a/forge-gui-mobile/libs/gdx.jar b/forge-gui-mobile/libs/gdx.jar index 0ba4a3f2bb4..2c603b032c5 100644 Binary files a/forge-gui-mobile/libs/gdx.jar and b/forge-gui-mobile/libs/gdx.jar differ diff --git a/forge-gui-mobile/pom.xml b/forge-gui-mobile/pom.xml index 9062150762e..60029bb033b 100644 --- a/forge-gui-mobile/pom.xml +++ b/forge-gui-mobile/pom.xml @@ -70,24 +70,6 @@ gdx-freetype 1.9.10 - - org.cache2k - cache2k-base-bom - 1.2.4.Final - pom - - - org.cache2k - cache2k-core - 1.2.4.Final - compile - - - org.cache2k - cache2k-api - 1.2.4.Final - compile - diff --git a/forge-gui-mobile/src/forge/assets/ImageCache.java b/forge-gui-mobile/src/forge/assets/ImageCache.java index 70919ec452b..5d472e6e1aa 100644 --- a/forge-gui-mobile/src/forge/assets/ImageCache.java +++ b/forge-gui-mobile/src/forge/assets/ImageCache.java @@ -22,6 +22,8 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Pixmap.Format; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.LoadingCache; import forge.ImageKeys; import forge.card.CardEdition; import forge.game.card.CardView; @@ -32,11 +34,11 @@ import forge.model.FModel; import forge.properties.ForgeConstants; import forge.util.ImageUtil; import org.apache.commons.lang3.StringUtils; -import org.cache2k.Cache; -import org.cache2k.Cache2kBuilder; import java.util.HashSet; import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; /** * This class stores ALL card images in a cache with soft values. this means @@ -56,13 +58,10 @@ public class ImageCache { // short prefixes to save memory private static final Set missingIconKeys = new HashSet<>(); - private static final Cache cache = new Cache2kBuilder() {} - .name("cache") - .eternal(true) - .permitNullValues(true) - .disableStatistics(true) - .loader(new ImageLoader()) - .build(); + private static final LoadingCache cache = CacheBuilder.newBuilder() + .maximumSize(400) + .expireAfterAccess(15, TimeUnit.MINUTES) + .build(new ImageLoader()); public static final Texture defaultImage; public static FImage BlackBorder = FSkinImage.IMG_BORDER_BLACK; public static FImage WhiteBorder = FSkinImage.IMG_BORDER_WHITE; @@ -85,7 +84,7 @@ public class ImageCache { } public static void clear() { - cache.clear(); + cache.invalidateAll(); missingIconKeys.clear(); } @@ -134,7 +133,7 @@ public class ImageCache { Texture image; if (useDefaultIfNotFound) { // Load from file and add to cache if not found in cache initially. - image = cache.get(imageKey); + image = cache.getIfPresent(imageKey); if (image != null) { return image; } @@ -165,7 +164,11 @@ public class ImageCache { return image; } public static void preloadCache(Iterable keys) { - cache.getAll(keys); + try { + cache.getAll(keys); + } catch (ExecutionException e) { + e.printStackTrace(); + } } public static TextureRegion croppedBorderImage(Texture image, boolean fullborder) { if (!fullborder) diff --git a/forge-gui-mobile/src/forge/assets/ImageLoader.java b/forge-gui-mobile/src/forge/assets/ImageLoader.java index 5f33d4c44c9..0137daa9f5e 100644 --- a/forge-gui-mobile/src/forge/assets/ImageLoader.java +++ b/forge-gui-mobile/src/forge/assets/ImageLoader.java @@ -8,8 +8,8 @@ import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.TextureData; import com.badlogic.gdx.graphics.glutils.PixmapTextureData; +import com.google.common.cache.CacheLoader; import forge.FThreads; -import org.cache2k.integration.CacheLoader; import forge.Forge; import forge.ImageKeys;