PDA

View Full Version : FunctionLibrary and Patterns


avkiev
11-07-2005, 15:15
Lets talk here about FunctionLibrary patch (http://avkiev.kiev.ua/Siemens/Patches/s65/library.vkp) and signatures for it.

> benj9: In Smelter 7.10 functions.ini some functions are prepared, but the search string is missing
Because I didn't find it's patterns. Lets fill file "functions.ini" for Smelter together

> benj9: When I replace the 3 lines with:
f66:IsScreenSaver = B50120????????80BD80B50028????0120????????80BD0120
it has no effect...
Smelter searchs functions for FunctionLibrary only via even addresses...
So, you have to write: f66:IsScreenSaver = ??B5...

Please, put your signatures for functions, variables, constants, patches here...

benj9
11-07-2005, 19:02
ok, it works nice. a common database is appreciated.

smelter does the job, but could you explain the rule, in which case to add +1 to a jump?

f66:IsScreenSaver = 80B50120????????80BD80B50028????0120????????80BD01 20
f67:IsUnlocked = ????80B5103880680028????????????002801D1012080BD
f68:TempLigntOn = B0B5????????163D29780022????????291C201C????????B0 BD10B5041C00220021

f75:StartMidlet = F04D2DE90040A0E10100D0E5

avkiev
11-08-2005, 07:10
could you explain the rule, in which case to add +1 to a jump?
If second byte is Bx (example - 80B5...).
In other cases you have to write it manually. Example:
MySuperFunction = 123456789A + 1

benj9
11-08-2005, 13:41
Thx.

I think that maximum limit of 100 functions in the library is maybe a little bit to close, and there is no reason to limit it. Please be more splendid NOW, before we code it in our patches.

BuG
11-08-2005, 14:21
Here are some more functions, maybe some of them are usefull: :)

