Welcome
Ladies and Gents:

These forums are now closed and registration disabled.

Please join us at our new forum on Proboards. Our hope is that these new forums are more stable, provide more and better features, and allow continuation of the project forums in a safer, more secure, long term environment.

me3explorer.proboards.com

--The ME3Explorer Team

Research: How to turn your DLC pcc into a vanilla one

Semi-technical area to discuss content modding research and discoveries. Technical information necessary for coding tools should be posted in Technical Research on the Coders board.

Research: How to turn your DLC pcc into a vanilla one

Postby Kinkojiro » 14 Feb 2016, 23:41

WARNING: This is advanced modding - I recommend not doing this unless absolutely necessary. It may cause unexpected side effects.

So I have discovered how to make a DLC pcc into a vanilla version, so you can add/remove exports and imports, clone, use ME3Creator with its invasive file resaving etc etc.

TECHNICAL STUFF (AFIK)

The key issue for DLC is they have a shadercache baked into each file. This contains settings the for static shading of 3d objects. Somewhere in its binary code the shadercache contains its offset (location), exact number of objects etc. So changing the position would break the file. PCCEd2 only works because it appends additional name table and revised objects to the end of the file. ME3Creator breaks stuff because it removes/replaces objects and names into their proper places - but this changes the position of the cache so it breaks.

What is static shading and what does it do? Basically there are 2 types of 3d objects. Dynamically lit (which includes characters, pretty much anything that is animated) and statically lit (which is most inanimate objects such as walls/floors etc). If Unreal had only dynamically lit objects it would run like treacle (or the graphical quality would be set very poor), because object the PC would have to calculate on the fly how it should be lit. So as a final stage of game making they "Cook" the lighting for objects that don't move. This means the lighting data is already built into the game and can be quickly read, with little processing power needed. In the main game this data is housed in a giant shader cache file that is loaded on launch. The DLCs for ME2/3 house it inside every single pcc. What I have done is remove the shadercache from the file.


IMPORTANT: THIS ONLY SHOULD BE DONE WITH PCC FILES THAT HAVE NO STATIC LIGHTING EFFECTS

Never do this to a BioA file. BioD files you need to check the file.

1. Check for Static Lighting
Go into a pcc using ME3Creator. Go into the level explorer. On the left side is a list of stuff in the level. Anything that is a StaticMeshCollectionActor or StaticMeshActor is almost certainly statically lit. Interpactors can be either statically or dynamically lit. Check whether all interpactors have a module called a DynamicLightEnvironment (DLE). If so you are good to go.

2. Modify ShaderCache.
(a) Find the SeekFreeShaderCache object. Change its class to package.
(b) Export an existing package and copy it over (or hex edit delete everything except for the "none" 8 byte unreal reference at the top).
(c) Save and you are good to go.

What happens if you do this to a pcc with a static lighting object? As far as I have tested, the pcc still runs just any object statically lit appears black.

Kinkojiro has been thanked by:
User avatar
Kinkojiro
Modder
 
Posts: 578
Joined: 02 Dec 2013, 04:14
Has thanked: 233 time
Have thanks: 249 time

Re: Research: How to turn your DLC pcc into a vanilla one

Postby The Fob » 15 Feb 2016, 20:37

So we might be able to clone in all (or most of) these difficult files now?

That's awesome man. Thanks!!!
User avatar
The Fob
Modder
 
Posts: 702
Joined: 08 Oct 2012, 04:37
Has thanked: 242 time
Have thanks: 212 time

Re: Research: How to turn your DLC pcc into a vanilla one

Postby dybuk » 17 Feb 2016, 07:23

Interesting, me3creator changes all the offsets as soon as you make a change. I recently adjusted PCCObject.pm for mass effect 2 to allow resource cloning:

https://github.com/Dybuk/ME3Explorer/co ... 3171fc5508

This leaves all the offsets in their original location. It just duplicates the name list and the export list and puts it at the end of the file leaving all the original data at its original offsets. A similar change could be done for mass effcet 3 PCCObject I wonder if this would get around this problem.

So before:

Header
Names
Imports
Exports
Exports data

After:

Header (with ofsets and sizes updates for names and exports)
Names (original)
Imports
Exports (original)
Export data
New export data
Names (all duplicated plus new ones)
Exports (all duplicated plus new ones)

Obviously if its actually checking the header for sizes and ofsets you are screwed. But.. If its going into the file at ofsets unknown to us to pull data, using this method might work around it as all the original ofsets are there.

Just a thought.

Dybuk
User avatar
dybuk
Modder
 
Posts: 292
Joined: 30 Apr 2015, 18:38
Has thanked: 10 time
Have thanks: 127 time

Re: Research: How to turn your DLC pcc into a vanilla one

Postby giftfish » 17 Feb 2016, 16:11

@dybuk -- WV explicitly made ME3Creator that way, from what I remember. PCCEd2 concatenates everything to the end of the file, like you explain, but ME3Creator actually restructures the file. I don't understand the details about why he did it that way, but I know it was intended, so he had some type of reason for going that route.
User avatar
giftfish
Toolset Developer
 
