8,484
edits
Paradox-01 (talk | contribs) m (correction on hierarchy)  | 
				Paradox-01 (talk | contribs)  m (restoring binary reader of AKEV AGQG)  | 
				||
| Line 810: | Line 810: | ||
  ' [...]  |   ' [...]  | ||
  ' INFO : TXMPWH_DCTRBND  |   ' INFO : TXMPWH_DCTRBND  | ||
====AKEV AGQG====  | |||
 read_AGQG_binary  | |||
 sub read_AGQG_binary  | |||
 	OniInputFile =  "C:\Oni\AE\GameDataFolder\L3\AKEVlab.oni"  | |||
 	' ##############################################  | |||
 	Set OniInputFileStream = CreateObject("ADODB.Stream")  | |||
 	OniInputFileStream.Type = 1  | |||
 	OniInputFileStream.Open  | |||
 	OniInputFileStream.LoadFromFile OniInputFile  | |||
 	data_table_offset = "&H20"  | |||
 	AGQG_table_offset = "&H94"  | |||
 	AGQG_table_size   = "&H9C"  | |||
 	ByteNum = 4  | |||
 	OniInputFileStream.Position = clng(data_table_offset)  | |||
 	BArr0 = OniInputFileStream.Read(ByteNum)  | |||
 	ByteNum = 4  | |||
 	OniInputFileStream.Position = clng(AGQG_table_offset)  | |||
 	BArr1 = OniInputFileStream.Read(ByteNum)  | |||
 	ByteNum = 4  | |||
 	OniInputFileStream.Position = clng(AGQG_table_size)  | |||
 	BArr2 = OniInputFileStream.Read(ByteNum)  | |||
 	newhex = ""  | |||
 	data_table_offset_hex = SimpleBinaryToString(BArr0)  | |||
 	for i = ubound(data_table_offset_hex) - 1 to 0 step -1  | |||
 		h = hex(Asc(data_table_offset_hex(i)))  | |||
 		if len(h) = 1 then  | |||
 			h = "0" & h  | |||
 		end if  | |||
 		newhex = newhex & h  | |||
 	next  | |||
 	logmessage newhex  | |||
 	logmessage "data table offset: " & cLng("&H" & newhex)  | |||
 	data_table_offset_int = cLng("&H" & newhex)  | |||
 	newhex = ""  | |||
 	AGQG_offset_hex = SimpleBinaryToString(BArr1)  | |||
 	for i = ubound(AGQG_offset_hex) - 1 to 0 step -1  | |||
 		h = hex(Asc(AGQG_offset_hex(i)))  | |||
 		if len(h) = 1 then  | |||
 			h = "0" & h  | |||
 		end if  | |||
 		newhex = newhex & h	  | |||
 	next  | |||
 	logmessage newhex  | |||
 	logmessage "AGQG table offset: " & cLng("&H" & newhex)  | |||
 	AGQG_offset_int = cLng("&H" & newhex)  | |||
 	newhex = ""  | |||
 	AGQG_size_hex = SimpleBinaryToString(BArr2)  | |||
 	for i = ubound(AGQG_size_hex) - 1 to 0 step -1  | |||
 		h = hex(Asc(AGQG_size_hex(i)))  | |||
 		if len(h) = 1 then  | |||
 			h = "0" & h  | |||
 		end if  | |||
 		newhex = newhex & h	  | |||
 	next  | |||
 	logmessage newhex  | |||
 	logmessage "AGQG table size: " & cLng("&H" & newhex)  | |||
 	AGQG_size_int = cLng("&H" & newhex)   | |||
   	logmessage "------------------------------"  | |||
   	AGQG_start = data_table_offset_int + AGQG_offset_int - 8  | |||
   	AGQG_end   = data_table_offset_int + AGQG_offset_int + AGQG_size_int - 8  | |||
   	logmessage "AGQG_start: " & AGQG_start  | |||
 	' AGQG array size  | |||
  	ByteNum = 4  | |||
 	OniInputFileStream.Position = AGQG_start + 28  | |||
 	BArr3 = OniInputFileStream.Read(ByteNum)  | |||
 	TContent = SimpleBinaryToString(BArr3)  | |||
   	logmessage "------------------------------"  | |||
 	newhex = 0  | |||
 	for i = ubound(TContent) to 0 step -1  | |||
 		h = hex(Asc(TContent(i)))  | |||
 		if len(h) = 1 then  | |||
 			h = "0" & h  | |||
 		end if  | |||
 		newhex = newhex & h	  | |||
 	next  | |||
 	AGQG_array_size = clng("&H" & newhex)   | |||
 	logmessage "AGQG array size: " & clng("&H" & newhex)  | |||
 	' reduce number by header space  | |||
 	ByteNum = AGQG_size_int - 31  | |||
 	' skip bytes used by header  | |||
 	OniInputFileStream.Position = AGQG_start + 32  | |||
 	BArr4 = OniInputFileStream.Read(ByteNum)  | |||
 	TContent2 = SimpleBinaryToString(BArr4)  | |||
 	c = -1  | |||
 	loop_count = 1  | |||
 	h = ""  | |||
 	newhex = ""  | |||
 	color = 0  | |||
 	logmessage "----------"  | |||
 	logmessage "element: 1"  | |||
 	for i = 0 to ubound(TContent2) - 1  | |||
 		c = c + 1  | |||
 		if c = 56 then  | |||
 			c = 0  | |||
 			loop_count = loop_count + 1  | |||
 			logmessage "----------"  | |||
 			logmessage "element: " & loop_count  | |||
 		end if  | |||
 		h = hex(Asc(TContent2(i)))  | |||
 		if len(h) = 1 then  | |||
 			h = "0" & h  | |||
 		end if  | |||
 		newhex = newhex & h  | |||
 		if i mod 56 = 32 then  | |||
 			color = 1  | |||
 		end if  | |||
 		if i mod 56 = 48 then  | |||
 			color = 0  | |||
 		end if  | |||
 		if i mod 56 = 52 then  | |||
 			objid = 1  | |||
 		end if  | |||
 		if i mod 56 = 0 then  | |||
 			objid = 0  | |||
 		end if  | |||
 		if len(newhex) = 8 then  | |||
 			if color = 1 then  | |||
 				logmessage newhex & " (color: " & clng(("&H" & left(newhex, 2))) _  | |||
 				& " " & clng("&H" & mid(newhex, 3, 2)) _  | |||
 				& " " & clng("&H" & mid(newhex, 5, 2)) _  | |||
 				& " " & clng("&H" & mid(newhex, 7, 2)) & ")"  | |||
 			elseif objid = 1 then  | |||
 				if newhex = "FFFFFFFF" then  | |||
 					logmessage newhex & " (object id: -1)"  | |||
 				else  | |||
 					logmessage newhex  | |||
 				end if  | |||
 			else  | |||
 				logmessage newhex  | |||
 			end if  | |||
 			newhex = ""  | |||
 		end if  | |||
 	next  | |||
 end sub  | |||
 Function SimpleBinaryToString(Binary)  | |||
 	ReDim tmpArr(LenB(Binary) - 1)  | |||
 	For I = 1 To LenB(Binary)  | |||
 		S = Chr(AscB(MidB(Binary, I, 1)))  | |||
 		tmpArr(I - 1) = S  | |||
 		'logmessage "hex = " & hex(AscB(S))  | |||
 	Next  | |||
 	SimpleBinaryToString = tmpArr  | |||
 End Function  | |||
edits