dfitemdump appears to work. Materials still buggy (Pig Iron Bar != Mule Bar). This has been bugged since .12 or earlier

develop
unknown 2010-10-19 05:07:07 -05:00
parent 6da86ef1de
commit ba88c86670
3 changed files with 70 additions and 5 deletions

@ -1771,6 +1771,15 @@
<Address name="current_year" value="0xe8b410" />
<Address name="current_weather" value="0x1480948" />
</Group>
<Group name="Items">
<Address name="items_vector" value="0x16580d8" />
<Offset name="item_type_accessor" value="0x0" />
<Offset name="item_subtype_accessor" value="0x4" />
<Offset name="item_subindex_accessor" value="0x8" />
<Offset name="item_index_accessor" value="0xC" />
<Offset name="item_quality_accessor" value="0x238" />
<Offset name="item_improvement_vector" value="0x90" />
</Group>
</Offsets>
</Version>
.-"""-.

@ -116,6 +116,21 @@ Accessor::Accessor(uint32_t function, Process *p)
this->offset1 = (funcText>>24) & 0xffff;
return;
}
if( (funcText&0x000000FF00FFFFFFLL) == 0x000000C300418B66LL )
{
/* mov ax, [ecx+xx]; ret; (shorter instruction)*/
this->type = ACCESSOR_INDIRECT;
this->offset1 = (funcText>>24) & 0xff;
return;
}
if( (funcText&0x00000000FF00FFFFLL) == 0x00000000C300418BLL )
{
/* mov eax, [ecx+xx]; ret; */
this->type = ACCESSOR_INDIRECT;
this->offset1 = (funcText>>16) & 0xff;
this->dataWidth = 4;
return;
}
if( (funcText&0xFFFFFFFF0000FFFFLL) == 0x8B6600000000818BLL )
{
uint64_t funcText2 = p->readQuad(function+8);
@ -134,6 +149,13 @@ Accessor::Accessor(uint32_t function, Process *p)
this->offset1 = (funcText>>24) & 0xffff;
return;
}
if( (funcText&0x000000FF00FFFFFFLL) == 0x000000C30041BF0FLL )
{
/* movsx eax, word ptr [ecx+xx]; ret (shorter opcode)*/
this->type = ACCESSOR_INDIRECT;
this->offset1 = (funcText>>24) & 0xff;
return;
}
if( (funcText&0xFFFFFFFF0000FFFFLL) == 0xCCC300000000818BLL )
{
/* mov eax, [ecx+xx]; ret; */

@ -41,7 +41,8 @@ int main ()
Materials = DF->getMaterials();
Materials->ReadAllMaterials();
p = DF->getProcess();
DFHack::DfVector <uint32_t> p_items (p, p->getDescriptor()->getAddress ("items_vector"));
DFHack::OffsetGroup* itemGroup = mem->getGroup("Items");
DFHack::DfVector <uint32_t> p_items (p, itemGroup->getAddress("items_vector"));
uint32_t size = p_items.size();
Items = DF->getItems();
@ -49,6 +50,7 @@ int main ()
printf("type\tvtable\tname\tquality\tdecorate\n");
for (i=0;i<size;i++)
{
uint32_t curItem = p_items[i];
uint32_t vtable = p->readDWord(p_items[i]);
uint32_t func0 = p->readDWord(vtable);
uint64_t funct0 = p->readQuad(func0);
@ -84,6 +86,8 @@ int main ()
if (funct1 == 0xC300000092818B66LL)
quality = p->readWord(p_items[i]+0x92);
if (funct1 == 0xC300000082818B66LL)
quality = p->readWord(p_items[i]+0x82);
else if (funct1 == 0xCCCCCCCCCCC3C033LL)
quality = 0;
else
@ -115,6 +119,11 @@ int main ()
uint32_t off1 = (funcBt>>24) & 0xffff;
typeB = p->readWord(p_items[i] + off1);
}
else if ( (funcBt&0x000000FF00FFFFFFLL) == 0x000000C300418B66LL )
{
uint32_t off1 = (funcBt>>24) & 0xff;
typeB = p->readWord(p_items[i] + off1);
}
else
printf("bad typeB func @%p\n", (void*) funcB);
}
@ -126,6 +135,16 @@ int main ()
uint32_t off1 = (funcCt>>24)&0xffff;
typeC = p->readWord(p_items[i] + off1);
}
else if ( (funcCt&0x000000FF00FFFFFFLL) == 0x000000C300418B66LL )
{
uint32_t off1 = (funcCt>>24) & 0xff;
typeC = p->readWord(p_items[i] + off1);
}
else if ( (funcCt&0x00000000FF00FFFFLL) == 0x00000000C300418BLL )
{
uint32_t off1 = (funcCt>>16) & 0xff;
typeC = p->readWord(p_items[i] + off1);
}
else
printf("bad typeC func @%p\n", (void*) funcC);
@ -134,12 +153,27 @@ int main ()
else if ( (funcDt&0xFFFFFFFF0000FFFFLL) == 0xCCC300000000818BLL )
{
uint32_t off1 = (funcDt>>16) & 0xffff;
typeD = p->readDWord(p_items[i] + off1);
typeD = p->readWord(p_items[i] + off1);
}
else if ( (funcDt&0xFFFFFF0000FFFFFFLL) == 0xC30000000081BF0FLL )
{
uint32_t off1 = (funcDt>>24) & 0xffff;
typeD = (int16_t) p->readWord(p_items[i] + off1);
typeD = p->readWord(p_items[i] + off1);
}
else if ( (funcDt&0x000000FF00FFFFFFLL) == 0x000000C30041BF0FLL )
{
uint32_t off1 = (funcDt>>24) & 0xff;
typeD = p->readWord(p_items[i] + off1);
}
else if ( (funcDt&0x000000FF00FFFFFFLL) == 0x000000C300418B66LL )
{
uint32_t off1 = (funcDt>>24) & 0xff;
typeD = p->readWord(p_items[i] + off1);
}
else if ( (funcDt&0x00000000FF00FFFFLL) == 0x00000000C300418BLL )
{
uint32_t off1 = (funcDt>>16) & 0xff;
typeD = p->readDWord(p_items[i] + off1);
}
else
printf("bad typeD func @%p\n", (void*) funcD);
@ -155,8 +189,8 @@ int main ()
{
bool sep = false;
printf("\tdeco=[");
uint32_t decStart = p->readDWord(p_items[i] + 0xAC);
uint32_t decEnd = p->readDWord(p_items[i] + 0xB0);
uint32_t decStart = p->readDWord(p_items[i] + 0x90); // 0xAC pre .13
uint32_t decEnd = p->readDWord(p_items[i] + 0x94); // 0xB0 pre .13
if (decStart != decEnd)
{
for (j=decStart;j<decEnd;j+=4)