BOOL CScene::OnInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) /************************************************************************/ { // Force the caption flag off for win95 DWORD dwStyle = GetWindowLong( hWnd, GWL_STYLE ); SetWindowLong( hWnd, GWL_STYLE, dwStyle & (~WS_CAPTION) ); // Get the command string STRING szString; GetWindowText( hWnd, szString, sizeof(STRING)-1 ); FNAME szMidi; GetStringParm( szString, 1/*nIndex*/, ',', szMidi ); LPLONG lpSwitches = ExtractSwitches( szString ); // Create the sound class with or w/o wavemix m_pSound = new CSound((BOOL)GetSwitchValue( 'w', lpSwitches)); if (m_pSound) m_pSound->Open( NULL/*"powersnd.dll"*/ ); if ( lpSwitches ) FreeUp( (LPTR)lpSwitches ); // Fix the coordinates from the resource file RepositionDialogControls( hWnd ); // Center the scene within the app's client area CenterWindow( hWnd ); // This should not be necessary, since it's done in the OnClose() if ( m_hMidiTheme ) { // close any looping midi theme MCIClose( m_hMidiTheme ); m_hMidiTheme = NULL; } if ( *szMidi ) { // The scene has a midi theme, so start it LPLONG lpMidiSwitches = ExtractSwitches( szMidi ); if ( m_hMidiTheme = MCIOpen( GetApp()->m_hDeviceMID, szMidi, NULL/*lpAlias*/ ) ) { if ( lpMidiSwitches ) MCILoop( m_hMidiTheme, (BOOL)GetSwitchValue( 'l', lpMidiSwitches ) ); if ( !MCIPlay( m_hMidiTheme, GetApp()->GetMainWnd() ) ) { MCIClose( m_hMidiTheme ); m_hMidiTheme = NULL; } // if it's not looping, it will close itself when it ends } if ( lpMidiSwitches ) FreeUp( (LPTR)lpMidiSwitches ); } // if we have an animation object then setup a timer for it m_idAnimatorTimer = SetTimer(hWnd, ANIMATOR_TIMER_ID, 1, NULL); return(TRUE); }
void BumpDraw( HWND hWindow ) /***********************************************************************/ { LPVIDEO lpVideo; if ( !(lpVideo = (LPVIDEO)GetWindowLong( hWindow, GWL_DATAPTR )) ) return; RECT SRect = SrcRect; RECT DRect = DstRect; int iZoomFactor = (int)GetSwitchValue( 'z', lpVideo->lpSwitches ); if ( !iCount ) { SRect.top += 10; DRect = SRect; ScaleRect( &DRect, iZoomFactor ); iCount = 1; } else { SRect.top -= 10; DRect = SRect; ScaleRect( &DRect, iZoomFactor ); iCount = 0; } MCIClip( lpVideo->hDevice, &SRect, NULL/*&DRect*/, /*0*/iZoomFactor ); }
void CPuzzle::Resize() /***********************************************************************/ { int dx, dy; if ( ComputeDIBControlSize( m_hWnd, &dx, &dy ) ) { ResizeControl( m_hWnd, dx, dy ); if (m_lpSwitches && (GetSwitchValue('c', m_lpSwitches) != 0)) CenterWindow(m_hWnd); } }
LOCAL BOOL Hotspot_OnCreate(HWND hWindow, LPCREATESTRUCT lpCreateStruct) /***********************************************************************/ { LPLONG lpSwitches; STRING szString; int iTimedSeconds; GetWindowText( hWindow, szString, sizeof(STRING) ); GetStringParm( szString, 0/*nIndex*/, ',', szString ); if ( lpSwitches = ExtractSwitches( szString ) ) { if ( iTimedSeconds = (int)GetSwitchValue( 't', lpSwitches ) ) { // Use the window handle as the timer id SetTimer( hWindow, (WORD)hWindow/*TimerID*/, 1000*iTimedSeconds, NULL ); } FreeUp( (LPTR)lpSwitches ); } return TRUE; }
int main(int argc, char* argv[]) { CefEnableHighDPISupport(); CefMainArgs mainArgs(argc, argv); auto cmdLine = CefCommandLine::CreateCommandLine(); cmdLine->InitFromArgv(argc, argv); std::string configPath = cmdLine->GetSwitchValue("config").ToString(); if (configPath.empty()) { configPath = "config.default.json"; } AppConfig config; if (!LoadAppConfig(configPath.c_str(), &config)) { return -1; } CefRefPtr<CefApp> app(new App(config)); int exitCode = CefExecuteProcess(mainArgs, app, nullptr); if (exitCode >= 0) { return exitCode; } CefSettings settings; settings.no_sandbox = true; settings.remote_debugging_port = 1337; settings.single_process = false; CefString(&settings.cache_path).FromASCII(CACHE_PATH); CefInitialize(mainArgs, settings, app, nullptr); CefRunMessageLoop(); CefShutdown(); return 0; }
static void Video_OnPaint(HWND hWindow) /***********************************************************************/ { LPVIDEO lpVideo; HDC hDC; PAINTSTRUCT ps; if ( !(lpVideo = (LPVIDEO)GetWindowLong( hWindow, GWL_DATAPTR )) ) return; hDC = BeginPaint( hWindow, &ps ); MCIUpdate( lpVideo->hDevice, hDC ); EndPaint( hWindow, &ps ); if ( !lpVideo->bAutoplayUsed ) { lpVideo->bAutoplayUsed = YES; if ( GetSwitchValue( 'a', lpVideo->lpSwitches ) ) FORWARD_WM_KEYDOWN( hWindow, 'P', 0/*cRepeat*/, 0/*flags*/, SendMessage); Video_DrawProcInstall( hWindow, VDP_HotspotSet, VDP_HotspotDraw, 33 ); } }
static BOOL Video_Open( HWND hWindow, LPVIDEO lpVideo, WORD wDisk, long lStartFrame ) /***********************************************************************/ { if ( !lpVideo ) return( NO ); HourGlass( YES ); // Cleanup any open video file if ( lpVideo->lpSwitches ) { FreeUp( (LPTR)lpVideo->lpSwitches ); lpVideo->lpSwitches = NULL; } if ( lpVideo->idLoopTimer ) { KillTimer( hWindow, lpVideo->idLoopTimer ); lpVideo->idLoopTimer = NULL; } if ( lpVideo->hDevice ) { Video_Close( hWindow, lpVideo ); lpVideo->hDevice = NULL; } FNAME szFileName; GetWindowText( hWindow, szFileName, sizeof(STRING) ); GetStringParm( szFileName, 0/*nIndex*/, ',', szFileName ); lpVideo->lpSwitches = ExtractSwitches( szFileName ); // Replace any %d in the file name with the disk number, // and flag whether we need to check disk labels wsprintf( szFileName, szFileName, wDisk ); BOOL bFullScreen = (BOOL)GetSwitchValue( 'f', lpVideo->lpSwitches ); VideoInit( NO/*ZoomBy2*/, bFullScreen ); if ( !lpVideo->iZoomFactor ) { if ( iDefaultZoomFactor ) lpVideo->iZoomFactor = iDefaultZoomFactor; else { lpVideo->iZoomFactor = (int)GetSwitchValue( 'z', lpVideo->lpSwitches ); if ( !lpVideo->iZoomFactor ) lpVideo->iZoomFactor = 1; } } STRING szAlias; wsprintf( szAlias, "A%d%ld", wDisk, (LPSTR)hWindow ); if ( !(lpVideo->hDevice = MCIOpen( GetApp()->m_hDeviceAVI, szFileName, szAlias, hWindow, lStartFrame )) ) { HourGlass( NO ); return( NO ); } lpVideo->lFrames = MCIGetLength( lpVideo->hDevice ); lpVideo->wDisk = wDisk; //MCISetVideoDrawProc( lpVideo->hDevice, NULL/*lpDrawDibProc*/, NULL/*lpDrawDCProc*/ ); MCISetTimeFormat( lpVideo->hDevice, MCI_FORMAT_FRAMES ); // force the control to take on the size of the video file RECT rect; GetClientRect( hWindow, &rect ); MapWindowPoints( hWindow, GetParent(hWindow), (LPPOINT)&rect, 2 ); SetWindowPos( hWindow, NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER | SWP_NOACTIVATE ); HourGlass( NO ); return( YES ); }
//@CalledByNative void ChildProcessLauncher::Start( /* [in] */ IContext* context, /* [in] */ const ArrayOf<String>* commandLine, /* [in] */ Int32 childProcessId, /* [in] */ ArrayOf<Int32>* fileIds, /* [in] */ ArrayOf<Int32>* fileFds, /* [in] */ ArrayOf<Boolean>* fileAutoClose, /* [in] */ Int64 clientContext) { TraceEvent::Begin(); assert(fileIds->GetLength() == fileFds->GetLength() && fileFds->GetLength() == fileAutoClose->GetLength()); AutoPtr< ArrayOf<FileDescriptorInfo*> > filesToBeMapped = ArrayOf<FileDescriptorInfo*>::Alloc(fileFds->GetLength()); for (Int32 i = 0; i < fileFds->GetLength(); i++) { (*filesToBeMapped)[i] = new FileDescriptorInfo((*fileIds)[i], (*fileFds)[i], (*fileAutoClose)[i]); } assert(clientContext != 0); Int32 callbackType = CALLBACK_FOR_UNKNOWN_PROCESS; Boolean inSandbox = TRUE; String processType = GetSwitchValue(commandLine, SWITCH_PROCESS_TYPE); if (SWITCH_RENDERER_PROCESS.Equals(processType)) { callbackType = CALLBACK_FOR_RENDERER_PROCESS; } else if (SWITCH_GPU_PROCESS.Equals(processType)) { callbackType = CALLBACK_FOR_GPU_PROCESS; } else if (SWITCH_PPAPI_BROKER_PROCESS.Equals(processType)) { inSandbox = FALSE; } AutoPtr<ChildProcessConnection> allocatedConnection; { assert(0); // Object::Autolock lock(this); if (inSandbox) { allocatedConnection = sSpareSandboxedConnection; sSpareSandboxedConnection = NULL; } } if (allocatedConnection == NULL) { assert(0); // allocatedConnection = AllocateBoundConnection(context, commandLine, inSandbox); if (allocatedConnection == NULL) { // Notify the native code so it can free the heap allocated callback. NativeOnChildProcessStarted(clientContext, 0); // Log.e(TAG, "Allocation of new service failed."); TraceEvent::End(); return; } } // Log.d(TAG, "Setting up connection to process: slot=" + // allocatedConnection.getServiceNumber()); assert(0); // TriggerConnectionSetup(allocatedConnection, commandLine, childProcessId, filesToBeMapped, // callbackType, clientContext); TraceEvent::End(); }
void CScene::OnSize(HWND hWnd, UINT state, int cx, int cy) /***********************************************************************/ { STRING szString; FNAME szDib; PTOON pToon; // if there is a toon associated with this scene, there // is no need to create an offscreen, since a toon already // has all the offscreen functionality. if ( !(pToon = GetToon()) ) { // Instantiate the COffScreen object for this scene // if it has not already been done GetWindowText( hWnd, szString, sizeof(STRING)-1 ); GetStringParm( szString, 0/*nIndex*/, ',', szDib ); if ( !m_lpOffScreen ) { // /p switch sets up offscreen to use identity palette // created from the read-only dib instead of the // common application palette LPLONG lpSwitches = ExtractSwitches( szString ); if (GetSwitchValue('p', lpSwitches)) m_lpOffScreen = new COffScreen(); else m_lpOffScreen = new COffScreen(GetApp()->m_hPal); FreeUp(lpSwitches); } // if we don't have enough memory to instantiate // the offscreen, then we are done if ( !m_lpOffScreen ) return; // load the read-only background dib if it has not been done already if ( !m_lpOffScreen->GetReadOnlyDIB() ) { if ( *szDib ) m_lpOffScreen->Load( szDib ); else m_lpOffScreen->Load( GetWindowInstance(hWnd), m_nSceneNo ); // copy the colors to the stage dib to be used with WinG m_lpOffScreen->CopyColors(); } // if we were unsuccessful, then clean up and bail out if ( !m_lpOffScreen->GetReadOnlyDIB() ) { delete m_lpOffScreen; m_lpOffScreen = NULL; return; } // Resize the stage dib and create the WinG bitmap m_lpOffScreen->Resize( cx, cy ); // Copy bits from the read-only dib to the WinG bitmap m_lpOffScreen->CopyBits(); } // setup animator object to be used with sprite engine // if it has not been setup already. if (!m_pAnimator) { if (pToon) m_pAnimator = new CAnimator(pToon); else m_pAnimator = new CAnimator(hWnd, m_lpOffScreen); } }