Exemplo n.º 1
0
int Config_ReadScreenInt(const char *itemname) {
  int res_data = Config_ReadInt("resolution", NULL, 7, FALSE, FALSE);
  if(!strcmp("ScreenWidth", itemname))
    return resolutions[res_data][0];
  else if(!strcmp("ScreenHeight", itemname))
    return resolutions[res_data][1];
  else return FALSE;
}
Exemplo n.º 2
0
// NOTE: NEW GFX_INFO vs old
EXPORT int CALL InitiateGFX(GFX_INFO Gfx_Info)
{
	LOG("API WRAPPER:\t InitiateGFX")

	Config_Open();

	SETTINGS settings;
	settings.anisotropic_level = (int)Config_ReadInt("anisotropic_level","ANISOTROPIC_FILTERING_LEVEL",0,TRUE,FALSE);
	settings.brightness = (int)Config_ReadInt("brightness","Brightness level",0,TRUE,FALSE);
	settings.antialiasing_level = (int)Config_ReadInt("antialiasing_level","Antialiasing level",0,TRUE,FALSE);
	settings.super2xsal = (BOOL)Config_ReadInt("super2xsal","Enables Super2xSal textures",FALSE);
	settings.texture_filter = (BOOL)Config_ReadInt("texture_filter","Always use texture filter",FALSE);
	settings.adjust_aspect_ratio = (BOOL)Config_ReadInt("adjust_aspect_ratio","Adjust game aspect ratio to match yours",FALSE);
	settings.legacy_pixel_pipeline = (BOOL)Config_ReadInt("legacy_pixel_pipeline","Use legacy pixel pipeline",FALSE);
	settings.alpha_blending = (BOOL)Config_ReadInt("alpha_blending","Force alpha blending",FALSE);

	// As far as I can tell there is no way to apply this setting without opening the dll config window
	//settings.wireframe = (BOOL)Config_ReadInt("wireframe","Wireframe rendering",FALSE);

	settings.direct3d_transformation_pipeline = (BOOL)Config_ReadInt("direct3d_transformation_pipeline","Use Direct3D transformation pipeline",FALSE);
	settings.z_compare = (BOOL)Config_ReadInt("z_compare","Force Z Compare",FALSE);
	settings.copy_framebuffer = (BOOL)Config_ReadInt("copy_framebuffer","Copy framebuffer to RDRAM",FALSE);
	settings.resolution_width = (int)Config_ReadInt("resolution_width","Emulated Width",-1,TRUE,FALSE);
	settings.resolution_height = (int)Config_ReadInt("resolution_height","Emulated Height",-1,TRUE,FALSE);
	settings.clear_mode = (int)Config_ReadInt("clear_mode","Direct3D Clear Mode Height",0,TRUE,FALSE);

	DWORD new_options_val = 0;
	if (settings.copy_framebuffer == TRUE) { new_options_val |= 0x20000000; }
	if (settings.z_compare == TRUE) { new_options_val |= 0x10000000; }
	if (settings.legacy_pixel_pipeline == TRUE) { new_options_val |= 0x08000000; }
	if (settings.alpha_blending == TRUE) { new_options_val |= 0x04000000; }
	if (settings.adjust_aspect_ratio == TRUE) { new_options_val |= 0x02000000; }
	if (settings.texture_filter == TRUE) { new_options_val |= 0x01000000; }
	if (settings.super2xsal == TRUE) { new_options_val |= 0x00001000; }
	new_options_val |= (((settings.brightness - 100) / 3) & 0x1F) << 19;
	switch (settings.antialiasing_level)
	{
		case 1: new_options_val |= 0x00004000; break;
		case 2: new_options_val |= 0x00008000; break;
		case 3: new_options_val |= 0x00010000; break;
	}
	switch (settings.anisotropic_level)
	{
		case 1: new_options_val |= 0x00000020; break;
		case 2: new_options_val |= 0x00000040; break;
		case 3: new_options_val |= 0x00000080; break;
		case 4: new_options_val |= 0x00000100; break;
	}

	int width, height;
	Config_ReadScreenResolution(&width,&height);
	if (width == 320 && height == 240) { new_options_val |= 0x00000000; }
	else if (width == 400 && height == 300) { new_options_val |= 0x00000001; } 
	else if (width == 512 && height == 384) { new_options_val |= 0x00000002; } 
	else if (width == 640 && height == 480) { new_options_val |= 0x00000003; } 
	else if (width == 800 && height == 600) { new_options_val |= 0x00000004; } 
	else if (width == 1024 && height == 768) { new_options_val |= 0x00000005; } 
	else if (width == 1152 && height == 864) { new_options_val |= 0x00000006; } 
	else if (width == 1280 && height == 960) { new_options_val |= 0x00000007; } 
	else if (width == 1600 && height == 1200) { new_options_val |= 0x00000008; } 
	else if (width == 848 && height == 480) { new_options_val |= 0x00000009; } 
	else if (width == 1024 && height == 576) { new_options_val |= 0x0000000a; } 
	else if (width == 1380 && height == 768) { new_options_val |= 0x0000000b; } 
	else { /* will pick 320x240 */ }

	DWORD new_initflags_val = 0x00e00000;
	if (settings.direct3d_transformation_pipeline == TRUE) { new_initflags_val = 0x00a00000; }

	readOptionsInitflags(&old_options,&old_initflags);

	writeOptionsInitflags(new_options_val,new_initflags_val);

	createRDBFile(Gfx_Info.HEADER, settings.resolution_height, settings.resolution_width, settings.clear_mode);

	OldAPI::GFX_INFO blah;

	blah.hWnd = GetDesktopWindow();
	blah.hStatusBar = NULL;
	blah.MemoryBswaped = true;

	blah.HEADER = Gfx_Info.HEADER;

	blah.RDRAM = Gfx_Info.RDRAM;
	blah.DMEM = Gfx_Info.DMEM;
	blah.IMEM = Gfx_Info.IMEM;

	blah.MI_INTR_REG = (DWORD *)Gfx_Info.MI_INTR_REG;

	blah.DPC_START_REG = (DWORD *)Gfx_Info.DPC_START_REG;
	blah.DPC_END_REG = (DWORD *)Gfx_Info.DPC_END_REG;
	blah.DPC_CURRENT_REG = (DWORD *)Gfx_Info.DPC_CURRENT_REG;
	blah.DPC_STATUS_REG = (DWORD *)Gfx_Info.DPC_STATUS_REG;
	blah.DPC_CLOCK_REG = (DWORD *)Gfx_Info.DPC_CLOCK_REG;
	blah.DPC_BUFBUSY_REG = (DWORD *)Gfx_Info.DPC_BUFBUSY_REG;
	blah.DPC_PIPEBUSY_REG = (DWORD *)Gfx_Info.DPC_PIPEBUSY_REG;
	blah.DPC_TMEM_REG = (DWORD *)Gfx_Info.DPC_TMEM_REG;

	blah.VI_STATUS_REG = (DWORD *)Gfx_Info.VI_STATUS_REG;
	blah.VI_ORIGIN_REG = (DWORD *)Gfx_Info.VI_ORIGIN_REG;
	blah.VI_WIDTH_REG = (DWORD *)Gfx_Info.VI_WIDTH_REG;
	blah.VI_INTR_REG = (DWORD *)Gfx_Info.VI_INTR_REG;
	blah.VI_V_CURRENT_LINE_REG = (DWORD *)Gfx_Info.VI_V_CURRENT_LINE_REG;
	blah.VI_TIMING_REG = (DWORD *)Gfx_Info.VI_TIMING_REG;
	blah.VI_V_SYNC_REG = (DWORD *)Gfx_Info.VI_V_SYNC_REG;
	blah.VI_H_SYNC_REG = (DWORD *)Gfx_Info.VI_H_SYNC_REG;
	blah.VI_LEAP_REG = (DWORD *)Gfx_Info.VI_LEAP_REG;
	blah.VI_H_START_REG = (DWORD *)Gfx_Info.VI_H_START_REG;
	blah.VI_V_START_REG = (DWORD *)Gfx_Info.VI_V_START_REG;
	blah.VI_V_BURST_REG = (DWORD *)Gfx_Info.VI_V_BURST_REG;
	blah.VI_X_SCALE_REG = (DWORD *)Gfx_Info.VI_X_SCALE_REG;
	blah.VI_Y_SCALE_REG = (DWORD *)Gfx_Info.VI_Y_SCALE_REG;

	blah.CheckInterrupts = Gfx_Info.CheckInterrupts;

	OldAPI::InitiateGFX(blah);

    return(TRUE);
}