Member Controls

Goto page 1 2      Next
Developers > New developer starting point?
vonLeebLink to postposted: Thu May 17, 2007 11:02 am

Member since:
 2007-05-11
Posts:
 19

... 

Was the concept of wrappers implemented consistently for all resource types already in a code at SVN?

 

Is there any developers documentation about key classes of SimPE or class browser is the only source of info (code comments)?

 

Is there any naming convention?

 

I know you lack developers however. I think, taking my example, it takes a lot of time to go through all SimPE details to understand how it works. There hundreds of classes, several namespaces, some code looks like garbage from previous versions. Some basic developers documentation would help to make it easier to start develop in SimPE and extend developers base.

 

I will be greatefull for any suggestion how should I attack a subject


quaxiLink to postposted: Sat May 19, 2007 2:12 pm
Avator for quaxi

Member since:
 2006-04-28
Posts:
 3154

First of, thanks very much for considering to help out in developing. We allways are in need for more developers!! 

 

Was the concept of wrappers implemented consistently for all resource types already in a code at SVN?

Yes. All Resources SimPE proceses are handled by a Wrapper. Wrappers handle read/wrote operations on one Resource Type, and currently provide a Pointer to a GUI that allows the Users to change that resource type.

 

 

Is there any developers documentation about key classes of SimPE or class browser is the only source of info (code comments)?

Unfortunatley there is nor documentation. Comments in the code ar the only thing available. I know that sucks, but I just can't get myself to write an API documentation. But if anyone is voluntering to do so, It would be very appreciated :D 

 

Is there any naming convention?

Not realy. SimPe.Helper contains all global helper classes, SimPe.Interfaces has almost all available Interfaces provided by SimPE, SimPe.Plugin.Anyname was supposed to be the namespace used for a plugin.

 

I know you lack developers however. I think, taking my example, it takes a lot of time to go through all SimPE details to understand how it works. There hundreds of classes, several namespaces, some code looks like garbage from previous versions. Some basic developers documentation would help to make it easier to start develop in SimPE and extend developers base.

Yes, you are 100% right. The code is a mess. That is because it was developed quite fast, and it grew too fast. You can see the evolution of code in so many places. 

 

I will be greatefull for any suggestion how should I attack a subject

You might want to start with the SimPE Example Plugin project. It is (compared to the rest of SimPE) well documented, and shows the different possibiliteis you have when developing a Plugin.

The types are

  • wrapper - this handles ONE resource type and provides a GUI for that one type
  • window/tool plugin - this is a plugin that should start in a modal dialog performing tasks on multiple resources (searching, selecting)
  • dockable plugin - those plugins can be docked on the SimPE GUI, and can be open permanently while you work. They have to update whenever the opened package changes, so they are a little harder to implement.

When you compilke a SimPE plugin, you have to make sure that the file ends with .plugin.dll, and that it get's copied into SimPE's Plugin subfolder. SimPE will load all those .plugin.dll files, and check for an object that implements SimPe.Interfaces.Plugin.AbstractWrapperFactory.

This class (see MyWrapperFactory.cs in the example plugin project) announces which plugins are available.

 

Let me know if you have problems to compile/understand that example plugin.

I am not sure what you would need to create your plugin, so it would be best, if you'd have concrete questions, like How can I find a creatain package or a certain resource, or how can I open/save a package. Stuff like that.

 

Thanks again for trying! 


 

quaxiLink to postposted: Sat May 19, 2007 2:13 pm
Avator for quaxi

Member since:
 2006-04-28
Posts:
 3154
Sorry, your initial post got messed up (my bad) :(
vonLeebLink to postposted: Sat May 19, 2007 3:02 pm

Member since:
 2007-05-11
Posts:
 19

Thanks, Quaxi, for answer.

In fact, I'm more than Example Plugin now that I found at spot. With no prob I could compile a plugin but also entire project as well. I also have discovered how to create a package but still digging how to add specific resources to a package. It looks for example that 3IDR has no wrapper just CPF editor. I'm not sure if wrappers are instatiated at SimPE startup and if it may be a problem if I will start another wrapper instance, because users will need originals when they have some package open. Your scanner plugins are a great help for me so far and show the way to scan resources. I like the concept and going to create similar one. I hope you don't mind to copy/paste some parts of your code not saying the scanner architecture.

I'm a little bit lost in terms of caching. What is included in SimPE cache and under what circumstances I should/could rebuild it? Does it relates somehow to game cache?

 

Thanks for help,

vl 

quaxiLink to postposted: Sat May 19, 2007 6:33 pm
Avator for quaxi

Member since:
 2006-04-28
Posts:
 3154
3IDR:
Ther should be awrapper for 3IDR, but since 3IDR would not be a valid name, I think I was calling it SimPe.Plugin.RefFile, and it is not in the SimPE 3IDR Project (yes I know, it is confusing), but in the SimPE Scenegraph project (named PackedFileWrapper.cs)

Wrapper Instance:
SimPe is creatin one instance of each loaded wrapper in order to serve the GUI. I allways creat new instances of the wrappers when I am using them. And I'd suggest you do that too, otherwise you may get into conflict with the wrappers loaded for the GUI.

Copy/Paste:
Thanks , and No problem. :)

