Пример #1
0
int __fastcall diablo_init_menu(int a1, int bSinglePlayer)
{
	int v2; // esi
	int v3; // edi
	int v4; // ecx
	int pfExitProgram; // [esp+Ch] [ebp-4h]

	v2 = bSinglePlayer;
	v3 = a1;
	byte_678640 = 1;
	while ( 1 )
	{
		pfExitProgram = 0;
		dword_5256E8 = 0;
		if ( !NetInit(v2, &pfExitProgram) )
			break;
		byte_678640 = 0;
		if ( (v3 || !*(_DWORD *)&gbValidSaveFile)
		  && (InitLevels(), InitQuests(), InitPortals(), InitDungMsgs(myplr), !*(_DWORD *)&gbValidSaveFile)
		  || (v4 = WM_DIABLOADGAME, !dword_5256E8) )
		{
			v4 = WM_DIABNEWGAME;
		}
		run_game_loop(v4);
		NetClose();
		pfile_create_player_description(0, 0);
		if ( !gbRunGameResult )
			goto LABEL_11;
	}
	gbRunGameResult = pfExitProgram == 0;
LABEL_11:
	SNetDestroy();
	return gbRunGameResult;
}
Пример #2
0
mo_status mo_dtm_in (char *path)
{
  NetPort *inport;

  if (!done_init)
    {
      NetInit ("Mosaic");
      done_init = 1;
    }

  if (!done_register)
    {
#if 0
      NetRegisterModule
        ("Mosaic", NETCOM,
         mo_receive_com, (caddr_t) state,
         NULL, (caddr_t) 0,
         NULL, (caddr_t) 0);
#endif
      done_register = 1;
    }

  if (!done_inport)
    {
      inport = NetCreateInPort (path);
      done_inport = 1;
    }

  mo_register_dtm_blip ();

  return mo_succeed;
}
Пример #3
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE /*hPrevInstance*/,
                     LPSTR     /*lpCmdLine*/,
                     int       /*nCmdShow*/)
{

	appInstance = hInstance;

	OleInitialize(NULL);

	INITCOMMONCONTROLSEX icx;
	icx.dwSize = sizeof(INITCOMMONCONTROLSEX);
	icx.dwICC = ICC_DATE_CLASSES | ICC_LISTVIEW_CLASSES|ICC_WIN95_CLASSES;
	InitCommonControlsEx(&icx);


	resInstance = LoadLibrary(_T("TaskRes.dll"));

	CryptoUtil::GetCryptoUtil();

	NetInit();

	DataManager * pMM = DataManager::Get();
//	hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_XMLTREE);
    CTaskMainWnd *pAppWnd = new CTaskMainWnd(hInstance, pMM);
    RECT r = {
		pMM->GetConfiguration()->GetConfigurationInt(_T("mainWindowLeft"), 40), 
		pMM->GetConfiguration()->GetConfigurationInt(_T("mainWindowTop"), 40), 
		pMM->GetConfiguration()->GetConfigurationInt(_T("mainWindowRight"), 750), 
		pMM->GetConfiguration()->GetConfigurationInt(_T("mainWindowBottom"), 550)
	};
    mainAppHWND = pAppWnd->Create(NULL, r, WS_OVERLAPPEDWINDOW | WS_VISIBLE);


    MSG msg;
    ZeroMemory(&msg, sizeof(MSG));
	// Main message loop:
	while (GetMessage(&msg, NULL, 0, 0)) 
	{
//TODO: review why translate accelerator is not being used..
//		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 
//		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
//		}
	}

	pMM->Save(pMM->GetFileManager()->GetUserPlanFilename());
	delete pAppWnd;
	mainAppHWND = NULL;

	NetConclude();

    OleUninitialize();

	return msg.wParam;
}
Пример #4
0
void Init() {
	LogInit();
	LogSetLevel(LOG_DEBUG);
	SDL_Init(SDL_INIT_EVERYTHING);	/* Initialize SDL */
	window = SDL_CreateWindow("SDL_Shownn", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, 0);
	renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC);
	NetInit(WINDOW_WIDTH, WINDOW_HEIGHT);
	RenderInit(renderer, WINDOW_WIDTH, WINDOW_HEIGHT);
	LogDebug("Init complete");
}
Пример #5
0
static Boolean ForceNetInit(void)
{
    Boolean retval;

    reallyFinal = FALSE;
    num_attached = 0; /* force re-attempt to contact dispatcher */
    retval = NetInit();
    reallyFinal = TRUE;

    return retval;
}
Пример #6
0
/*============================================================================*\
 * Function:
 *	SuggestInit
 *
 * Purpose:
 *	Initializes Suggest API
 *
 * Parameters:
 *	none
 *
 * Return:
 *	TRUE if successful, FALSE otherwise
 *
\*----------------------------------------------------------------------------*/
Boolean
SuggestInit(void)
{
    SuggestRequestPtr	pRequest;
    SuggestResponsePtr	pResponse;

/*    myNetInit = SuggestInit;
*/
    if (!NetInit())
        return FALSE;

    svcp = NI_GenericGetService(dispatcher, NULL, "SUGGEST", "Suggest", TRUE);
    if (svcp == NULL)
    {
        ErrPostEx(SEV_ERROR, 0, 0, "NI_ServiceGet [%s] (%s)",
		  ni_errlist[ni_errno], ni_errtext);
        SuggestFini();

        return FALSE;
    }

    pAsnIn = svcp->raip;
    pAsnOut = svcp->waip;

    pRequest = ValNodeNew(NULL);
    pRequest->choice = SuggestRequest_init;
    SuggestRequestAsnWrite (pRequest, pAsnOut, NULL);
    AsnIoReset(pAsnOut);
    SuggestRequestFree(pRequest);

    if ((pResponse = NetSuggestReadAsn()) == NULL)
    {
        return FALSE;
    }

    if (pResponse->choice == SuggestResponse_error) {
	ErrorFromServer(pResponse->data.ptrvalue);
	if (((SuggestErrorPtr)pResponse->data.ptrvalue)->level
	    == Suggest_error_level_fatal)
	    bSendFini = FALSE;
	SuggestFini();
	SuggestResponseFree(pResponse->data.ptrvalue);
	
	return FALSE;
    }
    
    pResponse->data.ptrvalue = NULL;
    SuggestResponseFree(pResponse);

    return TRUE;
}
Пример #7
0
void SocketInterfaceInit() {
    int result;

    DebugPrint("Initializing Socket Interface.\n");
    connected = false;

    NetInit();
    listeningSocket = NetOpenTCP(SocketInterfacePort);
    NetSetNonBlocking(listeningSocket);
    result = NetListenTCP(listeningSocket);

#ifdef WIN32
    DebugPrint("Socket interface initialized.\nListening on port %d, result = %d, error = %d\n" _C_ SocketInterfacePort _C_ result _C_ WSAGetLastError());
#else
    DebugPrint("Socket interface initialized.\nListening on port %d, result = %d\n" _C_ SocketInterfacePort _C_ result);
#endif
}
Пример #8
0
Socket::Socket()
    : socketId(NET_INVALID_SOCKET_ID)
{
    NetInit();

    // `AF_INET` is for IPv4.
    // UDP would use `SOCK_DGRAM` instead of `SOCK_STREAM`.
    //
    // About the last parameter `protocol`:
    //   "If a value of 0 is specified, the caller does not wish to specify
    //   a protocol and the service provider will choose the protocol to use."
    //
    socketId = socket(AF_INET, SOCK_STREAM, /* protocol = */ 0);
    if (socketId == NET_INVALID_SOCKET_ID)
    {
        throw SocketError("Failed to create socket with 'socket(AF_INET, SOCK_STREAM, 0)'!");
    }
}
Пример #9
0
/************************************************************************************//**
** \brief     This is the entry point for the bootloader application and is called 
**            by the reset interrupt vector after the C-startup routines executed.
** \return    none.
**
****************************************************************************************/
void main(void)
{
  /* initialize the microcontroller */
  Init();
  /* initialize the network application */
  NetInit();
  /* initialize the bootloader interface */
  BootComInit();

  /* start the infinite program loop */
  while (1)
  {
    /* toggle LED with a fixed frequency */
    LedToggle();
    /* run the network task */ 
    NetTask();
    /* check for bootloader activation request */
    BootComCheckActivationRequest();
  }
} /*** end of main ***/
Пример #10
0
mo_status mo_dtm_send_text (mo_window *win, char *port, char *url, char *text)
{
    Text *t = (Text *)malloc (sizeof (Text));
    char *title = (char *)malloc (strlen (url) + 16);
    NetPort *inport, *outport;
    int rv;

    sprintf (title, "Mosaic: %s\0", url);
    t->title = title;
    t->id = strdup ("mosaic");
    t->selLeft = t->selRight = t->insertPt = 0;
    t->numReplace = t->dim = strlen (text);
    t->replaceAll = TRUE;
    t->textString = strdup (text);

    NetInit ();
    inport = NetCreateInPort (":0");
    outport = NetInternalCreateOutPort (port, FALSE);

    rv = NetSendText (outport, t, FALSE, "NewText");

    return mo_succeed;
}
Пример #11
0
Boolean ID1ArchInit (void)

