openlgtv / epk2extract

Extraction tool for LG, Hisense, Sharp, Philips/TPV, Thompson and similar TVs/Embedded Devices
GNU General Public License v2.0
304 stars 68 forks source link

Fix output directory names and version display for EPKv1 #66

Closed throwaway96 closed 1 year ago

throwaway96 commented 1 year ago

When I tried to extract 0.1.57.85_ota.epk (32LH2000), I was getting output directories like 03.75.00.f67130b0-<junk>. The problem was that the format string being used for the version (EPK_VERSION_FORMAT) requires four version number arguments, but only three were given. The last one was printing the address of a string, and the %s afterward was printing garbage (the beginning of the header, apparently). Now when I extract it, the directory is 03.75.00-HE_DTV_GP_M_AAAAABAA.

The incorrect version was also showing up in the header information:

Firmware type is EPK1...

Firmware otaID: HE_DTV_GP_M_AAAAABAA
Firmware version: 00.03.75.00
PAK count: 4
PAKs total size: 12362294

I don't have any other EPKv1 file of the other types (big endian and "new") to test this on. I also don't know if EPKv1 versions are supposed to only have three components.

I also added some error checking to give users an idea of what went wrong instead of just crashing.

throwaway96 commented 1 year ago

New changes:

I have tested this with two big endian EPKv1 files. One of them came from this LG support page (direct link), where the version given is 03.49.00. This EPK was previously treated as having a version of 00.03.49.00, but it now matches LG's with 03.49.00. My guess is that the first byte is just padding and always zero. I added a warning message to be displayed when a nonzero padding byte is encountered. If anyone comes across such an EPK, I'd like to hear about it.

smx-smx commented 1 year ago

Thanks for the effort, and the testing