Unity 3d Assets files
- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
Hey Luigi! I've enhanced your script with some type distinctions (function disttype) and thus changed the name creation. Take a look and decide if you want to use this or parts of it! The advantage could be that others can contribute and add other identified file types.
			
			
									
						
										
						- 
				aluigi
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unity 3d Assets files
Very cool idea, I have updated the script accordingly.
The only thing I changed was the FNAME generation that I have set just like it was before plus the extension.
			
			
									
						
										
						The only thing I changed was the FNAME generation that I have set just like it was before plus the extension.
- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
Updated disttype function with aif:
			
			
									
						
										
						Code: Select all
startfunction disttype
   string EXT p= ".%d" TYPE
   if TYPE == 21
      set EXT ".mat"
   elif TYPE == 28
      set EXT ".tex"
   elif TYPE == 48
      set EXT ".shader"
   elif TYPE == 49
      savepos MYOFF
      goto OFFSET
      get DUMMY long
      getDstring TEST 4
      if TEST == "<?xm"
         math OFFSET += 4
         math SIZE -= 4
         set EXT ".xml"
      endif
      goto MYOFF
   elif TYPE == 74
      set EXT ".ani"
   elif TYPE == 83
      set EXT ".snd"
      savepos MYOFF
      goto OFFSET
      getDstring DUMMY 0x14
      getDstring TEMP 4
      if TEMP == "OggS"
         set EXT ".ogg"
         math OFFSET += 0x14
         math SIZE -= 0x14
      elif TEMP == "RIFF"
         set EXT ".wav"
         math OFFSET += 0x14
         math SIZE -= 0x14
      elif TEMO == "FORM"
         set EXT ".aif"
         math OFFSET += 0x14
         math SIZE -= 0x14
      endif
      goto MYOFF
   elif TYPE == 115
      set EXT ".script"
   elif TYPE == 128
      set EXT ".ttf"
   elif TYPE == 150
      set EXT ".bin"
   elif TYPE == 152
      math OFFSET += 0x10
      math SIZE -= 0x10
      set EXT ".ogm"
   elif TYPE == 156
      set EXT ".ter"
   elif TYPE == 184
      set EXT ".sbam"
   elif TYPE == 194
      set EXT ".tes"
   endif
endfunction- 
				Haoose
- Posts: 68
- Joined: Thu Aug 07, 2014 9:43 pm
Re: Unity 3d Assets files
AlphaTwentyThree
TEMO → TEMP
			
			
									
						
										
						elif TEMO == "FORM"
TEMO → TEMP
- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
Haoose wrote:AlphaTwentyThreeelif TEMO == "FORM"
TEMO → TEMP
Whoops, sorry.

- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
Here's an updated version of disttype with mp3 added! 
			
			
													
Code: Select all
startfunction disttype
   string EXT p= ".%d" TYPE
   if TYPE == 21
      set EXT ".mat"
   elif TYPE == 28
      set EXT ".tex"
   elif TYPE == 48
      set EXT ".shader"
   elif TYPE == 49
      savepos MYOFF
      goto OFFSET
      get DUMMY long
      getDstring TEST 4
      if TEST == "<?xm"
         math OFFSET += 4
         math SIZE -= 4
         set EXT ".xml"
      endif
      goto MYOFF
   elif TYPE == 74
      set EXT ".ani"
   elif TYPE == 83
      set EXT ".snd"
      savepos MYOFF
      math OFFSET += 0x14
      math SIZE -= 0x14
      goto OFFSET
      getDstring TEMP 4
      if TEMP == "OggS"
         set EXT ".ogg"
      elif TEMP == "RIFF"
         set EXT ".wav"
      elif TEMP == "FORM"
         set EXT ".aif"
      else
         goto OFFSET
         get TEMP byte
         if TEMP == 0xff
            set EXT ".mp3"
         elif TEMP == 0x49
            savepos MYOFF
            math MYOFF -= 1
            goto MYOFF
            getDstring TEMP 3
            if TEMP == "ID3"
               set EXT ".mp3"
            else
               math OFFSET -= 0x14
               math SIZE += 0x14
            endif
         else # roll back changes
            math OFFSET -= 0x14
            math SIZE += 0x14
         endif
      endif
      goto MYOFF
   elif TYPE == 115
      set EXT ".script"
   elif TYPE == 128
      set EXT ".ttf"
   elif TYPE == 150
      set EXT ".bin"
   elif TYPE == 152
      math OFFSET += 0x10
      math SIZE -= 0x10
      set EXT ".ogm"
   elif TYPE == 156
      set EXT ".ter"
   elif TYPE == 184
      set EXT ".sbam"
   elif TYPE == 194
      set EXT ".tes"
   endif
