Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
#533401 31/07/14 01:34 PM
Joined: Apr 2013
N
Norbyte Offline OP
addict
OP Offline
addict
N
Joined: Apr 2013
Well, I've noticed that although the editor does not support adding custom C++/C# modules, interally it *does* use a plugin framework with a hardcoded list of plugins to load.

I've extended this system a bit to allow loading any .NET module.

Steps for setting up the launcher:
  • Download the alternate editor launcher from https://dl.dropboxusercontent.com/u/32263228/dos/GlassesAltEditorRel.zip
  • The "bin" folders the compiled launcher, the "src" folder contains the launcher sources and a minimal sample plugin
  • Copy bin\The Divinity Engine\GlassesAltEditor.exe to the editor root directory (SteamApps\Common\The Divinity Engine\ or something similar)
  • (optional) Copy the sample plugin (bin\EditorPlugins\SamplePlugin.dll) to the My Documents\Larian Studios\Divinity Original Sin\EditorPlugins
  • When you start the editor with GlassesAltEditor.exe a new menu item should appear like so:
    [Linked Image]


The launcher will only load a plugin if the following conditions are met:
  • The plugin .dll is in the My Documents\Larian Studios\Divinity Original Sin\EditorPlugins folder
  • The plugin filename ends with Plugin.dll (eg. MyTestPlugin.dll is fine, but MyTest.dll is not)
  • The plugin module is a managed (.NET) DLL
  • The module contains at least one *public* class that implements the LSToolFramework.IPlugin interface (if the module contains multiple such classes, the editor will instantiate and register each of them)


To see what classes/symbols are available in the editor I'd recommend using a .NET decompiler tool such as dotPeek: http://www.jetbrains.com/decompiler/
(or just add the editor assemblies -- LSToolFramework, LSFrameworkPlugin, etc. -- as a reference to your project and Visual Studio intellisense will see the classes just fine)

Joined: Dec 2013
stranger
Offline
stranger
Joined: Dec 2013
Excellent work!


Sunjammer
Code Monkey
Divinity Engine Wiki
Joined: Jul 2014
C
member
Offline
member
C
Joined: Jul 2014
Excellent this is exactly what the editor needed now we can go nuts

- terrain import
- item creation
- creature creation

the possibilities are endless. I just wish Larian would document their file formats publicly cause the guess work going on now is driving me crazy. I still can't find the exact formula to figure out the total amount of big 32*32 tiles in a map frown

I was working with dotpeek as well, to figure out their map creation but the sneaky buggers obscurified that part of their code AAAAAARGH !!!!

To bad you had to copy the entire contents of the GlassesEditor and couldn't extend theirs and just override what was needed frown

Last edited by Celludriel; 31/07/14 05:19 PM.
Joined: Apr 2013
N
Norbyte Offline OP
addict
OP Offline
addict
N
Joined: Apr 2013
The entire editor launcher is like 1 class, so its no big deal.
The code isn't obfuscated anywhere though, all .NET assemblies decompiled just fine for me.
Those that can't be decompiled are only partially managed (ie they contain native C++ code, thats why they look weird)

Joined: Jul 2014
C
member
Offline
member
C
Joined: Jul 2014
aaaaaaah k that explains. Yeah when I decompile java and I see those kind of symbols, it usually means it's obscurified. I just do .NET in my spare time. I used to write ANSI C though, that was hard to decompile, so I guess decompiling the c++ parts is an effort in vain ?

Joined: Apr 2013
N
Norbyte Offline OP
addict
OP Offline
addict
N
Joined: Apr 2013
Yeah, compiled C++ code loses almost all of the semantic information that the original code has (class names, variable names, function signatures, etc.) so all you get is a huge chunk of assembly code.

Decompiling everything is futile, however concentrating on certain parts and decompiling just those small functions can work.

Joined: Jul 2014
C
member
Offline
member
C
Joined: Jul 2014
Thought so, but well not to worry I just had a jolt of lightning in my head, and think I found the calculation for the tiles. I've put it in the heightmap tool thread. So I now should have a lib that can read the .data formats. Now I need to write helpers to manipulate the data within them and people can write their own height editors and importers.

Now I've been thinking what we really need is one lib fe: DosFileManager.dll. This one will be able to read the Dos Xml formats and all binary formats. Thing is I'm ambitious but not enough to do that all by myself. With a lib as this, making plugins would be a breeze for any implementor.

Last edited by Celludriel; 31/07/14 06:43 PM.
Joined: Apr 2013
N
Norbyte Offline OP
addict
OP Offline
addict
N
Joined: Apr 2013
We really should start a repository for a shared D:OS library smile

Joined: Jul 2014
C
member
Offline
member
C
Joined: Jul 2014
Agreed, although I have no idea how many authors are currently working on libs. I know you have some going for a few of the binary files. ChrisKang is working on his own parser and project to generate heightmaps and make them into terrains. So if anyone else is working on something and interested we could get something going. One of the first steps would be to make a todo list. I would go for the bare minimum first.

- Read format file into memory
- Write the memory back to file without breaking it

Next we could create helpers at will without breaking the base file read and write. Ok granted users can still mess up their files with bad data, but when careful helper authors could minmize that risk

Also each file format needs NUnit tests !!!!

Joined: Jul 2014
D
apprentice
Offline
apprentice
D
Joined: Jul 2014
This is awesome. I hope this takes off. After adding just 1 skill, I really would like an easier way to go about it.

Would it be possible for a plugin that basically streamlines what Rhidian describes here, for adding new spells? (Thanks Rhidian for the awesome pioneering)

Joined: Apr 2013
N
Norbyte Offline OP
addict
OP Offline
addict
N
Joined: Apr 2013
Yeah, a stats/skills editor is the first plugin I was thinking of doing, as that part is seriously lacking in the editor.

Joined: Jul 2014
journeyman
Offline
journeyman
Joined: Jul 2014
great news Norbyte! I'm an avid user of your tools so this will be no different, hats off;)


Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5