Jump to content

Connection between Root and client binary


Go to solution Solved by ragem0re,

Recommended Posts

  • Bot

Hello devs,

I have discovered a thing that is a bit confusing for me. I don't have enough experience in client section, however I would like somebody to explain me how this things works.
I'm talking here about connection between files in Root package and client binary. Let's move on to my question.

Okay, let's take a function form IntroLogin.py:

net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)

I though that this function has it's definition in NetworkModule.py:

def SetPhaseWindow(self, newPhaseWindow):
		if self.newPhaseWindow:
			print "Already changed to a new window, ", newPhaseWindow
			self.__ChangePhaseWindow()

		self.newPhaseWindow = newPhaseWindow

		if self.curPhaseWindow:
			print "Change when fade out."
			self.curtain.FadeOut(self.__ChangePhaseWindow)
		else:
			print "Current window does not exist."
			self.__ChangePhaseWindow()

But here is a problem with arguments. Function in NetworkModule.py has two parameters, self and newPhaseWindow. So if this definition is from function in IntroLogin.py it would looks like:
net.PHASE_WINDOW_LOGIN is a self argument and self (of SetPhaseWindow() function) is newPhaseWindow. I think there is not problem with second argument, but first could not be correct.

So I've been looking for definition in client binary...

Here we go, PythonNetworkStream.cpp:

void CPythonNetworkStream::SetPhaseWindow(UINT ePhaseWnd, PyObject* poPhaseWnd)
{
	if (ePhaseWnd >= PHASE_WINDOW_NUM)
	{
		return;
	}

	m_apoPhaseWnd[ePhaseWnd] = poPhaseWnd;
}

Yes, this probably could be that we are searching for, BUT! We have a bit similar function (by name) in PythonNetworkStreamModule.cpp:
And we know that our function is called with net module. So could this be a definition?

PyObject* netSetPhaseWindow(PyObject* poSelf, PyObject* poArgs)
{
	int ePhaseWnd;
	if (!PyTuple_GetInteger(poArgs, 0, &ePhaseWnd))
		return Py_BuildException();

	PyObject* poPhaseWnd;
	if (!PyTuple_GetObject(poArgs, 1, &poPhaseWnd))
		return Py_BuildException();

	CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
	rkNetStream.SetPhaseWindow(ePhaseWnd, poPhaseWnd);
	return Py_BuildNone();
}

 

List of questions:

  1. What does net module do? Where can I find it? Can I compile it by myself?
  2. What definition is from function in IntroLogin.py?
  3. Why there are those two functions in binary? What does each of them do?

 

Thanks for all replies, regards Chyu ^^.

english_banner.gif

Link to comment
Share on other sites

  • Premium
  • Solution

PythonNetworkStreamModule.cpp

Py_InitModule("net", s_methods);

 

Now every method/constants in void initnet() will be available through the net module.

 

Spoiler

{ "SetPhaseWindow",                        netSetPhaseWindow,                        METH_VARARGS },

net.SetPhaseWindow() will call netSetPhaseWindow(), and finally this function referes to CPythonNetworkStream::SetPhaseWindow

  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.