static m64p_error plugin_start_gfx(void) { /* fill in the GFX_INFO data structure */ gfx_info.HEADER = (unsigned char *) g_rom; gfx_info.RDRAM = (unsigned char *) g_rdram; gfx_info.DMEM = (unsigned char *) g_dev.sp.mem; gfx_info.IMEM = (unsigned char *) g_dev.sp.mem + 0x1000; gfx_info.MI_INTR_REG = &(g_dev.r4300.mi.regs[MI_INTR_REG]); gfx_info.DPC_START_REG = &(g_dev.dp.dpc_regs[DPC_START_REG]); gfx_info.DPC_END_REG = &(g_dev.dp.dpc_regs[DPC_END_REG]); gfx_info.DPC_CURRENT_REG = &(g_dev.dp.dpc_regs[DPC_CURRENT_REG]); gfx_info.DPC_STATUS_REG = &(g_dev.dp.dpc_regs[DPC_STATUS_REG]); gfx_info.DPC_CLOCK_REG = &(g_dev.dp.dpc_regs[DPC_CLOCK_REG]); gfx_info.DPC_BUFBUSY_REG = &(g_dev.dp.dpc_regs[DPC_BUFBUSY_REG]); gfx_info.DPC_PIPEBUSY_REG = &(g_dev.dp.dpc_regs[DPC_PIPEBUSY_REG]); gfx_info.DPC_TMEM_REG = &(g_dev.dp.dpc_regs[DPC_TMEM_REG]); gfx_info.VI_STATUS_REG = &(g_dev.vi.regs[VI_STATUS_REG]); gfx_info.VI_ORIGIN_REG = &(g_dev.vi.regs[VI_ORIGIN_REG]); gfx_info.VI_WIDTH_REG = &(g_dev.vi.regs[VI_WIDTH_REG]); gfx_info.VI_INTR_REG = &(g_dev.vi.regs[VI_V_INTR_REG]); gfx_info.VI_V_CURRENT_LINE_REG = &(g_dev.vi.regs[VI_CURRENT_REG]); gfx_info.VI_TIMING_REG = &(g_dev.vi.regs[VI_BURST_REG]); gfx_info.VI_V_SYNC_REG = &(g_dev.vi.regs[VI_V_SYNC_REG]); gfx_info.VI_H_SYNC_REG = &(g_dev.vi.regs[VI_H_SYNC_REG]); gfx_info.VI_LEAP_REG = &(g_dev.vi.regs[VI_LEAP_REG]); gfx_info.VI_H_START_REG = &(g_dev.vi.regs[VI_H_START_REG]); gfx_info.VI_V_START_REG = &(g_dev.vi.regs[VI_V_START_REG]); gfx_info.VI_V_BURST_REG = &(g_dev.vi.regs[VI_V_BURST_REG]); gfx_info.VI_X_SCALE_REG = &(g_dev.vi.regs[VI_X_SCALE_REG]); gfx_info.VI_Y_SCALE_REG = &(g_dev.vi.regs[VI_Y_SCALE_REG]); gfx_info.CheckInterrupts = EmptyFunc; /* call the audio plugin */ if (!gfx.initiateGFX(gfx_info)) { printf("plugin_start_gfx fail.\n"); return M64ERR_PLUGIN_FAIL; } printf("plugin_start_gfx success.\n"); return M64ERR_SUCCESS; }
static m64p_error plugin_start_gfx(void) { /* fill in the GFX_INFO data structure */ gfx_info.HEADER = (unsigned char *) rom; gfx_info.RDRAM = (unsigned char *) rdram; gfx_info.DMEM = (unsigned char *) SP_DMEM; gfx_info.IMEM = (unsigned char *) SP_IMEM; gfx_info.MI_INTR_REG = &(MI_register.mi_intr_reg); gfx_info.DPC_START_REG = &(dpc_register.dpc_start); gfx_info.DPC_END_REG = &(dpc_register.dpc_end); gfx_info.DPC_CURRENT_REG = &(dpc_register.dpc_current); gfx_info.DPC_STATUS_REG = &(dpc_register.dpc_status); gfx_info.DPC_CLOCK_REG = &(dpc_register.dpc_clock); gfx_info.DPC_BUFBUSY_REG = &(dpc_register.dpc_bufbusy); gfx_info.DPC_PIPEBUSY_REG = &(dpc_register.dpc_pipebusy); gfx_info.DPC_TMEM_REG = &(dpc_register.dpc_tmem); gfx_info.VI_STATUS_REG = &(vi_register.vi_status); gfx_info.VI_ORIGIN_REG = &(vi_register.vi_origin); gfx_info.VI_WIDTH_REG = &(vi_register.vi_width); gfx_info.VI_INTR_REG = &(vi_register.vi_v_intr); gfx_info.VI_V_CURRENT_LINE_REG = &(vi_register.vi_current); gfx_info.VI_TIMING_REG = &(vi_register.vi_burst); gfx_info.VI_V_SYNC_REG = &(vi_register.vi_v_sync); gfx_info.VI_H_SYNC_REG = &(vi_register.vi_h_sync); gfx_info.VI_LEAP_REG = &(vi_register.vi_leap); gfx_info.VI_H_START_REG = &(vi_register.vi_h_start); gfx_info.VI_V_START_REG = &(vi_register.vi_v_start); gfx_info.VI_V_BURST_REG = &(vi_register.vi_v_burst); gfx_info.VI_X_SCALE_REG = &(vi_register.vi_x_scale); gfx_info.VI_Y_SCALE_REG = &(vi_register.vi_y_scale); gfx_info.CheckInterrupts = EmptyFunc; /* call the audio plugin */ if (!gfx.initiateGFX(gfx_info)) return M64ERR_PLUGIN_FAIL; return M64ERR_SUCCESS; }
static m64p_error plugin_connect_gfx(m64p_dynlib_handle plugin_handle) { /* attach the Video plugin function pointers */ if (plugin_handle != NULL) { m64p_plugin_type PluginType; int PluginVersion, APIVersion; if (l_GfxAttached) return M64ERR_INVALID_STATE; /* set function pointers for required functions */ if (!GET_FUNC(ptr_PluginGetVersion, gfx.getVersion, "PluginGetVersion") || !GET_FUNC(ptr_ChangeWindow, gfx.changeWindow, "ChangeWindow") || !GET_FUNC(ptr_InitiateGFX, gfx.initiateGFX, "InitiateGFX") || !GET_FUNC(ptr_MoveScreen, gfx.moveScreen, "MoveScreen") || !GET_FUNC(ptr_ProcessDList, gfx.processDList, "ProcessDList") || !GET_FUNC(ptr_ProcessRDPList, gfx.processRDPList, "ProcessRDPList") || !GET_FUNC(ptr_RomClosed, gfx.romClosed, "RomClosed") || !GET_FUNC(ptr_RomOpen, gfx.romOpen, "RomOpen") || !GET_FUNC(ptr_ShowCFB, gfx.showCFB, "ShowCFB") || !GET_FUNC(ptr_UpdateScreen, gfx.updateScreen, "UpdateScreen") || !GET_FUNC(ptr_ViStatusChanged, gfx.viStatusChanged, "ViStatusChanged") || !GET_FUNC(ptr_ViWidthChanged, gfx.viWidthChanged, "ViWidthChanged") || !GET_FUNC(ptr_ReadScreen2, gfx.readScreen, "ReadScreen2") || !GET_FUNC(ptr_SetRenderingCallback, gfx.setRenderingCallback, "SetRenderingCallback") || !GET_FUNC(ptr_FBRead, gfx.fBRead, "FBRead") || !GET_FUNC(ptr_FBWrite, gfx.fBWrite, "FBWrite") || !GET_FUNC(ptr_FBGetFrameBufferInfo, gfx.fBGetFrameBufferInfo, "FBGetFrameBufferInfo")) { DebugMessage(M64MSG_ERROR, "broken Video plugin; function(s) not found."); plugin_disconnect_gfx(); return M64ERR_INPUT_INVALID; } /* set function pointers for optional functions */ gfx.resizeVideoOutput = (ptr_ResizeVideoOutput) osal_dynlib_getproc(plugin_handle, "ResizeVideoOutput"); /* check the version info */ (*gfx.getVersion)(&PluginType, &PluginVersion, &APIVersion, NULL, NULL); if (PluginType != M64PLUGIN_GFX || (APIVersion & 0xffff0000) != (GFX_API_VERSION & 0xffff0000)) { DebugMessage(M64MSG_ERROR, "incompatible Video plugin"); plugin_disconnect_gfx(); return M64ERR_INCOMPATIBLE; } /* handle backwards-compatibility */ if (APIVersion < 0x020100) { DebugMessage(M64MSG_WARNING, "Fallback for Video plugin API (%02i.%02i.%02i) < 2.1.0. Screenshots may contain On Screen Display text", VERSION_PRINTF_SPLIT(APIVersion)); // tell the video plugin to make its rendering callback to me (it's old, and doesn't have the bScreenRedrawn flag) gfx.setRenderingCallback(backcompat_videoRenderCallback); l_old1SetRenderingCallback = gfx.setRenderingCallback; // save this just for future use gfx.setRenderingCallback = (ptr_SetRenderingCallback) backcompat_setRenderCallbackIntercept; } if (APIVersion < 0x20200 || gfx.resizeVideoOutput == NULL) { DebugMessage(M64MSG_WARNING, "Fallback for Video plugin API (%02i.%02i.%02i) < 2.2.0. Resizable video will not work", VERSION_PRINTF_SPLIT(APIVersion)); gfx.resizeVideoOutput = dummyvideo_ResizeVideoOutput; } l_GfxAttached = 1; } else plugin_disconnect_gfx(); return M64ERR_SUCCESS; }