Exemplo n.º 1
0
static void gfx_info_init(void){
	gfx_info.MemoryBswaped = TRUE;
	gfx_info.HEADER = (BYTE*)ROM_HEADER;
	gfx_info.RDRAM = (BYTE*)rdram;
	gfx_info.DMEM = (BYTE*)SP_DMEM;
	gfx_info.IMEM = (BYTE*)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 = dummy_func;
	initiateGFX(gfx_info);
}
Exemplo n.º 2
0
bool GFX::init(void)
{
	if (!loaded) return false;

	gfx_info					= (GFX_INFO*) malloc(sizeof(GFX_INFO));

	gfx_info->hWnd				= hWnd;			// Render window
	gfx_info->hStatusBar		= hStatusBar;	// if render window does not have a status bar then this is NULL
	gfx_info->memoryBswaped		= TRUE;			// plugin_info->memoryBswaped;

	gfx_info->rom_header		= (byte*) MMU::get(ROM_SEG_BEG);
	gfx_info->rdram				= (byte*) MMU::get(RDRAM_SEG_BEG);
	gfx_info->dmem				= (byte*) MMU::get(SP_DMEM);
	gfx_info->imem				= (byte*) MMU::get(SP_IMEM);

	gfx_info->mi_intr_reg		= (word*) MMU::get(MI_INTR_REG);

	gfx_info->dpc_start_reg		= (word*) MMU::get(DPC_START_REG);
	gfx_info->dpc_end_reg		= (word*) MMU::get(DPC_END_REG);
	gfx_info->dpc_current_reg	= (word*) MMU::get(DPC_CURRENT_REG);
	gfx_info->dpc_status_reg	= (word*) MMU::get(DPC_STATUS_REG);
	gfx_info->dpc_clock_reg		= (word*) MMU::get(DPC_CLOCK_REG);
	gfx_info->dpc_bufbusy_reg	= (word*) MMU::get(DPC_BUFBUSY_REG);
	gfx_info->dpc_pipebusy_reg	= (word*) MMU::get(DPC_PIPEBUSY_REG);
	gfx_info->dpc_tmem_reg		= (word*) MMU::get(DPC_TMEM_REG);

	gfx_info->vi_status_reg		= (word*) MMU::get(VI_STATUS_REG);
	gfx_info->vi_origin_reg		= (word*) MMU::get(VI_ORIGIN_REG);
	gfx_info->vi_width_reg		= (word*) MMU::get(VI_WIDTH_REG);
	gfx_info->vi_intr_reg		= (word*) MMU::get(VI_INTR_REG);
	gfx_info->vi_current_reg	= (word*) MMU::get(VI_CURRENT_REG);
	gfx_info->vi_timing_reg		= (word*) MMU::get(VI_BURST_REG);
	gfx_info->vi_v_sync_reg		= (word*) MMU::get(VI_V_SYNC_REG);
	gfx_info->vi_h_sync_reg		= (word*) MMU::get(VI_H_SYNC_REG);
	gfx_info->vi_leap_reg		= (word*) MMU::get(VI_LEAP_REG);
	gfx_info->vi_h_start_reg	= (word*) MMU::get(VI_H_START_REG);
	gfx_info->vi_v_start_reg	= (word*) MMU::get(VI_V_START_REG);
	gfx_info->vi_v_burst_reg	= (word*) MMU::get(VI_V_BURST_REG);
	gfx_info->vi_x_scale_reg	= (word*) MMU::get(VI_X_SCALE_REG);
	gfx_info->vi_y_scale_reg	= (word*) MMU::get(VI_Y_SCALE_REG);

	gfx_info->CheckInterrupts	= &R4300i::check_interrupt;

	if (!initiateGFX())	return false;

	romOpen();
	return true;
}
Exemplo n.º 3
0
void plugin_load_plugins(const char *gfx_name,
			 const char *audio_name,
			 const char *input_name,
			 const char *RSP_name)
{
   int i;
   void *handle_gfx, *handle_audio, *handle_input, *handle_RSP;

   handle_gfx = get_handle(liste_plugins, gfx_name);
   if (handle_gfx)
     {
	changeWindow = dlsym(handle_gfx, "ChangeWindow");
	closeDLL_gfx = dlsym(handle_gfx, "CloseDLL");
	dllAbout = dlsym(handle_gfx, "DllAbout");
	dllConfig = dlsym(handle_gfx, "DllConfig");
	dllTest = dlsym(handle_gfx, "DllTest");
	initiateGFX = dlsym(handle_gfx, "InitiateGFX");
	processDList = dlsym(handle_gfx, "ProcessDList");
	processRDPList = dlsym(handle_gfx, "ProcessRDPList");
	romClosed_gfx = dlsym(handle_gfx, "RomClosed");
	romOpen_gfx = dlsym(handle_gfx, "RomOpen");
	showCFB = dlsym(handle_gfx, "ShowCFB");
	updateScreen = dlsym(handle_gfx, "UpdateScreen");
	viStatusChanged = dlsym(handle_gfx, "ViStatusChanged");
	viWidthChanged = dlsym(handle_gfx, "ViWidthChanged");
	readScreen = dlsym(handle_gfx, "ReadScreen");
	
	fBRead = dlsym(handle_gfx, "FBRead");
	fBWrite = dlsym(handle_gfx, "FBWrite");
	fBGetFrameBufferInfo = dlsym(handle_gfx, "FBGetFrameBufferInfo");

	if (changeWindow == NULL) changeWindow = dummy_void;
	if (closeDLL_gfx == NULL) closeDLL_gfx = dummy_void;
	if (initiateGFX == NULL) initiateGFX = dummy_initiateGFX;
	if (processDList == NULL) processDList = dummy_void;
	if (processRDPList == NULL) processRDPList = dummy_void;
	if (romClosed_gfx == NULL) romClosed_gfx = dummy_void;
	if (romOpen_gfx == NULL) romOpen_gfx = dummy_void;
	if (showCFB == NULL) showCFB = dummy_void;
	if (updateScreen == NULL) updateScreen = dummy_void;
	if (viStatusChanged == NULL) viStatusChanged = dummy_void;
	if (viWidthChanged == NULL) viWidthChanged = dummy_void;

	gfx_info.MemoryBswaped = TRUE;
	gfx_info.HEADER = rom;
	gfx_info.RDRAM = (BYTE*)rdram;
	gfx_info.DMEM = (BYTE*)SP_DMEM;
	gfx_info.IMEM = (BYTE*)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 = sucre;
	initiateGFX(gfx_info);
     }
   else
     {
	changeWindow = dummy_void;
	closeDLL_gfx = dummy_void;
	initiateGFX = dummy_initiateGFX;
	processDList = dummy_void;
	processRDPList = dummy_void;
	romClosed_gfx = dummy_void;
	romOpen_gfx = dummy_void;
	showCFB = dummy_void;
	updateScreen = dummy_void;
	viStatusChanged = dummy_void;
	viWidthChanged = dummy_void;
	readScreen = 0;
     }
   handle_audio = get_handle(liste_plugins, audio_name);
   if (handle_audio)
     {
	closeDLL_audio = dlsym(handle_audio, "CloseDLL");
	aiDacrateChanged = dlsym(handle_audio, "AiDacrateChanged");
	aiLenChanged = dlsym(handle_audio, "AiLenChanged");
	aiReadLength = dlsym(handle_audio, "AiReadLength");
	//aiUpdate = dlsym(handle_audio, "AiUpdate");
	initiateAudio = dlsym(handle_audio, "InitiateAudio");
	processAList = dlsym(handle_audio, "ProcessAList");
	romClosed_audio = dlsym(handle_audio, "RomClosed");
	romOpen_audio = dlsym(handle_audio, "RomOpen");
	
	if (aiDacrateChanged == NULL) aiDacrateChanged = dummy_aiDacrateChanged;
	if (aiLenChanged == NULL) aiLenChanged = dummy_void;
	if (aiReadLength == NULL) aiReadLength = dummy_aiReadLength;
	//if (aiUpdate == NULL) aiUpdate = dummy_aiUpdate;
	if (closeDLL_audio == NULL) closeDLL_audio = dummy_void;
	if (initiateAudio == NULL) initiateAudio = dummy_initiateAudio;
	if (processAList == NULL) processAList = dummy_void;
	if (romClosed_audio == NULL) romClosed_audio = dummy_void;
	if (romOpen_audio == NULL) romOpen_audio = dummy_void;
	
	audio_info.MemoryBswaped = TRUE;
	audio_info.HEADER = rom;
	audio_info.RDRAM = (BYTE*)rdram;
	audio_info.DMEM = (BYTE*)SP_DMEM;
	audio_info.IMEM = (BYTE*)SP_IMEM;
	audio_info.MI_INTR_REG = &(MI_register.mi_intr_reg);
	audio_info.AI_DRAM_ADDR_REG = &(ai_register.ai_dram_addr);
	audio_info.AI_LEN_REG = &(ai_register.ai_len);
	audio_info.AI_CONTROL_REG = &(ai_register.ai_control);
	audio_info.AI_STATUS_REG = &dummy;
	audio_info.AI_DACRATE_REG = &(ai_register.ai_dacrate);
	audio_info.AI_BITRATE_REG = &(ai_register.ai_bitrate);
	audio_info.CheckInterrupts = sucre;
	initiateAudio(audio_info);
     }
   else
     {
	aiDacrateChanged = dummy_aiDacrateChanged;
	aiLenChanged = dummy_void;
	aiReadLength = dummy_aiReadLength;
	//aiUpdate = dummy_aiUpdate;
	closeDLL_audio = dummy_void;
	initiateAudio = dummy_initiateAudio;
	processAList = dummy_void;
	romClosed_audio = dummy_void;
	romOpen_audio = dummy_void;
     }
   
   handle_input = get_handle(liste_plugins, input_name);
   if (handle_input)
     {
	closeDLL_input = dlsym(handle_input, "CloseDLL");
	controllerCommand = dlsym(handle_input, "ControllerCommand");
	getKeys = dlsym(handle_input, "GetKeys");
	initiateControllers = dlsym(handle_input, "InitiateControllers");
	readController = dlsym(handle_input, "ReadController");
	romClosed_input = dlsym(handle_input, "RomClosed");
	romOpen_input = dlsym(handle_input, "RomOpen");
	keyDown = dlsym(handle_input, "WM_KeyDown");
	keyUp = dlsym(handle_input, "WM_KeyUp");
	
	if (closeDLL_input == NULL) closeDLL_input = dummy_void;
	if (controllerCommand == NULL) controllerCommand = dummy_controllerCommand;
	if (getKeys == NULL) getKeys = dummy_getKeys;
	if (initiateControllers == NULL) initiateControllers = dummy_initiateControllers;
	if (readController == NULL) readController = dummy_readController;
	if (romClosed_input == NULL) romClosed_input = dummy_void;
	if (romOpen_input == NULL) romOpen_input = dummy_void;
	if (keyDown == NULL) keyDown = dummy_keyDown;
	if (keyUp == NULL) keyUp = dummy_keyUp;
	
	control_info.MemoryBswaped = TRUE;
	control_info.HEADER = rom;
	control_info.Controls = Controls;
	for (i=0; i<4; i++)
	  {
	     Controls[i].Present = FALSE;
	     Controls[i].RawData = FALSE;
	     Controls[i].Plugin = PLUGIN_NONE;
	  }
	initiateControllers(control_info);
     }
   else
     {
	closeDLL_input = dummy_void;
	controllerCommand = dummy_controllerCommand;
	getKeys = dummy_getKeys;
	initiateControllers = dummy_initiateControllers;
	readController = dummy_readController;
	romClosed_input = dummy_void;
	romOpen_input = dummy_void;
	keyDown = dummy_keyDown;
	keyUp = dummy_keyUp;
     }
   
   handle_RSP = get_handle(liste_plugins, RSP_name);
   if (handle_RSP)
     {
	closeDLL_RSP = dlsym(handle_RSP, "CloseDLL");
	doRspCycles = dlsym(handle_RSP, "DoRspCycles");
	initiateRSP = dlsym(handle_RSP, "InitiateRSP");
	romClosed_RSP = dlsym(handle_RSP, "RomClosed");
	
	if (closeDLL_RSP == NULL) closeDLL_RSP = dummy_void;
	if (doRspCycles == NULL) doRspCycles = dummy_doRspCycles;
	if (initiateRSP == NULL) initiateRSP = dummy_initiateRSP;
	if (romClosed_RSP == NULL) romClosed_RSP = dummy_void;
	
	rsp_info.MemoryBswaped = TRUE;
	rsp_info.RDRAM = (BYTE*)rdram;
	rsp_info.DMEM = (BYTE*)SP_DMEM;
	rsp_info.IMEM = (BYTE*)SP_IMEM;
	rsp_info.MI_INTR_REG = &MI_register.mi_intr_reg;
	rsp_info.SP_MEM_ADDR_REG = &sp_register.sp_mem_addr_reg;
	rsp_info.SP_DRAM_ADDR_REG = &sp_register.sp_dram_addr_reg;
	rsp_info.SP_RD_LEN_REG = &sp_register.sp_rd_len_reg;
	rsp_info.SP_WR_LEN_REG = &sp_register.sp_wr_len_reg;
	rsp_info.SP_STATUS_REG = &sp_register.sp_status_reg;
	rsp_info.SP_DMA_FULL_REG = &sp_register.sp_dma_full_reg;
	rsp_info.SP_DMA_BUSY_REG = &sp_register.sp_dma_busy_reg;
	rsp_info.SP_PC_REG = &rsp_register.rsp_pc;
	rsp_info.SP_SEMAPHORE_REG = &sp_register.sp_semaphore_reg;
	rsp_info.DPC_START_REG = &dpc_register.dpc_start;
	rsp_info.DPC_END_REG = &dpc_register.dpc_end;
	rsp_info.DPC_CURRENT_REG = &dpc_register.dpc_current;
	rsp_info.DPC_STATUS_REG = &dpc_register.dpc_status;
	rsp_info.DPC_CLOCK_REG = &dpc_register.dpc_clock;
	rsp_info.DPC_BUFBUSY_REG = &dpc_register.dpc_bufbusy;
	rsp_info.DPC_PIPEBUSY_REG = &dpc_register.dpc_pipebusy;
	rsp_info.DPC_TMEM_REG = &dpc_register.dpc_tmem;
	rsp_info.CheckInterrupts = sucre;
	rsp_info.ProcessDlistList = processDList;
	rsp_info.ProcessAlistList = processAList;
	rsp_info.ProcessRdpList = processRDPList;
	rsp_info.ShowCFB = showCFB;
	initiateRSP(rsp_info,(DWORD*)&i);
     }
   else
     {
	closeDLL_RSP = dummy_void;
	doRspCycles = dummy_doRspCycles;
	initiateRSP = dummy_initiateRSP;
	romClosed_RSP = dummy_void;
     }
}