collapse

Author [EN] [PL] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: Any way to access the VDialog vgui?  (Read 8569 times)

Offline ColonelAlias

  • Methuselah
  • ****
  • Posts: 327
  • Reputation: +368/-1
Re: Any way to access the VDialog vgui?
« Reply #75 on: March 03, 2011, 02:27:29 pm »
I wanted ctypes (or the SendKeys/win32 modules compiled in). That would be enough to "press 1,2,3,4,mouse buttons" programmatically, obviating all that nonsense with the remapping of the keys.

Offline ColonelAlias

  • Methuselah
  • ****
  • Posts: 327
  • Reputation: +368/-1
Re: Any way to access the VDialog vgui?
« Reply #76 on: March 03, 2011, 06:54:27 pm »
3 no ops were enough to start the thing. I doubt it runs very completly though (maybe the functions are unused?

If you wanna try it, compile the python source in VSc++ (probably 2003 would be best, but i fucked up and downloaded 2008). The project files for 2003 are on PC/VS6 or VS8 (i dunno). The ones for 2008 are in PCBuild.
Headers needed:
open the pythoncore project. On pythonrun.h add:
//troika additions headers
PyAPI_FUNC(void) Py_FlushConsoleOutput(void);
PyAPI_FUNC(void) Py_SetGameInterface(void);
PyAPI_FUNC(void) PyRun_ConsoleString(char *);

Somewhere. WARNING: i don't know if these are the right signatures. I just went with what looked ok to me from the names. My ASM knowledge is not enough to recognize when a argument is passed by argument.

On pythonrun.c add the following functions:

void Py_SetGameInterface(void){
   Py_NoSiteFlag = 1;
    return;
}

void Py_FlushConsoleOutput(void){
    return;
}

void PyRun_ConsoleString(char * string){
    return;
}

The nosite flag will have to be eliminated, it is a flag to tell the python dll not to search for the extensions (what i want). I'm not sure yet exactly how to fix the error that occurs if i don't have it.

Now, let's hope these 3 functions are not so important: setgameinterface is a noop. Flush and send string looks like something important, but if the game is running without them, i'd like to test a little before declaring defeat.

The game runs till you press "New Game"
Then it crashes and burns:
"err:dbghelp_msc:pe_load_debug_directory Got a page fault while loading symbols
err:dbghelp_msc:codeview_process_info Unknown CODEVIEW signature 74706563 in module L"vampire_python21""

Anyone that has visual studio 2003 (PROBABLY what troika used to build the game), care to try this? It is probably a linker error due to different versions of the depending dlls.

I'd try myself but VS2003 is not on msm.

Offline ColonelAlias

  • Methuselah
  • ****
  • Posts: 327
  • Reputation: +368/-1
Re: Any way to access the VDialog vgui?
« Reply #77 on: March 03, 2011, 07:07:41 pm »
Yeah. I know what these functions are now.

They are the functions that pass a unrecognized (half-life 2) console command to the python interpreter instead of doing nothing. It's not really essential as long as the rest of the python scripts runs.

Maybe there are additional modifications needed (for instance, importing things on the "Vampire\Python" directory.
« Last Edit: March 03, 2011, 07:31:47 pm by ColonelAlias »

Offline ColonelAlias

  • Methuselah
  • ****
  • Posts: 327
  • Reputation: +368/-1
Re: Any way to access the VDialog vgui?
« Reply #78 on: March 03, 2011, 09:42:56 pm »
Actually no. They are needed. There is a piece of code on the engine.dll that calls those functions to add the "Vampire\Python" path to the interpreter search path.

I kinda need help reimplementing those functions and finding out what are their headers.
I've been documenting the disasm here:
http://forum.bloodlinesresurgence.com/showthread.php?tid=75&pid=511#pid511

Looks like there are only 6 or 7 functions that need to be done (there may be more if the conversation engine is there too).
« Last Edit: March 04, 2011, 03:37:00 am by ColonelAlias »

Offline ColonelAlias

  • Methuselah
  • ****
  • Posts: 327
  • Reputation: +368/-1
Re: Any way to access the VDialog vgui?
« Reply #79 on: March 05, 2011, 04:20:11 am »
Ok i managed to get ingame (inside a level), though the console is not redirecting to the right place (it is going to the std out/err), and it crashed when i tried to start a conversation.

Details on the resurgence forum.

 

SimplePortal 2.3.7 © 2008-2020, SimplePortal