From 93e4f799f4f0ea435b3d77ca8ef2ab6beeb0a955 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 30 May 2025 22:46:34 -0400 Subject: [PATCH] Remove JPEG (#1065) Co-authored-by: Lasercar <64717068+Lasercar@users.noreply.github.com> --- source/funkin/Preferences.hx | 38 ------------------- source/funkin/save/Save.hx | 6 --- source/funkin/ui/options/PreferencesMenu.hx | 21 ---------- .../funkin/util/plugins/ScreenshotPlugin.hx | 10 ++--- 4 files changed, 5 insertions(+), 70 deletions(-) diff --git a/source/funkin/Preferences.hx b/source/funkin/Preferences.hx index 39406507b..057429055 100644 --- a/source/funkin/Preferences.hx +++ b/source/funkin/Preferences.hx @@ -371,44 +371,6 @@ class Preferences return value; } - /** - * The game will save any screenshots taken to this format. - * @default `PNG` - */ - public static var saveFormat(get, set):Any; - - static function get_saveFormat():Any - { - return Save?.instance?.options?.screenshot?.saveFormat ?? 'PNG'; - } - - static function set_saveFormat(value):Any - { - var save:Save = Save.instance; - save.options.screenshot.saveFormat = value; - save.flush(); - return value; - } - - /** - * The game will save JPEG screenshots with this quality percentage. - * @default `80` - */ - public static var jpegQuality(get, set):Int; - - static function get_jpegQuality():Int - { - return Save?.instance?.options?.screenshot?.jpegQuality ?? 80; - } - - static function set_jpegQuality(value:Int):Int - { - var save:Save = Save.instance; - save.options.screenshot.jpegQuality = value; - save.flush(); - return value; - } - /** * Loads the user's preferences from the save data and apply them. */ diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index f5984f1ed..64b8935fa 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -135,8 +135,6 @@ class Save shouldHideMouse: true, fancyPreview: true, previewOnSave: true, - saveFormat: 'PNG', - jpegQuality: 80, }, controls: @@ -1490,16 +1488,12 @@ typedef SaveDataOptions = * @param shouldHideMouse Should the mouse be hidden when taking a screenshot? Default: `true` * @param fancyPreview Show a fancy preview? Default: `true` * @param previewOnSave Only show the fancy preview after a screenshot is saved? Default: `true` - * @param saveFormat The save format of the screenshot, PNG or JPEG. Default: `PNG` - * @param jpegQuality The JPEG Quality, if we're saving to the format. Default: `80` */ var screenshot: { var shouldHideMouse:Bool; var fancyPreview:Bool; var previewOnSave:Bool; - var saveFormat:String; - var jpegQuality:Int; }; var controls: diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index 4b36930c1..10f258228 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -173,27 +173,6 @@ class PreferencesMenu extends Page createPrefItemCheckbox('Preview on save', 'If enabled, the preview will be shown only after a screenshot is saved.', function(value:Bool):Void { Preferences.previewOnSave = value; }, Preferences.previewOnSave); - // TODO: having oValue is weird, probably change this later? was done to accomodate VSync changes. - createPrefItemEnum('Save Format', 'Save screenshots to this format.', ['PNG' => 'PNG', 'JPEG' => 'JPEG'], function(value:String, oValue:String):Void { - Preferences.saveFormat = value; - }, Preferences.saveFormat); - createPrefItemNumber('JPEG Quality', 'The quality of JPEG screenshots.', function(value:Float) { - Preferences.jpegQuality = Std.int(value); - }, null, Preferences.jpegQuality, 0, 100, 5, 0); - #end - - #if FEATURE_HAPTICS - createPrefItemCheckbox('Vibration', 'If enabled, Haptic Feedback vibration effects will be active.', function(value:Bool):Void { - Preferences.vibration = value; - }, Preferences.vibration); - #end - - #if mobile - createPrefItemCheckbox('Allow Screen Timeout', - 'If enabled, The phone screen will timeout (sleep) after few seconds of inactivity.\nDoesn\'t apply when playing a song.', function(value:Bool):Void { - Preferences.screenTimeout = value; - }, Preferences.screenTimeout); - #end } override function update(elapsed:Float):Void diff --git a/source/funkin/util/plugins/ScreenshotPlugin.hx b/source/funkin/util/plugins/ScreenshotPlugin.hx index dad604211..19f0d2d28 100644 --- a/source/funkin/util/plugins/ScreenshotPlugin.hx +++ b/source/funkin/util/plugins/ScreenshotPlugin.hx @@ -469,7 +469,7 @@ class ScreenshotPlugin extends FlxBasic } /** - * Convert a Bitmap to a PNG or JPEG ByteArray to save to a file. + * Convert a Bitmap to a PNG ByteArray to save to a file. */ function encode(bitmap:Bitmap):ByteArray { @@ -494,7 +494,7 @@ class ScreenshotPlugin extends FlxBasic if (previousScreenshotName != targetPath && previousScreenshotName != (targetPath + ' (${previousScreenshotCopyNum})')) { previousScreenshotName = targetPath; - targetPath = getScreenshotPath() + targetPath + '.' + Std.string(Preferences.saveFormat).toLowerCase(); + targetPath = getScreenshotPath() + targetPath + '.png'; previousScreenshotCopyNum = 2; } else @@ -506,7 +506,7 @@ class ScreenshotPlugin extends FlxBasic newTargetPath = targetPath + ' (${previousScreenshotCopyNum})'; } previousScreenshotName = newTargetPath; - targetPath = getScreenshotPath() + newTargetPath + '.' + Std.string(Preferences.saveFormat).toLowerCase(); + targetPath = getScreenshotPath() + newTargetPath + '.png'; } // TODO: Make screenshot saving work on browser. @@ -520,7 +520,7 @@ class ScreenshotPlugin extends FlxBasic if (pngData == null) { - trace('[WARN] Failed to encode ${Preferences.saveFormat} data'); + trace('[WARN] Failed to encode PNG data'); previousScreenshotName = null; // Just in case unsavedScreenshotBuffer.shift(); @@ -544,7 +544,7 @@ class ScreenshotPlugin extends FlxBasic if (pngData == null) { - trace('[WARN] Failed to encode ${Preferences.saveFormat} data'); + trace('[WARN] Failed to encode PNG data'); previousScreenshotName = null; return; }