HRESULT OffscreenSurface::Unlock(
	LPVOID lpSurfaceData
	)
{
#if LOGGER
	std::ostringstream str;
	str << this << " " << __FUNCTION__;
	LogText(str.str());
#endif

	return DD_OK;
}
HRESULT Direct3DExecuteBuffer::Initialize(
	LPDIRECT3DDEVICE lpDirect3DDevice,
	LPD3DEXECUTEBUFFERDESC lpDesc
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	LogText(str.str());

	return this->_original->Initialize(lpDirect3DDevice, lpDesc);
}
Example #3
0
HRESULT DirectDraw4::GetFourCCCodes(
	LPDWORD lpNumCodes,
	LPDWORD lpCodes
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	LogText(str.str());

	return this->_original->GetFourCCCodes(lpNumCodes, lpCodes);
}
//-----------------------------------------------------------------------------
void HIDDevice::closeDevice(bool wasUnplugged)
{
    OVR_UNUSED(wasUnplugged);
    OVR_ASSERT(DeviceHandle >= 0);
    
    HIDManager->DevManager->pThread->RemoveSelectFd(this,-1);

	hid_close(DeviceHandle);
	DeviceHandle = NULL;
        
    LogText("OVR::Linux::HIDDevice - HID Device Closed '%s'\n", DevDesc.Path.ToCStr());
}
Example #5
0
static void logpool_test_Write(logpool_t *logpool)
{
    long   i = n;
    const char *s = "Good Bye";
    void *args;
    logpool_record(logpool, &args, LOG_NOTICE, "check",
                   LogText("string", s),
                   LogUint("tid",   i%10),
                   LOG_END
                  );
    n++;
}
Example #6
0
//## int System.bind(int socket, String srcIP, int srcPort, int family);
KMETHOD System_bind(KonohaContext *kctx, KonohaStack* sfp)
{
	struct sockaddr_in addr;
	toSockaddr(&addr,
			S_text(sfp[2].asString),
			WORD2INT(sfp[3].intValue),
			WORD2INT(sfp[4].intValue)
	);
	int ret = bind(WORD2INT(sfp[1].intValue),
			(struct sockaddr *)&addr,
			sizeof(addr)
	);
	if(ret != 0) {
		OLDTRACE_SWITCH_TO_KTrace(_SystemFault,
			LogText("@", "bind"),
			LogUint("errno", errno),
			LogText("errstr", strerror(errno))
		);
	}
	KReturnUnboxValue(ret);
}
HRESULT OffscreenSurface::BltFast(
	DWORD dwX,
	DWORD dwY,
	LPDIRECTDRAWSURFACE lpDDSrcSurface,
	LPRECT lpSrcRect,
	DWORD dwTrans
	)
{
#if LOGGER
	std::ostringstream str;
	str << this << " " << __FUNCTION__;
	LogText(str.str());
#endif

#if LOGGER
	str.str("\tDDERR_UNSUPPORTED");
	LogText(str.str());
#endif

	return DDERR_UNSUPPORTED;
}
Example #8
0
HRESULT DirectDraw4::GetSurfaceFromDC(
	HDC hdc,
	LPDIRECTDRAWSURFACE4 * lpDDS4
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	LogText(str.str());

	return this->_original->GetSurfaceFromDC(hdc, lpDDS4);
}
Example #9
0
HRESULT DirectDraw4::GetCaps(
	LPDDCAPS lpDDDriverCaps,
	LPDDCAPS lpDDHELCaps
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	LogText(str.str());

	return this->_original->GetCaps(lpDDDriverCaps, lpDDHELCaps);
}
Example #10
0
static void logpool_test_Write1(logpool_t *logpool)
{
    double f = 3.14;
    long   i = 128;
    const char *s = "hello world";
    logpool_record(logpool, NULL, LOG_NOTICE, "event",
            KEYVALUE_f("float", f),
            KEYVALUE_i("int",   i),
            LogText("string", s),
            LOG_END
            );
}
HRESULT OffscreenSurface::UpdateOverlay(
	LPRECT lpSrcRect,
	LPDIRECTDRAWSURFACE lpDDDestSurface,
	LPRECT lpDestRect,
	DWORD dwFlags,
	LPDDOVERLAYFX lpDDOverlayFx
	)
{
#if LOGGER
	std::ostringstream str;
	str << this << " " << __FUNCTION__;
	LogText(str.str());
#endif

#if LOGGER
	str.str("\tDDERR_UNSUPPORTED");
	LogText(str.str());
#endif

	return DDERR_UNSUPPORTED;
}
Example #12
0
HRESULT DirectDraw2::Compact()
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	HRESULT hr = this->_original->Compact();

	str << std::endl;
	str << tostr_HR(hr);

	LogText(str.str());
	return hr;
}
ULONG DirectDrawClipper::AddRef()
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	ULONG count = this->_original->AddRef();

	str << std::endl;
	str << "\t" << count;

	LogText(str.str());
	return count;
}
Example #14
0
HRESULT DirectDraw4::DuplicateSurface(
	LPDIRECTDRAWSURFACE4 lpDDSurface,
	LPDIRECTDRAWSURFACE4 FAR *lplpDupDDSurface
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;
	str << " " << lpDDSurface;

	LogText(str.str());

	return this->_original->DuplicateSurface(lpDDSurface, lplpDupDDSurface);
}
Example #15
0
HRESULT DirectDraw4::CreateClipper(
	DWORD dwFlags,
	LPDIRECTDRAWCLIPPER FAR *lplpDDClipper,
	IUnknown FAR *pUnkOuter
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	LogText(str.str());

	return this->_original->CreateClipper(dwFlags, lplpDDClipper, pUnkOuter);
}
Example #16
0
HRESULT DirectDraw4::GetAvailableVidMem(
	LPDDSCAPS2 lpDDSCaps,
	LPDWORD lpdwTotal,
	LPDWORD lpdwFree
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	LogText(str.str());

	return this->_original->GetAvailableVidMem(lpDDSCaps, lpdwTotal, lpdwFree);
}
Example #17
0
HRESULT DirectDraw::FlipToGDISurface()
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	HRESULT hr = this->_original->FlipToGDISurface();

	str << std::endl;
	str << tostr_HR(hr);

	LogText(str.str());
	return hr;
}
Example #18
0
HRESULT DirectDraw::RestoreDisplayMode()
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	HRESULT hr = this->_original->RestoreDisplayMode();

	str << std::endl;
	str << tostr_HR(hr);

	LogText(str.str());
	return hr;
}
Example #19
0
static void logpool_test_write(logpool_t *logpool)
{
    double f = 3.14;
    long   i = 128;
    const char *s = "hello world";
    logpool_record(logpool, NULL, LOG_NOTICE, "event",
            KEYVALUE_f("0:float", f),
            KEYVALUE_i("0:int",   i),
            LogText("0:string", s),
            KEYVALUE_f("1:float", f),
            KEYVALUE_i("1:int",   i),
            LogText("1:string", s),
            KEYVALUE_f("2:float", f),
            KEYVALUE_i("2:int",   i),
            LogText("2:string", s),
            KEYVALUE_f("3:float", f),
            KEYVALUE_i("3:int",   i),
            LogText("3:string", s),
            KEYVALUE_f("4:float", f),
            KEYVALUE_i("4:int",   i),
            LogText("4:string", s),
            KEYVALUE_f("5:float", f),
            KEYVALUE_i("5:int",   i),
            LogText("5:string", s),
            KEYVALUE_f("6:float", f),
            KEYVALUE_i("6:int",   i),
            LogText("6:string", s),
            KEYVALUE_f("7:float", f),
            KEYVALUE_i("7:int",   i),
            LogText("7:string", s),
            KEYVALUE_f("8:float", f),
            KEYVALUE_i("8:int",   i),
            LogText("8:string", s),
            KEYVALUE_f("9:float", f),
            KEYVALUE_i("9:int",   i),
            LogText("9:string", s),
            LOG_END
            );
}
Example #20
0
HRESULT DirectDraw4::CreateSurface(
	LPDDSURFACEDESC2 lpDDSurfaceDesc,
	LPDIRECTDRAWSURFACE4 FAR *lplpDDSurface,
	IUnknown FAR *pUnkOuter
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	LogText(str.str());

	return this->_original->CreateSurface(lpDDSurfaceDesc, lplpDDSurface, pUnkOuter);
}
Example #21
0
HRESULT DirectDraw4::CreatePalette(
	DWORD dwFlags,
	LPPALETTEENTRY lpColorTable,
	LPDIRECTDRAWPALETTE FAR *lplpDDPalette,
	IUnknown FAR *pUnkOuter
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	if (dwFlags & DDPCAPS_1BIT)
	{
		str << " 1BIT";
	}

	if (dwFlags & DDPCAPS_2BIT)
	{
		str << " 2BIT";
	}

	if (dwFlags & DDPCAPS_4BIT)
	{
		str << " 4BIT";
	}

	if (dwFlags & DDPCAPS_8BITENTRIES)
	{
		str << " 8BITENTRIES";
	}

	if (dwFlags & DDPCAPS_8BIT)
	{
		str << " 8BIT";
	}

	if (dwFlags & DDPCAPS_ALLOW256)
	{
		str << " ALLOW256";
	}

	LogText(str.str());

	HRESULT hr = this->_original->CreatePalette(dwFlags, lpColorTable, lplpDDPalette, pUnkOuter);

	if (SUCCEEDED(hr))
	{
		*lplpDDPalette = GetOrCreateWrapperT(DirectDrawPalette, *lplpDDPalette);
	}

	return hr;
}
HRESULT BackbufferSurface::DeleteAttachedSurface(
	DWORD dwFlags,
	LPDIRECTDRAWSURFACE lpDDSAttachedSurface
	)
{
#if LOGGER
	std::ostringstream str;
	str << this << " " << __FUNCTION__;
	LogText(str.str());
#endif

	if (lpDDSAttachedSurface == nullptr)
	{
#if LOGGER
		str.str("\tDD_OK");
		LogText(str.str());
#endif

		return DD_OK;
	}

	if (lpDDSAttachedSurface == (LPDIRECTDRAWSURFACE)this->_deviceResources->_depthSurface)
	{
#if LOGGER
		str.str("\tDD_OK");
		LogText(str.str());
#endif

		return DD_OK;
	}

#if LOGGER
	str.str("\tDDERR_UNSUPPORTED");
	LogText(str.str());
#endif

	return DDERR_UNSUPPORTED;
}
HRESULT TextureSurface::GetSurfaceDesc(
	LPDDSURFACEDESC lpDDSurfaceDesc
	)
{
#if LOGGER
	std::ostringstream str;
	str << this << " " << __FUNCTION__;
	LogText(str.str());
#endif

	if (lpDDSurfaceDesc == nullptr)
	{
#if LOGGER
		str.str("\tDDERR_INVALIDPARAMS");
		LogText(str.str());
#endif

		return DDERR_INVALIDPARAMS;
	}

	*lpDDSurfaceDesc = {};
	lpDDSurfaceDesc->dwSize = sizeof(DDSURFACEDESC);
	lpDDSurfaceDesc->dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH | DDSD_MIPMAPCOUNT;
	lpDDSurfaceDesc->ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP | DDSCAPS_SYSTEMMEMORY;
	lpDDSurfaceDesc->ddpfPixelFormat = this->_pixelFormat;
	lpDDSurfaceDesc->dwHeight = this->_height;
	lpDDSurfaceDesc->dwWidth = this->_width;
	lpDDSurfaceDesc->lPitch = this->_width * this->_pixelFormat.dwRGBBitCount / 8;
	lpDDSurfaceDesc->dwMipMapCount = this->_mipmapCount;

#if LOGGER
	str.str("");
	str << "\t" << tostr_DDSURFACEDESC(lpDDSurfaceDesc);
	LogText(str.str());
#endif

	return DD_OK;
}
bool HIDDevice::HIDInitialize(const String& path)
{

    DevDesc.Path = path;

    if (!openDevice())
    {
        LogText("OVR::Win32::HIDDevice - Failed to open HIDDevice: ", path);
        return false;
    }


    HIDManager->Manager->pThread->AddTicksNotifier(this);
    HIDManager->Manager->pThread->AddMessageNotifier(this);

    LogText("OVR::Win32::HIDDevice - Opened '%s'\n"
            "                    Manufacturer:'%s'  Product:'%s'  Serial#:'%s'\n",
            DevDesc.Path.ToCStr(),
            DevDesc.Manufacturer.ToCStr(), DevDesc.Product.ToCStr(),
            DevDesc.SerialNumber.ToCStr());

    return true;
}
Example #25
0
HRESULT DirectDraw4::EnumSurfaces(
	DWORD dwFlags,
	LPDDSURFACEDESC2 lpDDSD,
	LPVOID lpContext,
	LPDDENUMSURFACESCALLBACK2 lpEnumSurfacesCallback
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	LogText(str.str());

	return this->_original->EnumSurfaces(dwFlags, lpDDSD, lpContext, lpEnumSurfacesCallback);
}
Example #26
0
//## Stat System.stat(String path)
static KMETHOD System_stat(KonohaContext *kctx, KonohaStack *sfp)
{
	KMakeTrace(trace, sfp);
	char buffer[K_PATHMAX];
	kString *path = sfp[1].asString;
	const char *systemPath = PLATAPI I18NModule.formatSystemPath(kctx, buffer, sizeof(buffer), kString_text(path), kString_size(path), trace);
	struct stat buf = {}; /* zero */
	int ret = stat(systemPath, &buf);
	if(ret == -1) {
		int fault = KLIB DiagnosisFaultType(kctx, kString_GuessUserFault(path)|SystemError, trace);
		KTraceErrorPoint(trace, fault, "stat", LogText("path", kString_text(path)), LogErrno);
	}
	KReturn(KLIB new_kObject(kctx, OnStack, KGetReturnType(sfp), (uintptr_t)&buf));
}
Example #27
0
//## int System.accept(int socket, SockAddr remoteInfo);
KMETHOD System_accept(KonohaContext *kctx, KonohaStack* sfp)
{
	struct _kSockAddr *sa = (struct _kSockAddr *)sfp[2].asObject;
	struct sockaddr_in *addr = sa->sockaddr_in;
	int addrLen = sizeof(struct sockaddr_in);

	int ret = accept(
			WORD2INT(sfp[1].intValue),
			(struct sockaddr *)addr,
			(socklen_t *)&addrLen
	);
	if(ret >= 0) {
//		fromSockaddr(kctx, sa, addr);
	}
	else {
		OLDTRACE_SWITCH_TO_KTrace(_SystemFault,
				LogText("@", "accept"),
				LogUint("errno", errno),
				LogText("errstr", strerror(errno))
		);
	}
	KReturnUnboxValue(ret);
}
Example #28
0
//## int System.socketpair(int family, int type, int protocol, int[] pairCSock);
static KMETHOD System_socketpair(KonohaContext *kctx, KonohaStack* sfp)
{
	int ret = -2;
	kArray *a = sfp[4].asArray;
	if(kArray_size(a)) {
		int pairFd[2];
		if((ret = socketpair(WORD2INT(sfp[1].intValue),
				WORD2INT(sfp[2].intValue),
				WORD2INT(sfp[3].intValue),
				pairFd)) == 0) {
			a->kintItems[0] = pairFd[0];
			a->kintItems[1] = pairFd[1];
		}
		else {
			OLDTRACE_SWITCH_TO_KTrace(_SystemFault,
					LogText("@", "socketpair"),
					LogUint("errno", errno),
					LogText("errstr", strerror(errno))
			);
		}
	}
	KReturnUnboxValue(ret);
}
HRESULT Direct3DExecuteBuffer::Validate(
	LPDWORD lpdwOffset,
	LPD3DVALIDATECALLBACK lpFunc,
	LPVOID lpUserArg,
	DWORD dwReserved
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	LogText(str.str());

	return this->_original->Validate(lpdwOffset, lpFunc, lpUserArg, dwReserved);
}
Example #30
0
HRESULT DirectDraw::QueryInterface(
	REFIID riid,
	LPVOID* obp
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;
	str << tostr_GUID(&riid);

	HRESULT hr = this->_original->QueryInterface(riid, obp);

	if (SUCCEEDED(hr))
	{
		void* wrapper = GetWrapper(*obp);

		if (wrapper)
		{
			*obp = wrapper;
		}
		else if (riid == IID_IDirectDraw2)
		{
			*obp = CreateWrapperT(DirectDraw2, *obp);
		}
		else if (riid == IID_IDirectDraw4)
		{
			*obp = CreateWrapperT(DirectDraw4, *obp);
		}
		else if (riid == IID_IDirect3D)
		{
			*obp = CreateWrapperT(Direct3D, *obp);
		}
		else
		{
			str << std::endl;
			str << "\tNOT WRAPPED";
		}
	}

	str << std::endl;
	str << tostr_HR(hr);

	if (obp)
	{
		str << " " << *obp;
	}

	LogText(str.str());
	return hr;
}