CallScreening = 10B5041C??48??????????????????49031C1431201C??4A
CallWaiting = 80B58D208000??????????4909200870FF20A530????????00 28
CheckCarkitOrHeadsetStatus = BCB5041C68460D1C????????291C201C6A46????????0128?? D20120BCBD
CheckHomezoneStatus1 = B0B5??4C051C143CA0790028??D00020A071
CheckHomezoneStatus2 = 70B50025??????????4E0124201C????????0028??D0?????? ??A042
CheckHomezoneStatus3 = 10B50024??????????490120D4224243521892685207
CheckHomezoneStatus4 = B0B50025????????0124201C????????0528??D1D4206043
CheckIrDAStatus = F8B5061C0D1C0024??????????4FB842??D0311C????????B8 42
CheckKeypadLockStatus= ??4880B5103880680028??D0????????0028??D1012080BD
CheckMicMute = 04E02DE541DF4DE204008DE2??????E???????FA741FA0E3?? ????E5??????FA04308DE2??????E?0110A0E33400A0E3
CheckRingtoneStatusBeepOrOff = 10402DE9??????E???????E?004090E5??????E?0400A0E110 80BDE8
CheckVibraStatus = ??4880B501780129??D140680128??D1????????0028??D001 2080BD
CheckVibraStatusForVibraLogo = 80B5??F???F???F???F?FF28??D0012080BD002080BD
Divert = B0B5051C??488EB0????????00240120????????0028??D105 200590062006900224
DrawFrameInNativeMenu= FFB59FB01F1C0123289C0020161C002C04900593299D
DrawIconToIconbar = F8B510880F1C141C8507AD0F86081328??D902DF
DrawMainScreen = 70B5??490131481E??????E???4D0120??600420
DrawMainScreenIcons = F0B5051C002087B000AB??4C1883261C002D
GenProviderString = B0B5051C0C1C??F???F?011C221C281C??F???F?B0BD
GenProviderStringMS = F0B5041C0E1CD7B03BA936A82422??F???E?051C
GetCallList = 80B5ACB00A9110A9087128A9002008800B9008220A72
GetMissedCallsCount = 10B5??F???E?AA484468??F???E?201C10BD10B5??F???E?16 48
HideID = ??4880B59038??????????490A200870??48??A1??A27030
IlluminationFadeOut = 10B5041C??????????4941436420????????021C0021201C?? ??????201C????????10BD
MainScreenInit = B0B500240D1CE443??????????30????????0028??D0?????? ????30
ProviderInMainScreen = 70B5051C0021????????0128??D1281C????????061C0124?? E0211C281C
ProviderInScreensaver= 70B5041C0E1C9AB007A902A82622
RemoveKeypadLockOnClosedSlider = 10B5??49??48??????????49041CA831??????????49201C?? ????????490120????????201C????????10BD
RunNativeMenu = 10B5??????F???????F?041C??????E?201C10BD0020704700 207047
ShowMsgInR1_1 = ??4AC307??D438320B1C0021??E7
ShowMsgInR1_2 = ??4AE032C307??D438320B1C0021??E7??4AE0
ShowMsgInR1_3 = ??4AE032C307??D438320B1C0021??E7??4AC3
ShowMsgInR1_4 = ??4AC307??D4383A0B1C0021??E7
ShowMsgInR1_5 = ??4A3832C307??D438320B1C0021??E7
ShowMsgInR1_6 = 0B1C111C??4A7032??E6
ShowMsgInR1_7 = 0B1C111C??4AA832??E6
ShowMsgInR1_8 = 8CB5C20702D5??F???F?8CBD
ShowMsgInR3_1 = FFB5FFB0E4B0171C0E1CFF221D1CBD3205A96846??F???E?04 1C0022011C281C??F???F?201C??F???E???F???E?051C211C ??F???E?3A1C311C2B1CE398??F???F?7FB068B0F0BD0000?? ????A0
ShowMsgInR3_2 = FFB5FFB0E4B0171C0E1CFF221D1CBD3205A96846??F???E?04 1C0022011C281C??F???F?201C??F???E???F???E?051C211C ??F???E?3A1C311C2B1CE398??F???F?7FB068B0F0BD??B5
ShowMainMenu = 80B5??F???F???F???E?80BD08B5??F???E?0028??D0
ShowNativeMenu = 80B5??F???F?80BD0000??????A0????0000??????A0?????? A0??????A0??????A1??????A070B5
SwitchGprsOnOff = 80B5??F???E?0028??D00020??F???E???490231??E00120?? F???E???4903310120??F???E?80BD
SwitchIrdaOnOff = 80B50120??F???F?01210120??F???F?0028??D0??49??E0
SwitchVibraOnOff = 80B5??F???F???490870??F???F???F???F?FF28??D1??F??? F?0021??F???F???49??E0
ToggleHandsfree = F0452DE941DF4DE20170A0E10060A0E104008DE2??????E202 A0A0E1??????FA??????E5??????E5??????FA04308DE2???? ??E20110A0E33400A0E3??????FA??????E5000098E5A00350 E30020A003??00000A????F?EB0050B0E1??00000A0500A0E1 ????F?EB0040B0E1??00000A????F?EBA003A0E3000088E5B6 70C8E1B460C8E1????F?EB1C
ToggleMicMute = F0452DE941DF4DE20170A0E10060A0E104008DE2??????E202 A0A0E1??????FA??????E5??????E5??????FA04308DE2???? ??E20110A0E33400A0E3??????FA??????E5000098E5A00350 E30020A003??00000A????F?EB0050B0E1??00000A0500A0E1 ????F?EB0040B0E1??00000A????F?EBA003A0E3000088E5B6 70C8E1B460C8E1????F?EB18


expanded searchstring:
DecToHex = F0B5061C0C1C151C85B068461122??49??????????E0207869 466A460009085C307021780134
GetAkku = 1C402DE9????9FE5002180E0822083E00120D2E7FF0052E374 039F050F00000A
SPrintF_1 = 0FB430B591B00F900C4816A90E91784408900B48784409900F AD281C01AB0EAA1599????????041C291C0020????????201C 11B030BC08BC04B01847????0000????0000??B50C1C
SPrintF_2 = 0FB430B591B00F900C4816A90E91784408900B48784409900F AD281C01AB0EAA1599????????041C291C0020????????201C 11B030BC08BC04B01847????0000????0000??B4??B5

