From cbd1a610ce1241f4db6946c196b3224e901629ac Mon Sep 17 00:00:00 2001 From: Vhati Date: Mon, 18 Dec 2017 23:13:53 -0500 Subject: [PATCH] Added Validate warnings about FTL 1.6.1 for PNG, MP3, and TTF files --- skel_common/backup/auto_update.json | 9 +++++++ skel_common/readme_changelog.txt | 5 ++++ .../vhati/modmanager/core/ModUtilities.java | 25 ++++++++++++++++--- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/skel_common/backup/auto_update.json b/skel_common/backup/auto_update.json index 9b3c2ac..a150c94 100644 --- a/skel_common/backup/auto_update.json +++ b/skel_common/backup/auto_update.json @@ -11,6 +11,15 @@ "notice" : "Reminder: Return FTL to an unmodded state before upgrading SMM.\nAnd delete SMM's backups when upgrading FTL." }, "changelog" : [ + { + "version" : "1.9.1", + "hidden" : true, + "changes" : [ + "Edited a comment in boilerplate mod metadata to include AE ships", + "Fixed omitted Validate warnings for PNG files", + "Added Validate warnings about FTL 1.6.1+ for TTF, MP3, and PNG files" + ] + }, { "version" : "1.9", "hidden" : false, diff --git a/skel_common/readme_changelog.txt b/skel_common/readme_changelog.txt index 971acab..22ef5e5 100644 --- a/skel_common/readme_changelog.txt +++ b/skel_common/readme_changelog.txt @@ -1,5 +1,10 @@ Changelog +1.9.1: +- Edited a comment in boilerplate mod metadata to include AE ships +- Fixed omitted Validate warnings for PNG files +- Added Validate warnings about FTL 1.6.1+ for TTF, MP3, and PNG files + 1.9: - Fixed corrupted civilian sector music in FTL 1.6.1+ diff --git a/src/main/java/net/vhati/modmanager/core/ModUtilities.java b/src/main/java/net/vhati/modmanager/core/ModUtilities.java index 19dc652..51d6572 100644 --- a/src/main/java/net/vhati/modmanager/core/ModUtilities.java +++ b/src/main/java/net/vhati/modmanager/core/ModUtilities.java @@ -494,10 +494,23 @@ public class ModUtilities { ) ); modValid = false; } - else if ( innerPath.endsWith( "[.]png" ) ) { + else if ( innerPath.matches( "^.*[.]mp3$" ) ) { + pendingMsgs.add( new ReportMessage( + ReportMessage.WARNING, + String.format( "As of FTL 1.6.1, MP3 audio is not supported (Use OGG or WAV)" ) + ) ); + } + else if ( innerPath.matches( "^.*[.]png$" ) ) { try { PngReader pngr = new PngReader( zis ); + if ( pngr.interlaced ) { + pendingMsgs.add( new ReportMessage( + ReportMessage.WARNING, + String.format( "As of FTL 1.6.1, interlaced PNG images are not supported (Re-save it as non-interlaced)" ) + ) ); + } + // Check for Truecolor+Alpha (32bit RGBA). if ( pngr.imgInfo.channels != 4 || pngr.imgInfo.bitDepth != 8 ) { @@ -520,7 +533,7 @@ public class ModUtilities { } } catch ( Exception e ) { - log.error( String.format( "Error while validating \"%s:%s\".", modFile.getName(), innerPath ), e ); + log.error( String.format( "Error while validating \"%s:%s\"", modFile.getName(), innerPath ), e ); pendingMsgs.add( new ReportMessage( ReportMessage.ERROR, "An error occurred. See log for details." @@ -528,6 +541,12 @@ public class ModUtilities { modValid = false; } } + else if ( innerPath.matches( "^.*[.]ttf$" ) ) { + pendingMsgs.add( new ReportMessage( + ReportMessage.WARNING, + String.format( "FTL 1.01-1.5.13 had TTF fonts, but FTL 1.6.1 switched to *.font (A special bitmap format from the SIL library)" ) + ) ); + } else if ( innerPath.matches( "^.*(?:[.]xml[.]append|[.]append[.]xml)$" ) || innerPath.matches( "^.*(?:[.]xml[.]rawappend|[.]rawappend[.]xml)$" ) || innerPath.matches( "^.*(?:[.]xml[.]rawclobber|[.]rawclobber[.]xml)$" ) || @@ -560,7 +579,7 @@ public class ModUtilities { if ( decodeResult.encoding.equalsIgnoreCase( "windows-1252" ) ) { pendingMsgs.add( new ReportMessage( ReportMessage.WARNING, - String.format( "Fancy %s chars. (UTF-8 is recommended for that)", decodeResult.encoding ) + String.format( "Fancy %s chars (UTF-8 is recommended for that)", decodeResult.encoding ) ) ); modValid = false; }