[Firmware][MOD] Change timezone: correct time+EPG!
Posted: Thu May 05, 2011 4:20 pm
2All
Me, gao_atc and juuso have made a patch on the Time zone choice, for several models of TV if there is a desire of an insertion it is possible to take from juuso. Big thanx moras86 for great timezone images
Download!














The patch description:
After analyzing of T-CHL7DEUC 2004.1 firmware (exeDSP binary) the following has been found. The Time zones changing mechanism is already added to firmware initially, but it has been implemented for only two countries: Spain and Australia.
An operation principle is the following: Function TCCountrySpecBase is the designer of the country. Inside the structure is filled by default value, in this case we have interesting elements 0?40 and 0?48-0?64 . The initiating index, stored in menu TimeZone is in 0?40.
0?48-0?64 store values in minutes for each index of TimeZone.
But here is the problem: the maximum possible amount TimeZone is provided no more than 8. We cant`t use this way, because it is necessary to have 13 timezones (0-12 + auto)...
Then were functions of read and write TimeZone found:
CTvInfo:: GetTimeZone
CTvInfo:: SetTimeZone
Only edit of function CTvInfo:: GetTimeZone is needed to get working patch.
Function GetTimeZone reads from EEPROM current zone index and current time GMT, further these values are used in other functions for time calculation. For implementation of a patch it is enough to write down in the pointer the correct value for selected TimeZone, the decision idle time:
Since only 8 zones initially are putted to firmware, it was necessary to increase an amount of values in TimeZone menu with ability to write walues to EEPROM. The function for that is TCTimeZoneCheckerDVB:: t_Config (void)
Initially here is an check routine in firmware: if other country than Spain and Australia is selected, menu TimeZone is not shown. We needed to remove such checking and get this menu always shown for all countries.
Australia was chosen as a basis for displaying new time zones. To have menu on, following patching is needed:
Next is to increase an amount of lines in the menu:
and choose new names of timezones, correct patch to images. Images are stored on /mtd_appdata/Images_960x540/SingleMenuTimeZoneEA
Further ideas:
To have separate Content library game for GMT selection there are two variants:
1. Select a zone from the list just after start of game, save the selected zone to a file, change function GetTimeZoneto read values from file. But this way can be slow since function GetTimeZone is often used by other functions and reading from NAND is quite slow.
2. The same as previous but for saving selected zone use function SetTimeZone.
3. Loader who makes whole patching process like it was done to get permanent patch of GMT time zone.
Me, gao_atc and juuso have made a patch on the Time zone choice, for several models of TV if there is a desire of an insertion it is possible to take from juuso. Big thanx moras86 for great timezone images

Download!














The patch description:
After analyzing of T-CHL7DEUC 2004.1 firmware (exeDSP binary) the following has been found. The Time zones changing mechanism is already added to firmware initially, but it has been implemented for only two countries: Spain and Australia.
An operation principle is the following: Function TCCountrySpecBase is the designer of the country. Inside the structure is filled by default value, in this case we have interesting elements 0?40 and 0?48-0?64 . The initiating index, stored in menu TimeZone is in 0?40.
0?48-0?64 store values in minutes for each index of TimeZone.
SpoilerShow
Code: Select all
00000040 defaultTimeZoneRegion DCD ?
00000044 defaultTimezone DCD ? ; GMT value in minutes (60,120,180...)
00000048 field_48 DCD ?
0000004C field_4C DCD ?
00000050 field_50 DCD ?
00000054 field_54 DCD ?
00000058 field_58 DCD ?
0000005C field_5C DCD ?
00000060 field_60 DCD ?
00000064 field_64 DCD ?
Then were functions of read and write TimeZone found:
CTvInfo:: GetTimeZone
CTvInfo:: SetTimeZone
Only edit of function CTvInfo:: GetTimeZone is needed to get working patch.
SpoilerShow
Code: Select all
LDR R3, = _ZN8TCTvInfo10m_pManagerE; TCTvInfo:: m_pManager
MOV R1, R5; the pointer on an index
MOV R2, R6; the pointer for the period of GMT
LDR R4, [R3]
MOV R3, R7
MOV R0, R4
LDR R12, [R4]
MOV LR, PC
LDR PC, [R12, #0x94]; reading of values
B Patch_Time_zone
SpoilerShow
Code: Select all
GMT = zone number * 60min i.e.
GMT0 = 0 * 60 = 0
GMT1 = 1*60 = 60
GMT2 = 2*60 = 120 etc.
Patch_Time_zone
If (ItemZone <= 0x11) ItemZone = 0x11
else GMT = (ItemZone ? 0x12) *60
LDR R0, [R5]
CMP R0, #0x11
SUBHI R0, R0, #0x12
RSBHI R0, R0, R0, LSL#4
MOVHI R0, R0, LSL#2
STRHI R0, [R6]
MOVLS R0, #0x11
STRLS R0, [R5]
SpoilerShow
Code: Select all
STMFD SP!, {R4, R5, LR}
MOV R5, #0xF; 15th records
MOV R4, R0
STR R5, [R0, #0x1C]
SUB SP, SP, #4
MOV R0, #0x3C; 60 byte to select
BL _Znaj; operator new [] (uint)
MOV R3, #0x11; initiating value
STR R0, [R4, #0x20]
SpoilerShow
Code: Select all
CClockActionWindowTimeZoneItem::AddMenuItemFlag(void)const
BL _ZN4TCTv10GetCountryEPi ; TCTv::GetCountry(int *)
LDR R0, [SP,#0x10+var_C]
CMP R0, #0x21
CMPNE R0, #0
B loc_11849D0 ;patch
CClockActionWindowTimeZoneItem::EnableMenuItemFlag(void)const
BL _ZN4TCTv10GetCountryEPi ; TCTv::GetCountry(int *)
LDR R3, [SP,#0x10+var_C]
CMP R3, #0x21
CMPNE R3, #0
MOVNE R0, #0
MOVEQ R0, #1
B loc_1184A24 ;patch
SpoilerShow
Code: Select all
CClockActionWindowBase::t_CreateTimeZone(void)
BL _ZN4TCTv10GetCountryEPi ; TCTv::GetCountry(int *)
LDR R3, [SP,#0x18+var_14]
CMP R3, #0x16
B loc_1154054 ;patch
LDR R0, =0x3028 ; size
BL _Znwj ; operator new(uint)
MOV R4, R0
BL _ZN23CTimeZoneActionWindowSPC1Ev ; CTimeZoneActionWindowSP::CTimeZoneActionWindowSP(void)
loc_1154044 ; CODE XREF: CClockActionWindowBase::t_CreateTimeZone(void)+5Cj
MOV R3, #0x2800
STR R4, [R5,R3]
ADD SP, SP, #0xC
LDMFD SP!, {R4,R5,PC}
loc_1154054 ; CODE XREF: CClockActionWindowBase::t_CreateTimeZone(void)+28j
LDR R0, =0x3028 ; size
BL _Znwj ; operator new(uint)
MOV R4, R0
BL _ZN23CTimeZoneActionWindowAUC1Ev ; CTimeZoneActionWindowAU::CTimeZoneActionWindowAU(void)
B loc_1154044
SpoilerShow
Code: Select all
CTimeZoneActionWindowAU:: t_ChangeAppIndex (int)
CTimeZoneActionWindowAU:: t_SetTimeZoneValue (int)
CTimeZoneActionWindowAU:: t_ChangeMap (int)
Further ideas:
To have separate Content library game for GMT selection there are two variants:
1. Select a zone from the list just after start of game, save the selected zone to a file, change function GetTimeZoneto read values from file. But this way can be slow since function GetTimeZone is often used by other functions and reading from NAND is quite slow.
2. The same as previous but for saving selected zone use function SetTimeZone.
3. Loader who makes whole patching process like it was done to get permanent patch of GMT time zone.