MipsLA25Stub::MipsLA25Stub(const MipsGNULDBackend& pTarget) : m_Target(pTarget), m_Name("MipsLA25_Prototype"), m_pData(STUB), m_Size(sizeof(STUB)) { addFixup(0, 0x0, R_MIPS_LA25_LUI); addFixup(4, 0x0, R_MIPS_LA25_J); addFixup(8, 0x0, R_MIPS_LA25_ADD); }
ARMToTHMStub::ARMToTHMStub(bool pIsOutputPIC) : m_pData(NULL), m_Name("A2T_prototype"), m_Size(0x0) { if (pIsOutputPIC) { m_pData = PIC_TEMPLATE; m_Size = sizeof(PIC_TEMPLATE); addFixup(12u, 0x0, llvm::ELF::R_ARM_REL32); } else { m_pData = TEMPLATE; m_Size = sizeof(TEMPLATE); addFixup(8u, 0x0, llvm::ELF::R_ARM_ABS32); } }
THMToTHMStub::THMToTHMStub(bool pIsOutputPIC, bool pUsingThumb2) : m_pData(NULL), m_Name("T2T_prototype"), m_Size(0x0), m_bUsingThumb2(pUsingThumb2) { if (pIsOutputPIC) { m_pData = PIC_TEMPLATE; m_Size = sizeof(PIC_TEMPLATE); addFixup(16u, 0x0, llvm::ELF::R_ARM_REL32); } else { m_pData = TEMPLATE; m_Size = sizeof(TEMPLATE); addFixup(12u, 0x0, llvm::ELF::R_ARM_ABS32); } }
/// for doClone ARMToTHMStub::ARMToTHMStub(const uint32_t* pData, size_t pSize, const_fixup_iterator pBegin, const_fixup_iterator pEnd) : m_pData(pData), m_Name("A2T_veneer"), m_Size(pSize) { for (const_fixup_iterator it = pBegin, ie = pEnd; it != ie; ++it) addFixup(**it); }
MipsLA25Stub::MipsLA25Stub(const MipsGNULDBackend& pTarget, const uint32_t* pData, size_t pSize, const_fixup_iterator pBegin, const_fixup_iterator pEnd) : m_Target(pTarget), m_Name("pic"), m_pData(pData), m_Size(pSize) { for (const_fixup_iterator it = pBegin, ie = pEnd; it != ie; ++it) addFixup(**it); }
/// for doClone THMToTHMStub::THMToTHMStub(const uint32_t* pData, size_t pSize, const_fixup_iterator pBegin, const_fixup_iterator pEnd, bool pUsingThumb2) : m_pData(pData), m_Name("T2T_veneer"), m_Size(pSize), m_bUsingThumb2(pUsingThumb2) { for (const_fixup_iterator it = pBegin, ie = pEnd; it != ie; ++it) addFixup(**it); }
void addMaterial(zoneInfo_t* info, const char* name, char* data, size_t dataLen) { if(parseMatFile(data, dataLen) < 0) return; // load up the techset char techsetfname [128]; _snprintf(techsetfname, 128, "techsets/%s.techset", techsetName); loadAsset(info, ASSET_TYPE_TECHSET, techsetfname, techsetName); int asset = addAsset(info, ASSET_TYPE_MATERIAL, name, NULL, 0); BUFFER* buf = new BUFFER(4096); Material* mat = new Material; memset(mat, 0, sizeof(Material)); mat->name = (char*)0xFFFFFFFF; if(materialUsage == MATERIAL_USAGE_UI) { mat->flags = 0x2F; mat->animationX = 1; mat->animationY = 1; mat->unknown2 = 0xFFFFFFFF; mat->unknown3 = 0xFFFFFF00; memset(mat->unknown4, 0xFF, sizeof(mat->unknown4)); mat->numMaps = materialMapCount; mat->stateMapCount = 1; mat->unknown6 = 3; mat->unknown7 = 4; } // null dem pointers! mat->techniqueSet = (MaterialTechniqueSet*)0x0;//0xFFFFFFFF; mat->maps = (MaterialTextureDef*)0xFFFFFFFF; mat->stateMap = (void*)0xFFFFFFFF; buf->write(mat, sizeof(Material), 1); buf->write((void*)name, strlen(name) + 1, 1); // techset int assetPatchTo = containsAsset(info, ASSET_TYPE_TECHSET, techsetName); addFixup(info, asset, 80, assetPatchTo); // maps for(int i=0; i<materialMapCount; i++) { MaterialTextureDef* tex = new MaterialTextureDef; memset(tex, 0, sizeof(MaterialTextureDef)); tex->firstCharacter = materialMaps[i][0]; tex->secondLastCharacter = materialMaps[i][strlen(materialMaps[i])]; tex->typeHash = R_HashString(materialMaps[i]); tex->image = (GfxImage*)0xFFFFFFFF; tex->textureType = 0xE2; buf->write(tex, sizeof(MaterialTextureDef), 1); GfxImage* img = new GfxImage; memset(img, 0, sizeof(GfxImage)); img->depth = 1; img->textureType = 3; // 2d texture img->textureType2 = 3; img->texture = (GfxImageLoadDef*)0xFFFFFFFF; img->name = (char*)0xFFFFFFFF; img->width = iwiHeaders[i].xsize; img->height = iwiHeaders[i].ysize; buf->write(img, sizeof(GfxImage), 1); buf->write((void*)materialTextureNames[i], strlen(materialTextureNames[i]) + 1, 1); GfxImageLoadDef * def = new GfxImageLoadDef; memset(def, 0, sizeof(GfxImageLoadDef)); int format = 0; switch(iwiHeaders[i].format) { case IWI_ARGB: format = 21; break; case IWI_RGB8: format = 20; break; case IWI_DXT1: format = 0x31545844; break; case IWI_DXT3: format = 0x33545844; break; case IWI_DXT5: format = 0x35545844; break; } def->format = format; def->mipLevels = 1; buf->write(def, sizeof(GfxImageLoadDef), 1); } // unknown 8 goes here whenever we use it // statemap if(materialUsage == MATERIAL_USAGE_UI) { char statemap[] = {0x65, 0x51, 0x12, 0x18, 0x02, 0x00, 0x0E, 0xE0 }; buf->write(statemap, 8, 1); } buf->resize(-1); // fix the data setAssetData(info, asset, buf->data(), buf->getsize()); }