Exemple #1
0
Engines::Engine *KotOREngineProbe::createEngine() const {
	return new KotOREngine(getPlatform());
}
Exemple #2
0
int GSlider::getValue() {
    return getPlatform()->gslider_getValue(this);
}
Exemple #3
0
void GSlider::setPaintLabels(bool value) {
    getPlatform()->gslider_setPaintLabels(this, value);
}
Exemple #4
0
void GRadioButton::setSelected(bool state) {
    getPlatform()->gradiobutton_setSelected(this, state);
}
Exemple #5
0
bool GSlider::getPaintLabels() const {
    return getPlatform()->gslider_getPaintLabels(this);
}
Exemple #6
0
GCheckBox::GCheckBox(std::string label) {
    this->label = label;
    getPlatform()->gcheckbox_constructor(this, label);
}
Exemple #7
0
void GCheckBox::setSelected(bool state) {
    getPlatform()->gcheckbox_setSelected(this, state);
}
void setConsoleOutputColor(const std::string& color) {
    if (consoleLocked) { return; }
    // consoleOutputColor = color;
    getPlatform()->jbeconsole_setOutputColor(color);
}
void setConsoleSize(double width, double height) {
    if (consoleLocked) { return; }
    getPlatform()->jbeconsole_setSize(width, height);
}
void setConsoleLocation(int x, int y) {
    if (consoleLocked) { return; }
    getPlatform()->jbeconsole_setLocation(x, y);
}
void setConsoleLocationSaved(bool value) {
    if (consoleLocked) { return; }
    consoleLocationSaved = value;
    getPlatform()->jbeconsole_setLocationSaved(value);
}
void setConsoleFont(const std::string& font) {
    if (consoleLocked) { return; }
    getPlatform()->jbeconsole_setFont(font);
}
void setConsoleExitProgramOnClose(bool exitOnClose) {
    if (consoleLocked) { return; }
    consoleExitProgramOnClose = exitOnClose;
    getPlatform()->jbeconsole_setExitProgramOnClose(exitOnClose);
}
Exemple #14
0
OclHost::OclHost(int const device_type, int gpu_id, int const cpu_cores) :
    devType(device_type), maxGlobalMem(0), maxLocalMem(0) {
//		if (!isGPU()) {
//				gpu_id = 0;
//		}

    cl_int ciErrNum = CL_SUCCESS;
    Log.Verbose("Using device number %d", gpu_id);
//#pragma omp critical
//	{
    if (contextUserCount == 0) {
        Log.Verbose("Creating ocl context.");
//		cl_uint ciDeviceCount = 0;
        cl_platform_id cpPlatform = NULL;

        cpPlatform = getPlatform();
        //Get the devices

        //Get number of devices
        ciErrNum = clGetDeviceIDs(cpPlatform, devType, 0, NULL, &ciDeviceCount);
        checkClError("Couldn't get number of OpenCl devices. Error: ",
                     ciErrNum);

        if (isGPU()) {
            //Getting device ids
            devices = (cl_device_id *) malloc(
                          ciDeviceCount * sizeof(cl_device_id));
            ciErrNum = clGetDeviceIDs(cpPlatform, devType, ciDeviceCount,
                                      devices, NULL);
            checkClError("Couldn't get OpenCl device ids. Error: ", ciErrNum);

            //Create context
            oclGpuContext = clCreateContext(0, ciDeviceCount, devices, NULL,
                                            NULL, &ciErrNum);
            checkClError("Couldn't create context. Error: ", ciErrNum);
            Log.Message("Context for GPU devices created.");

            Log.Message("%d GPU device(s) found: ", ciDeviceCount);
            for (int i = 0; i < ciDeviceCount; ++i) {
                char device_string[1024];
                char driver_string[1024];
                clGetDeviceInfo(devices[i], CL_DEVICE_NAME,
                                sizeof(device_string), &device_string, NULL);
                clGetDeviceInfo(devices[i], CL_DRIVER_VERSION,
                                sizeof(driver_string), &driver_string, NULL);
                Log.Message("Device %d: %s (Driver: %s)", i, device_string, driver_string);
            }

        } else {
            if (ciDeviceCount > 1) {
                Log.Error("More than one CPU device found.");
                exit(-1);
            }

            cl_device_id device_id;
            ciErrNum = clGetDeviceIDs(cpPlatform, CL_DEVICE_TYPE_CPU, 1,
                                      &device_id, NULL);
            checkClError("Couldn't get CPU device id. Error: ", ciErrNum);

            Log.Message("%d CPU device found.", ciDeviceCount);
            char device_string[1024];
            char driver_string[1024];
            clGetDeviceInfo(device_id, CL_DEVICE_NAME, sizeof(device_string),
                            &device_string, NULL);
            clGetDeviceInfo(device_id, CL_DRIVER_VERSION, sizeof(driver_string),
                            &driver_string, NULL);
            Log.Message("Device %d: %s (Driver: %s)", 0, device_string, driver_string);

            cl_device_partition_property props[3];

            props[0] = CL_DEVICE_PARTITION_EQUALLY; // Equally
            props[1] = 1; // 4 compute units per sub-device
            props[2] = 0;

            devices = (cl_device_id *) malloc(256 * sizeof(cl_device_id));
            ciErrNum = clCreateSubDevices(device_id, props, 256, devices,
                                          &ciDeviceCount);
            if (ciErrNum == -18) {
                ciDeviceCount = 1;
                devices[0] = device_id;
            } else {
                checkClError("Couldn't create sub-devices. Error: ", ciErrNum);
            }

            Log.Message("%d CPU cores available.", ciDeviceCount);

            //Create context
            oclGpuContext = clCreateContext(0, ciDeviceCount, devices, NULL,
                                            NULL, &ciErrNum);
            checkClError("Couldn't create context. Error: ", ciErrNum);

        }
    }
    contextUserCount += 1;
    //}

    if (!isGPU()) {
        gpu_id = gpu_id % ciDeviceCount;
    }
    oclDevice = devices[gpu_id];
    //Create context
    //oclGpuContext = clCreateContext(0, 1, &oclDevice, NULL, NULL, &ciErrNum);
    //checkClError("Couldn't create context. Error: ", ciErrNum);

    // create command queue
    oclCommandQueue = clCreateCommandQueue(oclGpuContext, oclDevice, 0,
                                           &ciErrNum);

    checkClError("Couldn't create command queue for device: ", ciErrNum);

}
/*
 * Run a sub-process and capture its output.
 */
