Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant archive_postsperpage - assumed 'archive_postsperpage' (this will throw an Error in a future version of PHP) in ..../archive/index.php on line 456
.dat structure problem [Archive] - Forums

PDA

View Full Version : .dat structure problem



marek677
07-22-2014, 03:09 PM
Could anybody check if my code is correcct?


#include "mylib.h"
#include "mem.h"
void parseflag(void* data, unsigned char arg);
short int* sprites;
int spriteID = 0;
void getUnusedSprites(){
short int max;
int i,j;
for(i=0;i<spriteID;i++)
if(max<sprites[i])
max = sprites[i];
fprintf(stderr,"\nMax sprite value:%d",max);
printf("\n\nUnused:\n");
int found;
for(j=0x1F;j<max;j++){
found=0;
for(i=0;i<spriteID;i++)
if(sprites[i]==j){found=1; break;}
if(found!=1) printf("%d ",j);
}
}
int main(int argc,char** argv){
size_t datasize;
void* data = readfile("tibia.dat",&datasize);
setptr(data);
fprintf(stderr,"ver:%d\n",getU32());
short int items = getU16();
short int monsters = getU16();
short int effects = getU16();
short int distance = getU16();
sprites = malloc((items+monsters+effects+distance)*sizeof(sh ort int)*12); //allocate more memory then needed?
fprintf(stderr,"items:%d\n",items);
fprintf(stderr,"Monsters:0x%x\n",monsters);
fprintf(stderr,"Effects:0x%x\n",effects);
fprintf(stderr,"Distanceeffects:0x%x\n",distance);
int padding = 0;
int i;
for(;;){
parseflag(data,getU8());
if(getptr()>(data+datasize))
break;
}
fprintf(stderr,"\nReading done.");
getUnusedSprites();
fprintf(stderr,"\nParsing done.");
return 0;
}
void parseflag(void* data,unsigned char arg){
int width, height, blend,divx,divy,divz,animation;
int i ; //for a loop
switch(arg){
case 0x00: //Ground
//getU16(); //speed
//wasnt workin, so i deleted it
break;
case 0x01: //Top Order 1
case 0x02: //Top Order 2
case 0x03: //Top Order 3
case 0x04: //Container
case 0x05: //Stackable
case 0x06: //Corpse
case 0x07: //Useable
case 0x08: //Rune
break;
case 0x09: //Writeable
case 0x0A: //Readable
getU16(); //Text limit
break;
case 0x0B: //Fluid
case 0x0C: //Splash
case 0x0D: //Blocking
case 0x0E: //Immoble
case 0x0F: //Block Missle
case 0x10: //Blocks path
case 0x11: //Pickupable
case 0x12: //Hangable
case 0x13: //Horizontal (whatever it is)
case 0x14: //Vertical
case 0x15: //Rotatable
break;
case 0x16: //Light
getU16();//level
getU16();//color
break;
case 0x18://Floorchange
break;
case 0x19: //Offset
getU8(); //x
getU8(); //y
break;
case 0x1A:// Heighted
getU16(); //amount of pixel raised
break;
case 0x1B:// Layer(Player Appear on top)
case 0x1C:// Idle Animation
break;
case 0x1D:// Minimap
getU16(); //color
break;
case 0x1E:// floor change
/*86 - openable holes,
77 - can be used to go down,
76 - can be used to go up,
82 - stairs up,
79 - switch*/
getU8();
getU8(); //Returns 4... always.
break;
case 0x1F: //unknown
break;
case 0xFF: // End of flags, time to parse
width = getU8();
height = getU8();
if(width!=1 || height!=1) getU8(); //is this correct?
blend = getU8(); // is this correct?
divx = getU8();
divy = getU8();
divz = getU8();
animation = getU8();
printf("\n%d: Prev: 0x%.2x Width:%d Height:%d blendframes:%d divx:%d divy:%d divz:%d animation:%d\n",
spriteID++,*(unsigned char*)(getptr()-2),width,height,blend,divx,divy,divz,animation);
//if(width!=1 || height!=1) blend=1;
for(i=1;i<=width*height*blend*divx*divy*divz*animation;i++){
unsigned short int sprite = getU16();
sprites[spriteID-1] = sprite;
printf("%.5d ",sprite);
if(sprite>37000) exit(7);
// just some eye-candy, which makes readin it easier
if(i%8==0 && i!=0) printf("\n");
if(i%4==0 && i%8!=0 && i!=0) printf(" ");
}
printf("\n\tEnded at:%x\n",getptr()-1-data); // just some debug usefull info
break;
default:

printf("0x%x:Unknown value:0x%.2x Last byte 0x%.2x \n",
getptr()-data-1,arg,*(unsigned char*)(getptr()-2));
break;
}
}
}