endfunction
					Last edited by AlphaTwentyThree on Sat Mar 28, 2015 11:13 am, edited 2 times in total.
									
			
						
										
						- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
I've encountered Android games the have split assets archives. Here's a little bit of code that will take care of these (always apply to the *.assets.split0 obviously):
			
			
									
						
										
						Code: Select all
get EXT extension
if EXT == "split0"
   callfunction combine 1
endif
startfunction combine
   get BNAME basename
   set CSIZE 0
   for i = 0
      string ONAME p= "%s.split%d" BNAME i
      open FDSE ONAME 0 EXIST
      if EXIST == 0
         break
      else
         get SIZE asize
         append
         log MEMORY_FILE 0 SIZE
         append
      endif
   next i
   get SIZE asize MEMORY_FILE
   log BNAME 0 SIZE MEMORY_FILE
   open FDSE BNAME 0
endfunction- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
Just made another update on the disttype function above for MP3 files with an ID3 tag at the start. 
			
			
									
						
										
						
- 
				aluigi
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unity 3d Assets files
Well done, I have updated the script.
			
			
									
						
										
						- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
aluigi wrote:Well done, I have updated the script.
Hm, what about the split files support?
- 
				aluigi
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unity 3d Assets files
I thought yours is a standalone script.
I think it's difficult to implement it in unity.bms because it reads from file 0, while if you combile the splits you have a memory file or a new local file that probably can't be opened by quickbms because it's in the output folder.
			
			
									
						
										
						I think it's difficult to implement it in unity.bms because it reads from file 0, while if you combile the splits you have a memory file or a new local file that probably can't be opened by quickbms because it's in the output folder.
- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
Huh? 
I've just implemented it and it works perfectly fine:
			
			
									
						
										
						
I've just implemented it and it works perfectly fine:
Code: Select all
get EXT extension
if EXT == "unity3d"
    print "Error: you must use the unity3d_webplayer.bms script for this archive"
    cleanexit
elif EXT == "split0"
   callfunction combine 1
   open FDSE BNAME 0
endif
startfunction combine
   get BNAME basename
   set CSIZE 0
   for i = 0
      string ONAME p= "%s.split%d" BNAME i
      open FDSE ONAME 0 EXIST
      if EXIST == 0
         break
      else
         get SIZE asize
         append
         log MEMORY_FILE 0 SIZE
         append
      endif
   next i
   get SIZE asize MEMORY_FILE
   log BNAME 0 SIZE MEMORY_FILE
endfunction
goto 0
# rest of script- 
				aluigi
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unity 3d Assets files
Cool, quickbms rocks 
I have updated the script with minimal modifications to your code but I think it works.
			
			
									
						
										
						
I have updated the script with minimal modifications to your code but I think it works.
- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
Here are some archives that produce an error: http://*USE_ANOTHER_FILEHOSTING*/3641934 ... ts_prob.7z
An update would be cool
			
			
									
						
										
						An update would be cool

- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
aluigi wrote:Cool, quickbms rocks
I have updated the script with minimal modifications to your code but I think it works.
line 264: "append" instead of "ppend" will work slightly better.

Cool thing you implemented my suggestion!

- 
				aluigi
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unity 3d Assets files
Ah ah ah, I'm not even good at using copy&paste.
			
			
									
						
										
						- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
