int main(int argc, char *argv[]) { // initialize SDL if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO) < 0) { fprintf(stderr, "SDL_Init() failed: %s\n", SDL_GetError()); return 255; } atexit(SDL_Quit); SDL_SetHint(SDL_HINT_ORIENTATIONS, "Portrait"); // initialize video if (!VideoInit()) { fprintf(stderr, "VideoInit() failed: %s\n", SDL_GetError()); return 255; } atexit(VideoDestroy); // initialize audio if (SOUND_OpenAudio(44100, 2, 1024) < 0) { fprintf(stderr, "InitSound() failed: %s\n", SDL_GetError()); return 255; } return GameMain(); }
/** ** Start external player. ** ** @param filename path and name of file to play */ void PlayerStart(const char *filename) { PlayerPipeCnt = 0; // reset to defaults PlayerPipeIdx = 0; PlayerPipeIn[0] = -1; PlayerPipeIn[1] = -1; PlayerPipeOut[0] = -1; PlayerPipeOut[1] = -1; PlayerPid = 0; PlayerPaused = 0; PlayerSpeed = 1; PlayerDvdNav = 0; if (ConfigOsdOverlay) { // overlay wanted VideoSetColorKey(ConfigColorKey); VideoInit(ConfigX11Display); EnableDummyDevice(); } PlayerForkAndExec(filename); if (ConfigOsdOverlay || ConfigUseSlave) { PlayerThreadInit(); } }
void kmain( void* mdb,u32i magic ) { if( magic != 0x2BADB002 ) { while(1); } InitDescriptorTables(); VideoInit(); SetColor(BLACK,BRIGHT_WHITE); KPrintf("This is Atomic Kernel 12715A\n"); KPrintf("Starting Timer..."); InitTimer(100); KPrintf("Done.\n"); KPrintf("Starting Keyboard..."); InitKeyboard(); KPrintf("Done.\n"); KPrintf("Starting Paging..."); InitialisePaging(); KPrintf("Done.\n"); KPrintf("Starting Heap..."); HeapInit(); KPrintf("Done.\n"); u32i *A,*B,*C; A = Kmalloc(8); B = Kmalloc(8); KPrintf("A:%x,B:%x",A,B); KFree(A); KFree(B); C = Kmalloc(16); KPrintf("C:%x\n",C); while(1); }
void SystemInit (void) { TimerInit(); DirInit(); VideoInit(); // Must be before sound/input because of window InputInit(); SoundInit(); //LuaStart(); }
void __cdecl kshell() { VolInit(); StorageProbe(); VolList(); KbdInit(); VideoInit(); WindowsInit(); MouseInit(); }
void main(void) { HardwareInit(); UartInit(STDIO,115200,DEFAULT_LINE_CTRL); heap_size=free_heap(); #if defined DEBUG test_pattern(); #endif UartPrint(STDOUT,"video initialization\r"); VideoInit(); delay_ms(500); UartPrint(STDOUT,"keyboard initialization: "); if (KeyboardInit()){ UartPrint(STDOUT,"OK\r"); comm_channel=LOCAL_CON; }else{ UartPrint(STDOUT,"keyboard error\r"); UartPrint(STDOUT,"Using uart2 channel.\r"); comm_channel=SERIAL_CON; } text_coord_t cpos; UartPrint(STDOUT,"SD initialization: "); if (!mount(0)){ UartPrint(STDOUT,"Failed\r"); SDCardReady=FALSE; }else{ UartPrint(STDOUT,"succeeded\r"); SDCardReady=TRUE; } UartPrint(STDOUT,"SRAM initialization\r"); sram_init(); UartPrint(STDOUT,"sound initialization.\r"); tune((unsigned int*)&e3k[0]); UartPrint(STDOUT,"initialization completed.\r"); set_cursor(CR_BLOCK); // sauvegare video_buffer dans SRAM clear_screen(); #if defined _DEBUG_ graphics_test(); set_curpos(0,LINE_PER_SCREEN-1); print(comm_channel,"test"); sram_write_block(100000,video_bmp,BMP_SIZE); delay_ms(1000); clear_screen(); delay_ms(1000); sram_read_block(100000,video_bmp,BMP_SIZE); delay_ms(1000); clear_screen(); // print(comm_channel,"heap_size: "); // print_int(comm_channel,heap_size,0); // crlf(); #endif shell(); } // main()
void main(int argc, char *argv[]) { int n; memset(startdir,0,sizeof(startdir)); memset(cfgfilename,0,sizeof(cfgfilename)); ArgInit(argc, argv); VideoInit(); ShowCopyright(argc, argv); // CheckIfLocked(); ShowSysInfo(); ShowEnvInfo(); ShowMainMenu(); ShowMemory(); // CheckVersion(); ValidateConfig(); l1: ShowMemory(); SelectMainMenu(); l2: switch(mainmenu_sel) { case 0: ShowKernelMenu(); if(keycode==F2) { ShowMemory(); mainmenu_sel=1; goto l2; } else break; case 1: ShowExtenderMenu(); if(keycode==F1) { ShowMemory(); mainmenu_sel=0; goto l2; } else break; case 2: CreateConfig(); break; case 3: RestoreConfig();break; case 4: id32=id32_old; ClearConfigName(); break; case 5: DiscardExit(); break; case 6: ApplyExit(); break; } goto l1; }
void __cdecl ldr_logo() { kboot_info *bi; unsigned char ch; UINT32 e; HeapInit(); ConsoleInit(); TxtSetFlags(BGCOLOR_BLACK|FGCOLOR_GREEN); TxtClearScreen(); SerialInit(); PicInit(); DescriptorsInit(); InterruptsInit(); ExceptionsInit(); DbgInit(); _enable(); IrqInit(); TssInit(); Vm86Init(); TimerInit(); KbdInit(); //DbgStepEnable(); StorageProbe(); e = VolReadFile("A:\\OSLDR.EXE", (VPTR)0x300000); DbgPrintf("%s\n", DbgStatusStr(e)); if(VideoInit()) { DbgPrintf("\nError Initializing Video Subsystem"); } while(1) { ch=KbdGetKey(); _Putch(ch); if(ch==33) KbdCpuReset(); } while(1); }
int main() { char data[100]; uart0_init(); uart0_init(); // 波特率115200,8N1(8个数据位,无校验位,1个停止位) Lcd_Port_Init(); // 设置LCD引脚 Tft_Lcd_Init(); // 初始化LCD控制器 Lcd_PowerEnable(0, 1); // 设置LCD_PWREN有效,它用于打开LCD的电源 Lcd_EnvidOnOff(1); // 使能LCD控制器输出信号 ClearScr(50); // 清屏,黑色ssssssssssssssssssssssssssssssssssssssss VideoInit(); //setting font color and windwos size printf_k("\n\rhao are you\n\r"); while (1) { memset(data, 0, sizeof(data)); gets(data); puts(data); printf_k("%s\n\r", data); } return 0; }
void run_fba_emulator(const char *fn) { char build_version[] = "Finalburn Alpha Plus for Pi ("__DATE__")"; // process rom path and name char romname[MAX_PATH]; if (BurnCacheInit(fn, romname)) goto finish; if(config_options.option_showfps) bShowFPS=true; BurnLibInit(); // find rom by name for (nBurnDrvSelect=0; nBurnDrvSelect<nBurnDrvCount; nBurnDrvSelect++) if ( strcasecmp(romname, BurnDrvGetTextA(DRV_NAME)) == 0 ) break; if (nBurnDrvSelect >= nBurnDrvCount) { // unsupport rom ... nBurnDrvSelect = ~0U; logoutput ("rom not supported!\n"); printf ("rom not supported!\n"); goto finish; } logoutput("Attempt to initialise '%s'\n", BurnDrvGetTextA(DRV_FULLNAME)); memset (titlefb, 0, 320*240*2); DrawString (build_version, (uint16*)&titlefb, 10, 20, 320); DrawString ("Based on FinalBurnAlpha", (uint16*)&titlefb, 10, 35, 320); DrawString ("Now loading ... ", (uint16 *)&titlefb, 10, 105, 320); show_rom_loading_text("Open Zip", 0, 0); memcpy (VideoBuffer, titlefb, 320*240*2); pi_video_flip(); InpInit(); InpDIP(); VideoInit(); if (DrvInit(nBurnDrvSelect, false) != 0) { logoutput ("Driver initialisation failed! Likely causes are:\n- Corrupt/Missing ROM(s)\n- I/O Error\n- Memory error\n\n"); printf ("Driver initialisation failed! Likely causes are:\n- Corrupt/Missing ROM(s)\n- I/O Error\n- Memory error\n\n"); goto finish; } RunReset(); frame_count = 0; GameLooping = true; EZX_StartTicks(); logoutput ("Lets go!\n"); logflush(); if (config_options.option_sound_enable) { int timer = 0, tick=0, i=0, fps = 0; bool bRenderFrame; if (SndOpen() == 0) { while (GameLooping) { if (bShowFPS) { timer = EZX_GetTicks(); if(timer-tick>1000000) { fps = nFramesRendered; nFramesRendered = 0; tick = timer; } } //We need to render more audio: bRenderFrame=true; // Render last frame RunOneFrame(bRenderFrame,fps); update_audio_stream(pBurnSoundOut); pi_process_events(); } } } else { int now, done=0, timer = 0, ticks=0, tick=0, i=0, fps = 0; unsigned int frame_limit = nBurnFPS/100, frametime = 100000000/nBurnFPS; while (GameLooping) { timer = EZX_GetTicks()/frametime;; if(timer-tick>frame_limit && bShowFPS) { fps = nFramesRendered; nFramesRendered = 0; tick = timer; } now = timer; ticks=now-done; if(ticks<1) continue; if(ticks>10) ticks=10; for (i=0; i<ticks-1; i++) { RunOneFrame(false,fps); } if(ticks>=1) { RunOneFrame(true,fps); } done = now; } } logoutput ("Finished emulating\n"); finish: logoutput("---- Shutdown Finalburn Alpha plus ----\n\n"); DrvExit(); BurnLibExit(); if (config_options.option_sound_enable) SndExit(); VideoExit(); InpExit(); BurnCacheExit(); }
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 ); }
/*static*/ int __init StmLoadModule(void) { int Result; int i; short int AdapterNumbers[] = { -1 }; DvbContext = kzalloc(sizeof(struct DvbContext_s), GFP_KERNEL); if (DvbContext == NULL) { DVB_ERROR("Unable to allocate device memory\n"); return -ENOMEM; } #ifdef __TDT__ memset(DvbContext, 0, sizeof * DvbContext); #endif #ifdef __TDT__ if (swts) printk("swts ->routing streams from dvr0 to tsm to pti to player\n"); else printk("no swts ->routing streams from dvr0 direct to the player\n"); #endif #if DVB_API_VERSION < 5 Result = dvb_register_adapter(&DvbContext->DvbAdapter, MODULE_NAME, THIS_MODULE, NULL); #else Result = dvb_register_adapter(&DvbContext->DvbAdapter, MODULE_NAME, THIS_MODULE, NULL, AdapterNumbers); #endif if (Result < 0) { DVB_ERROR("Failed to register adapter (%d)\n", Result); kfree(DvbContext); DvbContext = NULL; return -ENOMEM; } mutex_init(&(DvbContext->Lock)); mutex_lock(&(DvbContext->Lock)); /*{{{ Register devices*/ for (i = 0; i < DVB_MAX_DEVICES_PER_ADAPTER; i++) { struct DeviceContext_s* DeviceContext = &DvbContext->DeviceContext[i]; struct dvb_demux* DvbDemux = &DeviceContext->DvbDemux; struct dmxdev* DmxDevice = &DeviceContext->DmxDevice; struct dvb_device* DvrDevice; #ifdef __TDT__ //sylvester: wenn der stream vom user kommt soll WriteToDecoder nix //tun, da das ja hier schon passiert. keine ahnung wie man das ansonsten //verhindern soll;-) DeviceContext->dvr_write = 0; #endif DeviceContext->DvbContext = DvbContext; #if defined (USE_KERNEL_DEMUX) memset(DvbDemux, 0, sizeof(struct dvb_demux)); #ifdef __TDT__ DvbDemux->dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING | DMX_TS_DESCRAMBLING; /* currently only dummy to avoid EINVAL error. Later we need it for second frontend ?! */ DvbDemux->dmx.set_source = SetSource; #else DvbDemux->dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING; #endif DvbDemux->priv = DeviceContext; DvbDemux->filternum = 32; DvbDemux->feednum = 32; DvbDemux->start_feed = StartFeed; DvbDemux->stop_feed = StopFeed; #ifdef __TDT__ DvbDemux->write_to_decoder = WriteToDecoder; #else DvbDemux->write_to_decoder = NULL; #endif Result = dvb_dmx_init(DvbDemux); if (Result < 0) { DVB_ERROR("dvb_dmx_init failed (errno = %d)\n", Result); return Result; } memset(DmxDevice, 0, sizeof(struct dmxdev)); DmxDevice->filternum = DvbDemux->filternum; DmxDevice->demux = &DvbDemux->dmx; DmxDevice->capabilities = 0; Result = dvb_dmxdev_init(DmxDevice, &DvbContext->DvbAdapter); if (Result < 0) { DVB_ERROR("dvb_dmxdev_init failed (errno = %d)\n", Result); dvb_dmx_release(DvbDemux); return Result; } DvrDevice = DvrInit(DmxDevice->dvr_dvbdev->fops); #ifdef __TDT__ printk("%d: DeviceContext %p, DvbDemux %p, DmxDevice %p\n", i, DeviceContext, DvbDemux, DmxDevice); #endif /* Unregister the built-in dvr device and replace it with our own version */ dvb_unregister_device(DmxDevice->dvr_dvbdev); dvb_register_device(&DvbContext->DvbAdapter, &DmxDevice->dvr_dvbdev, DvrDevice, DmxDevice, DVB_DEVICE_DVR); DeviceContext->MemoryFrontend.source = DMX_MEMORY_FE; Result = DvbDemux->dmx.add_frontend(&DvbDemux->dmx, &DeviceContext->MemoryFrontend); if (Result < 0) { DVB_ERROR("add_frontend failed (errno = %d)\n", Result); dvb_dmxdev_release(DmxDevice); dvb_dmx_release(DvbDemux); return Result; } #else dvb_register_device(&DvbContext->DvbAdapter, &DeviceContext->DemuxDevice, DemuxInit(DeviceContext), DeviceContext, DVB_DEVICE_DEMUX); dvb_register_device(&DvbContext->DvbAdapter, &DeviceContext->DvrDevice, DvrInit(DeviceContext), DeviceContext, DVB_DEVICE_DVR); #endif dvb_register_device(&DvbContext->DvbAdapter, &DeviceContext->AudioDevice, AudioInit(DeviceContext), DeviceContext, DVB_DEVICE_AUDIO); #ifdef __TDT__ /* register the CA device (e.g. CIMAX) */ if (i < 3) #ifndef VIP2_V1 dvb_register_device(&DvbContext->DvbAdapter, &DeviceContext->CaDevice, CaInit(DeviceContext), DeviceContext, DVB_DEVICE_CA); #endif #else dvb_register_device(&DvbContext->DvbAdapter, &DeviceContext->CaDevice, CaInit(DeviceContext), DeviceContext, DVB_DEVICE_CA); #endif dvb_register_device(&DvbContext->DvbAdapter, &DeviceContext->VideoDevice, VideoInit(DeviceContext), DeviceContext, DVB_DEVICE_VIDEO); DeviceContext->Id = i; DeviceContext->numRunningFeeds = 0; DeviceContext->DemuxContext = DeviceContext; /* wire directly to own demux by default */ DeviceContext->SyncContext = DeviceContext; /* we are our own sync group by default */ DeviceContext->Playback = NULL; DeviceContext->StreamType = STREAM_TYPE_TRANSPORT; DeviceContext->DvbContext = DvbContext; DeviceContext->DemuxStream = NULL; DeviceContext->VideoStream = NULL; DeviceContext->AudioStream = NULL; DeviceContext->PlaySpeed = DVB_SPEED_NORMAL_PLAY; DeviceContext->dvr_in = kmalloc(65536, GFP_KERNEL); // 128Kbytes is quite a lot per device. DeviceContext->dvr_out = kmalloc(65536, GFP_KERNEL); // However allocating on each write is expensive. DeviceContext->EncryptionOn = 0; #ifdef __TDT__ DeviceContext->VideoPlaySpeed = DVB_SPEED_NORMAL_PLAY; DeviceContext->provideToDecoder = 0; DeviceContext->feedPesType = 0; mutex_init(&DeviceContext->injectMutex); if (i < 4) { ptiInit(DeviceContext); } if (i < 1) { init_e2_proc(DeviceContext); } #endif } mutex_unlock(&(DvbContext->Lock)); DvbBackendInit(); #ifndef __TDT__ #if defined (CONFIG_CPU_SUBTYPE_STX7105) // || defined (CONFIG_CPU_SUBTYPE_STX7200) cap_init(); #endif #endif linuxdvb_v4l2_init(); DVB_DEBUG("STM stream device loaded\n"); return 0; }
BOOL CZogvmDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon //设置列表图标 m_SmallIcon.Create(16,16, 1, 10, 4); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_GREEN)); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_RED)); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_VIDEO)); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_AUDIO)); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_SUB)); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_ISO)); m_list.SetImageList(&m_SmallIcon,LVSIL_SMALL); //m_NullIcon.Create(1,1, 1, 10, 4); //m_NullIcon.Add(AfxGetApp()->LoadIcon(IDI_NULL)); //m_list.SetImageList(&m_NullIcon,LVSIL_SMALL); m_list.InsertColumn(0, ConvertString("磁盘序列号") , LVCFMT_LEFT, 90); m_list.InsertColumn(1, ConvertString("标签") , LVCFMT_LEFT, 80); m_list.InsertColumn(2, ConvertString("分区") , LVCFMT_LEFT, 40); m_list.InsertColumn(3, ConvertString("序号") , LVCFMT_LEFT, 50); m_list.InsertColumn(4, ConvertString("路径") , LVCFMT_LEFT, 200); m_list.InsertColumn(5, ConvertString("文件名") , LVCFMT_LEFT, 300); m_list.InsertColumn(6, ConvertString("类型") , LVCFMT_LEFT, 40); m_list.InsertColumn(7, ConvertString("后缀") , LVCFMT_LEFT, 50); m_list.InsertColumn(8, ConvertString("创建时间") , LVCFMT_LEFT, 130); m_list.InsertColumn(9, ConvertString("修改时间") , LVCFMT_LEFT,130); m_list.InsertColumn(10, ConvertString("文件大小") , LVCFMT_LEFT, 60); m_list.InsertColumn(11, ConvertString("分辨率") , LVCFMT_LEFT, 0); m_list.InsertColumn(12, ConvertString("播放长度") , LVCFMT_LEFT, 0); m_list.InsertColumn(13, ConvertString("硬盘接驳") , LVCFMT_LEFT, 60); m_list.InsertColumn(14, ConvertString("3D") , LVCFMT_LEFT,30); m_list.InsertColumn(15, ConvertString("画质") , LVCFMT_LEFT, 50); m_list.InsertColumn(16, ConvertString("分辨率") , LVCFMT_LEFT, 50); m_list.InsertColumn(17, ConvertString("压制组") , LVCFMT_LEFT, 80); m_list.InsertColumn(18, ConvertString("年代") , LVCFMT_LEFT, 40); m_list.InsertColumn(19, ConvertString("效验值") , LVCFMT_LEFT, 0); m_list.InsertColumn(20, ConvertString("重复ID") , LVCFMT_LEFT, 50); //带复选框 LVS_EX_CHECKBOXES 带图标 LVS_EX_SUBITEMIMAGES m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_SUBITEMIMAGES); // char output[1024]=""; // GetEd2kUrl("C:\\paramsettemp.jpg","paramsettemp.jpg",output); // TODO: Add extra initialization here #if OPEN_FFMEPG VideoInit(); #endif char title[512]=""; sprintf(title,"zogna video manager 1.07 Build:%s 更新地址:https://git.oschina.net/zogna/zogvm/attach_files",__DATE__); SetWindowText(title); //初始即最大化 ShowWindow(SW_MAXIMIZE); return TRUE; // return TRUE unless you set the focus to a control }
/* video2lcd </dev/video0,1,,,>*/ int main(int argc, char **argv) { int iError; T_VideoDevice tVideoDevice; PT_VideoConvert ptVideoConvert; int iPixFormatOfVideo; int iPixFormatOfDisp; PT_VideoBuf ptVideoBufCur; T_VideoBuf tVideoBuf; T_VideoBuf tConvertBuf; T_VideoBuf tZoomBuf; T_VideoBuf tFrameBuf; int iLcdWidth,iLcdHeight,iLcdBpp; int iTopLeftX,iTopLeftY ; float k; if (argc != 2) { DBG_PRINTF("Usage:\n"); DBG_PRINTF("%s video2lcd </dev/video0,1,,,>\n", argv[0]); return 0; } /*一系列的初始化*/ /* 注册显示设备 */ DisplayInit(); /* 可能可支持多个显示设备: 选择和初始化指定的显示设备 */ SelectAndInitDefaultDispDev("fb"); GetDispResolution(&iLcdWidth, &iLcdHeight, &iLcdBpp); GetVideoBufForDisplay(&tFrameBuf); iPixFormatOfDisp = tFrameBuf.iPixelFormat; VideoInit(); iError = VideoDeviceInit(argv[1], &tVideoDevice); if(iError) { DBG_PRINTF("VideoInit for %s error\n",argv[1]); return -1; } iPixFormatOfVideo = tVideoDevice.ptopr->GetFormat(&tVideoDevice); VideoConvertInit(); ptVideoConvert = GetVideoConvertForFormat(iPixFormatOfVideo, iPixFormatOfDisp); if(ptVideoConvert == NULL) { DBG_PRINTF("Can not support this format convert !\n"); return -1; } /*启动摄像头*/ iError = tVideoDevice.ptopr->StartDevice(&tVideoDevice); if(iError) { DBG_PRINTF("Start device for %s error\n",argv[1]); return -1; } memset(&tVideoBuf, 0, sizeof(tVideoBuf)); memset(&tConvertBuf, 0, sizeof(tConvertBuf)); tConvertBuf.tPixelDatas->iBpp = iLcdBpp; memset(&tZoomBuf, 0, sizeof(tZoomBuf)); while(1) { /*读入摄像头数据*/ iError = tVideoDevice.ptopr->GetFrame(&tVideoDevice, &tVideoBuf); if(iError) { DBG_PRINTF("GetFrame for %s error\n",argv[1]); return -1; } ptVideoBufCur = &tVideoBuf; /*转换为RGB数据*/ if(iPixFormatOfVideo != iPixFormatOfDisp) { /*转换为RGB数据*/ iError = ptVideoConvert->Covert(&tVideoBuf, &tConvertBuf); if(iError) { DBG_PRINTF("Covert for %s error\n",argv[1]); return -1; } ptVideoBufCur = &tConvertBuf; } /*如果图像分辨率,大于LCD,缩放*/ if (ptVideoBufCur->tPixelDatas.iWidth > iLcdWidth || ptVideoBufCur->tPixelDatas.iHeight> iLcdHeight) { /*确定缩放后的分辨率*/ /* 把图片按比例缩放到VideoMem上, 居中显示 * 1. 先算出缩放后的大小 */ k = (float)ptVideoBufCur->tPixelDatas.iHeight / ptVideoBufCur->tPixelDatas.iWidth; tZoomBuf.tPixelDatas.iWidth = iLcdWidth; tZoomBuf.tPixelDatas.iHeight = iLcdWidth* k; if (tZoomBuf.tPixelDatas.iHeight > iLcdHeight) { tZoomBuf.tPixelDatas.iWidth = iLcdHeight / k; tZoomBuf.tPixelDatas.iHeight = iLcdHeight; } tZoomBuf.tPixelDatas.iBpp = iLcdBpp; tZoomBuf.tPixelDatas.iLineBytes = tZoomBuf->tPixelDatas.iWidth * tZoomBuf.tPixelDatas.iBpp / 8; tZoomBuf.tPixelDatas.iTotalBytes = tZoomBuf->tPixelDatas.iLineBytes * tZoomBuf.tPixelDatas.iHeight; if(!tZoomBuf.tPixelDatas.aucPixelDatas) { tZoomBuf.tPixelDatas.aucPixelDatas = malloc(tZoomBuf.tPixelDatas.iTotalBytes); } if (tZoomBuf.tPixelDatas.aucPixelDatas == NULL) { PutVideoMem(ptVideoMem); return NULL; } PicZoom(&ptVideoBufCur.tPixelDatas, &tZoomBuf.tPixelDatas); ptVideoBufCur = &tZoomBuf; } /*合并进入frmaebuffer*/ /* 接着算出居中显示时左上角坐标 */ iTopLeftX = (iLcdWidth- ptVideoBufCur->tPixelDatas.iWidth) / 2; iTopLeftY = (iLcdHeight- ptVideoBufCur->tPixelDatas.iHeight) / 2; PicMerge(iTopLeftX,iTopLeftY,&ptVideoBufCur->tPixelDatas,&tFrameBuf.tPixelDatas); FlushPixelDataToDev(&tFrameBuf.tPixelDatas); iError = tVideoDevice.ptopr->PutFrame(&tVideoDevice, &tVideoBuf); if (iError) { DBG_PRINTF("PutFrame for %s error\n",argv[1]); return -1; } /*把framebuffer的数据刷到LCD上*/ } /* 初始化调试模块: 可以通过"标准输出"也可以通过"网络"打印调试信息 * 因为下面马上就要用到DBG_PRINTF函数, 所以先初始化调试模块 */ return 0; }
bool InitAll(const char *vmdir) { // Check ROM version if (!CheckROM()) { ErrorAlert(STR_UNSUPPORTED_ROM_TYPE_ERR); return false; } #if EMULATED_68K // Set CPU and FPU type (UAE emulation) switch (ROMVersion) { case ROM_VERSION_64K: case ROM_VERSION_PLUS: case ROM_VERSION_CLASSIC: CPUType = 0; FPUType = 0; TwentyFourBitAddressing = true; break; case ROM_VERSION_II: CPUType = PrefsFindInt32("cpu"); if (CPUType < 2) CPUType = 2; if (CPUType > 4) CPUType = 4; FPUType = PrefsFindBool("fpu") ? 1 : 0; if (CPUType == 4) FPUType = 1; // 68040 always with FPU TwentyFourBitAddressing = true; break; case ROM_VERSION_32: CPUType = PrefsFindInt32("cpu"); if (CPUType < 2) CPUType = 2; if (CPUType > 4) CPUType = 4; FPUType = PrefsFindBool("fpu") ? 1 : 0; if (CPUType == 4) FPUType = 1; // 68040 always with FPU TwentyFourBitAddressing = false; break; } CPUIs68060 = false; #endif // Load XPRAM XPRAMInit(vmdir); // Load XPRAM default values if signature not found if (XPRAM[0x0c] != 0x4e || XPRAM[0x0d] != 0x75 || XPRAM[0x0e] != 0x4d || XPRAM[0x0f] != 0x63) { D(bug("Loading XPRAM default values\n")); memset(XPRAM, 0, 0x100); XPRAM[0x0c] = 0x4e; // "NuMc" signature XPRAM[0x0d] = 0x75; XPRAM[0x0e] = 0x4d; XPRAM[0x0f] = 0x63; XPRAM[0x01] = 0x80; // InternalWaitFlags = DynWait (don't wait for SCSI devices upon bootup) XPRAM[0x10] = 0xa8; // Standard PRAM values XPRAM[0x11] = 0x00; XPRAM[0x12] = 0x00; XPRAM[0x13] = 0x22; XPRAM[0x14] = 0xcc; XPRAM[0x15] = 0x0a; XPRAM[0x16] = 0xcc; XPRAM[0x17] = 0x0a; XPRAM[0x1c] = 0x00; XPRAM[0x1d] = 0x02; XPRAM[0x1e] = 0x63; XPRAM[0x1f] = 0x00; XPRAM[0x08] = 0x13; XPRAM[0x09] = 0x88; XPRAM[0x0a] = 0x00; XPRAM[0x0b] = 0xcc; XPRAM[0x76] = 0x00; // OSDefault = MacOS XPRAM[0x77] = 0x01; } // Set boot volume int16 i16 = PrefsFindInt32("bootdrive"); XPRAM[0x78] = i16 >> 8; XPRAM[0x79] = i16 & 0xff; i16 = PrefsFindInt32("bootdriver"); XPRAM[0x7a] = i16 >> 8; XPRAM[0x7b] = i16 & 0xff; // Init drivers SonyInit(); DiskInit(); CDROMInit(); SCSIInit(); #if SUPPORTS_EXTFS // Init external file system ExtFSInit(); #endif // Init serial ports SerialInit(); // Init network EtherInit(); // Init Time Manager TimerInit(); // Init clipboard ClipInit(); // Init ADB ADBInit(); // Init audio AudioInit(); // Init video if (!VideoInit(ROMVersion == ROM_VERSION_64K || ROMVersion == ROM_VERSION_PLUS || ROMVersion == ROM_VERSION_CLASSIC)) return false; // Set default video mode in XPRAM XPRAM[0x56] = 0x42; // 'B' XPRAM[0x57] = 0x32; // '2' const monitor_desc &main_monitor = *VideoMonitors[0]; XPRAM[0x58] = uint8(main_monitor.depth_to_apple_mode(main_monitor.get_current_mode().depth)); XPRAM[0x59] = 0; #if EMULATED_68K // Init 680x0 emulation (this also activates the memory system which is needed for PatchROM()) if (!Init680x0()) return false; #endif // Install ROM patches if (!PatchROM()) { ErrorAlert(STR_UNSUPPORTED_ROM_TYPE_ERR); return false; } #if ENABLE_MON // Initialize mon mon_init(); mon_read_byte = mon_read_byte_b2; mon_write_byte = mon_write_byte_b2; #endif return true; }