same searchstring (what's wrong?):
MkDir = FF412DE90060A0E10800A0E30380A0E10170A0E10250A0E1?? ??????047080E5008080E50080A0E398779FE5
SetFileAttrib = FF412DE90060A0E10800A0E30380A0E10170A0E10250A0E1?? ??????047080E5008080E50080A0E398779FE5

avkiev
11-08-2005, 14:41
I think that maximum limit of 100 functions in the library is maybe a little bit to close, and there is no reason to limit it. Please be more splendid NOW, before we code it in our patches.
My first idea was just 32 functions :)))
Now we have 128 objects = 100 fun + 20 var + 8 const.
Ok, lets do 256 obj = 200 fun + 28 var + 28 const.
It'll be enough ?

PS. We don't need allocate ALL functions in library. Only patch-useable functions...
All another functions we can get by help unlimited "Standard functions"...

benj9
11-08-2005, 14:52
I guess that's enough, but if I see Bugs list ... 512 objects would only be 4k. And we have vast desert of space up to the next used block of almost 128k. what you think about A0FC0000-A0FC1000 as function library?

avkiev
11-08-2005, 15:07
I guess that's enough, but if I see Bugs list ... 512 objects would only be 4k. And we have vast desert of space up to the next used block of almost 128k. what you think about A0FC0000-A0FC1000 as function library?
We never will used _all_ this functions in patches.
We should allocate in library only useable functions.
We have not 128k, only 64K, because Extended PIT-table starts from 0FD0000.
So, I propose 256=200+28+28.

If 3 years later ( ;) ) we will need additional library - we can create patch "FunctionLibrary2" and allocate it at 0FCF000 (for example)

So, I propose:
A0FC0000: Library = 2K = 256 obj = 200+28+28
A0FC0800: Reserved for Library2 :)
A0FC0C00: MasterPatch
A0FC1000: patches...

avkiev
11-08-2005, 17:08
Smelter 7.15
- FunctionLibrary was extended to 256=200+28+28 objects

avkiev
11-08-2005, 18:53
Just try it:
S65v58 - FunctionLibrary (http://avkiev.kiev.ua/Siemens/Patches/s65/library.vkp)
x65 - MasterPatch (http://avkiev.kiev.ua/Siemens/Patches/s65/master.vkp)
x65 - Date at the bottom of maincsreen as "We, 11 May" v7 (http://avkiev.kiev.ua/Siemens/Patches/s65/bottom_date7.vkp)

BuG
11-09-2005, 10:09
Thanks for the new version. :)

Let me do a feature request for a new Smelter version, please. It's not urgent. :)
If you search for functions in a fullflash file, is it possible to search for those xrefs that call such "jump functions" to these functions automatically?
Something like that:
LDR PC, =dwMODdw
DCD dwMODdwor that:
LDR R12, =(GetProfile+1)
BX R12
DCD GetProfile+1
Would be great. :)

avkiev
11-09-2005, 10:32
If you search for functions in a fullflash file, is it possible to search for those xrefs that call such "jump functions" to these functions automatically?
You can do it manually.
Smelter - Ctrl-X

BuG
11-09-2005, 11:24
Sure, I know that and it's great. But it's annoying to do that for every single function. ;)

avkiev
11-09-2005, 11:28
Ok, may be later.......

benj9
11-10-2005, 19:50
I would like to ask you to include these 3 items in functions.ini, I use them in my coming patch, having these ones I am *free of porting* :D


--- function: ---------
Mainscreen_Get_ScreensaverAddressAndState = 80B50028????0120????????80BD0120????????80BD
returns address in of Screensaver-Byte R0 and its content in R1. You can read and set the byte.
Byte AND 0x19: = 0x19: Lock Device.
Byte AND 1: =1: screensaver active. =0: screensaver not active.

--- ram var: ---------
ram_gui_state = 00AB??8B??28????????CE43301C????????0028
add 0x20 to the found address. goto its content. add 2, there is the byte.
meaning: 0 while booting, FF not at mainscreen, something else at mainscreen
----
edit: one func removed temporariliy

-------------------------
By the way: smelter is a g-r-e-a-t tool!

