Created
November 18, 2023 05:41
-
-
Save North-West-Wind/78659c0935600d91942a8b377c52194e to your computer and use it in GitHub Desktop.
Extract splash screen from Atmosphere's package3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PIL import Image | |
| import sys, os | |
| from struct import pack as pk | |
| from math import floor | |
| SPLASH_SCREEN_WIDTH = 1280 | |
| SPLASH_SCREEN_HEIGHT = 720 | |
| SPLASH_SCREEN_STRIDE = 768 | |
| def convert_bytes(data): | |
| mutable = bytearray() | |
| pixel_length = 4 + ((SPLASH_SCREEN_STRIDE - SPLASH_SCREEN_HEIGHT) * 4) | |
| row_length = 4 * SPLASH_SCREEN_HEIGHT + ((SPLASH_SCREEN_STRIDE - SPLASH_SCREEN_HEIGHT) * 4) | |
| for ii in range(SPLASH_SCREEN_WIDTH): | |
| for jj in range(SPLASH_SCREEN_HEIGHT): | |
| mutable += pk('<BBBB', data[ii*row_length+jj*4+2], data[ii*row_length+jj*4+1], data[ii*row_length+jj*4], data[ii*row_length+jj*4+3]) | |
| splash = Image.frombytes('RGBA', (SPLASH_SCREEN_HEIGHT, SPLASH_SCREEN_WIDTH), mutable) | |
| # splash = splash.transpose(Image.ROTATE_270) | |
| splash.save('splash.bmp') | |
| def main(argc, argv): | |
| if argc != 2: | |
| print('Usage: %s package3' % argv[0]) | |
| return 1 | |
| with open(argv[1], 'rb') as f: | |
| package3 = f.read() | |
| assert package3[:4] == b'PK31' | |
| assert len(package3) == 0x800000 | |
| convert_bytes(package3[0x400000:0x7C0000]) | |
| return 0 | |
| if __name__ == '__main__': | |
| sys.exit(main(len(sys.argv), sys.argv)) |
Author
I have no idea. This script is just the reversed version of insert_splash_screen.py from Atmosphere
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can we convert our custom bmp logos into .bin file so that we can Include it in the source and build it inline?