{
    

    myNetInit = ID1ArchInit;

    if (! NetInit())
        return FALSE;

    svcp = NI_GenericGetService(dispatcher, NULL, "ID1", "ID1", TRUE);
    if (svcp == NULL)
    {
        ErrPost(CTX_UNKNOWN, 1, "NI_ServiceGet [%s] (%s)", ni_errlist[ni_errno], ni_errtext);
        ID1ArchFini();
        return FALSE;
    }

    asnin = svcp->raip;
    AsnIoSetBufsize(asnin,4390);
    asnout = svcp->waip;
    return TRUE;
}
Пример #12
0
/**
**  Initialize network port.
*/
void InitNetwork1()
{
	CNetworkParameter::Instance.FixValues();

	NetInit(); // machine dependent setup

	// Our communication port
	const int port = CNetworkParameter::Instance.localPort;
	const char *NetworkAddr = NULL; // FIXME : bad use
	const CHost host(NetworkAddr, port);
	NetworkFildes.Open(host);
	if (NetworkFildes.IsValid() == false) {
		fprintf(stderr, "NETWORK: No free port %d available, aborting\n", port);
		NetExit(); // machine dependent network exit
		return;
	}
#ifdef DEBUG
	const std::string hostStr = host.toString();
	DebugPrint("My host:port %s\n" _C_ hostStr.c_str());
#endif

#if 0 // FIXME: need a working interface check
	unsigned long ips[10];
	int networkNumInterfaces = NetSocketAddr(NetworkFildes, ips, 10);
	if (networkNumInterfaces) {
		DebugPrint("Num IP: %d\n" _C_ networkNumInterfaces);
		for (int i = 0; i < networkNumInterfaces; ++i) {
			DebugPrint("IP: %d.%d.%d.%d\n" _C_ NIPQUAD(ntohl(ips[i])));
		}
	} else {
		fprintf(stderr, "NETWORK: Not connected to any external IPV4-network, aborting\n");
		ExitNetwork1();
		return;
	}
#endif
}
Пример #13
0
Socket::Socket(const NetSocketId sid)
    : socketId(NET_INVALID_SOCKET_ID)
{
    NetInit();
    socketId = sid;
}
Пример #14
0
int main(int argc, char** argv) {


#ifdef DEBUGCONSOLE
if(AllocConsole())
{
    freopen("CONOUT$", "wt", stdout);

    SetConsoleTitle("The Outcast : Debug Console");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);

}
#endif




	DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "THE OUTCAST 0.4\n");
	DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "===============\n");


    DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "Reading cmd line arguments\n");

    for (int i=1;i<argc;i++) {
        if (!strcmp(argv[i], "sprplayground")) {
        	sprplayground = true;
        }
        #ifndef WIN32
        // linux only arguments:
        if (!strcmp(argv[i], "softwarerenderer")) {
            setenv("LIBGL_ALWAYS_INDIRECT", "1", 1);
        }
        #endif
    }

	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up net\n");
	NetInit();
	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up database\n");
	DBInit();
	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up sound system\n");
	SoundInit(NULL);

	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up windowing system\n");

    win_Init(&argc, argv);
    options.Load();

    win_CreateDisplay();



	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up GL\n");
	GLInit();

	if (!sprplayground) {
	    DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Loading skin\n");
	    skin = new Skin;
        skin->Load(options.skin.c_str());
	}


	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Loading mousepointer\n");
	win_SetMousePointer("DEFAULT");

	// game must be inited LAST.
	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up game\n");
	GameInit();



    win_MainLoop();

	return 0;
}