<commit_before>#pragma once
typedef struct TDWMBHdr_s
{
	BYTE				id[4];				// 0
	unsigned int		version;			// 4
	int					unknownA;			// 8
	unsigned int		vertexFormat;		// C
	short				unknownB;			// E
	short				unknownC;			//10
	float				boundingBox[6];		//14
	unsigned int		ofsVertexGroups;	//2C
	int					numVertexGroups;	//30
	unsigned int		ofsBatches;			//34
	int					numBatches;			//38
	unsigned int		ofsBatchGroups;		//3C
	unsigned int		ofsBones;			//40
	int					numBones;			//44
	unsigned int		ofsBoneIndexTT;		//48
	int					sizeBoneIndexTT;	//4C
	unsigned int		ofsBoneSets;		//50
	int					numBoneSets;		//54
	unsigned int		ofsMaterials;		//58
	int					numMaterials;		//5C
	unsigned int		ofsTextureIDs;		//60
	int					numTextureIDs;		//64
	unsigned int		ofsMeshes;			//68
	int					numMeshes;			//6C
} TDWMBHdr_t;
template <bool big>
struct TDWMBHdr : public TDWMBHdr_s {
	TDWMBHdr(TDWMBHdr_t * ptr) : TDWMBHdr_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(*((int *)id));
			LITTLE_BIG_SWAP(version);
			LITTLE_BIG_SWAP(unknownA);
			LITTLE_BIG_SWAP(vertexFormat);
			LITTLE_BIG_SWAP(unknownB);
			LITTLE_BIG_SWAP(unknownC);
			for (int i = 0; i < 6; i++) {
				LITTLE_BIG_SWAP(boundingBox[i]);
			}
			LITTLE_BIG_SWAP(ofsVertexGroups);
			LITTLE_BIG_SWAP(numVertexGroups);
			LITTLE_BIG_SWAP(ofsBatches);
			LITTLE_BIG_SWAP(numBatches);
			LITTLE_BIG_SWAP(ofsBatchGroups);
			LITTLE_BIG_SWAP(ofsBones);
			LITTLE_BIG_SWAP(numBones);
			LITTLE_BIG_SWAP(ofsBoneIndexTT);
			LITTLE_BIG_SWAP(sizeBoneIndexTT);
			LITTLE_BIG_SWAP(ofsBoneSets);
			LITTLE_BIG_SWAP(numBoneSets);
			LITTLE_BIG_SWAP(ofsMaterials);
			LITTLE_BIG_SWAP(numMaterials);
			LITTLE_BIG_SWAP(ofsTextureIDs);
			LITTLE_BIG_SWAP(numTextureIDs);
			LITTLE_BIG_SWAP(ofsMeshes);
			LITTLE_BIG_SWAP(numMeshes);
		}
	}
};
typedef struct TDVertexGroup_s {
	unsigned int	ofsVerts;
	unsigned int	ofsVertsExData;
	unsigned int	unknownA;
	unsigned int	unknownB;
	unsigned int	sizeVert;
	unsigned int	sizeVertExData;
	unsigned int	unknownD;
	unsigned int	unknownE;
	unsigned int	numVerts;
	unsigned int	ofsIndexBuffer;
	unsigned int	numIndexes;
} TDVertexGroup_t;
template <bool big>
struct TDVertexGroup : public TDVertexGroup_s {
	TDVertexGroup(TDVertexGroup_t * ptr) : TDVertexGroup_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(ofsVerts);
			LITTLE_BIG_SWAP(ofsVertsExData);
			LITTLE_BIG_SWAP(unknownA);
			LITTLE_BIG_SWAP(unknownB);
			LITTLE_BIG_SWAP(sizeVert);
			LITTLE_BIG_SWAP(sizeVertExData);
			LITTLE_BIG_SWAP(unknownD);
			LITTLE_BIG_SWAP(unknownE);
			LITTLE_BIG_SWAP(numVerts);
			LITTLE_BIG_SWAP(ofsIndexBuffer);
			LITTLE_BIG_SWAP(numIndexes);
		}
	}
};
typedef struct TDBatch_s {
	unsigned int	vertexGroupIndex;
	unsigned int	vertexStart;
	unsigned int	indexStart;
	unsigned int	numVerts;
	unsigned int	numIndices;
} TDBatch_t;
template <bool big>
struct TDBatch : public TDBatch_s {
	TDBatch(TDBatch_t * ptr) : TDBatch_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(vertexGroupIndex);
			LITTLE_BIG_SWAP(vertexStart);
			LITTLE_BIG_SWAP(indexStart);
			LITTLE_BIG_SWAP(numVerts);
			LITTLE_BIG_SWAP(numIndices);
		}
	}
};
typedef struct TDBatcGroups_s {
	struct {
		unsigned int ofsBatchGroup;
		unsigned int numBatch;
	} groups[5];
} TDBatchGroups_t;
template <bool big>
struct TDBatchGroups : public TDBatcGroups_s {
	TDBatchGroups(TDBatchGroups_t * ptr) : TDBatcGroups_s(*ptr) {
		if (big) {
			for (int i = 0; i < 5; i++) {
				LITTLE_BIG_SWAP(groups[i].ofsBatchGroup);
				LITTLE_BIG_SWAP(groups[i].numBatch);
			}
		}
	}
};
typedef struct TDBatchInfo_s
{
	unsigned int	batchIndex;
	unsigned int	meshIndex;
	unsigned short	materialIndex;
	short			boneSetIndex;
	int				unknown;
} TDBatchInfo_t;
template <bool big>
struct TDBatchInfo : TDBatchInfo_s {
	TDBatchInfo(TDBatchInfo_t * ptr) : TDBatchInfo_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(batchIndex);
			LITTLE_BIG_SWAP(meshIndex);
			LITTLE_BIG_SWAP(materialIndex);
			LITTLE_BIG_SWAP(boneSetIndex);
			LITTLE_BIG_SWAP(unknown);
		}
	}
};
typedef struct TDBone_s
{
	short			globalId;
	short			ttIndex;
	short			parentIndex;
	short			padding;
	bayoVector_t	localPosition;
	bayoVector_t	position;
} TDBone_t;
template <bool big>
struct TDBone : public TDBone_s {
	TDBone(TDBone_t * ptr) : TDBone_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(globalId);
			LITTLE_BIG_SWAP(ttIndex);
			LITTLE_BIG_SWAP(parentIndex);
			LITTLE_BIG_SWAP(padding);
			localPosition.swap();
			position.swap();
		}
	}
};
typedef struct TDBoneSet_s {
	unsigned int	ofsBoneSet;
	unsigned int	numBoneIndices;
} TDBoneSet_t;
template <bool big>
struct TDBoneSet : public TDBoneSet_s {
	TDBoneSet(TDBoneSet_t * ptr) : TDBoneSet_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(ofsBoneSet);
			LITTLE_BIG_SWAP(numBoneIndices);
		}
	}
};
typedef struct TDMaterial_s
{

	unsigned int	ofsShaderName;
	unsigned int	ofsTextures;
	unsigned int	unknownA;
	unsigned int	ofsParameters;
	unsigned short	unknownB;
	unsigned short	numTextures;
	unsigned short	unknownC;
	unsigned short	numParameters;
} TDMaterial_t;
template <bool big>
struct TDMaterial : public TDMaterial_s {
	TDMaterial(TDMaterial_t * ptr) : TDMaterial_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(ofsShaderName);
			LITTLE_BIG_SWAP(ofsTextures);
			LITTLE_BIG_SWAP(unknownA);
			LITTLE_BIG_SWAP(ofsParameters);
			LITTLE_BIG_SWAP(unknownB);
			LITTLE_BIG_SWAP(numTextures);
			LITTLE_BIG_SWAP(unknownC);
			LITTLE_BIG_SWAP(numParameters);
		}
	}
};
typedef struct TDTexture_s
{
	unsigned int	ofsName;
	int				textureIndex;
} TDTexture_t;
template <bool big>
struct TDTexture : public TDTexture_s {
	TDTexture(TDTexture_t * ptr) : TDTexture_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(ofsName);
			LITTLE_BIG_SWAP(textureIndex);
		}
	}
};
typedef struct TDMesh_s {
	unsigned int	ofsName;
	float			boundingBox[6];
	struct {
		unsigned int	ofsBatchGroupIndex;
		unsigned int	numBatchGroupIndices;
	} groups[5];
	unsigned int	ofsMaterials;
	unsigned int	numMaterials;
} TDMesh_t;
template <bool big>
struct TDMesh : public TDMesh_s {
	TDMesh(TDMesh_t * ptr) : TDMesh_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(ofsName);
			for (int i = 0; i < 6; i++) {
				LITTLE_BIG_SWAP(boundingBox[i]);
			}
			for (int i = 0; i < 5; i++) {
				LITTLE_BIG_SWAP(groups[i].ofsBatchGroupIndex);
				LITTLE_BIG_SWAP(groups[i].numBatchGroupIndices);
			}
			LITTLE_BIG_SWAP(ofsMaterials);
			LITTLE_BIG_SWAP(numMaterials);
		}
	}
};