Cache:
SimPE provides a basic infrastucture for caching. That framework takes care of cache invalidation and creation if files got changed/were added.
basically it is just a big aarchive storing tokens of different types. If you'd like to use the cache, you'd have to write your own container class, which will read/write the values from the cache.
I think you might find the scanner plugin helpful again, as it is using that cache quite a bit. In particular the File PackageCacheFile.cs (provides the acces to the cache file), and scannerItem.cs (which is one container stored in the cache file).
vonLeebLink to postposted: Tue May 22, 2007 1:48 am

Member since:
 2007-05-11
Posts:
 19

Thanks, that was really helpful.

I progressed nicely but was stuck on picture wrapper. It seems this wrapper has no method to actually add picture  data to pfd or I'm missing something and should work it another way like direct stream read to pfd user data?

Any suggestion?

 

Thanks,

vl 

 

[Edit] I used stream and it works like a charm, however picture wrapper is annoying still with no method to add resources, and consequently picture plugin obviously doesn't have that option.

vonLeebLink to postposted: Wed May 23, 2007 10:07 am

Member since:
 2007-05-11
Posts:
 19

OK, now I have concrete question.

I'm getting problems with 3IDR resource. My pseudocode for adding this resource:

 

RefFile reffile = new RefFile();

IPackedFileDesriptor pfd = IPackedFileDescriptor.NewDescritpor(data here);

reffile.ProcessData(pfd, package);

IPackedFileDescriptor[] pfds = new IPackedFileDescriptor[size];

foreach( in pfds)

pfds[index]=IPackedFileDescriptor.NewDescriptor(data here);

 

reffile.Items = pfds;

 

reffile.SynchronizeUserData();

package.Add(pfd);

 

When I look at created 3IDR in SimPE everything is ok, however in the game it seems that this reference is not recognized.

So I made a similar reference in the game,  extracted it with SimPE and imported to my package and it starts to work. So in fact I suspect that I'm doing something wrong the way I create this resource.

Yes, I doubled checked instance, etc of referenced data.

Any suggestions?

 

Thanks,

vl

vonLeebLink to postposted: Wed May 23, 2007 7:00 pm

Member since:
 2007-05-11
Posts:
 19

OK, I love to discuss with myself :).

 

I believe I found a small bug that is preventing proper recognition of 3IDR in the game.

3IDR resource user data has following structure:

DWORD
ID (0xDEADBEEF)
DWORD
Index Type (1=12 byte records,2=16 byte records)
DWORD
Number of records
for each entry
DWORD
Type ID
DWORD
Group ID
DWORD
Instance ID
DWORD
Resource ID(optional)
 

 In RefFile wrapper ID is never set to 0xDEADBEEF, and Index Type is not set to 2 only number of records is set. Maybe it's fine for other resources but in that particular case game seems to be sensitive to that. Unofrtunatly RefFile does not expose id and type in public so the only way I see to progress is to inherit RefFile wrapper until this will be fixed.

Quaxi am I correct or I miss something?

 

vl 

quaxiLink to postposted: Wed May 23, 2007 9:42 pm
Avator for quaxi

Member since:
 2006-04-28
Posts:
 3154
Sorry, for the delay :)

You may have found a bug (thanks a lot), that is correct. I will fix it, and publish an updated QA Version. For the time being, you could manually edit the SimPE code, fixing the issue in the RefFile Wrapper (probably add some code to initialize those values in teh constructor).

Thats why SimPE is available in the source. If you think something can be done in a better way (and there are lot's of things that could get better) feel free to change it, and send me a patch file (make sure you diff with the latest SVN version), or the altered source files.
I will gladly add any improvements to the sources.
vonLeebLink to postposted: Mon May 28, 2007 12:44 am

Member since:
 2007-05-11
Posts:
 19

I found some other issue.

It looks like WaitingScreen.Wait() shows a splash screen only when it's first time called. Every next call does not show the splash screen, although no error is raised. I checked current production realease and behaviour is similar.

I decided to use FileIndex for my plugin and noticed that initial reading of group cache takes soooo long even though the file is small in size. Debugging it further on revealed that the most time consuming action is actually binary string byte by byte reading of file names stored in group cache. Is this possible to rewrite it to some faster method? Or maybe some C++ guru could have a look and write a function in C to help with that?

 

Thanks,

vl 

Goto page 1 2      Next


viewthread, 0, 0, New-developer-starting-point