avkiev
11-11-2005, 09:36
--- ram var: ---------
ram_gui_state = 00AB??8B??28????????CE43301C????????0028
add 0x20 to the found address. goto its content. add 2, there is the byte.
0000:A1698D80 00 AB ADD R3, SP, #0
0000:A1698D82 18 8B LDRH R0, [R3,#0x18]
0000:A1698D84 13 28 CMP R0, #0x13
0000:A1698D86 36 D2 BCS loc_A1698DF6
0000:A1698D88 00 21 MOV R1, #0
0000:A1698D8A CE 43 MVN R6, R1
0000:A1698D8C 30 1C ADD R0, R6, #0
0000:A1698D8E 1C F0 CC EA BLX sub_A16B5328
0000:A1698D92 00 28 CMP R0, #0
0000:A1698D94 03 D0 BEQ loc_A1698D9E
0000:A1698D96 CB 49 LDR R1, =unk_2AB
0000:A1698D98 06 AA ADD R2, SP, #0x18
0000:A1698D9A 10 31 ADD R1, #0x10
0000:A1698D9C 0A E0 B loc_A1698DB4
0000:A1698D9E ; ---------------------------------------------------------------------------
0000:A1698D9E
0000:A1698D9E loc_A1698D9E
0000:A1698D9E 96 F4 64 FA BL sub_A132F26A
0000:A1698DA2 00 28 CMP R0, #0
It is S65v58. No RAM-addresses...

benj9
11-11-2005, 11:55
Sorry, hoped to fix ram addresses by references in fubu. But the code has changed in 58 ab bit, cannot get at stable searching string. Pls forget this one.

The searched address is loaded directly after the entrypoint of the "improved net indicator", but I see no way to make it findable by smelter :(

benj9
11-11-2005, 20:39
Ok, here another one, I would like to have in next version auf func lib patch :)

Screensaver_GetAddress = A0680028????0121????????10BD + E
returns the address of the "screensaver" byte.
set the byte to FF to lock device.

(should work also in s65v58)

edit: Example of usage: if users have an old version of func lib on phone, and a patch is trying to call a function that is still missing in that version of the func lib, the func lib returns zero, and instead of calling blx 0 and to crash one can lock the phone and exit the patch. So the user knows about the reason of the error.

It would be nice to have a version byte in the function library to check in patch if the version is new enough ... but where to put that byte ...?

avkiev
11-12-2005, 07:53
Last versions of files:
Smelter's Library.ini (http://avkiev.kiev.ua/Siemens/Smelter/Library.ini)
Smelter's Functions.ini (http://avkiev.kiev.ua/Siemens/Smelter/Functions.ini)
Smelter's Patches.ini (http://avkiev.kiev.ua/Siemens/Smelter/Patches.ini)

S65v58 - Library.vkp (http://avkiev.kiev.ua/Siemens/Patches/s65/library.vkp)

2 benj9. I think, if user has problems with patch - At first, he must refresh patch "Library" and try again...

benj9
11-16-2005, 18:34
Considering http://forum.modopo.com/showpost.php?p=100177&postcount=3, it would be nice to have these 2 funcs in function library, thx.

ShowMsgInR1_3 = ??4AE032C307??D438320B1C0021??E7??4AC3
ShowMsgInR1_4 = ??4AC307??D4383A0B1C0021??E7

The idea is: the above patch (which uses func lib) patches GetLP. Now patch coders can call a message like ShowMsgInR1_4 with an own string.

PS: Pls note that I updated the patch now, Nov, 16, 23:00, benj9

avkiev
11-17-2005, 09:06
it would be nice to have these 2 funcs in function library
f078:ShowMsgInR1_3 = ??4AE032C307??D438320B1C0021??E7??4AC3
f079:ShowMsgInR1_4 = ??4AC307??D4383A0B1C0021??E7

benj9
11-17-2005, 19:54
CallAfterTimer =
(70402DE90160A0E10250B0E10040A0E1????????2010A0E3? ???????????????020000EF0000A0E3999999993C201FE5)

but seems to be the same static address at least in m65v50, sl65v50, s65v58

benj9
11-21-2005, 20:47
Could you please also link a third message (with a questionmark icon) in the func lib (pls note the corrected searching string for unique result). After no more messages boxes ;) Thx a lot.

ShowMsgInR1_7 = (0B1C111C??4AA832??E60B1C) +1

avkiev
11-22-2005, 08:46
f080:ShowMsgInR1_7 = (0B1C111C??4AA832??E60B1C) + 1

benj9
11-25-2005, 14:55
Here (http://forum.modopo.com/showpost.php?p=100849&postcount=3) you find a demonstration for "GetLP_UsrStrings" messages, which also uses the func lib in a way, that phone doesnt crash without. Check appended source if interest.

benj9
12-01-2005, 12:21
Would you pls insert this function:

Get_NetAccessMode = (????021C09780120914200D000207047????00787047) + 0x10

returns the current net access mode. E.g. 0x13 phone has net, but is idle. 0x06=heavy net traffic (phoning).

I use already number f81, thx.

benj9
12-01-2005, 15:52
And another one:

Get_IlluminationDataTable = (00B0CAE571FFFFEA????????1EFF2FE1F04D) + 8

Returns the address of an table with the whole illumination data. E.g.: +0x94: the OS' opinion, wether illumination should be on or off.

I use already func lib no f82. :)

benj9
12-02-2005, 16:00
Sorry, because I'm going to finalize my latest patch now, I detach the 2 above funcs now from f81 and f82 and hard-wire them in my patch. Once hard-wired, I don't think it's necessary to put them later in func lib. Thx for attention.

benj9
12-07-2005, 11:56
hi avkiev,

could use the 2 above funcs now in 2 patches, would be worth do put them in function lib :)