int execAndCapture(std::string cmd, std::string& output) {
#ifdef _WIN32
    // Windows code for external process (ugly)
    HANDLE g_hChildStd_IN_Rd = NULL;
    HANDLE g_hChildStd_IN_Wr = NULL;
    HANDLE g_hChildStd_OUT_Rd = NULL;
    HANDLE g_hChildStd_OUT_Wr = NULL;
    SECURITY_ATTRIBUTES saAttr;
    saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
    saAttr.bInheritHandle = TRUE;
    saAttr.lpSecurityDescriptor = NULL;
    if (!CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr, 0)) {
        return 1;   // fail
    }
    if (!SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0)) {
        return 1;   // fail
    }
    if (!CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr, 0)) {
        return 1;   // fail
    }
    if (!SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0) ) {
        return 1;   // fail
    }

    // CreateChildProcess();
    PROCESS_INFORMATION piProcInfo;
    STARTUPINFOA siStartInfo;
    ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));
    ZeroMemory( &siStartInfo, sizeof(STARTUPINFOA) );
    siStartInfo.cb = sizeof(STARTUPINFO);
    siStartInfo.hStdError = g_hChildStd_OUT_Wr;
    siStartInfo.hStdOutput = g_hChildStd_OUT_Wr;
    siStartInfo.hStdInput = g_hChildStd_IN_Rd;
    siStartInfo.dwFlags |= STARTF_USESTDHANDLES;

    if (!CreateProcessA(
            NULL,
            (char*) cmd.c_str(),   // command line
            NULL,                  // process security attributes
            NULL,                  // primary thread security attributes
            TRUE,                  // handles are inherited
            CREATE_NO_WINDOW,      // creation flags
            NULL,                  // use parent's environment
            NULL,                  // use parent's current directory
            &siStartInfo,          // STARTUPINFO pointer
            &piProcInfo)) {        // receives PROCESS_INFORMATION
        std::cerr << "CREATE PROCESS FAIL: " << getPlatform()->os_getLastError() << std::endl;
        std::cerr << cmd << std::endl;
        return 1;   // fail
    }

    // close the subprocess's handles (waits for it to finish)
    WaitForSingleObject(piProcInfo.hProcess, INFINITE);
    CloseHandle(piProcInfo.hProcess);
    CloseHandle(piProcInfo.hThread);

    // ReadFromPipe();
    DWORD dwRead;
    const int BUFSIZE = 65536;
    CHAR chBuf[BUFSIZE] = {0};
    if (!ReadFile(g_hChildStd_OUT_Rd, chBuf, BUFSIZE, &dwRead, NULL) || dwRead == 0) {
        return 1;
    }
    std::ostringstream out;
    for (int i = 0; i < (int) dwRead; i++) {
        out.put(chBuf[i]);
    }

    output = out.str();
    return 0;
