Forum > Miscellaneous
[QUESTION] Basic ADT C# Reader
<< < (3/5) > >>
Keta:
--- Quote from: "schlumpf" ---Cryect's tools really seem to be the best start. They are small and easy to understand. Only problem here: They always only read parts of the file, not the whole file. --- End quote --- But as far as I remember, I see a lot of places where people states that CryectsTools is outdated regarding reading of ADTs. The structure has changed since then, so it doesn't work 100%. Or is that just all rubbish?
And yeah, it only reads parts of the file, whereas I would like a source code that reads the whole file... :/
Thanks Keta
schlumpf:
The only way to do it properly would be writing it yourself from the wiki and own reverse engineering. The wiki is wrong on some parts as well.
You can also try viewtopic.php?f=59&t=830.
Keta:
So I've come to the conclusion that after reading up on Binary and getting some help from Steff, that CryectsTools CPP files would probably be the best way to go, for a quick understanding of the structure and such. However I've encountered a roadblock :s I was hoping someone could help me translate this piece of C++ into C#...
--- Code: ---void LoadMTEX() { unsigned int TexSize; fseek(Input,0x14+0x04+MTEX_Offset,SEEK_SET); fread(&TexSize,sizeof(int),1,Input); Textures=new char[TexSize]; fread(Textures,sizeof(char),TexSize,Input);
for(int i=0;i<TexSize-1;i++) if (Textures[i]==0) Textures[i]='n'; } --- End code ---
Because this is what I got so far, and its still very filled with errors, according to Visual Studio:
--- Code: ---void LoadMTEX() { uint TexSize; using (BinaryReader b = new BinaryReader(File.Open("C:\Maruum_51_17.adt", FileMode.Open))) { b.BaseStream.Seek(0x14 + 0x04 + MTEX_Offset, SeekOrigin.Begin); TexSize = b.ReadUInt32(); Textures = new char[TexSize]; for (int i = 0; i < TexSize - 1; i++) if (Textures[i] == 0) Textures[i] = 'n';
} --- End code ---
So yea, any help please? :)
Thanks Keta
Mjollna:
Mmmh, I've never done any C#, but I think there may be something wrong at that line :
--- Code: ---Textures=new char[TexSize]; --- End code ---
I tried : http://msdn.microsoft.com/en-us/library ... 53(v=vs.71).aspx This page mentions you have to the array beforehand, something like :
--- Code: ---char[] Textures; --- End code ---
Hope that helps...
Keta:
--- Quote from: "Mjollna" ---Mmmh, I've never done any C#, but I think there may be something wrong at that line :
--- Code: ---Textures=new char[TexSize]; --- End code ---
I tried : http://msdn.microsoft.com/en-us/library ... 53(v=vs.71).aspx This page mentions you have to the array beforehand, something like :
--- Code: ---char[] Textures; --- End code ---
Hope that helps... --- End quote --- Oh yeah those parts I already got fixed. Thanks thought :) Its mainly the "fread" and the "fseek" I find confusing u.u
Thanks Keta
Navigation
[0] Message Index
[#] Next page
[*] Previous page
|