8,484
edits
Paradox-01 (talk | contribs)  (there's a problem with reading some registry keys on a 64-bit OS with an 32-bit program)  | 
				Paradox-01 (talk | contribs)   (not a fan of VbsEdit (especially since testing the code is delayed to force annoyance onto the user to buy the god damn license) but it can compile scripts to a program)  | 
				||
| Line 1: | Line 1: | ||
===build an vbs executable===  | |||
[[Image:VbsEdit_for_scripting_and_compiling.png|thumb]]  | |||
Executable, app(lication), program. Whatever you call it, sometimes it might be necessary to compile the script into an actual program.  | |||
Even though vbs is a script language and not a programming language, it can be done.  | |||
VbsEdit is an editor to fulfill such task with ease.  | |||
: Just goto ''File > Convert into Executable''. Choose output path, 32/64-bit version and hit OK.  | |||
===OS bit version===  | ===OS bit version===  | ||
  if GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth = 64 then  |   if GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth = 64 then  | ||
| Line 27: | Line 38: | ||
  wText.WriteLine AE_path  |   wText.WriteLine AE_path  | ||
  wText.Close  |   wText.Close  | ||
===read file===  | |||
====as binary====  | |||
 scan_AKEV_file_table  | |||
 sub scan_AKEV_file_table  | |||
 	' ##############################################  | |||
 	OniInputFile =  "H:\Oni\AE\GameDataFolder\level1_Final\AKEVEnvWarehouse.oni"  | |||
 	' ##############################################  | |||
 	Set OniInputFileStream = CreateObject("ADODB.Stream")  | |||
 	OniInputFileStream.Type = 1  | |||
 	OniInputFileStream.Open  | |||
 	OniInputFileStream.LoadFromFile OniInputFile  | |||
 	' ### read AKEV textures table offset and size  | |||
 	ByteNum = 4  | |||
 	' ##############################################  | |||
 	TOffset = cLng("&H" & "28")  | |||
 	' ##############################################  | |||
 	OniInputFileStream.Position = TOffset  | |||
 	BArr1 = OniInputFileStream.Read(ByteNum)  | |||
 	ByteNum = 4  | |||
 	' ##############################################  | |||
 	TSize = cLng ("&H" & "2C")  | |||
 	' ##############################################  | |||
 	OniInputFileStream.Position = TSize  | |||
 	BArr2 = OniInputFileStream.Read(ByteNum)  | |||
 	' ### get AKEV textures table offset and size  | |||
 	TOffsetHex = SimpleBinaryToString(BArr1)  | |||
 	for i = ubound(TOffsetHex ) - 1 to 0 step -1  | |||
 		newhex = newhex & hex(Asc(TOffsetHex(i)))  | |||
 	next  | |||
 	logmessage newhex  | |||
 	logmessage "name table offset: " & cLng("&H" & newhex)  | |||
 	TOffsetInt = cLng("&H" & newhex)  | |||
 	newhex = ""  | |||
 	TSizeHex = SimpleBinaryToString(BArr2)  | |||
 	for i = ubound(TSizeHex) - 1 to 0 step -1  | |||
 		newhex = newhex & hex(Asc(TSizeHex(i)))  | |||
 	next  | |||
 	logmessage newhex  | |||
 	logmessage "name table size: " & cLng("&H" & newhex)  | |||
 	TSizeInt = cLng("&H" & newhex)   | |||
   	logmessage "------------------------------"  | |||
 	' ### read table content  | |||
 	ByteNum = TSizeInt  | |||
 	OniInputFileStream.Position = TOffsetInt  | |||
 	BArr3 = OniInputFileStream.Read(ByteNum)  | |||
 	TContent = SimpleBinaryToString(BArr3)  | |||
 	' ### name grapper  | |||
 	NG = ""  | |||
 	for each n in TContent  | |||
 		if not Asc(n) = 0 then  | |||
 			NG = NG & n  | |||
 		else  | |||
 			'if instr(NG, "TXMP") = 1 then  | |||
 				' write TXMP to array ?  | |||
 				logmessage NG  | |||
 			'end if  | |||
 			NG = ""  | |||
 		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  | |||
 	Next  | |||
 	SimpleBinaryToString = tmpArr  | |||
 End Function  | |||
Output:  | |||
 ' INFO : 0E40  | |||
 ' INFO : name table offset: 3648  | |||
 ' INFO : 0A4A  | |||
 ' INFO : name table size: 2634  | |||
 ' INFO : ------------------------------  | |||
 ' INFO : AKEVEnvWarehouse  | |||
 ' INFO : AGDBEnvWarehouse  | |||
 ' INFO : TXMP_DOOR_FRAME  | |||
 ' INFO : TXMPNONE  | |||
 ' INFO : TXMPSUMI_1  | |||
 ' INFO : TXMPTC_CONTROL_01  | |||
 ' [...]  | |||
 ' INFO : TXMPWH_DCTRBND  | |||
| Line 203: | Line 311: | ||
  	'qW = ... * -1  |   	'qW = ... * -1  | ||
  'set qRotation = XSIMath.CreateQuaternion (qW, qX, qY, qZ)  |   'set qRotation = XSIMath.CreateQuaternion (qW, qX, qY, qZ)  | ||
[[Category:Windows-only modding tools]]  | [[Category:Windows-only modding tools]]  | ||
edits