#else
    // Linux / Mac code for external process
    cmd += " 2>&1";
    printf("CMD = %s\n", cmd.c_str());
    fflush(stdout);
    FILE* pipe = popen(cmd.c_str(), "r");
    if (!pipe) {
        return -1;
    }
    char buffer[65536] = {0};
    output = "";
    while (!feof(pipe)) {
        if (fgets(buffer, 65536, pipe) != NULL) {
            output += buffer;
        }
    }
    return pclose(pipe);
#endif // _WIN32
}
void setConsoleWindowTitle(const std::string& title) {
    if (consoleLocked) { return; }
    getPlatform()->jbeconsole_setTitle(title);
}
//================================================================================================
//
//   CheckSleepCapability
//
//================================================================================================
//
void
AppleUSBOHCI::CheckSleepCapability(void)
{
	// assume that sleep is OK
	_controllerCanSleep = true;
	_hasPCIPwrMgmt = false;
	
    //   We need to determine which OHCI controllers don't survive sleep.  These fall into 2 categories:
    //
    //   1.  CardBus cards
    //	 2.  PCI Cards that lose power (right now because of a bug in the PCI Family, USB PCI cards do not prevent
    //	     sleep, so even cards that don't support the PCI Power Mgmt stuff get their power removed.
    //
    //  Additionally, the PowerBook 101 controller cannot survive across sleep (I doesn't support remote wakeup).
    //
    //  So here, we look at all those cases and set the _unloadUIMAcrossSleep boolean to true.  As it turns out,
    //  if a controller does not have the "AAPL,clock-id" property, then it means that it cannot survive sleep.  We
    //  might need to refine this later once we figure how to deal with PCI cards that can go into PCI sleep mode.
    //  An exception is the B&W G3, that does not have this property but can sleep.  Sigh...
		
    //  Now, look at PCI cards.  Note that the onboard controller's provider is an IOPCIDevice so we cannot use that
    //  to distinguish between USB PCI cards and the on board controller.  Instead, we use the existence of the
    //  "AAPL,clock-id" property in the provider.  If it does not exist, then we are a OHCI controller on a USB PCI card.
    //
    if ( !_device->getProperty("AAPL,clock-id") && !((getPlatform()->getChipSetType() == kChipSetTypeGossamer) && getPlatform()->getMachineType() == kGossamerTypeYosemite) )
    {
		if (_device->getProperty("built-in"))
		{
			if (_errataBits & kErrataNECIncompleteWrite)
			{
				FixupNECControllerConfigRegisters();
			}

			// rdar://5769508 - if we are on a built in PCI device, then assume the system supports D3cold
			if (_device->hasPCIPowerManagement(kPCIPMCPMESupportFromD3Cold) && (_device->enablePCIPowerManagement(kPCIPMCSPowerStateD3) == kIOReturnSuccess))
			{
				_hasPCIPwrMgmt = true;
				setProperty("Card Type","Built-in");
			}
		}
		else
		{
			// rdar://5856545 - on older machines without the built-in property, we need to use the "default" case in the IOPCIDevice code
			if (_device->hasPCIPowerManagement() && (_device->enablePCIPowerManagement() == kIOReturnSuccess))
			{
				_hasPCIPwrMgmt = true;
				setProperty("Card Type","Built-in");
			}
		}
		
        if (!_hasPCIPwrMgmt)
        {
            USBError(1, "AppleUSBOHCI[%p]::CheckSleepCapability - controller will be unloaded across sleep",this);
            _controllerCanSleep = false;
            setProperty("Card Type","PCI");
        }
    }
    else
    {
        setProperty("Card Type","Built-in");
    }
    
	// if we have an ExpressCard attached (non-zero port), then we will need to disable port resume 
	// for that port (some cards disconnect when the ExpressCard power goes away and we would like to ignore these extra detach events.
	_ExpressCardPort = ExpressCardPort(_device);	
	_badExpressCardAttached = false;

	// Call registerService() so that the IOUSBController object is published and clients (like Prober) can find it
	registerService();
}
void setConsoleCloseOperation(ConsoleCloseOperation op) {
    if (consoleLocked) { return; }
    consoleCloseOperation = op;
    consoleExitProgramOnClose = op == ConsoleCloseOperation::CONSOLE_EXIT_ON_CLOSE;
    getPlatform()->jbeconsole_setCloseOperation(op);
}
Exemple #19
0
bool GCheckBox::isSelected() {
    return getPlatform()->gcheckbox_isSelected(this);
}
Exemple #20
0
// If main_cycle returns false, don't process more events!
int AgiEngine::mainCycle() {
	unsigned int key, kascii;
	VtEntry *v = &_game.viewTable[0];

	pollTimer();
	updateTimer();

	key = doPollKeyboard();

	// In AGI Mouse emulation mode we must update the mouse-related
	// vars in every interpreter cycle.
	//
	// We run AGIMOUSE always as a side effect
	if (getFeatures() & GF_AGIMOUSE || true) {
		_game.vars[28] = _mouse.x / 2;
		_game.vars[29] = _mouse.y;
	}
	if (key == KEY_PRIORITY) {
		_sprites->eraseBoth();
		_debug.priority = !_debug.priority;
		_picture->showPic();
		_sprites->blitBoth();
		_sprites->commitBoth();
		key = 0;
	}

	if (key == KEY_STATUSLN) {
		_debug.statusline = !_debug.statusline;
		writeStatus();
		key = 0;
	}

	// Click-to-walk mouse interface
	if (_game.playerControl && v->flags & ADJ_EGO_XY) {
		int toX = v->parm1;
		int toY = v->parm2;

		// AGI Mouse games use ego's sprite's bottom left corner for mouse walking target.
		// Amiga games use ego's sprite's bottom center for mouse walking target.
		// TODO: Check what Atari ST AGI and Apple IIGS AGI use for mouse walking target.
		if (getPlatform() == Common::kPlatformAmiga)
			toX -= (v->xSize / 2); // Center ego's sprite horizontally

		// Adjust ego's sprite's mouse walking target position (These parameters are
		// controlled with the adj.ego.move.to.x.y-command). Note that these values rely
		// on the horizontal centering of the ego's sprite at least on the Amiga platform.
		toX += _game.adjMouseX;
		toY += _game.adjMouseY;

		v->direction = getDirection(v->xPos, v->yPos, toX, toY, v->stepSize);

		if (v->direction == 0)
			inDestination(v);
	}

	kascii = KEY_ASCII(key);

	if (kascii)
		setvar(vKey, kascii);

process_key:

	switch (_game.inputMode) {
	case INPUT_NORMAL:
		if (!handleController(key)) {
			if (key == 0 || !_game.inputEnabled)
				break;
			handleKeys(key);

			// if ESC pressed, activate menu before
			// accept.input from the interpreter cycle
			// sets the input mode to normal again
			// (closes: #540856)
			if (key == KEY_ESCAPE) {
				key = 0;
				goto process_key;
			}

			// commented out to close Sarien bug #438872
			//if (key)
			//	_game.keypress = key;
		}
		break;
	case INPUT_GETSTRING:
		handleController(key);
		handleGetstring(key);
		setvar(vKey, 0);	// clear ENTER key
		break;
	case INPUT_MENU:
		_menu->keyhandler(key);
		_gfx->doUpdate();
		return false;
	case INPUT_NONE:
		handleController(key);
		if (key)
			_game.keypress = key;
		break;
	}
	_gfx->doUpdate();

	if (_game.msgBoxTicks > 0)
		_game.msgBoxTicks--;

	return true;
}
Exemple #21
0
bool GRadioButton::isSelected() {
    return getPlatform()->gradiobutton_isSelected(this);
}
Exemple #22
0
int AgiEngine::runGame() {
	int ec = errOK;

	// Execute the game
	do {
		debugC(2, kDebugLevelMain, "game loop");
		debugC(2, kDebugLevelMain, "game version = 0x%x", getVersion());

		if (agiInit() != errOK)
			break;

		if (_restartGame) {
			setflag(fRestartGame, true);
			_game.lastController = 0;
			setvar(vTimeDelay, 2);	// "normal" speed
			_restartGame = false;
		}

		// Set computer type (v20 i.e. vComputer) and sound type
		switch (getPlatform()) {
		case Common::kPlatformAtariST:
			setvar(vComputer, kAgiComputerAtariST);
			setvar(vSoundgen, kAgiSoundPC);
			break;
		case Common::kPlatformAmiga:
			if (getFeatures() & GF_OLDAMIGAV20)
				setvar(vComputer, kAgiComputerAmigaOld);
			else
				setvar(vComputer, kAgiComputerAmiga);
			setvar(vSoundgen, kAgiSoundTandy);
			break;
		case Common::kPlatformApple2GS:
			setvar(vComputer, kAgiComputerApple2GS);
			if (getFeatures() & GF_2GSOLDSOUND)
				setvar(vSoundgen, kAgiSound2GSOld);
			else
				setvar(vSoundgen, kAgiSoundTandy);
			break;
		case Common::kPlatformPC:
		default:
			setvar(vComputer, kAgiComputerPC);
			setvar(vSoundgen, kAgiSoundPC);
			break;
		}

		// Set monitor type (v26 i.e. vMonitor)
		switch (_renderMode) {
		case Common::kRenderCGA:
			setvar(vMonitor, kAgiMonitorCga);
			break;
		case Common::kRenderHercG:
		case Common::kRenderHercA:
			setvar(vMonitor, kAgiMonitorHercules);
			break;
		// Don't know if Amiga AGI games use a different value than kAgiMonitorEga
		// for vMonitor so I just use kAgiMonitorEga for them (As was done before too).
		case Common::kRenderAmiga:
		case Common::kRenderDefault:
		case Common::kRenderEGA:
		default:
			setvar(vMonitor, kAgiMonitorEga);
			break;
		}

		setvar(vFreePages, 180); // Set amount of free memory to realistic value
		setvar(vMaxInputChars, 38);
		_game.inputMode = INPUT_NONE;
		_game.inputEnabled = false;
		_game.hasPrompt = 0;

		_game.state = STATE_RUNNING;
		ec = playGame();
		_game.state = STATE_LOADED;
		agiDeinit();
	} while (_restartGame);

	delete _menu;
	_menu = NULL;

	releaseImageStack();

	return ec;
}
Exemple #23
0
int GSlider::getMinorTickSpacing() const {
    return getPlatform()->gslider_getMinorTickSpacing(this);
}
int
MersenneTwister::setupCL(void)
{
    cl_int status = 0;
    cl_device_type dType;

    if(sampleArgs->deviceType.compare("cpu") == 0)
    {
        dType = CL_DEVICE_TYPE_CPU;
    }
    else //deviceType = "gpu"
    {
        dType = CL_DEVICE_TYPE_GPU;
        if(sampleArgs->isThereGPU() == false)
        {
            std::cout << "GPU not found. Falling back to CPU device" << std::endl;
            dType = CL_DEVICE_TYPE_CPU;
        }
    }

    /*
     * Have a look at the available platforms and pick either
     * the AMD one if available or a reasonable default.
     */
    cl_platform_id platform = NULL;
    int retValue = getPlatform(platform, sampleArgs->platformId,
                               sampleArgs->isPlatformEnabled());
    CHECK_ERROR(retValue, SDK_SUCCESS, "getPlatform() failed");

    retValue = displayDevices(platform, dType);
    CHECK_ERROR(retValue, SDK_SUCCESS, "displayDevices() failed");

    /*
     * If we could find our platform, use it. Otherwise use just available platform.
     */

    cl_context_properties cps[3] =
    {
        CL_CONTEXT_PLATFORM,
        (cl_context_properties)platform,
        0
    };

    context = clCreateContextFromType(cps,
                                      dType,
                                      NULL,
                                      NULL,
                                      &status);

    if(checkVal(status,
                CL_SUCCESS,
                "clCreateContextFromType failed."))
    {
        return SDK_FAILURE;
    }

    // getting device on which to run the sample
    status = getDevices(context, &devices, sampleArgs->deviceId,
                       sampleArgs->isDeviceIdEnabled());
    CHECK_ERROR(status, 0, "getDevices() failed");

    //Set device info of given cl_device_id
    retValue = deviceInfo.setDeviceInfo(devices[sampleArgs->deviceId]);
    CHECK_ERROR(retValue, 0, "SDKDeviceInfo::setDeviceInfo() failed");

    {
        // The block is to move the declaration of prop closer to its use
        cl_command_queue_properties prop = 0;
        commandQueue = clCreateCommandQueue(context,
                                            devices[sampleArgs->deviceId],
                                            prop,
                                            &status);
        if(checkVal(status,
                    0,
                    "clCreateCommandQueue failed."))
        {
            return SDK_FAILURE;
        }
    }

    // Set Persistent memory only for AMD platform
    cl_mem_flags inMemFlags = CL_MEM_READ_ONLY;
    if(sampleArgs->isAmdPlatform())
    {
        inMemFlags |= CL_MEM_USE_PERSISTENT_MEM_AMD;
    }

    seedsBuf = clCreateBuffer(context,
                              inMemFlags,
                              width * height * sizeof(cl_float4),
                              0,
                              &status);
    CHECK_OPENCL_ERROR(status, "clCreateBuffer failed. (seedsBuf)");

    resultBuf = clCreateBuffer(context,
                               CL_MEM_WRITE_ONLY,
                               width * height * sizeof(cl_float4) * mulFactor,
                               NULL,
                               &status);
    CHECK_OPENCL_ERROR(status, "clCreateBuffer failed. (resultBuf)");

    cl_event writeEvt;
    // Enqueue write to seedsBuf
    status = clEnqueueWriteBuffer(commandQueue,
                                  seedsBuf,
                                  CL_FALSE,
                                  0,
                                  width * height * sizeof(cl_float4),
                                  seeds,
                                  0,
                                  NULL,
                                  &writeEvt);
    CHECK_OPENCL_ERROR(status, "clEnqueueWriteBuffer failed. (seedsBuf)");

    status = clFlush(commandQueue);
    CHECK_OPENCL_ERROR(status, "clFlush failed.");

    status = waitForEventAndRelease(&writeEvt);
    CHECK_ERROR(status,SDK_SUCCESS, "WaitForEventAndRelease(inMapEvt1) Failed");

    // create a CL program using the kernel source
    buildProgramData buildData;
    buildData.kernelName = std::string("MersenneTwister_Kernels.cl");
    buildData.devices = devices;
    buildData.deviceId = sampleArgs->deviceId;
    buildData.flagsStr = std::string("-x clc++ ");
    if(sampleArgs->isLoadBinaryEnabled())
    {
        buildData.binaryName = std::string(sampleArgs->loadBinary.c_str());
    }

    if(sampleArgs->isComplierFlagsSpecified())
    {
        buildData.flagsFileName = std::string(sampleArgs->flags.c_str());
    }

    retValue = buildOpenCLProgram(program, context, buildData);
    CHECK_ERROR(retValue, SDK_SUCCESS, "buildOpenCLProgram() failed");

    // get a kernel object handle for a kernel with the given name
    kernel = clCreateKernel(program, "gaussianRand", &status);
    CHECK_OPENCL_ERROR(status, "clCreateKernel failed.");

    return SDK_SUCCESS;
}
Exemple #25
0
bool GSlider::getSnapToTicks() const {
    return getPlatform()->gslider_getSnapToTicks(this);
}
Exemple #26
0
bool SagaEngine::isMacResources() const { return (getPlatform() == Common::kPlatformMacintosh); }
Exemple #27
0
void GSlider::setMinorTickSpacing(int value) {
    getPlatform()->gslider_setMinorTickSpacing(this, value);
}
Exemple #28
0
OpenCLDevice* OpenCLMain::getDevice(int platform_pos, int pos) {
	return getPlatform(platform_pos)->getDevice(pos);
}
Exemple #29
0
void GSlider::setSnapToTicks(bool value) {
    getPlatform()->gslider_setSnapToTicks(this, value);
}
Exemple #30
0
void AgiEngine::initialize() {
	// TODO: Some sound emulation modes do not fit our current music
	//       drivers, and I'm not sure what they are. For now, they might
	//       as well be called "PC Speaker" and "Not PC Speaker".

	// If used platform is Apple IIGS then we must use Apple IIGS sound emulation
	// because Apple IIGS AGI games use only Apple IIGS specific sound resources.
	if (getPlatform() == Common::kPlatformApple2GS) {
		_soundemu = SOUND_EMU_APPLE2GS;
	} else if (getPlatform() == Common::kPlatformCoCo3) {
		_soundemu = SOUND_EMU_COCO3;
	} else if (ConfMan.get("music_driver") == "auto") {
		// Default sound is the proper PCJr emulation
		_soundemu = SOUND_EMU_PCJR;
	} else {
		switch (MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK|MDT_AMIGA|MDT_ADLIB|MDT_PCJR|MDT_MIDI))) {
		case MT_PCSPK:
			_soundemu = SOUND_EMU_PC;
			break;
		case MT_ADLIB:
			_soundemu = SOUND_EMU_NONE;
			break;
		case MT_PCJR:
			_soundemu = SOUND_EMU_PCJR;
			break;
		case MT_AMIGA:
			_soundemu = SOUND_EMU_AMIGA;
			break;
		default:
			debug(0, "DEF");
			_soundemu = SOUND_EMU_MIDI;
			break;
		}
	}

	initRenderMode();

	_buttonStyle = AgiButtonStyle(_renderMode);
	_defaultButtonStyle = AgiButtonStyle();
	_console = new Console(this);
	_gfx = new GfxMgr(this);
	_sound = new SoundMgr(this, _mixer);
	_picture = new PictureMgr(this, _gfx);
	_sprites = new SpritesMgr(this, _gfx);

	_gfx->initMachine();

	_game.gameFlags = 0;

	_game.colorFg = 15;
	_game.colorBg = 0;

	_game.name[0] = '\0';

	_game.sbufOrig = (uint8 *)calloc(_WIDTH, _HEIGHT * 2); // Allocate space for two AGI screens vertically
	_game.sbuf16c  = _game.sbufOrig + SBUF16_OFFSET; // Make sbuf16c point to the 16 color (+control line & priority info) AGI screen
	_game.sbuf256c = _game.sbufOrig + SBUF256_OFFSET; // Make sbuf256c point to the 256 color AGI screen
	_game.sbuf     = _game.sbuf16c; // Make sbuf point to the 16 color (+control line & priority info) AGI screen by default

	_gfx->initVideo();
	_sound->initSound();

	_lastSaveTime = 0;

	_lastTick = _system->getMillis();

	debugC(2, kDebugLevelMain, "Detect game");

	if (agiDetectGame() == errOK) {
		_game.state = STATE_LOADED;
		debugC(2, kDebugLevelMain, "game loaded");
	} else {
		warning("Could not open AGI game");
	}

	debugC(2, kDebugLevelMain, "Init sound");
}