• Welcome to Valhalla Legends Archive.
 

icons.bni process, from the start

Started by Smithsonian, July 31, 2005, 06:49 PM

Previous topic - Next topic

Smithsonian

I'm about to tackle the icons.bni task. I've just added bnftp support to my client. I'm ready to download and process the file. I just wanted to get a few things out of the way.

My client should first check to see if it has a copy of icons.bni in its directory, if it doesn't it should download it and process it. My client, on the second connect, should check the version of icons.bni using some packet I saw on bnetdocs, but either way, it should check the version of icons.bni - then if local version is older download the newer one, otherwise keep the local one.

Once it's verified I have the current version of icons.bni - I should make my client extract the targa file, and somehow save it in memory and apply it to my list view.

Does this process sound about right?

UserLoser.

Well, yeah.  To clarify:

You send SID_GETICONDATA and the server will respond with the icons filename.  Then you check if you have that file locally, if not, proceed to download it.  If you do, then send SID_GETFILETIME to get the date of when the file was last modified.  You then will have to check the filetime of your local icons file.  If they do not match (i.e. servers filetime is more recent) then download the new file, otherwise keep what you have.

As far as reading from the icons file, I suggest understanding this documentation of it's format.  You'll have to 'pick it apart' first by Blizzard's icon file header.  Then from there you'll extract the targa header, it's image data and decompress it if necessary (pretty sure it's never not necessary).  Create a DIB/bitmap and store it in memory, then draw to your listview whenever using a function such as BitBlt.

Hope this helps.

Eric

QuoteYou send SID_GETICONDATA and the server will respond with the icons filename.  Then you check if you have that file locally, if not, proceed to download it.  If you do, then send SID_GETFILETIME to get the date of when the file was last modified.  You then will have to check the filetime of your local icons file.  If they do not match (i.e. servers filetime is more recent) then download the new file, otherwise keep what you have.

SID_GETICONDATA includes the filetime, so sending SID_GETFILETIME is not required.

Arta

Quote from: UserLoser on July 31, 2005, 10:02 PM
If they do not match (i.e. servers filetime is more recent) then download the new file, otherwise keep what you have.

Actually, I'd suggest getting the one from the server even if the local time is more recent than the server. In other words, download if the times differ at all. I suggest this because the server should be authoritative: if the user connects to an emulator or something, it might have custom icons, and they might have an earlier filetime than Battle.net's icons.

Fairly minor nit-pick though.

UserLoser.

Quote from: Arta[vL] on August 01, 2005, 04:00 AM
Quote from: UserLoser on July 31, 2005, 10:02 PM
If they do not match (i.e. servers filetime is more recent) then download the new file, otherwise keep what you have.

Actually, I'd suggest getting the one from the server even if the local time is more recent than the server. In other words, download if the times differ at all. I suggest this because the server should be authoritative: if the user connects to an emulator or something, it might have custom icons, and they might have an earlier filetime than Battle.net's icons.

Fairly minor nit-pick though.

Well we're not supposed to be connecting to emulators now are we!? :P

tA-Kane

Are you suggesting that the bots recognize the difference between an emulated server and an authorized server? Umm, no, plzkthx.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Arta

No. I'm suggesting that clients should download icons.bni, or any other file, when the filetimes differ, not just when the filetime is lower.

In other words, the server's version should be authoritative.

Spht

SphtBotv3 uses a series of _info.cfi (CFI = Check File Info) files which are used by CheckUpdateFileTime to perform versioning on files.

bool CheckUpdateFileTime(LPCSTR lpszFileName, const LPFILETIME lpFileTime)

lpszFileName is the file to check info for and lpFileTime is the FILETIME to compare with.  It returns true if current file is same or newer than Battle.net's file, and false if older.  CheckUpdateFileTime also updates the recorded file info.

This is used for all automated file downloads from Battle.net.

Quote[14:43:39] Connected to Battle.net!
[14:43:39] New IX86ver1.mpq available, downloading...
[14:43:40] Checking versions and CD-key...
[14:43:40] Passed version and CD-key check!
[14:43:40] Attempting to log on...
[14:43:40] New icons.bni available, downloading...
[14:43:40] Successfully logged on!