Exemple #1
0
static int lua_pathCat(lua_State* L)
{
    int top = 0;
    const char* dstPath = NULL;
    const char* srcPath = NULL;
    char buff[MAX_PATH];

    top = lua_gettop(L);
    jn2Exit0(top == 2);

    dstPath = lua_tostring(L, 1);
    jn2Exit0(dstPath);

    srcPath = lua_tostring(L, 2);
    jn2Exit0(srcPath);

    strncpy_s( buff,  _countof(buff) - 1, dstPath, strlen(buff) );
    buff[ _countof(buff) - 1 ] = '\0';

    PathCat(buff, _countof(buff) - 1, srcPath);

    lua_pushstring(L, buff);
    return 1;
Exit0:
    return 0;
}
Exemple #2
0
void System_SetArgs(int argc, char ** argv, int * argcPtr, const char *** argvPtr)
{
#if defined(__unix__)
   *argcPtr = argc;
   *argvPtr = (const char **)argv;

   if(!__thisModule && argv)
   {
      if(!getcwd(exeLocation, MAX_LOCATION))
         exeLocation[0] = 0;
      PathCat(exeLocation, argv[0]);
   }
#endif
}
Exemple #3
0
void Instance_COM_Initialize(int argc, char ** argv, char ** parsedCommand, int * argcPtr, char *** argvPtr)
{
#if !defined(__WIN32__)
   // Disable stdout buffering on Unix
   setvbuf(stdout, null, _IONBF, 0);
#endif
#if defined(__WIN32__)
   *parsedCommand = UTF16toUTF8(GetCommandLineW());
   *argvPtr = eSystem_New0(sizeof(char *) * 512);
   *argcPtr = Tokenize(*parsedCommand, 512,(void*)(char **)(*argvPtr), false);
#else
   *argcPtr = argc;
   *argvPtr = argv;
#endif
#if defined(__unix__)
   if(!__thisModule && argv)
   {
      getcwd(exeLocation, MAX_LOCATION);
      PathCat(exeLocation, argv[0]);
   }
#endif
}
Exemple #4
0
void LoadPuzzleImage(HWND hWnd)
{
    char szTemp[MAX_PATH];
    char szFname[MAX_PATH];
    BOOL bLoad;
    HWND hImageCtrl = GetDlgItem(hWnd, IDC_PUZZLE_IMAGE);
    if (hImageCtrl)
    {
        lstrcpy(szTemp, GetString (IDS_PUZZLE, NULL));
        wsprintf(szFname, szTemp, iHardness);
        PathCat(szPreview,Control.PouchPath,szFname);
        bLoad = AstralImageLoad(0, szPreview, TRUE, FALSE);
        if (bLoad && lpImage)
        {
            // set in the image and tool proc
            SetWindowLong(hImageCtrl, GWL_IMAGE,
                (long) ImgGetBase (lpImage));
            SetWindowLong(hImageCtrl, GWL_IMAGE_TOOLPROC,
                (long) PuzzleProc);
            ShowWindow(hImageCtrl, SW_SHOW);
            AstralControlPaint(hWnd, IDC_PUZZLE_IMAGE);
        }
    }
}
Exemple #5
0
static char *
RemoteCompletionFunction(const char *text, int state, int fTypeFilter)
{
	char rpath[256];
	char *cp;
	char *cp2;
	const char *textbasename;
	int fType;
	FileInfoPtr diritemp;
	FileInfoListPtr filp;
	int textdirlen;
	size_t tbnlen;
	size_t flen, mlen;
	static FileInfoVec diritemv;
	static int i;

	textbasename = strrchr(text, '/');
	if (textbasename == NULL) {
		textbasename = text;
		textdirlen = -1;
	} else {
		textdirlen = (int) (textbasename - text);
		textbasename++;
	}
	tbnlen = strlen(textbasename);

	if (state == 0) {
		if (text[0] == '\0') {
			/* Special case when they do "get <TAB><TAB> " */
			STRNCPY(rpath, gRemoteCWD);
		} else {
			PathCat(rpath, sizeof(rpath), gRemoteCWD, text);
			if (text[strlen(text) - 1] == '/') {
				/* Special case when they do "get /dir1/dir2/<TAB><TAB>" */
				STRNCAT(rpath, "/");
			}
			cp2 = strrchr(rpath, '/');
			if (cp2 == NULL) {
				return NULL;
			} else if (cp2 == rpath) {
				/* Item in root directory. */
				cp2++;
			}
			*cp2 = '\0';
		}

		filp = GetLsCacheFileList(rpath);
		if (filp == NULL)
			return NULL;

		diritemv = filp->vec;
		if (diritemv == NULL)
			return NULL;

		i = 0;
	}

	for ( ; ; ) {
		diritemp = diritemv[i];
		if (diritemp == NULL)
			break;

		i++;
		fType = (int) diritemp->type;
		if ((fTypeFilter == 0) || (fType == fTypeFilter) || (fType == /* symlink */ 'l')) {
			if (strncmp(textbasename, diritemp->relname, tbnlen) == 0) {
				flen = strlen(diritemp->relname);
				if (textdirlen < 0) {
					mlen = flen + 2;
					cp = (char *) malloc(mlen);
					if (cp == NULL)
						return (NULL);
					(void) memcpy(cp, diritemp->relname, mlen);
				} else {
					mlen = textdirlen + 1 + flen + 2;
					cp = (char *) malloc(mlen);
					if (cp == NULL)
						return (NULL);
					(void) memcpy(cp, text, (size_t) textdirlen);
					cp[textdirlen] = '/';
					(void) strcpy(cp + textdirlen + 1, diritemp->relname);
				}
				if (fType == 'd') {
					gl_completion_exact_match_extra_char = '/';
				} else {
					gl_completion_exact_match_extra_char = ' ';
				}
				return cp;
			}
		}
	}
	return NULL;
}	/* RemoteCompletionFunction */
Exemple #6
0
BOOL WINPROC EXPORT DlgRoomDot2Dot (HWND hWnd,UINT wMsg,WPARAM wParam,LPARAM lParam)
{
    BOOL bHandled = TRUE;
    char szTemp[MAX_PATH];
    HWND hImageCtrl;

    switch (wMsg)
    {
        case WM_COMMAND:
            switch (wParam)
            {
            case HS_COVER:
				ShowControls(hWnd, TRUE);
				ShowCoverAnimatedButtons(hWnd, TRUE);
                break;
                
            case HS_SHOW_ME:
                iActiveDot = 0;
				bPlaying = FALSE;
				UpdateDot2DotImage(hWnd, NULL);
                break;
                
            case HS_COLORME_ME:
                RemoveCodedBackground();
                GoPaintApp (hWnd,szPreview);
                break;
                
            case HS_TAB1:
            case HS_TAB2:
            case HS_TAB3:
            case HS_TAB4:
            case HS_TAB5:
            case HS_TAB6:
            case HS_TAB7:
            case HS_TAB8:
                {
                    BOOL    bLoad;

					ShowCoverAnimatedButtons(hWnd, FALSE);
					ShowControls(hWnd, FALSE);
                    hImageCtrl = GetDlgItem(hWnd, IDC_HIDDEN_IMAGE);
                    
                    if (hImageCtrl)
                    {
                		wsprintf (szTemp,GetString (IDS_CIRCUS, NULL),wParam - HS_TAB1 + 1);
                        PathCat (szPreview,Control.PouchPath,szTemp);
                        bLoad = AstralImageLoad( 0, szPreview, TRUE, FALSE);
                        if (bLoad && lpImage)
                        {
							bPlaying = TRUE;
                            SetWindowLong(hImageCtrl, GWL_IMAGE,
                                (long) ImgGetBase (lpImage));
                            SetWindowLong(hImageCtrl, GWL_IMAGE_TOOLPROC,
                                (long) Dot2DotProc);
							InitPoints();
                            ImgSetPixelProc(Dot2DotPixelProc);
                            ShowWindow(hImageCtrl, SW_SHOW);
                            UpdateDot2DotImage(hWnd, NULL);
                        }
                    }
                        
                        
                } // HS_TABS
				SoundStartID(HS_XTRA_CIRCUS, FALSE, 0);
                break;
                
                default:
                    bHandled = FALSE;
            } // switch (wParam)
            break;
                          
        case WM_INITDIALOG:
            hDot2DotWnd = hWnd;
			ShowControls(hWnd, TRUE);
            bHandled = FALSE;           // allow DefRoomProc to be called.
            break;

        case WM_DESTROY:
            ImgSetPixelProc(NULL);      // make sure our proc is no longer used
            bHandled = FALSE;           // allow DefRoomProc to be called
            break;

        case WM_PAINT:
            hImageCtrl = GetDlgItem(hWnd, IDC_HIDDEN_IMAGE);
            DefRoomProc (hWnd,wMsg,wParam,lParam);
			UpdateWindow(hImageCtrl);
            PaintDot2Dots(hImageCtrl);
            break;
            
        default:
            bHandled = FALSE;    
    } // switch (wMsg)

    if (!bHandled)
        bHandled = DefRoomProc (hWnd,wMsg,wParam,lParam);
    return bHandled;
}
Exemple #7
0
BOOL WINPROC EXPORT DlgRoomMazes (HWND hWnd,UINT wMsg,WPARAM wParam,LPARAM lParam)
{
    BOOL bHandled = TRUE;
    char szTemp[MAX_PATH];
    HWND hCtl;

    switch (wMsg)
    {
    case WM_COMMAND:
        switch (wParam)
        {
        case HS_COVER:
			StopAnimation();
			ShowCoverAnimatedButtons(hWnd, TRUE);
            hCtl = GetDlgItem (hWnd,IDC_HIDDEN_IMAGE);
            ShowWindow (hCtl,SW_HIDE);
            if (idCurrentRoom == RM_MAILMAZE)
            {
                hCtl = GetDlgItem (hWnd,HS_LOGO_MAILMAZE);
                ShowWindow (hCtl,SW_SHOW);
                hCtl = GetDlgItem (hWnd,HS_XTRA_MAILMAZE);
                ShowWindow (hCtl,SW_HIDE);
                hCtl = GetDlgItem (hWnd,HS_RESTART);
                ShowWindow (hCtl,SW_HIDE);
            }
            else if (idCurrentRoom == RM_MAZES)
            {
                hCtl = GetDlgItem (hWnd,HS_LOGO_MAZES);
                ShowWindow (hCtl,SW_SHOW);
                hCtl = GetDlgItem (hWnd,HS_XTRA_MAZES);
                ShowWindow (hCtl,SW_HIDE);
                hCtl = GetDlgItem (hWnd,HS_RESTART);
                ShowWindow (hCtl,SW_HIDE);
            }
            bHandled = FALSE;
            break;
        case HS_TAB1:
        case HS_TAB2:
        case HS_TAB3:
        case HS_TAB4:
        case HS_TAB5:
        case HS_TAB6:
        case HS_TAB7:
        case HS_TAB8:
			StopAnimation();
			ShowCoverAnimatedButtons(hWnd, FALSE);
            bTrack = FALSE;
            if (idCurrentRoom == RM_MAILMAZE)
                wsprintf (szTemp,GetString (IDS_MAILMAZE,NULL),wParam - HS_TAB1 + 1);
            else if (idCurrentRoom == RM_MAZES)
                wsprintf (szTemp,GetString (IDS_MAZES,NULL),wParam - HS_TAB1 + 1);
            PathCat (szPreview,Control.PouchPath,szTemp);
            AstralImageLoad (IDN_ART,szPreview,MAYBE,NO);
            if (lpImage)
            {
                bShowSolution = bSolved = FALSE;
                ImgSetPixelProc (MazePixelProc);
                hCtl = GetDlgItem (hWnd,IDC_HIDDEN_IMAGE);
                SetWindowLong (hCtl,GWL_IMAGE,(long) ImgGetBase (lpImage));
                SetWindowLong (hCtl,GWL_IMAGE_TOOLPROC,(long)MazeToolProc);
                ShowWindow (hCtl,SW_SHOW);
                InvalidateRect (hCtl,NULL,FALSE);
                if (idCurrentRoom == RM_MAILMAZE)
                {
                    hCtl = GetDlgItem (hWnd,HS_LOGO_MAILMAZE);
                    ShowWindow (hCtl,SW_HIDE);
                    hCtl = GetDlgItem (hWnd,HS_XTRA_MAILMAZE);
                    ShowWindow (hCtl,SW_SHOW);
                    hCtl = GetDlgItem (hWnd,HS_RESTART);
                    ShowWindow (hCtl,SW_SHOW);
                }
                else if (idCurrentRoom == RM_MAZES)
                {
                    hCtl = GetDlgItem (hWnd,HS_LOGO_MAZES);
                    ShowWindow (hCtl,SW_HIDE);
                    hCtl = GetDlgItem (hWnd,HS_XTRA_MAZES);
                    ShowWindow (hCtl,SW_SHOW);
                    hCtl = GetDlgItem (hWnd,HS_RESTART);
                    ShowWindow (hCtl,SW_SHOW);
                }
                bHandled = FALSE;
            }
#ifdef STUDIO			
				SoundStartID(HS_XTRA_MAILMAZE, FALSE, 0);
#else
				SoundStartID(HS_XTRA_MAZES, FALSE, 0);
#endif			
            break;
        case HS_COLORME:
			StopAnimation();
            GoPaintApp (hWnd,szPreview);
            break;
        case HS_SHOWME:
        case HS_RESTART:
            bTrack = FALSE;
            bShowSolution = (wParam == HS_SHOWME);
            hCtl = GetDlgItem (hWnd,IDC_HIDDEN_IMAGE);
			StopAnimation();
            InvalidateRect (hCtl,NULL,FALSE);
            UpdateWindow (hCtl);
			if (wParam == HS_SHOWME)
				StartAnimation(hCtl);
            break;
        default:
            bHandled = FALSE;
        }
        break;
    case WM_INITDIALOG:
        hMazePen = CreatePen (PS_SOLID,3,RGB (0,0,255));
        bHandled = FALSE;
        break;
    case WM_DESTROY:
		StopAnimation();
        ImgSetPixelProc (NULL);
        if (hMazePen)
        {
            DeleteObject (hMazePen);
            hMazePen = 0;
        }
        bHandled = FALSE;
        break;
    default:
        bHandled = FALSE;
    }
    if (!bHandled)
        bHandled = DefRoomProc (hWnd,wMsg,wParam,lParam);
    return bHandled;
}