benj9
12-10-2005, 16:47
this post was temporarily deleted.

avkiev
12-12-2005, 11:56
778: 004FF746,0x00000569 ; z11: Pic_Calendar
It is additional pictures for patch "Calendar on the main screen"

benj9
12-13-2005, 21:04
These strings have to be corrected like this (misunderstood alignment convention here, sorry for inconvenience)

f081: Get_NetAccessMode = (??021C09780120914200D000207047????00787047) + 0x10
f078:ShowMsgInR1_3 = 4AE032C307??D438320B1C0021??E7??4AC3
f079:ShowMsgInR1_4 = 4AC307??D4383A0B1C0021??E7


PlaySoundLoop can with this string found on x65 and x75: F0402DE9??D04DE20170A0E10250A0E10040A0E1

avkiev
12-14-2005, 08:35
...
Refreshed: Library.ini (http://avkiev.kiev.ua/Siemens/Smelter/Library.ini)

avkiev
12-19-2005, 10:00
f083:memcmp
f084:StrToInt = 10B5002302780130141C093C042C????202A????302A

benj9
12-28-2005, 18:38
Here are some of my strings again, now (hopefully) really working, please correct them in library.ini:

f078:ShowMsgInR1_3 = ??4AE032C307??D438320B1C0021??E7??4AC3 + 1
f079:ShowMsgInR1_4 = ??4AC307??D4383A0B1C0021??E7 + 1
f082:GetIlluminationDataTable = (00B0CAE571FFFFEA????????1EFF2FE1F04D) + 8

benj9
12-28-2005, 18:45
Please add/correct THIS string, I use it in the new "Blinker" patch. Thx :)

f081: Get_NetAccessMode = 021C09780120914200D000207047????00787047 + F

avkiev
12-30-2005, 13:47
Refreshed: Library.ini (http://avkiev.kiev.ua/Siemens/Smelter/Library.ini)

Happy New Year to all !!!

BuG
12-30-2005, 15:09
I have another package of fixed searchstrings. Some are fixed to work with x75 too, others (like DecToHex and GetAkku) are fixed in general.
(Please remove the spaces, the board software adds)

f003:SetProfile = 10B5041C??F???E?0?2C0CD2201C
f005:DecToHex = F0B5061C0C1C151C85B068461122??49??????????E0207869 466A460009085C307021780134
f006:GetAkku = 1C402DE9????9FE5002180E0822083E00120D2E7FF0052E374 039F050F00000A
f023:strcat = 0378021C002B03D0 + 1
f024:strchr = 0A06120E01380130 + 1
f027:StrLen = 30B4441C8107??D001780130 + 1
f031:DrawMainScreen = 70B5??490131481E??????E???4D0120??600420
f036:DrawImage2 = F8B50E1C051C171C652000F02?FE041C6420
f047:DeleteEELiteBlock = 08402DE90130A0E10010A0E1??021FE5??219FE5B200D0E1?? ????EB??119FE5
f053:AlarmClockRing = 98B51?4900241?484C600880??F???E?
f059:MemChr = 0B061B0E002A??D? + 1
f063:SelectColor = ??491828??D28000??E0 + 1
f067:IsUnlocked = ??4880B5103880680028??D0????????0028??D1012080BD
f080:ShowMsgInR1_7 = 0B1C111C??4AA832??E6 + 1


Happy New Year to you and to all. :-)