lol 
Don't miss my little post in-between about the error archives.
			
			
									
						
										
						
Don't miss my little post in-between about the error archives.

- 
				aluigi
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unity 3d Assets files
I have fixed the disttype function because you didn't return to the original information offset.
Now it does it automatically so you don't even need to save it and use "goto OFFSET" because it's already done.
			
			
									
						
										
						Now it does it automatically so you don't even need to save it and use "goto OFFSET" because it's already done.
- 
				AlphaTwentyThree
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: Unity 3d Assets files
aluigi wrote:I have fixed the disttype function because you didn't return to the original information offset.
Now it does it automatically so you don't even need to save it and use "goto OFFSET" because it's already done.
whoops...
 Thanks for that
 Thanks for that 
- 
				happyend
- Posts: 157
- Joined: Sun Aug 24, 2014 8:54 am
Re: Unity 3d Assets files
hi~~aluigi
script not support 5.0.1f1,get some error
offset filesize filename
--------------------------------------
- SCRIPT's MESSAGE:
5.0.1f1
001a8494 104 TYPE_21/DirectionalLight.mat
001a8494 108 TYPE_120/DirectionalLight.120
001a8483 0 TYPE_248/resources_2.248
001a8480 4 TYPE_0/DirectionalLight.0
00198495 0 TYPE_5/resources_4.5
001a8495 4294901781 TYPE_0/resources_5.0
Error: impossible to write 0xffff0015 bytes (total 0xffff0015)
Check your disk space
Last script line before the error or that produced the error:
157 log FNAME OFFSET SIZE
================================================================
offset filesize filename
--------------------------------------
- SCRIPT's MESSAGE:
5.0.1f1
00024004 80 TYPE_150/sharedassets0_0.bin
0000a0c0 106392 TYPE_360/EmptyBrush.360
0000a0b3 0 TYPE_106768/sharedassets0_2.106768
0000a0b0 4 TYPE_0/EmptyBrush.0
Error: incomplete input file 0: D:\Unity 5\sharedassets0.assets
Can't read 4 bytes from offset ffffa0c5.
Anyway don't worry, it's possible that the BMS script has been written
to exit in this way if it's reached the end of the archive so check it
or contact its author or verify that all the files have been extracted.
Please check the following coverage information to know if it's ok.
coverage file 0 0% 107897 73012508
Last script line before the error or that produced the error:
122 get NAMESZ long
			
			
									
						
										
						script not support 5.0.1f1,get some error
offset filesize filename
--------------------------------------
- SCRIPT's MESSAGE:
5.0.1f1
001a8494 104 TYPE_21/DirectionalLight.mat
001a8494 108 TYPE_120/DirectionalLight.120
001a8483 0 TYPE_248/resources_2.248
001a8480 4 TYPE_0/DirectionalLight.0
00198495 0 TYPE_5/resources_4.5
001a8495 4294901781 TYPE_0/resources_5.0
Error: impossible to write 0xffff0015 bytes (total 0xffff0015)
Check your disk space
Last script line before the error or that produced the error:
157 log FNAME OFFSET SIZE
================================================================
offset filesize filename
--------------------------------------
- SCRIPT's MESSAGE:
5.0.1f1
00024004 80 TYPE_150/sharedassets0_0.bin
0000a0c0 106392 TYPE_360/EmptyBrush.360
0000a0b3 0 TYPE_106768/sharedassets0_2.106768
0000a0b0 4 TYPE_0/EmptyBrush.0
Error: incomplete input file 0: D:\Unity 5\sharedassets0.assets
Can't read 4 bytes from offset ffffa0c5.
Anyway don't worry, it's possible that the BMS script has been written
to exit in this way if it's reached the end of the archive so check it
or contact its author or verify that all the files have been extracted.
Please check the following coverage information to know if it's ok.
coverage file 0 0% 107897 73012508
Last script line before the error or that produced the error:
122 get NAMESZ long