Posts: 1247
Joined: 08 Jan 2016, 02:35
Has thanked: 129 time
Have thanks: 75 time

Re: Research: How to turn your DLC pcc into a vanilla one

Postby FemShep » 17 Feb 2016, 19:28

As someone who doesn't really do content mods (only gameplay), what are the issues cause by the shader cache in each dlc file? You say "break" a file but what does that entail? Game crash? No textures? The nearest enemy head grows in size logarithmically?
Image
ME3Tweaks has modding guides, tools, forums for mods, a modding wiki, and ModMaker, an online mod creation tool.
ME3 Mod Manager, the civilized way of installing and managing ME3 mods.
ME3Tweaks Facebook Page
User avatar
FemShep
Modder
 
Posts: 1101
Joined: 18 Oct 2012, 20:48
Has thanked: 42 time
Have thanks: 76 time

Re: Research: How to turn your DLC pcc into a vanilla one

Postby The Fob » 17 Feb 2016, 20:30

In the past, when trying to clone an object in some (not all) DLC pcc files (one example that always bugged me was BioD_End002.pcc), the game would crash upon loading that file.
User avatar
The Fob
Modder
 
Posts: 702
Joined: 08 Oct 2012, 04:37
Has thanked: 242 time
Have thanks: 212 time

Re: Research: How to turn your DLC pcc into a vanilla one

Postby Kinkojiro » 17 Feb 2016, 22:51

@Femshep As Fob says cloning or doing the invasive save via ME3Cr would cause crash on load.

@Dybuk - that would work as well I would think. A modder (not a coder) but I believe PCCEd2 saves a copy of the name table to the end of the file, and appends extra export data, however it adjusts the export table when cloning hence moves the shadercache.

The only issue is the import table (which I have successfully moved by hand to the end of the file in the past).

I guess WV wanted to save the file to minimize space. I know I built the CIC file from 17MB to 34MB by hundreds of tiny edits using PCCEd2. When saved under ME3Cr it shrinks to 19MB. Also a saved file under ME3Cr can be repacked, whilst a PCCEd2 saved file cannot.

From a modders perspective it is mainly that ME3Cr has more advanced tools around messing with the level, changing import/export tables and much easier cloning.
User avatar
Kinkojiro
Modder
 
Posts: 578
Joined: 02 Dec 2013, 04:14
Has thanked: 233 time
Have thanks: 249 time

Re: Research: How to turn your DLC pcc into a vanilla one

Postby FemShep » 19 Feb 2016, 21:13

Does anyone know what the difference between pcceditor2's alt save vs save feature does? I used it a lot on my GUI transplanter but the documentation is pretty confusing for alt, and standard save is lacking anything beyond "save the PCC object to disk".
Image
ME3Tweaks has modding guides, tools, forums for mods, a modding wiki, and ModMaker, an online mod creation tool.
ME3 Mod Manager, the civilized way of installing and managing ME3 mods.
ME3Tweaks Facebook Page
User avatar
FemShep
Modder
 
Posts: 1101
Joined: 18 Oct 2012, 20:48
Has thanked: 42 time
Have thanks: 76 time

Re: Research: How to turn your DLC pcc into a vanilla one

Postby SirCxyrtyx » 25 May 2016, 22:59

I want to create a save method that would allow cloning and importing in files where the SeekFreeShaderCache can't be removed. I plan to do some experimenting to see if this can be done, but before I do, I'd like to make sure that I'm not missing any knowledge other might possess on the subject.

So, questions for anyone who might know:
  • We know that changing the offset of all the exports breaks things. Is it known whether changing the offset of the SeekFreeShaderCache is the problem, or is the problem changing the offset of things it references? Or both?
  • (Wishful thinking probably, but I have to ask) Does anyone have any clue where in the SeekFreeShaderCache binary the offset(s) are? Or even what objects it would be referencing?
User avatar
SirCxyrtyx
Toolset Lead
 
Posts: 345
Joined: 16 Apr 2014, 00:20
Has thanked: 28 time
Have thanks: 288 time

Re: Research: How to turn your DLC pcc into a vanilla one

Postby Kinkojiro » 26 May 2016, 00:14

I have looked inside the hex but don't really have a clue.

The best place to start would be a DLC plot manager. Startup_DLC_HEN_PR. These have a shader cache but are a tiny file with no graphics and a small cache. When I was looking it looks like a list of name references followed by big endian floating numbers. I couldn't spot the offset at all. But then I actually haven't tested whether a reconstructive save breaks it. But that might help you start.
User avatar
Kinkojiro
Modder
 
Posts: 578
Joined: 02 Dec 2013, 04:14
Has thanked: 233 time
Have thanks: 249 time

Next

Return to Modders' Research

Who is online

Users browsing this forum: No registered users and 0 guests

suspicion-preferred