Skip to content

If you need your computer fixed or your electronics set up, I have another website where you can request technical help from me! Only $40 p/h.


http://zephyrpc.co.nz

December 8, 2011

Serious Sam 3 Gets Serious about Fighting Piracy… with a Giant Pink Scorpion


This is hilarious :D

Serious Sam 3 Gets Serious about Fighting Piracy… with a Giant Pink Scorpion.

From MaximumPC

December 8, 2011

New app – PC Controller


I was playing Oblivion on my old T400 when I realised the volume controls wouldn’t respond while in game! So I decided to create an app for android/iphone where you could control your computer’s volume level without having to alt-tab out and thereby break the game Sad smile.

I had a fairly good idea of how I was going to go about it seeing as we had done some P2P stuff using python in first semester this year. Basically I have a program running on the computer that acts as a sort of web server, and the app makes calls to that server as if it were loading a webpage.

E.g. If i want to shutdown the computer, all I have to do is navigate any web browser (or the app) to http://192.168.1.x:port/Shutdown. There is also a webpage for setting the volume percentage: http://192.168.1.x:port/SetVolume?vol=50 (50% volume)  [Edit: changed links so flatmates can't shutdown my computer lol]

I am using the python module cherrypy for the server functionality. Another feature I wanted in the app is to be able to monitor the system’s temperature while I am in a fullscreen game. For this I am using the CoreTemp SDK. One of the downfalls of this is that CoreTemp must be running for this part to work.

SC20111208-141549

As you can see, it is still a bit rough, I have only been working on it for a few hours. However you can get the temperature and core load values from the PC, and set the volume using the slider!

Extra For Experts:

In case anyone comes across this looking how to make CoreTemp’s SDK interface with python, here is the source code:

from ctypes import *

#Define the data structure for core_temp_shared_data
class core_temp_shared_data(Structure):
	_fields_ = [
		("uiLoad", c_uint * 256), #The * operand makes an array of n
		("uiTjMax", c_uint * 128),
		("uiCoreCnt", c_uint),
		("uiCPUCnt", c_uint),
		("fTemp", c_float * 256),
		("fVID", c_float),
		("fCPUSpeed", c_float),
		("fFSBSpeed", c_float),
		("fMultipier", c_float),
		("fMultipier", c_float),
		("sCPUName", c_char * 100),
		("ucFahrenheit", c_ubyte),
		("ucDeltaToTjMax", c_ubyte)
	]

GetCoreTempInfo = WinDLL('GetCoreTempInfo.dll')
GetCoreTempInfo.restype =  c_bool
GetCoreTempInfo.argtypes = [core_temp_shared_data]

#Create a variable of type core_temp_shared_data and a pointer to it
coretemp = core_temp_shared_data();
a1 = pointer(coretemp)

coretempRunning = False
def UpdateCoreTemp():
	""" This function calls the dll to update coretemp variable with system data
	"""
	global coretempRunning
	result = GetCoreTempInfo.fnGetCoreTempInfoAlt(a1) #Returns 0 if fail, 1 if success

	if result==0:
		print  "Error: ", GetLastError()
		print  FormatError()

		if GetLastError()==2:
			print "Coretemp.exe is not running, it must be running for this progam to work"
			coretempRunning = False
	else:
		coretempRunning = True

def GetCoreTemperatures
	"""Returns the data value in the coretemp structure that corresponds to the array of core temperatures
	"""
	global coretempRunning
	if coretempRunning == False:
		return {"error": "Coretemp is not running on the monitored pc"}

	ret = []
	for i in range(coretemp.uiCoreCnt):
		ret.append(coretemp.fTemp[i])

	return ret

def GetCoreLoad():
	"""Returns the data value in the coretemp structure that corresponds to the array of core loads
	"""
	global coretempRunning
	if coretempRunning == False:
		return {"error": "Coretemp is not running on the monitored pc"}

	ret = []
	for i in range( coretemp.uiCoreCnt):
		ret.append(int(coretemp.uiLoad[i]))
	return ret

Follow

Get every new post delivered to your Inbox.