It works kinda good, but it crashes in the midle of the file. Have i mismatched some adresses?

Thanks in advance,
Marek677

@edit
My point of viev:
[bytes] comment
[4] file version
[2] Items
[2] Outfits
[2] Effect
[2] Distance effects

[x] - sooome stuff and flags
[1] - 0xFF
[2] - Width
[2] - Height
[2] - Blendedframes (some things mismatched with that shit?)
[2] - divx
[2] - divy
[2] - divz
[2] - animation
[2*animation*divx*divy*divz*width*height*blendedfra mes] - sprite numbers

[x] - soome stuff flags //again

The tibia ver is 860

FrankJScott
03-04-2024, 08:36 PM
Please try Google (https://www.google.com/) before asking about Recommended Product Blog (https://rostovbike.ru/thread-960-post-2059.html#pid2059) 9b2ee98

FrankJScott
03-05-2024, 03:03 AM
For the lady talking about status saver tiktok, save twitter video as gif, tiktok com mp4, download twitter video private account, download twitter spaces recording, download all twitter images from a user, download all photos from twitter profile, tweetadder download, download twitter video to mp4 mac, tiktok to video converter, download video from tiktok without watermark, snap twitter download, tik tok video status, download video from link twitter, tiktok without watermark video, download tiktok 18th, download archive twitter, tik tok save from, download twitter video audio, download movie twitter, I suggest this what is ssstik.io? (https://hindirocks.com/review-of-ssstik-io-a-tiktok-users-ally/) for tikmate hd, save video on tiktok, facebook instagram twitter logo png download, app to remove tiktok watermark, save tiktok online, download twitter files, download twitter following, tiktok downloader with watermark, convert tiktok video, download twitter for iphone, tiktok arabic ringtone download, twitter followers app download, free online twitter video downloader, savetik cc, ssstiktok story, tiktok download watermark, twitter video download chrome extension, twitter account downloader, douyin downloader no watermark, download from twitter iphone, also. See More Updated Twitter Video Downloaders Website (http://heathenboard.com/viewtopic.php?f=10&t=46378&p=43595#p43595) 9d2289d

FrankJScott
03-05-2024, 05:56 PM
To the guy inquiring about identify as binary, gender variance, non binary fluid meaning, intersex gender identity, howmany genders are there, genderfluid agender, gender outlaw identity, non binary term for sister, gender of human, gender identity for male, non binary family terms, no gender person, i don t understand non binary, identity terms, all genders list and meanings, bigender meaning lgbt, dsm 5 gender, cross gender identification, gender terms, gender fluid examples, I recommend this marrakech desert tours (https://www.wokewaves.com/posts/under-the-stars-experiencing-marrakechs-desert-tours) for prenatal hormones and gender identity, gender dysphoria examples, amaze org gender identity, non binary meaning in hindi, judith butler non binary, questioning my gender, rapid onset gender dysphoria reddit, 4th generation beta blockers, non binary bisexual means, bigender people, cross gender identification, gender identity in schools, nhs gender identity, millennials centennials y alpha, gender dysphoria counseling near me, non non binary, demi lovato non binary, gender facebook, genderqueer maia kobabe, androgyne gender identity, also. See More Great Tiktok Video Downloaders Tips (https://gamersbuild.org/fora/viewtopic.php?p=38695#p38695) 8b2_e4e

FrankJScott
03-13-2024, 12:00 AM
For the man asking about battery sconces indoor, black side table lamp, lucite chandelier, modern abstract rug, wall lights for sitting room, square area rugs 8x8, home depot runner rugs, martha stewart outdoor rugs, wall sconce with cord, flower wall with lights, mid century modern home decor, aqara light sensor, wrought iron chandeliers, amethyst crystal pendant, low profile table lamp, usb table lamp, folding tray table, big lots wall decor, living spaces rugs, gold wall lights living room, I recommend this handmade rugs (https://englanderline.com/product-category/collection/rugs/handmade-rugs/) for name pendant designs for female, ikea bathroom mats, clover heart necklace, wisteria lamp, designer home accessories, hamsa pendant gold, kawaii decor, main door decoration, project source wall lantern, home depot christmas decorations, tiffany style chandelier, allmodern rugs, sconce light with switch, crystal butterfly necklace, beige rug modern, custom ice cube molds, acrylic wall light, modern home decor, 70s shag carpet, hall decoration items, also. See More Top Home Decor Guide (http://www.lacvietvodao.vn/diendan/viewtopic.php?f=15&t=24321&p=1345463#p1345463) 48f6fd6