Merge pull request #1321 from FunkinCrew/moon/hacky-gc-calls
This commit is contained in:
@@ -48,6 +48,7 @@ import funkin.mobile.util.AdMobUtil;
|
||||
import funkin.mobile.util.InAppReviewUtil;
|
||||
#end
|
||||
#end
|
||||
import funkin.util.DeviceUtil;
|
||||
|
||||
/**
|
||||
* The state for the results screen after a song or week is finished.
|
||||
@@ -594,11 +595,12 @@ class ResultState extends MusicBeatSubState
|
||||
// ratingsPopin.animation.play("idle");
|
||||
// ratingsPopin.visible = true;
|
||||
|
||||
ratingsPopin.animation.onFinish.add(anim -> {
|
||||
// scorePopin.animation.play("score");
|
||||
ratingsPopin.animation.onFinish.add(anim ->
|
||||
{
|
||||
// scorePopin.animation.play("score");
|
||||
|
||||
// scorePopin.visible = true;
|
||||
});
|
||||
// scorePopin.visible = true;
|
||||
});
|
||||
}
|
||||
|
||||
refresh();
|
||||
@@ -1049,6 +1051,16 @@ class ResultState extends MusicBeatSubState
|
||||
}
|
||||
else
|
||||
{
|
||||
FlxG.signals.preStateSwitch.addOnce(function() {
|
||||
#if ios
|
||||
trace(DeviceUtil.iPhoneNumber);
|
||||
if (DeviceUtil.iPhoneNumber > 12) funkin.FunkinMemory.purgeCache(true);
|
||||
else
|
||||
funkin.FunkinMemory.purgeCache();
|
||||
#else
|
||||
funkin.FunkinMemory.purgeCache(true);
|
||||
#end
|
||||
});
|
||||
FlxG.switchState(() -> targetState);
|
||||
}
|
||||
}
|
||||
@@ -1069,6 +1081,16 @@ class ResultState extends MusicBeatSubState
|
||||
}
|
||||
else
|
||||
{
|
||||
FlxG.signals.preStateSwitch.addOnce(function() {
|
||||
#if ios
|
||||
trace(DeviceUtil.iPhoneNumber);
|
||||
if (DeviceUtil.iPhoneNumber > 12) funkin.FunkinMemory.purgeCache(true);
|
||||
else
|
||||
funkin.FunkinMemory.purgeCache();
|
||||
#else
|
||||
funkin.FunkinMemory.purgeCache(true);
|
||||
#end
|
||||
});
|
||||
FlxG.switchState(() -> targetState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import funkin.data.freeplay.player.PlayerRegistry;
|
||||
import funkin.ui.mainmenu.MainMenuState;
|
||||
#if mobile
|
||||
import funkin.util.TouchUtil;
|
||||
import funkin.util.DeviceUtil;
|
||||
#end
|
||||
|
||||
using flixel.util.FlxSpriteUtil;
|
||||
@@ -125,7 +126,14 @@ class CharacterUnlockState extends MusicBeatState
|
||||
// Fade to black, then switch state.
|
||||
FlxG.camera.fade(FlxColor.BLACK, 0.75, false, () -> {
|
||||
funkin.FunkinMemory.clearFreeplay();
|
||||
#if ios
|
||||
trace(DeviceUtil.iPhoneNumber);
|
||||
if (DeviceUtil.iPhoneNumber > 12) funkin.FunkinMemory.purgeCache(true);
|
||||
else
|
||||
funkin.FunkinMemory.purgeCache();
|
||||
#else
|
||||
funkin.FunkinMemory.purgeCache(true);
|
||||
#end
|
||||
FlxG.switchState(() -> nextState);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import funkin.ui.freeplay.FreeplayState;
|
||||
import funkin.ui.MusicBeatSubState;
|
||||
import funkin.ui.transition.stickers.StickerPack;
|
||||
import funkin.FunkinMemory;
|
||||
import funkin.util.DeviceUtil;
|
||||
|
||||
using Lambda;
|
||||
using StringTools;
|
||||
@@ -257,7 +258,14 @@ class StickerSubState extends MusicBeatSubState
|
||||
// FlxG.addChildBelowMouse(dipshit);
|
||||
*/
|
||||
FlxG.signals.preStateSwitch.addOnce(function() {
|
||||
#if ios
|
||||
trace(DeviceUtil.iPhoneNumber);
|
||||
if (DeviceUtil.iPhoneNumber > 12) funkin.FunkinMemory.purgeCache(true);
|
||||
else
|
||||
funkin.FunkinMemory.purgeCache();
|
||||
#else
|
||||
funkin.FunkinMemory.purgeCache(true);
|
||||
#end
|
||||
});
|
||||
FlxG.switchState(() -> {
|
||||
// TODO: Rework this asset caching stuff
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package funkin.util;
|
||||
|
||||
import lime.system.System;
|
||||
|
||||
class DeviceUtil
|
||||
{
|
||||
// --- iPhone Number Detection ---
|
||||
#if ios
|
||||
public static var iPhoneNumber(get, never):Int;
|
||||
|
||||
private static function get_iPhoneNumber():Int
|
||||
{
|
||||
// TODO: Add ipad detection gah
|
||||
if (!model.startsWith("iPhone")) return 0; // Not an iPhone, must be an ipad!!
|
||||
|
||||
return switch (model)
|
||||
{
|
||||
// iPhone 12 Series
|
||||
case "iPhone13,1": 12;
|
||||
case "iPhone13,2": 12;
|
||||
case "iPhone13,3": 12;
|
||||
case "iPhone13,4": 12;
|
||||
|
||||
// iPhone 13 Series
|
||||
case "iPhone14,4": 13;
|
||||
case "iPhone14,5": 13;
|
||||
case "iPhone14,2": 13;
|
||||
case "iPhone14,3": 13;
|
||||
|
||||
// iPhone 14 Series
|
||||
case "iPhone14,7": 14;
|
||||
case "iPhone14,8": 14;
|
||||
case "iPhone15,2": 14;
|
||||
case "iPhone15,3": 14;
|
||||
|
||||
// iPhone 15 Series
|
||||
case "iPhone15,4": 15;
|
||||
case "iPhone15,5": 15;
|
||||
case "iPhone16,1": 15;
|
||||
case "iPhone16,2": 15;
|
||||
|
||||
// iPhone 16 Series
|
||||
case "iPhone17,1": 16;
|
||||
case "iPhone17,5": 16;
|
||||
case "iPhone17,4": 16;
|
||||
case "iPhone17,3": 16;
|
||||
case "iPhone17,2": 16;
|
||||
|
||||
// Unknown or newer model fallback
|
||||
default:
|
||||
final parts = model.substr(6).split(",");
|
||||
if (parts.length == 2)
|
||||
{
|
||||
final major = Std.parseInt(parts[0]);
|
||||
final minor = Std.parseInt(parts[1]);
|
||||
if (major != null && minor != null)
|
||||
{
|
||||
if (major > 17 || (major == 17 && minor > 5))
|
||||
{
|
||||
return 100; // future device
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0; // obsolete or unknown
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
// --- General Device Info ---
|
||||
public static var osVersion(get, null):String;
|
||||
|
||||
private static function get_osVersion():String
|
||||
{
|
||||
return System.platformVersion;
|
||||
}
|
||||
|
||||
public static var vendor(get, null):String;
|
||||
|
||||
private static function get_vendor():String
|
||||
{
|
||||
return System.deviceVendor;
|
||||
}
|
||||
|
||||
public static var model(get, null):String;
|
||||
|
||||
private static function get_model():String
|
||||
{
|
||||
return System.deviceModel;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user