mirror of https://github.com/PCSX2/pcsx2.git
IPC: make per emulator configuration a bit easier
This commit is contained in:
parent
119942b7a4
commit
0be35a3799
|
@ -42,7 +42,7 @@
|
|||
#include "svnrev.h"
|
||||
#include "IPC.h"
|
||||
|
||||
SocketIPC::SocketIPC(SysCoreThread* vm, unsigned int slot = DEFAULT_PORT)
|
||||
SocketIPC::SocketIPC(SysCoreThread* vm, unsigned int slot)
|
||||
: pxThread("IPC_Socket")
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
@ -85,11 +85,11 @@ SocketIPC::SocketIPC(SysCoreThread* vm, unsigned int slot = DEFAULT_PORT)
|
|||
char* tmp_socket;
|
||||
|
||||
if (runtime_dir == NULL)
|
||||
m_socket_name = tmp_socket = (char*)"/tmp/pcsx2.sock";
|
||||
m_socket_name = tmp_socket = (char*)"/tmp/" IPC_EMULATOR_NAME ".sock";
|
||||
else
|
||||
m_socket_name = tmp_socket = strcat(runtime_dir, "/pcsx2.sock");
|
||||
m_socket_name = tmp_socket = strcat(runtime_dir, "/" IPC_EMULATOR_NAME ".sock");
|
||||
|
||||
if (slot != DEFAULT_PORT)
|
||||
if (slot != IPC_DEFAULT_SLOT)
|
||||
{
|
||||
// maximum size of .%u
|
||||
char slot_ending[34];
|
||||
|
|
11
pcsx2/IPC.h
11
pcsx2/IPC.h
|
@ -18,6 +18,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
// IPC uses a concept of "slot" to be able to communicate with multiple
|
||||
// emulators at the same time, each slot should be unique to each emulator to
|
||||
// allow PnP and configurable by the end user so that several runs don't
|
||||
// conflict with each others
|
||||
#define IPC_DEFAULT_SLOT 28011
|
||||
#define IPC_EMULATOR_NAME "pcsx2"
|
||||
|
||||
#include "Utilities/PersistentThread.h"
|
||||
#include "System/SysThreads.h"
|
||||
#ifdef _WIN32
|
||||
|
@ -29,7 +36,6 @@ using namespace Threading;
|
|||
|
||||
class SocketIPC : public pxThread
|
||||
{
|
||||
|
||||
// parent thread
|
||||
typedef pxThread _parent;
|
||||
|
||||
|
@ -37,7 +43,6 @@ protected:
|
|||
#ifdef _WIN32
|
||||
// windows claim to have support for AF_UNIX sockets but that is a blatant lie,
|
||||
// their SDK won't even run their own examples, so we go on TCP sockets.
|
||||
#define DEFAULT_PORT 28011
|
||||
SOCKET m_sock = INVALID_SOCKET;
|
||||
// the message socket used in thread's accept().
|
||||
SOCKET m_msgsock = INVALID_SOCKET;
|
||||
|
@ -200,7 +205,7 @@ public:
|
|||
bool m_end = true;
|
||||
|
||||
/* Initializers */
|
||||
SocketIPC(SysCoreThread* vm, unsigned int slot = DEFAULT_PORT);
|
||||
SocketIPC(SysCoreThread* vm, unsigned int slot = IPC_DEFAULT_SLOT);
|
||||
virtual ~SocketIPC();
|
||||
|
||||
}; // class SocketIPC
|
||||
|
|
Loading…
Reference in New Issue