Widget:FEHUpdateHelper

From Fire Emblem Heroes Wiki
Jump to: navigation, search

About

A utility to assist with FEH updates.

Zip file diffs

Generates a diff from two different zips and uploads to Project:Asset diffs. Zip files containing game assets can be created by running a shell script on an Android phone:

#!/bin/sh
# Adds every file from the apk and Common files from the app data directory into a zip file located at the root of Internal Storage.
set -e
CURRENT_DATE=$(date -u +%Y-%m-%d)
FEH_APK_PATH=$(su -c pm path com.nintendo.zaba | sed -e "s/^\s*package:\s*//")
su -c "zip -9 $FEH_APK_PATH -U --out /sdcard/FEH$CURRENT_DATE.zip && cd /data/data/com.nintendo.zaba/files && zip -g -r -9 /sdcard/FEH$CURRENT_DATE.zip ./assets/Common"

The diff tool is not optimized. It holds both zips in memory a lot of RAM is needed to run this and it will take a very long time to complete. Switching tabs will make it take longer. Native programs will do better than this, this is mostly for convenience since it is on the wiki with no download required and easily editable.

Features:

  • Can generate a new zip file containing only the media files that have differed. These files are all placed at the root of the new zip.
    • If a filename conflict occurs where multiple files share the same name, the parent directory is continuously appended to each filename until there are no conflicts.
    • Reads the content of files with the .png extension to see if they are actually a png file. If it turns out they are actually WebP, the file will be renamed with the WebP extension in the new zip file.
    • The new generated zip file has comments for each file:
      • WEBP_RENAMED: The file was read to see if it was actually a webp, and it was and has been renamed.
      • SMALLER: The file in the new version is smaller than the older version. Although a smaller file size is not indicative of lower quality, it is possible that this piece of media has been made lower quality to save space, as the developers have done before with combat backgrounds. Take caution when deciding to upload to the wiki.
      • CONFLICT_RENAMED: The file has been renamed due to a filename conflict.
  • Uploads the generated diff in a new section. You can edit the wikitext before uploading.
    • By default the section title is the date grabbed from the new zip filename in the format "YYYY-MM-DD". If the new zip filename does not contain this, it uses the current date in "YYYY-MM-DD" format instead.
  • Remembers the different lz files for use in Widget:FEHUpdateHelper/PagesFromLZList.

Possible future feature ideas:

  • Split image files with plist into individual images. Probably not possible in JavaScript. Can be done with the Canvas api (pixel perfect precision possible, but might not save color values from completely transparent pixels in some instances)