template <>
static void Model_Bayo_GetTextureBundle<TD>(CArrayList<bayoDatFile_t *> &texFiles, CArrayList<bayoDatFile_t> &dfiles, bayoDatFile_t &df, noeRAPI_t *rapi) {
	Model_Bayo_GetTextureBundle<BAYONETTA2>(texFiles, dfiles, df, rapi);
}

template <>
static void Model_Bayo_LoadTextures<false, TD>(CArrayList<noesisTex_t *> &textures, CArrayList<bayoDatFile_t *> &texFiles, noeRAPI_t *rapi) {
	Model_Bayo_LoadTextures<false, NIER_AUTOMATA>(textures, texFiles, rapi);
}

template <bool big, game_t game>
static void Model_TD_LoadMaterials(
	TDWMBHdr<big> &hdr,
	CArrayList<noesisTex_t *> &textures,
	CArrayList<noesisMaterial_t *> &matList,
	CArrayList<noesisMaterial_t *> &matListLightMap,
	CArrayList<noesisMaterial_t *> &totMatList,
	BYTE *data,
	noeRAPI_t *rapi) {

	TDMaterial_t *matPtr = (TDMaterial_t *)(data + hdr.ofsMaterials);
	unsigned int *textureIDs = (unsigned int *)(data + hdr.ofsTextureIDs);

	DBGLOG("Found %d materials\n", hdr.numMaterials);
	for (int i = 0; i < hdr.numMaterials; i++)
	{
		TDMaterial<big> mat(matPtr + i);
		DBGLOG("\tFound %s\n", data + mat.ofsShaderName);
		noesisMaterial_t *nmat = rapi->Noesis_GetMaterialList(1, true);
		char matName[128];
		sprintf_s(matName, 128, "bayomat%i", i);
		DBGLOG(" name: %s,", matName);
		nmat->name = rapi->Noesis_PooledString(matName);
		nmat->noDefaultBlend = false;
		nmat->texIdx = -1;
		nmat->normalTexIdx = textures.Num() - 1;
		nmat->specularTexIdx = -1;
		int difTexId = 0;
		int nrmTexId = 0;
		int specTexId = 0;
		int maskTexId = 0;
		DBGLOG("\tFound %d textures\n", mat.numTextures);
		TDTexture_t * texPtr = (TDTexture_t *)(data + mat.ofsTextures);
		for (unsigned int j = 0; j < mat.numTextures; j++) {
			TDTexture<big> tex(texPtr + j);
			if (strcmp((char*)(data + tex.ofsName), "Albedo0") == 0) {
				difTexId = textureIDs[tex.textureIndex];
			}
			if (strcmp((char*)(data + tex.ofsName), "NormalMap0") == 0) {
				nrmTexId = textureIDs[tex.textureIndex];
			}
		}
		for (int j = 0; j < textures.Num(); j++) {
			noesisTex_t *tex = textures[j];
			if (difTexId && tex->globalIdx == difTexId) {
				DBGLOG("Found matching texture %d\n", j);
				nmat->texIdx = j;
			}
			if (nrmTexId && tex->globalIdx == nrmTexId) {
				DBGLOG("Found matching normal %d\n", j);
				nmat->normalTexIdx = j;
			}
		}<commit_msg>Fix materials in TLoK, thanks Rich.<commit_after>#pragma once
typedef struct TDWMBHdr_s
{
	BYTE				id[4];				// 0
	unsigned int		version;			// 4
	int					unknownA;			// 8
	unsigned int		vertexFormat;		// C
	short				unknownB;			// E
	short				unknownC;			//10
	float				boundingBox[6];		//14
	unsigned int		ofsVertexGroups;	//2C
	int					numVertexGroups;	//30
	unsigned int		ofsBatches;			//34
	int					numBatches;			//38
	unsigned int		ofsBatchGroups;		//3C
	unsigned int		ofsBones;			//40
	int					numBones;			//44
	unsigned int		ofsBoneIndexTT;		//48
	int					sizeBoneIndexTT;	//4C
	unsigned int		ofsBoneSets;		//50
	int					numBoneSets;		//54
	unsigned int		ofsMaterials;		//58
	int					numMaterials;		//5C
	unsigned int		ofsTextureIDs;		//60
	int					numTextureIDs;		//64
	unsigned int		ofsMeshes;			//68
	int					numMeshes;			//6C
} TDWMBHdr_t;
template <bool big>
struct TDWMBHdr : public TDWMBHdr_s {
	TDWMBHdr(TDWMBHdr_t * ptr) : TDWMBHdr_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(*((int *)id));
			LITTLE_BIG_SWAP(version);
			LITTLE_BIG_SWAP(unknownA);
			LITTLE_BIG_SWAP(vertexFormat);
			LITTLE_BIG_SWAP(unknownB);
			LITTLE_BIG_SWAP(unknownC);
			for (int i = 0; i < 6; i++) {
				LITTLE_BIG_SWAP(boundingBox[i]);
			}
			LITTLE_BIG_SWAP(ofsVertexGroups);
			LITTLE_BIG_SWAP(numVertexGroups);
			LITTLE_BIG_SWAP(ofsBatches);
			LITTLE_BIG_SWAP(numBatches);
			LITTLE_BIG_SWAP(ofsBatchGroups);
			LITTLE_BIG_SWAP(ofsBones);
			LITTLE_BIG_SWAP(numBones);
			LITTLE_BIG_SWAP(ofsBoneIndexTT);
			LITTLE_BIG_SWAP(sizeBoneIndexTT);
			LITTLE_BIG_SWAP(ofsBoneSets);
			LITTLE_BIG_SWAP(numBoneSets);
			LITTLE_BIG_SWAP(ofsMaterials);
			LITTLE_BIG_SWAP(numMaterials);
			LITTLE_BIG_SWAP(ofsTextureIDs);
			LITTLE_BIG_SWAP(numTextureIDs);
			LITTLE_BIG_SWAP(ofsMeshes);
			LITTLE_BIG_SWAP(numMeshes);
		}
	}
};
typedef struct TDVertexGroup_s {
	unsigned int	ofsVerts;
	unsigned int	ofsVertsExData;
	unsigned int	unknownA;
	unsigned int	unknownB;
	unsigned int	sizeVert;
	unsigned int	sizeVertExData;
	unsigned int	unknownD;
	unsigned int	unknownE;
	unsigned int	numVerts;
	unsigned int	ofsIndexBuffer;
	unsigned int	numIndexes;
} TDVertexGroup_t;
template <bool big>
struct TDVertexGroup : public TDVertexGroup_s {
	TDVertexGroup(TDVertexGroup_t * ptr) : TDVertexGroup_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(ofsVerts);
			LITTLE_BIG_SWAP(ofsVertsExData);
			LITTLE_BIG_SWAP(unknownA);
			LITTLE_BIG_SWAP(unknownB);
			LITTLE_BIG_SWAP(sizeVert);
			LITTLE_BIG_SWAP(sizeVertExData);
			LITTLE_BIG_SWAP(unknownD);
			LITTLE_BIG_SWAP(unknownE);
			LITTLE_BIG_SWAP(numVerts);
			LITTLE_BIG_SWAP(ofsIndexBuffer);
			LITTLE_BIG_SWAP(numIndexes);
		}
	}
};
typedef struct TDBatch_s {
	unsigned int	vertexGroupIndex;
	unsigned int	vertexStart;
	unsigned int	indexStart;
	unsigned int	numVerts;
	unsigned int	numIndices;
} TDBatch_t;
template <bool big>
struct TDBatch : public TDBatch_s {
	TDBatch(TDBatch_t * ptr) : TDBatch_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(vertexGroupIndex);
			LITTLE_BIG_SWAP(vertexStart);
			LITTLE_BIG_SWAP(indexStart);
			LITTLE_BIG_SWAP(numVerts);
			LITTLE_BIG_SWAP(numIndices);
		}
	}
};
typedef struct TDBatcGroups_s {
	struct {
		unsigned int ofsBatchGroup;
		unsigned int numBatch;
	} groups[5];
} TDBatchGroups_t;
template <bool big>
struct TDBatchGroups : public TDBatcGroups_s {
	TDBatchGroups(TDBatchGroups_t * ptr) : TDBatcGroups_s(*ptr) {
		if (big) {
			for (int i = 0; i < 5; i++) {
				LITTLE_BIG_SWAP(groups[i].ofsBatchGroup);
				LITTLE_BIG_SWAP(groups[i].numBatch);
			}
		}
	}
};
typedef struct TDBatchInfo_s
{
	unsigned int	batchIndex;
	unsigned int	meshIndex;
	unsigned short	materialIndex;
	short			boneSetIndex;
	int				unknown;
} TDBatchInfo_t;
template <bool big>
struct TDBatchInfo : TDBatchInfo_s {
	TDBatchInfo(TDBatchInfo_t * ptr) : TDBatchInfo_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(batchIndex);
			LITTLE_BIG_SWAP(meshIndex);
			LITTLE_BIG_SWAP(materialIndex);
			LITTLE_BIG_SWAP(boneSetIndex);
			LITTLE_BIG_SWAP(unknown);
		}
	}
};
typedef struct TDBone_s
{
	short			globalId;
	short			ttIndex;
	short			parentIndex;
	short			padding;
	bayoVector_t	localPosition;
	bayoVector_t	position;
} TDBone_t;
template <bool big>
struct TDBone : public TDBone_s {
	TDBone(TDBone_t * ptr) : TDBone_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(globalId);
			LITTLE_BIG_SWAP(ttIndex);
			LITTLE_BIG_SWAP(parentIndex);
			LITTLE_BIG_SWAP(padding);
			localPosition.swap();
			position.swap();
		}
	}
};
typedef struct TDBoneSet_s {
	unsigned int	ofsBoneSet;
	unsigned int	numBoneIndices;
} TDBoneSet_t;
template <bool big>
struct TDBoneSet : public TDBoneSet_s {
	TDBoneSet(TDBoneSet_t * ptr) : TDBoneSet_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(ofsBoneSet);
			LITTLE_BIG_SWAP(numBoneIndices);
		}
	}
};
typedef struct TDMaterial_s
{

	unsigned int	ofsShaderName;
	unsigned int	ofsTextures;
	unsigned int	unknownA;
	unsigned int	ofsParameters;
	unsigned short	unknownB;
	unsigned short	numTextures;
	unsigned short	unknownC;
	unsigned short	numParameters;
} TDMaterial_t;
template <bool big>
struct TDMaterial : public TDMaterial_s {
	TDMaterial(TDMaterial_t * ptr) : TDMaterial_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(ofsShaderName);
			LITTLE_BIG_SWAP(ofsTextures);
			LITTLE_BIG_SWAP(unknownA);
			LITTLE_BIG_SWAP(ofsParameters);
			LITTLE_BIG_SWAP(unknownB);
			LITTLE_BIG_SWAP(numTextures);
			LITTLE_BIG_SWAP(unknownC);
			LITTLE_BIG_SWAP(numParameters);
		}
	}
};
typedef struct TDTexture_s
{
	unsigned int	ofsName;
	int				textureIndex;
} TDTexture_t;
template <bool big>
struct TDTexture : public TDTexture_s {
	TDTexture(TDTexture_t * ptr) : TDTexture_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(ofsName);
			LITTLE_BIG_SWAP(textureIndex);
		}
	}
};
typedef struct TDMesh_s {
	unsigned int	ofsName;
	float			boundingBox[6];
	struct {
		unsigned int	ofsBatchGroupIndex;
		unsigned int	numBatchGroupIndices;
	} groups[5];
	unsigned int	ofsMaterials;
	unsigned int	numMaterials;
} TDMesh_t;
template <bool big>
struct TDMesh : public TDMesh_s {
	TDMesh(TDMesh_t * ptr) : TDMesh_s(*ptr) {
		if (big) {
			LITTLE_BIG_SWAP(ofsName);
			for (int i = 0; i < 6; i++) {
				LITTLE_BIG_SWAP(boundingBox[i]);
			}
			for (int i = 0; i < 5; i++) {
				LITTLE_BIG_SWAP(groups[i].ofsBatchGroupIndex);
				LITTLE_BIG_SWAP(groups[i].numBatchGroupIndices);
			}
			LITTLE_BIG_SWAP(ofsMaterials);
			LITTLE_BIG_SWAP(numMaterials);
		}
	}
};

