Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI update file format #5

Open
DSchndr opened this issue Apr 30, 2021 · 4 comments
Open

UI update file format #5

DSchndr opened this issue Apr 30, 2021 · 4 comments

Comments

@DSchndr
Copy link

DSchndr commented Apr 30, 2021

I have looked at P_UI_2_6.bin, it contains all images for the ui and presumably gets loaded onto the spi flash near stm32

Img format: 320x240 | 16bpp (2bytes per pixel) 5:6:5 (r:g:b)

(#1 goes 0h-30000h) (196608 dec)

IMG #1 0h - 25800h (Chinese Mainmenu)
a800h x FF (Padding)

IMG #2 30000h - 55800h (Chinese Filemenu)
a800h x FF (Padding)

...

743824h (24x57): right arrow with x above it
@DSchndr
Copy link
Author

DSchndr commented Apr 30, 2021

29 Images can be extracted, some currnently unknown data is at the end of the file

using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;

namespace PhotonS_UIExtract
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("PhotonS-UIEXtract");
            Console.Write("File: ");
            string fp = Console.ReadLine();
       
            var fs = new FileStream(fp, FileMode.Open);
            var len = (int)fs.Length;
            var bits = new byte[len];
            fs.Read(bits, 0, len);


            int imagecount = 0;

            // Dump 25800h (one image) bytes per line, skip a800h padding
            for (int ix = 0; ix < len; ix += 0x25800)
            {
                var cnt = Math.Min(0x25800, len - ix);
                var line = new byte[cnt];
                Array.Copy(bits, ix, line, 0, cnt);

                ix += 0xa800;
                imagecount++;

                int stride = 4 * ((320 * 2 + 3) / 4);

                Bitmap im = new Bitmap(320, 240, stride, PixelFormat.Format16bppRgb565, Marshal.UnsafeAddrOfPinnedArrayElement(line, 0));

                im.Save($"ui_{imagecount}.bmp");             
            }
            Console.ReadLine();
        }
    }
}

@IdontKnowWhatToNameThisAccount

How did you manage to extract the UI File? I've tried with the Photonsters UIExtractor, but I only ever get the "Invalid UI file!" error. Extracting the Photonsters Firmware for the Non-S works fine but I havent had any luck extracting the Photon S firmware. Did you modify the tool somehow?

@DSchndr
Copy link
Author

DSchndr commented Jun 18, 2021

Photon S has a different mainboard with completely diffrerent software on it.
You cannot use Chitubox fw or ui on it

My vid should have a download link to the binary that can extract and pack Photon-S ui files
https://www.youtube.com/watch?v=ioST-wdf2YM

Btw, if you think about using the ethernet port: forget it, it has absolutely no reference in the firmware and would need firmware patching (you could ask AndyBig) as well as adding the ethernet mac and port to the mainboard

@IdontKnowWhatToNameThisAccount

Ok, thats a bummer. Just tried your tool, seems to work pretty well! I absolutely hate the stock firmware style so I might use this to make a dark mode firmware that looks like the photonsters firmware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants