User:Erythros: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
Line 5: Line 5:
In my efforts to re-skin or re-model preexisting Portal models I have learned a few things.
In my efforts to re-skin or re-model preexisting Portal models I have learned a few things.


I use Cannonfodder's MDL decompiler to decompile all of the models I've worked on. I have found however that certain models cause the decompiler to crash. Upon closer inspection I found that headers of Portal MDL files were different when compared to Half Life 2 MDLs. This can easily over come with a simply HEX editor.
==== Decompiling ====


The Header Begins as
I use [[User:Cannonfodder|Cannonfodder's]] [http://www.chaosincarnate.net/cannonfodder/mdldecompiler.php| MDL decompiler] on all of the models I work with. I have had several models cause the decompiler to crash. Upon closer inspection I found that the error seems to be with how the decompiler handled the headers of some Portal MDL files. By comparing MDLs that successfully decompiled against ones that failed, using a text editor, I noticed that the first 4 characters where consistent throughout all the models, and the first 5 where consistent in the models that decompiled. My theory is that the decompiler expects the first five characters to be a set standard, and when they deviate it errors out. I tested this by opening one of the offending MDLs in a hex editor and changing the 5th character to reflect what I thought the decompiler expected. After saving the result I ran the MDL through the decompiler without further problems. I have successfully used this method on multiple models that have otherwise failed to decompile.
[[
 
49 44 53 54
 
]]
The header should read:
49 44 53 54 2C
Which if read in a text editor displays as:
IDST,


== Materials ==
== Materials ==

Revision as of 07:40, 7 February 2008

All info will pertain to Portal. The majority of the models or materials I have worked on were not created by me. I have merely decompiled and edited as needed.

Models

In my efforts to re-skin or re-model preexisting Portal models I have learned a few things.

Decompiling

I use Cannonfodder's MDL decompiler on all of the models I work with. I have had several models cause the decompiler to crash. Upon closer inspection I found that the error seems to be with how the decompiler handled the headers of some Portal MDL files. By comparing MDLs that successfully decompiled against ones that failed, using a text editor, I noticed that the first 4 characters where consistent throughout all the models, and the first 5 where consistent in the models that decompiled. My theory is that the decompiler expects the first five characters to be a set standard, and when they deviate it errors out. I tested this by opening one of the offending MDLs in a hex editor and changing the 5th character to reflect what I thought the decompiler expected. After saving the result I ran the MDL through the decompiler without further problems. I have successfully used this method on multiple models that have otherwise failed to decompile.


The header should read:

49 44 53 54 2C

Which if read in a text editor displays as:

IDST,

Materials