avkiev
12-30-2005, 16:07
Refreshed: Library.ini (http://avkiev.kiev.ua/Siemens/Smelter/Library.ini)
Happy New Year to all !!!

benj9
12-30-2005, 17:01
happy new year, too, and a cold sixpack of patcher's luck for everybody who reads this :)

benj9
01-28-2006, 00:52
hi, i use now

138: 004F3847,0xA1633B99 ; f039: AddIconToIconbar

could you pls mark it in the lib?

string will follow :)

benj9
02-17-2006, 19:15
Please add this address to function library:

_ram_net_online

search for : ; (70B5????????00680028) + 2, there you find the address loaded by LDR R0, =ram_Net_Online

one find the address for most fw in all Blinker patches. Thank you.

avkiev
02-20-2006, 12:12
Please add this address to function library:
_ram_net_online
Added:
f105:LockShed
f106:UnLockShed
f193:RunGraphSearcher
v13:RamNetOnline
v27:RamProfileNum
z20:Additional_PIT_address
z21:Additional_PIT_start
z22:Additional_PIT_end

benj9
03-04-2006, 10:44
v13_RamIsLocked
is expired and
v13_RamNetOnline
is now valid??

Or is the double use a mistake? Just want to prevent to compile patches wrong now ...

avkiev
03-04-2006, 15:15
v13_RamIsLocked
is expired and
v13_RamNetOnline
is now valid??
I didn't see nothing about "v13_RamIsLocked". Whence it ?
v13 is "v13:RamNetOnline"

Last version of Library - always here: http://avkiev.kiev.ua/Siemens/Smelter/Library.ini

benj9
03-06-2006, 13:01
okay .

benj9
03-07-2006, 11:49
Hi, RamIsLocked is used in the * Running Some Functions While Keyboard is Locked v10.5 * by invisible! So, please, choose another slot for your new function RamNetOnline.
Now we have the prob, that 2 different layouts of function library are on the road.

PLEASE avkiev and 1nvisible, mail each other and find a unique func lib again

benj9
03-07-2006, 17:01
I solve the problem for myself:
I use v14 for ram_GetNetOnline now.

@avkiev: could you pls change in func lib description files, thanks.

@1nvisible:
1. I dont understand the usage of this ram address because we have already:
218: 004F3847,0xA114D0A7 ; f067: IsUnlocked
in func lib.
2. please let's have ONE unique thread like this to coordinate the usage of function library, for future. thank you.

benj9
03-09-2006, 17:22
Another double entry:

;320: 004F3847,0x ; f100: OpenWriteCloseFile
320: 004F3847,0xA165EF2C ; f100: EndUpdateScreen

BuG
03-09-2006, 17:43
OpenWriteCloseFile is on f170 now, as far as I know. ;)

benj9
03-09-2006, 18:15
Better searchstring for x65 and working on S75v23:

SetIllumination: FF4D2DE????9A0E1????9FE508D04DE200????E5????????00 A0A0E30000

(please remove spaces from string)

avkiev
03-14-2006, 14:01
Okay, last changes:
f107: FindFirstFile
f108: FindNextFile
f109: FindClose
f110: IsCalling

f193: /*This fun was deleted as obsolete*/

f171: Hex2Int


f100: EndUpdateScreen
f101: EndCall
f102: EndCallBusy
f103: IsDirectCallActive

f194: GetAllPatchesByInject

v13: RamIsLocked
v14: RamNetOnline

Library.ini (http://avkiev.kiev.ua/Siemens/Smelter/Library.ini)
library.inc (http://avkiev.kiev.ua/Siemens/Patches/s75/library.inc)