mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 14:37:41 +00:00
Compare commits
26 Commits
cursors2
...
exploit-fi
Author | SHA1 | Date | |
---|---|---|---|
23f4d22b9b | |||
c3589e3fc4 | |||
431bb5ff90 | |||
1d309e3ce5 | |||
78bfdad9c4 | |||
368d757bf8 | |||
ca58d0e701 | |||
a3592d9a0a | |||
3cf35d0bc0 | |||
76ee9975b7 | |||
7f3d416290 | |||
ec29c270e4 | |||
357d4aa7d1 | |||
eba0968808 | |||
97b9503cb1 | |||
68ba122afe | |||
743419d9e5 | |||
5951a11e86 | |||
46810aa990 | |||
fdc8e28c2f | |||
1cac4f85da | |||
487f63f60b | |||
f4b3a43026 | |||
3c552912fa | |||
c3657d20a4 | |||
a87b691e33 |
@ -5480,6 +5480,22 @@ This event record is used to pass a ptKey variable to another python program"""
|
||||
|
||||
def addVarNumber(self,name,number):
|
||||
"""Add a number variable event record to the Notify message
|
||||
Method will try to pick appropriate variable type
|
||||
This event record is used to pass a number variable to another python program"""
|
||||
pass
|
||||
|
||||
def addVarFloat(self,name,number):
|
||||
"""Add a float variable event record to the Notify message
|
||||
This event record is used to pass a number variable to another python program"""
|
||||
pass
|
||||
|
||||
def addVarInt(self,name,number):
|
||||
"""Add a integer variable event record to the Notify message
|
||||
This event record is used to pass a number variable to another python program"""
|
||||
pass
|
||||
|
||||
def addVarNull(self,name):
|
||||
"""Add a null (no data) variable event record to the Notify message
|
||||
This event record is used to pass a number variable to another python program"""
|
||||
pass
|
||||
|
||||
|
@ -215,8 +215,10 @@ class PtNotificationType:
|
||||
|
||||
class PtNotifyDataType:
|
||||
"""(none)"""
|
||||
kNumber = 1
|
||||
kFloat = 1
|
||||
kKey = 2
|
||||
kInt = 3
|
||||
kNull = 4
|
||||
|
||||
class PtSDLReadWriteOptions:
|
||||
"""(none)"""
|
||||
|
@ -69,7 +69,7 @@ kOfferLinkingBook=PtEventType.kOfferLinkingBook # [1]=offerer, [2]=link panel ID
|
||||
|
||||
|
||||
# OnNotify Var Event Data Types
|
||||
kVarNumberType=PtNotifyDataType.kNumber
|
||||
kVarNumberType=PtNotifyDataType.kFloat
|
||||
kVarKeyType=PtNotifyDataType.kKey
|
||||
# OnNotify MultiStageEvent - what event types
|
||||
kEnterStage=PtMultiStageEventType.kEnterStage
|
||||
@ -179,8 +179,12 @@ def PtAddEvent(notify,event):
|
||||
elif event[0] == kControlKeyEvent:
|
||||
notify.addControlKeyEvent(event[1],event[2])
|
||||
elif event[0] == kVariableEvent:
|
||||
if event[2] == kVarNumberType:
|
||||
notify.addVarNumber(event[1],event[3])
|
||||
if event[2] == PtNotifyDataType.kFloat:
|
||||
notify.addVarFloat(event[1],event[3])
|
||||
elif event[2] == PtNotifyDataType.kInt:
|
||||
notify.addVarInt(event[1],event[3])
|
||||
elif event[2] == PtNotifyDataType.kNull:
|
||||
notify.addVarNull(event[1])
|
||||
elif event[2] == kVarKeyType:
|
||||
notify.addVarKey(event[1],event[3])
|
||||
elif event[0] == kFacingEvent:
|
||||
|
@ -767,7 +767,7 @@ hsBool plClient::MsgReceive(plMessage* msg)
|
||||
{
|
||||
ISetGraphicsDefaults();
|
||||
ResetDisplayDevice(plPipeline::fDefaultPipeParams.Width, plPipeline::fDefaultPipeParams.Height, plPipeline::fDefaultPipeParams.ColorDepth, plPipeline::fDefaultPipeParams.Windowed,
|
||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount, plPipeline::fDefaultPipeParams.AnisotropicLevel, plPipeline::fDefaultPipeParams.VSync, true);
|
||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount, plPipeline::fDefaultPipeParams.AnisotropicLevel, plPipeline::fDefaultPipeParams.VSync);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1546,6 +1546,7 @@ hsBool plClient::StartInit()
|
||||
|
||||
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
|
||||
plMouseDevice::Instance()->SetDisplayResolution((float)fPipeline->Width(), (float)fPipeline->Height());
|
||||
plInputManager::SetRecenterMouse(false);
|
||||
|
||||
// create the listener for the audio system:
|
||||
plListener* pLMod = TRACKED_NEW plListener;
|
||||
@ -2164,55 +2165,61 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
|
||||
return dmr;
|
||||
}
|
||||
|
||||
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync, hsBool windowOnly)
|
||||
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync)
|
||||
{
|
||||
if(!fPipeline) return;
|
||||
int BorderWidth = 0, BorderHeight = 0, CaptionHeight = 0;
|
||||
|
||||
WindowActivate(false);
|
||||
int ActualWidth;
|
||||
int ActualHeight;
|
||||
|
||||
if( Windowed )
|
||||
{
|
||||
BorderWidth = GetSystemMetrics( SM_CXSIZEFRAME );
|
||||
BorderHeight = GetSystemMetrics( SM_CYSIZEFRAME );
|
||||
CaptionHeight = GetSystemMetrics( SM_CYCAPTION );
|
||||
ActualWidth = Width + BorderWidth * 2;
|
||||
ActualHeight = Height + BorderHeight * 2 + CaptionHeight;
|
||||
SetWindowLong( fWindowHndl, GWL_STYLE,
|
||||
WS_POPUP | WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE);
|
||||
SetWindowLong(fWindowHndl, GWL_EXSTYLE, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowLong(fWindowHndl, GWL_STYLE,
|
||||
WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_MAXIMIZE | WS_VISIBLE);
|
||||
|
||||
SetWindowLong(fWindowHndl, GWL_EXSTYLE, WS_EX_APPWINDOW);
|
||||
}
|
||||
|
||||
if(!windowOnly)
|
||||
fPipeline->ResetDisplayDevice(Width, Height, ColorDepth, Windowed, NumAASamples, MaxAnisotropicSamples, VSync);
|
||||
|
||||
float aspectratio = (float)Width / (float)Height;
|
||||
plMouseDevice::Instance()->SetDisplayResolution((float)Width, (float)Height);
|
||||
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
|
||||
|
||||
UINT flags = SWP_NOCOPYBITS | SWP_NOMOVE | SWP_SHOWWINDOW;
|
||||
if(Windowed)
|
||||
{
|
||||
SetWindowPos( fWindowHndl, HWND_NOTOPMOST, 0, 0, ActualWidth, ActualHeight, flags );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowPos( fWindowHndl, HWND_TOP, 0, 0, Width, Height, flags );
|
||||
::ClipCursor(nil);
|
||||
}
|
||||
fPipeline->ResetDisplayDevice(Width, Height, ColorDepth, Windowed, NumAASamples, MaxAnisotropicSamples, VSync);
|
||||
|
||||
ResizeDisplayDevice(Width, Height, Windowed);
|
||||
|
||||
WindowActivate(true);
|
||||
}
|
||||
|
||||
void plClient::ResizeDisplayDevice(int Width, int Height, hsBool Windowed)
|
||||
{
|
||||
|
||||
if (plMouseDevice::Instance())
|
||||
plMouseDevice::Instance()->SetDisplayResolution((float)Width, (float)Height);
|
||||
|
||||
float aspectratio = (float)Width / (float)Height;
|
||||
if (pfGameGUIMgr::GetInstance())
|
||||
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
|
||||
|
||||
|
||||
UInt32 winStyle, winExStyle;
|
||||
if( Windowed )
|
||||
{
|
||||
// WS_VISIBLE appears necessary to avoid leaving behind framebuffer junk when going from windowed to a smaller window
|
||||
winStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE;
|
||||
winExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
|
||||
} else {
|
||||
winStyle = WS_POPUP;
|
||||
winExStyle = WS_EX_APPWINDOW;
|
||||
}
|
||||
SetWindowLong(fWindowHndl, GWL_STYLE, winStyle);
|
||||
SetWindowLong(fWindowHndl, GWL_EXSTYLE, winExStyle);
|
||||
|
||||
|
||||
UInt32 flags = SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED;
|
||||
UInt32 OutsideWidth, OutsideHeight;
|
||||
HWND insertAfter;
|
||||
if( Windowed )
|
||||
{
|
||||
RECT winRect = { 0, 0, Width, Height };
|
||||
AdjustWindowRectEx(&winRect, winStyle, false, winExStyle);
|
||||
OutsideWidth = winRect.right - winRect.left;
|
||||
OutsideHeight = winRect.bottom - winRect.top;
|
||||
insertAfter = HWND_NOTOPMOST;
|
||||
} else {
|
||||
OutsideWidth = Width;
|
||||
OutsideHeight = Height;
|
||||
insertAfter = HWND_TOP;
|
||||
}
|
||||
SetWindowPos( fWindowHndl, insertAfter, 0, 0, OutsideWidth, OutsideHeight, flags );
|
||||
}
|
||||
|
||||
void WriteBool(hsStream *stream, char *name, hsBool on )
|
||||
{
|
||||
|
@ -292,7 +292,8 @@ public:
|
||||
virtual hsBool WindowActive() const { return fWindowActive; }
|
||||
|
||||
void SetMessagePumpProc( plMessagePumpProc proc ) { fMessagePumpProc = proc; }
|
||||
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false, hsBool windowOnly = false);
|
||||
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false);
|
||||
void ResizeDisplayDevice(int Width, int Height, hsBool Windowed);
|
||||
void IDetectAudioVideoSettings();
|
||||
void IWriteDefaultGraphicsSettings(const wchar* destFile);
|
||||
|
||||
|
@ -58,6 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "../plNetClient/plNetClientMgr.h"
|
||||
#include "../plNetClient/plNetLinkingMgr.h"
|
||||
#include "../plInputCore/plInputManager.h"
|
||||
#include "../plInputCore/plInputDevice.h"
|
||||
#include "../plUnifiedTime/plUnifiedTime.h"
|
||||
#include "plPipeline.h"
|
||||
#include "../plResMgr/plResManager.h"
|
||||
@ -453,7 +454,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_LBUTTONUP :
|
||||
case WM_RBUTTONUP :
|
||||
case WM_MBUTTONUP : // The middle mouse button was released.
|
||||
case WM_MOUSEMOVE :
|
||||
case 0x020A: // fuc&ing windows b.s...
|
||||
{
|
||||
if (gClient && gClient->WindowActive() && gClient->GetInputManager())
|
||||
@ -463,6 +463,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
if (gClient && gClient->GetInputManager())
|
||||
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd);
|
||||
}
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case WM_KILLFOCUS:
|
||||
SetForegroundWindow(hWnd);
|
||||
@ -498,6 +505,31 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SETCURSOR:
|
||||
{
|
||||
static bool winCursor = true;
|
||||
if (LOWORD(lParam) == HTCLIENT)
|
||||
{
|
||||
if (winCursor)
|
||||
{
|
||||
winCursor = false;
|
||||
ShowCursor(FALSE);
|
||||
plMouseDevice::ShowCursor();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!winCursor)
|
||||
{
|
||||
winCursor = true;
|
||||
ShowCursor(TRUE);
|
||||
plMouseDevice::HideCursor();
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_ACTIVATE:
|
||||
{
|
||||
bool active = (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE);
|
||||
@ -509,28 +541,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
(LOWORD(wParam) == WA_CLICKACTIVE) ? "true" : "false");
|
||||
|
||||
if (gClient && !minimized && !gClient->GetDone())
|
||||
{
|
||||
if (LOWORD(wParam) == WA_CLICKACTIVE)
|
||||
{
|
||||
// See if they've clicked on the frame, in which case they just want to
|
||||
// move, not activate, us.
|
||||
POINT pt;
|
||||
GetCursorPos(&pt);
|
||||
ScreenToClient(hWnd, &pt);
|
||||
|
||||
RECT rect;
|
||||
GetClientRect(hWnd, &rect);
|
||||
|
||||
if( (pt.x < rect.left)
|
||||
||(pt.x >= rect.right)
|
||||
||(pt.y < rect.top)
|
||||
||(pt.y >= rect.bottom) )
|
||||
{
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
gClient->WindowActivate(active);
|
||||
}
|
||||
else
|
||||
{
|
||||
gPendingActivate = true;
|
||||
@ -794,11 +805,6 @@ bool InitClient( HWND hWnd )
|
||||
|
||||
#ifdef DETACH_EXE
|
||||
hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
|
||||
#endif
|
||||
// If in fullscreen mode, get rid of the window borders. Note: this won't take
|
||||
// effect until the next SetWindowPos call
|
||||
|
||||
#ifdef DETACH_EXE
|
||||
|
||||
// This Function loads the EXE into Virtual memory...supposedly
|
||||
HRESULT hr = DetachFromMedium(hInstance, DMDFM_ALWAYS | DMDFM_ALLPAGES);
|
||||
@ -808,34 +814,7 @@ bool InitClient( HWND hWnd )
|
||||
gClient->SetDone(true);
|
||||
else
|
||||
{
|
||||
if( gClient->GetPipeline()->IsFullScreen() )
|
||||
{
|
||||
SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
|
||||
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_TOPMOST);
|
||||
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
gWinBorderDX = gWinBorderDY = gWinMenuDY = 0;
|
||||
}
|
||||
else {
|
||||
SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPED | WS_CAPTION);
|
||||
SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
int goodWidth = gClient->GetPipeline()->Width() + gWinBorderDX * 2;
|
||||
int goodHeight = gClient->GetPipeline()->Height() + gWinBorderDY * 2 + gWinMenuDY;
|
||||
|
||||
SetWindowPos(
|
||||
hWnd,
|
||||
nil,
|
||||
0,
|
||||
0,
|
||||
goodWidth,
|
||||
goodHeight,
|
||||
SWP_NOCOPYBITS
|
||||
| SWP_NOMOVE
|
||||
| SWP_NOOWNERZORDER
|
||||
| SWP_NOZORDER
|
||||
| SWP_FRAMECHANGED
|
||||
);
|
||||
gClient->ResizeDisplayDevice(gClient->GetPipeline()->Width(), gClient->GetPipeline()->Height(), !gClient->GetPipeline()->IsFullScreen());
|
||||
}
|
||||
|
||||
if( gPendingActivate )
|
||||
|
@ -155,8 +155,7 @@ void ErrorMinimizeAppWindow () {
|
||||
// If the application's topmost window is a fullscreen
|
||||
// popup window, minimize it before displaying an error
|
||||
HWND appWindow = GetActiveWindow();
|
||||
if ( ((GetWindowLong(appWindow, GWL_STYLE) & WS_POPUP) != 0) &&
|
||||
((GetWindowLong(appWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0) )
|
||||
if ( ((GetWindowLong(appWindow, GWL_STYLE) & WS_POPUP) != 0) )
|
||||
SetWindowPos(
|
||||
appWindow,
|
||||
HWND_NOTOPMOST,
|
||||
|
@ -752,7 +752,7 @@ public:
|
||||
|
||||
if(strncmp("SampleCmd",c->GetName(), 9) != 0)
|
||||
{
|
||||
fprintf(fFile, "<P><I>%s </I><BR>%s </P>\n",c->GetSignature(),
|
||||
fprintf(fFile, "<p><em>%s </em><br />%s </p>\n",c->GetSignature(),
|
||||
c->GetHelp());
|
||||
}
|
||||
}
|
||||
@ -760,10 +760,11 @@ public:
|
||||
{
|
||||
// if(g->GetFirstCommand() != nil)
|
||||
{
|
||||
fprintf(fFile, "<P><B><H%s>Command %sGroup %s </B></H2></P>\n",
|
||||
fprintf(fFile, "<p><strong><h%s>Command %sGroup %s </strong></h%s></p>\n",
|
||||
(depth > 0) ? "3" : "2",
|
||||
(depth > 0) ? "Sub" :"" ,
|
||||
g->GetName());
|
||||
g->GetName(),
|
||||
(depth > 0) ? "3" : "2");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -781,7 +782,7 @@ public:
|
||||
|
||||
if(strncmp("SampleCmd",c->GetName(), 9) != 0)
|
||||
{
|
||||
fprintf(fFile, "<I>%s.%s </I> - %s <BR>\n",fGrpName,c->GetSignature(),
|
||||
fprintf(fFile, "<em>%s.%s </em> - %s <br />\n",fGrpName,c->GetSignature(),
|
||||
c->GetHelp());
|
||||
}
|
||||
}
|
||||
@ -789,11 +790,14 @@ public:
|
||||
{
|
||||
// if(g->GetFirstCommand() != nil)
|
||||
{
|
||||
fprintf(fFile, "<BR>\n");
|
||||
fprintf(fFile, "<br />\n");
|
||||
if(depth <1)
|
||||
strcpy(fGrpName, g->GetName());
|
||||
else
|
||||
{
|
||||
pfConsoleCmdGroup *parentGrp;
|
||||
parentGrp = g->GetParent();
|
||||
strcpy(fGrpName, parentGrp->GetName());
|
||||
strcat(fGrpName,".");
|
||||
strcat(fGrpName,g->GetName());
|
||||
}
|
||||
@ -822,7 +826,7 @@ PF_CONSOLE_CMD( Console, CreateDocumentation, "string fileName",
|
||||
}
|
||||
|
||||
|
||||
fprintf(f, "<CENTER> <H2> Console Commands for Plasma 2.0 Client </H2> <I>Built %s on %s.</I></CENTER><BR>",
|
||||
fprintf(f, "<h2 style=\"text-align: center;\"> Console Commands for Plasma 2.0 Client </h2> <em style=\"display: block; text-align: center;\">Built %s on %s.</em><br />",
|
||||
pnBuildDates::fBuildTime, pnBuildDates::fBuildDate );
|
||||
|
||||
DocGenIterator iter(f);
|
||||
@ -852,7 +856,7 @@ PF_CONSOLE_CMD( Console, CreateBriefDocumentation, "string fileName",
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(f, "<CENTER> <H3> Console Commands for Plasma 2.0 Client </H3> <I>Built %s on %s.</I></CENTER><BR>",
|
||||
fprintf(f, "<h2 style=\"text-align: center;\"> Console Commands for Plasma 2.0 Client </h2> <em style=\"display: block; text-align: center;\">Built %s on %s.</em><br />",
|
||||
pnBuildDates::fBuildTime, pnBuildDates::fBuildDate );
|
||||
BriefDocGenIterator iter(f);
|
||||
group = pfConsoleCmdGroup::GetBaseGroup();
|
||||
@ -6997,38 +7001,6 @@ PF_CONSOLE_CMD( KI, // Group name
|
||||
|
||||
PF_CONSOLE_GROUP( Python ) // Defines a main command group
|
||||
|
||||
PF_CONSOLE_CMD( Python, // Group name
|
||||
RunFile, // Function name
|
||||
"string filename", // Params
|
||||
"Run the specified Python file program" ) // Help string
|
||||
{
|
||||
// now evaluate this mess they made
|
||||
PyObject* mymod = PythonInterface::FindModule("__main__");
|
||||
// make sure the filename doesn't have the .py extension (import doesn't need it)
|
||||
char importname[200];
|
||||
int i;
|
||||
for (i=0; i<199; i++ )
|
||||
{
|
||||
char ch = ((const char*)params[0])[i];
|
||||
// if we are at the end of the string or at a dot, truncate here
|
||||
if ( ch == '.' || ch == 0 )
|
||||
break;
|
||||
else
|
||||
importname[i] = ((const char*)params[0])[i];
|
||||
}
|
||||
importname[i] = 0;
|
||||
|
||||
// create the line to execute the file
|
||||
char runline[256];
|
||||
sprintf(runline,"import %s", importname);
|
||||
PythonInterface::RunString(runline,mymod);
|
||||
std::string output;
|
||||
// get the messages
|
||||
PythonInterface::getOutputAndReset(&output);
|
||||
PrintString(output.c_str());
|
||||
}
|
||||
|
||||
|
||||
#include "../pfPython/cyMisc.h"
|
||||
|
||||
PF_CONSOLE_CMD( Python, // Group name
|
||||
@ -7070,16 +7042,18 @@ PF_CONSOLE_CMD( Python,
|
||||
"string functions, ...", // Params
|
||||
"Run a cheat command" )
|
||||
{
|
||||
const char* extraParms = "";
|
||||
std::string extraParms;
|
||||
if (numParams > 1)
|
||||
extraParms = params[1];
|
||||
// now evaluate this mess they made
|
||||
PyObject* mymod = PythonInterface::FindModule("__main__");
|
||||
{
|
||||
extraParms = "(";
|
||||
extraParms.append(params[1]);
|
||||
extraParms.append(",)");
|
||||
}
|
||||
else
|
||||
extraParms = "()";
|
||||
|
||||
PythonInterface::RunFunctionSafe("xCheat", params[0], extraParms.c_str());
|
||||
|
||||
// create the line to execute the file
|
||||
char runline[256];
|
||||
sprintf(runline,"import xCheat;xCheat.%s('%s')", (const char*)params[0],extraParms);
|
||||
PythonInterface::RunString(runline,mymod);
|
||||
std::string output;
|
||||
// get the messages
|
||||
PythonInterface::getOutputAndReset(&output);
|
||||
|
@ -1718,6 +1718,20 @@ void PythonInterface::WriteToStdErr(const char* text)
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* PythonInterface::ImportModule(const char* module)
|
||||
{
|
||||
PyObject* result = nil;
|
||||
PyObject* name = PyString_FromString(module);
|
||||
|
||||
if (name != nil)
|
||||
{
|
||||
result = PyImport_Import(name);
|
||||
Py_DECREF(name);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Function : FindModule
|
||||
@ -2061,6 +2075,78 @@ hsBool PythonInterface::RunPYC(PyObject* code, PyObject* module)
|
||||
return true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Function : RunFunction
|
||||
// PARAMETERS : module - module name to run 'name' in
|
||||
// : name - name of function
|
||||
// : args - tuple with arguments
|
||||
//
|
||||
//
|
||||
PyObject* PythonInterface::RunFunction(PyObject* module, const char* name, PyObject* args)
|
||||
{
|
||||
if (module == NULL)
|
||||
return NULL;
|
||||
|
||||
PyObject* function = PyObject_GetAttrString(module, const_cast<char*>(name));
|
||||
|
||||
PyObject* result = NULL;
|
||||
if (function != nil)
|
||||
{
|
||||
result = PyObject_Call(function, args, NULL);
|
||||
Py_DECREF(function);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PyObject* PythonInterface::ParseArgs(const char* args)
|
||||
{
|
||||
PyObject* result = NULL;
|
||||
PyObject* scope = PyDict_New();
|
||||
if (scope)
|
||||
{
|
||||
//- Py_eval_input makes this function accept only single expresion (not statement)
|
||||
//- When using empty scope, functions and classes like 'file' or '__import__' are not visible
|
||||
result = PyRun_String(args, Py_eval_input, scope, NULL);
|
||||
Py_DECREF(scope);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool PythonInterface::RunFunctionSafe(const char* module, const char* function, const char* args)
|
||||
{
|
||||
PyObject* moduleObj = ImportModule(module);
|
||||
bool result = false;
|
||||
if (moduleObj)
|
||||
{
|
||||
PyObject* argsObj = ParseArgs(args);
|
||||
if (argsObj)
|
||||
{
|
||||
PyObject* callResult = RunFunction(moduleObj, function, argsObj);
|
||||
if (callResult)
|
||||
{
|
||||
result = true;
|
||||
Py_DECREF(callResult);
|
||||
}
|
||||
|
||||
Py_DECREF(argsObj);
|
||||
}
|
||||
Py_DECREF(moduleObj);
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
PyErr_Print();
|
||||
|
||||
if (Py_FlushLine())
|
||||
PyErr_Clear();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Function : GetpyKeyFromPython
|
||||
@ -2073,4 +2159,4 @@ pyKey* PythonInterface::GetpyKeyFromPython(PyObject* pkey)
|
||||
if (!pyKey::Check(pkey))
|
||||
return nil;
|
||||
return pyKey::ConvertFrom(pkey);
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +138,8 @@ public:
|
||||
// Writes 'text' to stderr specified in the python interface
|
||||
static void WriteToStdErr(const char* text);
|
||||
|
||||
static PyObject* ImportModule(const char* module);
|
||||
|
||||
// Find module. If it doesn't exist then don't create, return nil.
|
||||
static PyObject* FindModule(char* module);
|
||||
|
||||
@ -219,6 +221,12 @@ public:
|
||||
//
|
||||
static hsBool RunPYC(PyObject* code, PyObject* module);
|
||||
|
||||
static PyObject* RunFunction(PyObject* module, const char* name, PyObject* args);
|
||||
|
||||
static PyObject* ParseArgs(const char* args);
|
||||
|
||||
static bool RunFunctionSafe(const char* module, const char* function, const char* args);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Function : GetpyKeyFromPython
|
||||
|
@ -171,6 +171,8 @@ PyObject* pyVaultImageNode::Image_GetImage( void )
|
||||
else
|
||||
fMipmapKey->RefObject();
|
||||
}
|
||||
else
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
return pyImage::New(fMipmap);
|
||||
|
@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
// This line must NEVER be modified manually; it is automatically updated
|
||||
// by the build server.
|
||||
#define BUILD_ID 906
|
||||
#define BUILD_ID 912
|
||||
COMPILER_ASSERT(BUILD_ID != 0);
|
||||
|
||||
|
||||
|
@ -170,12 +170,6 @@ void plAvBrainGeneric::Activate(plArmatureModBase *avMod)
|
||||
{
|
||||
plArmatureBrain::Activate(avMod);
|
||||
|
||||
if ((GetType() == kEmote || GetType() == kAFK || GetType() == kSitOnGround) && fAvMod->IsLocalAvatar())
|
||||
{
|
||||
plInputIfaceMgrMsg* msg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableClickables );
|
||||
plgDispatch::MsgSend(msg);
|
||||
}
|
||||
|
||||
int numStages = fStages->size();
|
||||
if (!numStages)
|
||||
return;
|
||||
@ -315,12 +309,6 @@ void plAvBrainGeneric::Deactivate()
|
||||
}
|
||||
|
||||
plArmatureBrain::Deactivate();
|
||||
|
||||
if ((GetType() == kEmote || GetType() == kAFK || GetType() == kSitOnGround) && fAvMod->IsLocalAvatar())
|
||||
{
|
||||
plInputIfaceMgrMsg* msg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kEnableClickables );
|
||||
plgDispatch::MsgSend(msg);
|
||||
}
|
||||
}
|
||||
|
||||
// GETRECIPIENT
|
||||
|
@ -930,28 +930,3 @@ hsBool plMouseDevice::MsgReceive(plMessage* msg)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void plMouseDevice::HandleWindowActivate(bool bActive, HWND hWnd)
|
||||
{
|
||||
if ( bActive )
|
||||
{
|
||||
RECT rect;
|
||||
::GetClientRect(hWnd,&rect);
|
||||
|
||||
// rect.right /= plInputManager::GetInstance()->GetMouseScale();
|
||||
// rect.bottom /= plInputManager::GetInstance()->GetMouseScale();
|
||||
|
||||
::MapWindowPoints( hWnd, NULL, (POINT *)&rect, 2 );
|
||||
::ClipCursor(&rect);
|
||||
::ShowCursor( FALSE );
|
||||
SetCapture(hWnd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ReleaseCapture();
|
||||
::ClipCursor(nil);
|
||||
::ShowCursor( TRUE );
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,6 @@ public:
|
||||
~plMouseDevice();
|
||||
|
||||
const char* GetInputName() { return "mouse"; }
|
||||
void HandleWindowActivate(bool bActive, HWND hWnd);
|
||||
|
||||
hsBool HasControlFlag(int f) const { return fControlFlags.IsBitSet(f); }
|
||||
void SetControlFlag(int f)
|
||||
|
@ -563,10 +563,7 @@ void plDInputMgr::AddDevice(IDirectInputDevice8* device)
|
||||
|
||||
void plDInputMgr::ConfigureDevice()
|
||||
{
|
||||
::ClipCursor(nil);
|
||||
::ShowCursor( TRUE );
|
||||
ReleaseCapture();
|
||||
|
||||
|
||||
DICOLORSET dics;
|
||||
ZeroMemory(&dics, sizeof(DICOLORSET));
|
||||
@ -587,13 +584,7 @@ void plDInputMgr::ConfigureDevice()
|
||||
for (int i = 0; i < fDI->fSticks.Count(); i++)
|
||||
fDI->fSticks[i]->fDevice->SetActionMap( fDI->fActionFormat, NULL, DIDSAM_FORCESAVE );
|
||||
|
||||
RECT rect;
|
||||
::GetClientRect(fhWnd,&rect);
|
||||
::ClientToScreen(fhWnd,(LPPOINT)&rect);
|
||||
::ClipCursor(&rect);
|
||||
::ShowCursor( FALSE );
|
||||
SetCapture(fhWnd);
|
||||
|
||||
}
|
||||
|
||||
hsBool plDInputMgr::MsgReceive(plMessage* msg)
|
||||
|
@ -328,11 +328,25 @@ plMipmap* plJPEG::ReadFromFile( const char *fileName )
|
||||
plMipmap* plJPEG::ReadFromFile( const wchar *fileName )
|
||||
{
|
||||
// we use a stream because the IJL can't handle unicode
|
||||
hsUNIXStream out;
|
||||
if (!out.Open(fileName, L"rb"))
|
||||
hsRAMStream tempstream;
|
||||
hsUNIXStream in;
|
||||
if (!in.Open(fileName, L"rb"))
|
||||
return false;
|
||||
plMipmap* ret = IRead(&out);
|
||||
out.Close();
|
||||
|
||||
// The stream reader for JPEGs expects a 32-bit size at the start,
|
||||
// so insert that into the stream before passing it on
|
||||
in.FastFwd();
|
||||
UInt32 fsize = in.GetPosition();
|
||||
UInt8 *tempbuffer = TRACKED_NEW UInt8[fsize];
|
||||
in.Rewind();
|
||||
in.Read(fsize, tempbuffer);
|
||||
tempstream.WriteSwap32(fsize);
|
||||
tempstream.Write(fsize, tempbuffer);
|
||||
delete [] tempbuffer;
|
||||
tempstream.Rewind();
|
||||
|
||||
plMipmap* ret = IRead(&tempstream);
|
||||
in.Close();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -419,7 +433,7 @@ hsBool plJPEG::IWrite( plMipmap *source, hsStream *outStream )
|
||||
jcProps.jquality = fWriteQuality;
|
||||
#else
|
||||
cinfo.jpeg_width = source->GetWidth(); // default
|
||||
cinfo.jpeg_width = source->GetHeight(); // default
|
||||
cinfo.jpeg_height = source->GetHeight(); // default
|
||||
cinfo.jpeg_color_space = JCS_YCbCr; // default
|
||||
// not sure how to set 4:1:1 but supposedly it's the default
|
||||
jpeg_set_quality( &cinfo, fWriteQuality, TRUE );
|
||||
@ -487,10 +501,23 @@ hsBool plJPEG::WriteToFile( const char *fileName, plMipmap *sourceData )
|
||||
hsBool plJPEG::WriteToFile( const wchar *fileName, plMipmap *sourceData )
|
||||
{
|
||||
// we use a stream because the IJL can't handle unicode
|
||||
hsRAMStream tempstream;
|
||||
hsUNIXStream out;
|
||||
if (!out.Open(fileName, L"wb"))
|
||||
return false;
|
||||
hsBool ret = IWrite(sourceData, &out);
|
||||
hsBool ret = IWrite(sourceData, &tempstream);
|
||||
if (ret)
|
||||
{
|
||||
// The stream writer for JPEGs prepends a 32-bit size,
|
||||
// so remove that from the stream before saving to a file
|
||||
tempstream.Rewind();
|
||||
UInt32 fsize = tempstream.ReadSwap32();
|
||||
UInt8 *tempbuffer = TRACKED_NEW UInt8[fsize];
|
||||
tempstream.Read(fsize, tempbuffer);
|
||||
out.Write(fsize, tempbuffer);
|
||||
|
||||
delete [] tempbuffer;
|
||||
}
|
||||
out.Close();
|
||||
return ret;
|
||||
}
|
||||
|
@ -2233,7 +2233,6 @@ hsBool plDXPipeline::IResetDevice()
|
||||
{
|
||||
IClearShadowSlaves();
|
||||
|
||||
ReleaseCapture();
|
||||
Sleep(100);
|
||||
HRESULT coopLev = fD3DDevice->TestCooperativeLevel();
|
||||
if( coopLev == D3DERR_DEVICELOST )
|
||||
@ -2281,8 +2280,6 @@ hsBool plDXPipeline::IResetDevice()
|
||||
/// all device-specific stuff needs to be recreated
|
||||
plDeviceRecreateMsg* clean = TRACKED_NEW plDeviceRecreateMsg();
|
||||
plgDispatch::MsgSend(clean);
|
||||
|
||||
SetCapture(fSettings.fHWnd);
|
||||
}
|
||||
fDevWasLost = true;
|
||||
fDeviceLost = false;
|
||||
|
Reference in New Issue
Block a user