Author Topic: Modifying The Level Description At Runtime  (Read 1907 times)

Offline Flashy

  • Sr. Member
  • ****
  • Posts: 391
Modifying The Level Description At Runtime
« on: April 29, 2011, 09:44:39 AM »
Is there any way to modify the the description while OP2 reads all strings to generate the mission list? It doesn't seem to load all fitting dlls, just the exported strings get read.
Praise the mighty light towers!!!

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Modifying The Level Description At Runtime
« Reply #1 on: April 30, 2011, 03:16:39 AM »
... What? Why would you ever need to do this? Perhaps I'm not understanding this correctly. I'm not sure what you're saying in that last sentence.
 

Offline Flashy

  • Sr. Member
  • ****
  • Posts: 391
Modifying The Level Description At Runtime
« Reply #2 on: April 30, 2011, 06:55:12 AM »
It was a crazy idea, it doesn't matter. OP2 just doesn't load the DLLs to read Strings, otherwise you could modify the mission name in DLLMain.
Praise the mighty light towers!!!

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Modifying The Level Description At Runtime
« Reply #3 on: April 30, 2011, 10:49:25 AM »
I remember looking into this once as well (the idea was for a mission that could contain multiple "missions" like a campaign inside one DLL, and so you would want to change the description depending on which missions the player had completed.

You are right in that OP2 does not actually load the DLLs to read the mission name (i.e. LoadLibrary or similar operating system function call). If I remember correctly it actually parses the structure of the PE file (i.e. reads the data directory, locates the export table and then dereferences the pointers to the various things like the LevelName). I assume it does this for performance purposes (loading and unloading 30+ DLLs would take a long time just to read their names, since loading by the operating system is a more involved process than just "memory map the file").

Really the only way you could go about accomplishing this would be to modify the DLL file yourself before the game reads it. Or patch the game to actually load the DLL completely and look up the exported address (which might have performance implications, but maybe not on a reasonably modern machine).