Page 1 of 1

Limiting Processor frequency within Sandboxie possible?

Posted: Fri Jun 12, 2015 8:56 pm
by some_guy123
Hi. So I know very little about Sandboxie so please forgive me if this is an ignorant question.

I have a really old video game called Close Combat V, and the scroll speed is somehow tied to the CPU speed, so even on the slowest cursor speed settings it's impossible to scroll the screen side to side on a modern computer, the slightest touch of the mouse cursor against the side of the screen sends you to the opposite side of the map. Arrow key movement is works but just isn't the same. So is it possible to have Sanboxie limit the processing speed of programs run in the sandbox ?

Re: Limiting Processor frequency within Sandboxie possible?

Posted: Sat Jun 13, 2015 1:06 am
by BUCKAROO

Code: Select all

;
/*
Close Combat(tm)V: Invasion Normandy Demo

A fixed map scroll speed and
a necessary adjusted margin.

http://ahkscript.org/
*/

#NoEnv
#SingleInstance force

SetTitleMatchMode,RegEx

Global NULL:=0

Global WinTitle:="Close Combat ahk_class TBX3AppWindow"

Global RECT
VarSetCapacity(RECT,16)

Global Margin:=5 ; original margin; touch it, you break it
Global NewMargin:=5 ; tacked onto original margin

CoordMode,Mouse,Client

;SendMode Input

Loop
{
	Sleep,50 ; adjust DelayInMilliseconds
	
	WinWaitActive,%WinTitle%
	hWnd:=WinExist()
	DllCall("GetClientRect","UPtr",hWnd,"UPtr",&RECT)
	NumPut(BorderLeft:=NumGet(RECT,0,"Int")+Margin,RECT,0,"Int")
	NumPut(BorderTop:=NumGet(RECT,4,"Int")+Margin,RECT,4,"Int")
	NumPut((BorderRight:=NumGet(RECT,8,"Int")-Margin)-1,RECT,8,"Int")
	NumPut((BorderBottom:=NumGet(RECT,12,"Int")-Margin)-1,RECT,12,"Int")
	DllCall("ClientToScreen","UPtr",hWnd,"UPtr",&RECT)
	DllCall("ClientToScreen","UPtr",hWnd,"UPtr",&RECT+8)
	DllCall("ClipCursor","UPtr",&RECT)
	MouseGetPos,CX,CY
;ToolTip,CursorX:%CX%`nCursorY:%CY%
	BorderLeft+=NewMargin,BorderTop+=NewMargin
	BorderRight-=NewMargin,BorderBottom-=NewMargin
;ToolTip,%BorderLeft%`n%BorderTop%`n%BorderRight%`n%BorderBottom%`n
	
	Left:=CX<=BorderLeft,Top:=CY<=BorderTop
	Right:=CX>=BorderRight,Bottom:=CY>=BorderBottom
	
	if(Left&&Top)
		Send,{Numpad7}
	else if(Top&&Right)
		Send,{Numpad9}
	else if(Left&&Bottom)
		Send,{Numpad1}
	else if(Bottom&&Right)
		Send,{Numpad3}
	else if(Left)
		Send,{Numpad4}
	else if(Top)
		Send,{Numpad8}
	else if(Right)
		Send,{Numpad6}
	else if(Bottom)
		Send,{Numpad2}
}

return

~LButton::
IfWinNotActive,%WinTitle%
{
	DllCall("ClipCursor","UPtr",NULL)
}
return

/*
	if(CX<=BorderLeft)
		Send,{Left}
	if(CY<=BorderTop)
		Send,{Up}
	if(CX>=BorderRight)
		Send,{Right}
	if(CY>=BorderBottom)
		Send,{Down}
*/
;

Re: Limiting Processor frequency within Sandboxie possible?

Posted: Sat Jun 13, 2015 10:31 am
by some_guy123
Ok, I'm not a coder but I think I can understand what is going on in that script, thanks, I'll try and get this going.