template <>
static void Model_Bayo_GetTextureBundle<TD>(CArrayList<bayoDatFile_t *> &texFiles, CArrayList<bayoDatFile_t> &dfiles, bayoDatFile_t &df, noeRAPI_t *rapi) {
	Model_Bayo_GetTextureBundle<BAYONETTA2>(texFiles, dfiles, df, rapi);
}

template <>
static void Model_Bayo_LoadTextures<false, TD>(CArrayList<noesisTex_t *> &textures, CArrayList<bayoDatFile_t *> &texFiles, noeRAPI_t *rapi) {
	Model_Bayo_LoadTextures<false, NIER_AUTOMATA>(textures, texFiles, rapi);
}

template <bool big, game_t game>
static void Model_TD_LoadMaterials(
	TDWMBHdr<big> &hdr,
	CArrayList<noesisTex_t *> &textures,
	CArrayList<noesisMaterial_t *> &matList,
	CArrayList<noesisMaterial_t *> &matListLightMap,
	CArrayList<noesisMaterial_t *> &totMatList,
	BYTE *data,
	noeRAPI_t *rapi) {

	TDMaterial_t *matPtr = (TDMaterial_t *)(data + hdr.ofsMaterials);
	unsigned int *textureIDs = (unsigned int *)(data + hdr.ofsTextureIDs);

	DBGLOG("Found %d materials\n", hdr.numMaterials);
	for (int i = 0; i < hdr.numMaterials; i++)
	{
		TDMaterial<big> mat(matPtr + i);
		DBGLOG("\tFound %s\n", data + mat.ofsShaderName);
		noesisMaterial_t *nmat = rapi->Noesis_GetMaterialList(1, true);
		char matName[128];
		sprintf_s(matName, 128, "bayomat%i", i);
		DBGLOG(" name: %s,", matName);
		nmat->name = rapi->Noesis_PooledString(matName);
		nmat->noDefaultBlend = false;
		nmat->texIdx = -1;
		DBGLOG("Deactivating normal\n"); //cell shaded game.
		nmat->ex->flags2 |= NMATFLAG2_PREFERPPL;
		nmat->normalTexIdx = -1;
		nmat->specularTexIdx = -1;
		int difTexId = 0;
		int nrmTexId = 0;
		int specTexId = 0;
		int maskTexId = 0;
		DBGLOG("\tFound %d textures\n", mat.numTextures);
		TDTexture_t * texPtr = (TDTexture_t *)(data + mat.ofsTextures);
		for (unsigned int j = 0; j < mat.numTextures; j++) {
			TDTexture<big> tex(texPtr + j);
			if (strcmp((char*)(data + tex.ofsName), "Albedo0") == 0) {
				difTexId = textureIDs[tex.textureIndex];
			}
			if (strcmp((char*)(data + tex.ofsName), "NormalMap0") == 0) {
				nrmTexId = textureIDs[tex.textureIndex];
			}
		}
		for (int j = 0; j < textures.Num(); j++) {
			noesisTex_t *tex = textures[j];
			if (difTexId && tex->globalIdx == difTexId) {
				DBGLOG("Found matching texture %d\n", j);
				nmat->texIdx = j;
			}
			if (nrmTexId && tex->globalIdx == nrmTexId) {
				DBGLOG("Found matching normal %d\n", j);
				nmat->normalTexIdx = j;
				nmat->ex->flags2 &= ~NMATFLAG2_PREFERPPL;
			}
		}
{'fraction_non_alphanumeric': 0.11511574604629841, 'fraction_numerical': 0.008365803346321338, 'mean_word_length': 4.535363146209959, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 85, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2176623', 'n_tokens_mistral': 8289, 'n_tokens_neox': 7394, 'n_words': 1339}