gs-merge: include hell, scoping, redefinitions

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-05-12 10:01:46 +02:00 committed by Kojin
parent 5f0699d382
commit bbcfc0ff1d
51 changed files with 837 additions and 744 deletions

View File

@ -602,9 +602,7 @@ set(pcsx2GSSources
GS/GSTables.cpp GS/GSTables.cpp
GS/GSUtil.cpp GS/GSUtil.cpp
GS/GSVector.cpp GS/GSVector.cpp
GS/GSdx.cpp
GS/GS_res.cpp GS/GS_res.cpp
GS/GS_types.h
GS/Renderers/Common/GSDevice.cpp GS/Renderers/Common/GSDevice.cpp
GS/Renderers/Common/GSDirtyRect.cpp GS/Renderers/Common/GSDirtyRect.cpp
GS/Renderers/Common/GSFunctionMap.cpp GS/Renderers/Common/GSFunctionMap.cpp
@ -662,8 +660,8 @@ set(pcsx2GSHeaders
GS/GSDrawingContext.h GS/GSDrawingContext.h
GS/GSDrawingEnvironment.h GS/GSDrawingEnvironment.h
GS/GSDump.h GS/GSDump.h
GS/GSdx.h
GS/GS_res.h GS/GS_res.h
GS/GS_types.h
GS/GS.h GS/GS.h
GS/GSLocalMemory.h GS/GSLocalMemory.h
GS/GSLzma.h GS/GSLzma.h

View File

@ -37,6 +37,8 @@
#include "Window/GSWndWGL.h" #include "Window/GSWndWGL.h"
#include "Window/GSSettingsDlg.h" #include "Window/GSSettingsDlg.h"
#undef None
static HRESULT s_hr = E_FAIL; static HRESULT s_hr = E_FAIL;
#else #else
@ -100,7 +102,7 @@ int GSinit()
return -1; return -1;
} }
// Vector instructions must be avoided when initialising GSdx since PCSX2 // Vector instructions must be avoided when initialising GS since PCSX2
// can crash if the CPU does not support the instruction set. // can crash if the CPU does not support the instruction set.
// Initialise it here instead - it's not ideal since we have to strip the // Initialise it here instead - it's not ideal since we have to strip the
// const type qualifier from all the affected variables. // const type qualifier from all the affected variables.
@ -268,7 +270,7 @@ int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads
break; break;
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
wnd->Detach(); wnd->Detach();
} }
@ -350,7 +352,7 @@ int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads
// be problematic, because of differing typeids between DLL and EXE compilations. // be problematic, because of differing typeids between DLL and EXE compilations.
// ('new' could throw std::alloc) // ('new' could throw std::alloc)
printf("GSdx error: Exception caught in GSopen: %s", ex.what()); printf("GS error: Exception caught in GSopen: %s", ex.what());
return -1; return -1;
} }
@ -375,9 +377,9 @@ int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads
if (renderer == GSRendererType::OGL_HW && theApp.GetConfigI("debug_glsl_shader") == 2) if (renderer == GSRendererType::OGL_HW && theApp.GetConfigI("debug_glsl_shader") == 2)
{ {
printf("GSdx: test OpenGL shader. Please wait...\n\n"); printf("GS: test OpenGL shader. Please wait...\n\n");
static_cast<GSDeviceOGL*>(s_gs->m_dev)->SelfShaderTest(); static_cast<GSDeviceOGL*>(s_gs->m_dev)->SelfShaderTest();
printf("\nGSdx: test OpenGL shader done. It will now exit\n"); printf("\nGS: test OpenGL shader done. It will now exit\n");
return -1; return -1;
} }
@ -488,7 +490,7 @@ void GSreset()
{ {
s_gs->Reset(); s_gs->Reset();
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
} }
@ -499,7 +501,7 @@ void GSgifSoftReset(uint32 mask)
{ {
s_gs->SoftReset(mask); s_gs->SoftReset(mask);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
} }
@ -510,7 +512,7 @@ void GSwriteCSR(uint32 csr)
{ {
s_gs->WriteCSR(csr); s_gs->WriteCSR(csr);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
} }
@ -522,12 +524,12 @@ void GSinitReadFIFO(uint8* mem)
{ {
s_gs->InitReadFIFO(mem, 1); s_gs->InitReadFIFO(mem, 1);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
catch (const std::bad_alloc&) catch (const std::bad_alloc&)
{ {
fprintf(stderr, "GSdx: Memory allocation error\n"); fprintf(stderr, "GS: Memory allocation error\n");
} }
} }
@ -537,12 +539,12 @@ void GSreadFIFO(uint8* mem)
{ {
s_gs->ReadFIFO(mem, 1); s_gs->ReadFIFO(mem, 1);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
catch (const std::bad_alloc&) catch (const std::bad_alloc&)
{ {
fprintf(stderr, "GSdx: Memory allocation error\n"); fprintf(stderr, "GS: Memory allocation error\n");
} }
} }
@ -553,12 +555,12 @@ void GSinitReadFIFO2(uint8* mem, uint32 size)
{ {
s_gs->InitReadFIFO(mem, size); s_gs->InitReadFIFO(mem, size);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
catch (const std::bad_alloc&) catch (const std::bad_alloc&)
{ {
fprintf(stderr, "GSdx: Memory allocation error\n"); fprintf(stderr, "GS: Memory allocation error\n");
} }
} }
@ -568,12 +570,12 @@ void GSreadFIFO2(uint8* mem, uint32 size)
{ {
s_gs->ReadFIFO(mem, size); s_gs->ReadFIFO(mem, size);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
catch (const std::bad_alloc&) catch (const std::bad_alloc&)
{ {
fprintf(stderr, "GSdx: Memory allocation error\n"); fprintf(stderr, "GS: Memory allocation error\n");
} }
} }
@ -583,7 +585,7 @@ void GSgifTransfer(const uint8* mem, uint32 size)
{ {
s_gs->Transfer<3>(mem, size); s_gs->Transfer<3>(mem, size);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
} }
@ -594,7 +596,7 @@ void GSgifTransfer1(uint8* mem, uint32 addr)
{ {
s_gs->Transfer<0>(const_cast<uint8*>(mem) + addr, (0x4000 - addr) / 16); s_gs->Transfer<0>(const_cast<uint8*>(mem) + addr, (0x4000 - addr) / 16);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
} }
@ -605,7 +607,7 @@ void GSgifTransfer2(uint8* mem, uint32 size)
{ {
s_gs->Transfer<1>(const_cast<uint8*>(mem), size); s_gs->Transfer<1>(const_cast<uint8*>(mem), size);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
} }
@ -616,7 +618,7 @@ void GSgifTransfer3(uint8* mem, uint32 size)
{ {
s_gs->Transfer<2>(const_cast<uint8*>(mem), size); s_gs->Transfer<2>(const_cast<uint8*>(mem), size);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
} }
@ -644,12 +646,12 @@ void GSvsync(int field)
s_gs->VSync(field); s_gs->VSync(field);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
catch (const std::bad_alloc&) catch (const std::bad_alloc&)
{ {
fprintf(stderr, "GSdx: Memory allocation error\n"); fprintf(stderr, "GS: Memory allocation error\n");
} }
} }
@ -676,7 +678,7 @@ uint32 GSmakeSnapshot(char* path)
return s_gs->MakeSnapshot(s + "gsdx"); return s_gs->MakeSnapshot(s + "gsdx");
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
return false; return false;
} }
@ -691,7 +693,7 @@ void GSkeyEvent(GSKeyEventData* e)
s_gs->KeyEvent(e); s_gs->KeyEvent(e);
} }
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
} }
@ -713,7 +715,7 @@ int GSfreeze(int mode, GSFreezeData* data)
return s_gs->Defrost(data); return s_gs->Defrost(data);
} }
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
@ -763,7 +765,7 @@ void GSconfigure()
#endif #endif
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
} }
} }
@ -801,17 +803,17 @@ bool GSsetupRecording(std::string& filename)
{ {
if (s_gs == NULL) if (s_gs == NULL)
{ {
printf("GSdx: no s_gs for recording\n"); printf("GS: no s_gs for recording\n");
return false; return false;
} }
#if defined(__unix__) || defined(__APPLE__) #if defined(__unix__) || defined(__APPLE__)
if (!theApp.GetConfigB("capture_enabled")) if (!theApp.GetConfigB("capture_enabled"))
{ {
printf("GSdx: Recording is disabled\n"); printf("GS: Recording is disabled\n");
return false; return false;
} }
#endif #endif
printf("GSdx: Recording start command\n"); printf("GS: Recording start command\n");
if (s_gs->BeginCapture(filename)) if (s_gs->BeginCapture(filename))
{ {
pt(" - Capture started\n"); pt(" - Capture started\n");
@ -826,7 +828,7 @@ bool GSsetupRecording(std::string& filename)
void GSendRecording() void GSendRecording()
{ {
printf("GSdx: Recording end command\n"); printf("GS: Recording end command\n");
s_gs->EndCapture(); s_gs->EndCapture();
pt(" - Capture ended\n"); pt(" - Capture ended\n");
} }
@ -983,7 +985,7 @@ void GSReplay(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS); ::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);
Console console{"GSdx", true}; Console console{"GS", true};
const std::string f{lpszCmdLine}; const std::string f{lpszCmdLine};
const bool is_xz = f.size() >= 4 && f.compare(f.size() - 3, 3, ".xz") == 0; const bool is_xz = f.size() >= 4 && f.compare(f.size() - 3, 3, ".xz") == 0;
@ -1113,7 +1115,7 @@ void GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
{ {
::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS); ::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);
Console console("GSdx", true); Console console("GS", true);
if (1) if (1)
{ {
@ -1716,7 +1718,7 @@ void* fifo_alloc(size_t size, size_t repeat)
{ {
ASSERT(s_shm_fd == -1); ASSERT(s_shm_fd == -1);
const char* file_name = "/GSDX.mem"; const char* file_name = "/GS.mem";
s_shm_fd = shm_open(file_name, O_RDWR | O_CREAT | O_EXCL, 0600); s_shm_fd = shm_open(file_name, O_RDWR | O_CREAT | O_EXCL, 0600);
if (s_shm_fd != -1) if (s_shm_fd != -1)
{ {
@ -1758,3 +1760,546 @@ void fifo_free(void* ptr, size_t size, size_t repeat)
} }
#endif #endif
static void* s_hModule;
#ifdef _WIN32
bool GSApp::LoadResource(int id, std::vector<char>& buff, const wchar_t* type)
{
buff.clear();
HRSRC hRsrc = FindResource((HMODULE)s_hModule, MAKEINTRESOURCE(id), type != NULL ? type : (LPWSTR)RT_RCDATA);
if (!hRsrc)
return false;
HGLOBAL hGlobal = ::LoadResource((HMODULE)s_hModule, hRsrc);
if (!hGlobal)
return false;
DWORD size = SizeofResource((HMODULE)s_hModule, hRsrc);
if (!size)
return false;
// On Linux resources are always NULL terminated
// Add + 1 on size to do the same for compatibility sake (required by GSDeviceOGL)
buff.resize(size + 1);
memcpy(buff.data(), LockResource(hGlobal), size);
return true;
}
#else
#include "GS_res.h"
bool GSApp::LoadResource(int id, std::vector<char>& buff, const char* type)
{
std::string path;
switch (id)
{
case IDR_COMMON_GLSL:
path = "/GS/res/glsl/common_header.glsl";
break;
case IDR_CONVERT_GLSL:
path = "/GS/res/glsl/convert.glsl";
break;
case IDR_FXAA_FX:
path = "/GS/res/fxaa.fx";
break;
case IDR_INTERLACE_GLSL:
path = "/GS/res/glsl/interlace.glsl";
break;
case IDR_MERGE_GLSL:
path = "/GS/res/glsl/merge.glsl";
break;
case IDR_SHADEBOOST_GLSL:
path = "/GS/res/glsl/shadeboost.glsl";
break;
case IDR_TFX_VGS_GLSL:
path = "/GS/res/glsl/tfx_vgs.glsl";
break;
case IDR_TFX_FS_GLSL:
path = "/GS/res/glsl/tfx_fs.glsl";
break;
case IDR_FONT_ROBOTO:
path = "/GS/res/fonts-roboto/Roboto-Regular.ttf";
break;
default:
printf("LoadResource not implemented for id %d\n", id);
return false;
}
GBytes* bytes = g_resource_lookup_data(GS_res_get_resource(), path.c_str(), G_RESOURCE_LOOKUP_FLAGS_NONE, nullptr);
size_t size = 0;
const void* data = g_bytes_get_data(bytes, &size);
if (data == nullptr || size == 0)
{
printf("Failed to get data for resource: %d\n", id);
return false;
}
buff.clear();
buff.resize(size + 1);
memcpy(buff.data(), data, size + 1);
g_bytes_unref(bytes);
return true;
}
#endif
size_t GSApp::GetIniString(const char* lpAppName, const char* lpKeyName, const char* lpDefault, char* lpReturnedString, size_t nSize, const char* lpFileName)
{
BuildConfigurationMap(lpFileName);
std::string key(lpKeyName);
std::string value = m_configuration_map[key];
if (value.empty())
{
// save the value for futur call
m_configuration_map[key] = std::string(lpDefault);
strcpy(lpReturnedString, lpDefault);
}
else
strcpy(lpReturnedString, value.c_str());
return 0;
}
bool GSApp::WriteIniString(const char* lpAppName, const char* lpKeyName, const char* pString, const char* lpFileName)
{
BuildConfigurationMap(lpFileName);
std::string key(lpKeyName);
std::string value(pString);
m_configuration_map[key] = value;
// Save config to a file
FILE* f = px_fopen(lpFileName, "w");
if (f == NULL)
return false; // FIXME print a nice message
// Maintain compatibility with GSDumpGUI/old Windows ini.
#ifdef _WIN32
fprintf(f, "[Settings]\n");
#endif
for (const auto& entry : m_configuration_map)
{
// Do not save the inifile key which is not an option
if (entry.first.compare("inifile") == 0)
continue;
// Only keep option that have a default value (allow to purge old option of the GS.ini)
if (!entry.second.empty() && m_default_configuration.find(entry.first) != m_default_configuration.end())
fprintf(f, "%s = %s\n", entry.first.c_str(), entry.second.c_str());
}
fclose(f);
return false;
}
int GSApp::GetIniInt(const char* lpAppName, const char* lpKeyName, int nDefault, const char* lpFileName)
{
BuildConfigurationMap(lpFileName);
std::string value = m_configuration_map[std::string(lpKeyName)];
if (value.empty())
{
// save the value for futur call
SetConfig(lpKeyName, nDefault);
return nDefault;
}
else
return atoi(value.c_str());
}
GSApp theApp;
GSApp::GSApp()
{
// Empty constructor causes an illegal instruction exception on an SSE4.2 machine on Windows.
// Non-empty doesn't, but raises a SIGILL signal when compiled against GCC 6.1.1.
// So here's a compromise.
#ifdef _WIN32
Init();
#endif
}
void GSApp::Init()
{
static bool is_initialised = false;
if (is_initialised)
return;
is_initialised = true;
m_current_renderer_type = GSRendererType::Undefined;
if (m_ini.empty())
m_ini = "inis/GS.ini";
m_section = "Settings";
#ifdef _WIN32
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::DX1011_HW), "Direct3D 11", ""));
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_HW), "OpenGL", ""));
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_SW), "Software", ""));
#else // Linux
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_HW), "OpenGL", ""));
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_SW), "Software", ""));
#endif
// The null renderer goes third, it has use for benchmarking purposes in a release build
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::Null), "Null", ""));
m_gs_interlace.push_back(GSSetting(0, "None", ""));
m_gs_interlace.push_back(GSSetting(1, "Weave tff", "saw-tooth"));
m_gs_interlace.push_back(GSSetting(2, "Weave bff", "saw-tooth"));
m_gs_interlace.push_back(GSSetting(3, "Bob tff", "use blend if shaking"));
m_gs_interlace.push_back(GSSetting(4, "Bob bff", "use blend if shaking"));
m_gs_interlace.push_back(GSSetting(5, "Blend tff", "slight blur, 1/2 fps"));
m_gs_interlace.push_back(GSSetting(6, "Blend bff", "slight blur, 1/2 fps"));
m_gs_interlace.push_back(GSSetting(7, "Automatic", "Default"));
m_gs_aspectratio.push_back(GSSetting(0, "Stretch", ""));
m_gs_aspectratio.push_back(GSSetting(1, "4:3", ""));
m_gs_aspectratio.push_back(GSSetting(2, "16:9", ""));
m_gs_upscale_multiplier.push_back(GSSetting(1, "Native", "PS2"));
m_gs_upscale_multiplier.push_back(GSSetting(2, "2x Native", "~720p"));
m_gs_upscale_multiplier.push_back(GSSetting(3, "3x Native", "~1080p"));
m_gs_upscale_multiplier.push_back(GSSetting(4, "4x Native", "~1440p 2K"));
m_gs_upscale_multiplier.push_back(GSSetting(5, "5x Native", "~1620p 3K"));
m_gs_upscale_multiplier.push_back(GSSetting(6, "6x Native", "~2160p 4K"));
m_gs_upscale_multiplier.push_back(GSSetting(8, "8x Native", "~2880p 5K"));
m_gs_max_anisotropy.push_back(GSSetting(0, "Off", "Default"));
m_gs_max_anisotropy.push_back(GSSetting(2, "2x", ""));
m_gs_max_anisotropy.push_back(GSSetting(4, "4x", ""));
m_gs_max_anisotropy.push_back(GSSetting(8, "8x", ""));
m_gs_max_anisotropy.push_back(GSSetting(16, "16x", ""));
m_gs_dithering.push_back(GSSetting(0, "Off", ""));
m_gs_dithering.push_back(GSSetting(2, "Unscaled", "Default"));
m_gs_dithering.push_back(GSSetting(1, "Scaled", ""));
m_gs_bifilter.push_back(GSSetting(static_cast<uint32>(BiFiltering::Nearest), "Nearest", ""));
m_gs_bifilter.push_back(GSSetting(static_cast<uint32>(BiFiltering::Forced_But_Sprite), "Bilinear", "Forced excluding sprite"));
m_gs_bifilter.push_back(GSSetting(static_cast<uint32>(BiFiltering::Forced), "Bilinear", "Forced"));
m_gs_bifilter.push_back(GSSetting(static_cast<uint32>(BiFiltering::PS2), "Bilinear", "PS2"));
m_gs_trifilter.push_back(GSSetting(static_cast<uint32>(TriFiltering::None), "None", "Default"));
m_gs_trifilter.push_back(GSSetting(static_cast<uint32>(TriFiltering::PS2), "Trilinear", ""));
m_gs_trifilter.push_back(GSSetting(static_cast<uint32>(TriFiltering::Forced), "Trilinear", "Ultra/Slow"));
m_gs_generic_list.push_back(GSSetting(-1, "Automatic", "Default"));
m_gs_generic_list.push_back(GSSetting(0, "Force-Disabled", ""));
m_gs_generic_list.push_back(GSSetting(1, "Force-Enabled", ""));
m_gs_hack.push_back(GSSetting(0, "Off", "Default"));
m_gs_hack.push_back(GSSetting(1, "Half", ""));
m_gs_hack.push_back(GSSetting(2, "Full", ""));
m_gs_offset_hack.push_back(GSSetting(0, "Off", "Default"));
m_gs_offset_hack.push_back(GSSetting(1, "Normal", "Vertex"));
m_gs_offset_hack.push_back(GSSetting(2, "Special", "Texture"));
m_gs_offset_hack.push_back(GSSetting(3, "Special", "Texture - aggressive"));
m_gs_hw_mipmapping = {
GSSetting(HWMipmapLevel::Automatic, "Automatic", "Default"),
GSSetting(HWMipmapLevel::Off, "Off", ""),
GSSetting(HWMipmapLevel::Basic, "Basic", "Fast"),
GSSetting(HWMipmapLevel::Full, "Full", "Slow"),
};
m_gs_crc_level = {
GSSetting(CRCHackLevel::Automatic, "Automatic", "Default"),
GSSetting(CRCHackLevel::None, "None", "Debug"),
GSSetting(CRCHackLevel::Minimum, "Minimum", "Debug"),
#ifdef _DEBUG
GSSetting(CRCHackLevel::Partial, "Partial", "OpenGL"),
GSSetting(CRCHackLevel::Full, "Full", "Direct3D"),
#endif
GSSetting(CRCHackLevel::Aggressive, "Aggressive", ""),
};
m_gs_acc_blend_level.push_back(GSSetting(0, "None", "Fastest"));
m_gs_acc_blend_level.push_back(GSSetting(1, "Basic", "Recommended"));
m_gs_acc_blend_level.push_back(GSSetting(2, "Medium", ""));
m_gs_acc_blend_level.push_back(GSSetting(3, "High", ""));
m_gs_acc_blend_level.push_back(GSSetting(4, "Full", "Very Slow"));
m_gs_acc_blend_level.push_back(GSSetting(5, "Ultra", "Ultra Slow"));
m_gs_acc_blend_level_d3d11.push_back(GSSetting(0, "None", "Fastest"));
m_gs_acc_blend_level_d3d11.push_back(GSSetting(1, "Basic", "Recommended"));
m_gs_acc_blend_level_d3d11.push_back(GSSetting(2, "Medium", "Debug"));
m_gs_acc_blend_level_d3d11.push_back(GSSetting(3, "High", "Debug"));
m_gs_tv_shaders.push_back(GSSetting(0, "None", ""));
m_gs_tv_shaders.push_back(GSSetting(1, "Scanline filter", ""));
m_gs_tv_shaders.push_back(GSSetting(2, "Diagonal filter", ""));
m_gs_tv_shaders.push_back(GSSetting(3, "Triangular filter", ""));
m_gs_tv_shaders.push_back(GSSetting(4, "Wave filter", ""));
// clang-format off
// Avoid to clutter the ini file with useless options
#ifdef _WIN32
// Per OS option.
m_default_configuration["Adapter"] = "default";
m_default_configuration["CaptureFileName"] = "";
m_default_configuration["CaptureVideoCodecDisplayName"] = "";
m_default_configuration["dx_break_on_severity"] = "0";
// D3D Blending option
m_default_configuration["accurate_blending_unit_d3d11"] = "1";
#else
m_default_configuration["linux_replay"] = "1";
#endif
m_default_configuration["aa1"] = "0";
m_default_configuration["accurate_date"] = "1";
m_default_configuration["accurate_blending_unit"] = "1";
m_default_configuration["AspectRatio"] = "1";
m_default_configuration["autoflush_sw"] = "1";
m_default_configuration["capture_enabled"] = "0";
m_default_configuration["capture_out_dir"] = "/tmp/GS_Capture";
m_default_configuration["capture_threads"] = "4";
m_default_configuration["CaptureHeight"] = "480";
m_default_configuration["CaptureWidth"] = "640";
m_default_configuration["clut_load_before_draw"] = "0";
m_default_configuration["crc_hack_level"] = std::to_string(static_cast<int8>(CRCHackLevel::Automatic));
m_default_configuration["CrcHacksExclusions"] = "";
m_default_configuration["debug_glsl_shader"] = "0";
m_default_configuration["debug_opengl"] = "0";
m_default_configuration["disable_hw_gl_draw"] = "0";
m_default_configuration["dithering_ps2"] = "2";
m_default_configuration["dump"] = "0";
m_default_configuration["extrathreads"] = "2";
m_default_configuration["extrathreads_height"] = "4";
m_default_configuration["filter"] = std::to_string(static_cast<int8>(BiFiltering::PS2));
m_default_configuration["force_texture_clear"] = "0";
m_default_configuration["fxaa"] = "0";
m_default_configuration["interlace"] = "7";
m_default_configuration["conservative_framebuffer"] = "1";
m_default_configuration["linear_present"] = "1";
m_default_configuration["MaxAnisotropy"] = "0";
m_default_configuration["mipmap"] = "1";
m_default_configuration["mipmap_hw"] = std::to_string(static_cast<int>(HWMipmapLevel::Automatic));
m_default_configuration["ModeHeight"] = "480";
m_default_configuration["ModeWidth"] = "640";
m_default_configuration["NTSC_Saturation"] = "1";
#ifdef _WIN32
m_default_configuration["osd_fontname"] = "C:\\Windows\\Fonts\\my_favorite_font_e_g_tahoma.ttf";
#else
m_default_configuration["osd_fontname"] = "/usr/share/fonts/truetype/my_favorite_font_e_g_DejaVu Sans.ttf";
#endif
m_default_configuration["osd_color_r"] = "0";
m_default_configuration["osd_color_g"] = "160";
m_default_configuration["osd_color_b"] = "255";
m_default_configuration["osd_color_opacity"] = "100";
m_default_configuration["osd_fontsize"] = "25";
m_default_configuration["osd_log_enabled"] = "1";
m_default_configuration["osd_log_timeout"] = "4";
m_default_configuration["osd_monitor_enabled"] = "0";
m_default_configuration["osd_max_log_messages"] = "2";
m_default_configuration["override_geometry_shader"] = "-1";
m_default_configuration["override_GL_ARB_compute_shader"] = "-1";
m_default_configuration["override_GL_ARB_copy_image"] = "-1";
m_default_configuration["override_GL_ARB_clear_texture"] = "-1";
m_default_configuration["override_GL_ARB_clip_control"] = "-1";
m_default_configuration["override_GL_ARB_direct_state_access"] = "-1";
m_default_configuration["override_GL_ARB_draw_buffers_blend"] = "-1";
m_default_configuration["override_GL_ARB_get_texture_sub_image"] = "-1";
m_default_configuration["override_GL_ARB_gpu_shader5"] = "-1";
m_default_configuration["override_GL_ARB_multi_bind"] = "-1";
m_default_configuration["override_GL_ARB_shader_image_load_store"] = "-1";
m_default_configuration["override_GL_ARB_shader_storage_buffer_object"] = "-1";
m_default_configuration["override_GL_ARB_sparse_texture"] = "-1";
m_default_configuration["override_GL_ARB_sparse_texture2"] = "-1";
m_default_configuration["override_GL_ARB_texture_view"] = "-1";
m_default_configuration["override_GL_ARB_vertex_attrib_binding"] = "-1";
m_default_configuration["override_GL_ARB_texture_barrier"] = "-1";
m_default_configuration["paltex"] = "0";
m_default_configuration["png_compression_level"] = std::to_string(Z_BEST_SPEED);
m_default_configuration["preload_frame_with_gs_data"] = "0";
m_default_configuration["Renderer"] = std::to_string(static_cast<int>(GSRendererType::Default));
m_default_configuration["resx"] = "1024";
m_default_configuration["resy"] = "1024";
m_default_configuration["save"] = "0";
m_default_configuration["savef"] = "0";
m_default_configuration["savel"] = "5000";
m_default_configuration["saven"] = "0";
m_default_configuration["savet"] = "0";
m_default_configuration["savez"] = "0";
m_default_configuration["ShadeBoost"] = "0";
m_default_configuration["ShadeBoost_Brightness"] = "50";
m_default_configuration["ShadeBoost_Contrast"] = "50";
m_default_configuration["ShadeBoost_Saturation"] = "50";
m_default_configuration["shaderfx"] = "0";
m_default_configuration["shaderfx_conf"] = "shaders/GS_FX_Settings.ini";
m_default_configuration["shaderfx_glsl"] = "shaders/GS.fx";
m_default_configuration["TVShader"] = "0";
m_default_configuration["upscale_multiplier"] = "1";
m_default_configuration["UserHacks"] = "0";
m_default_configuration["UserHacks_align_sprite_X"] = "0";
m_default_configuration["UserHacks_AutoFlush"] = "0";
m_default_configuration["UserHacks_DisableDepthSupport"] = "0";
m_default_configuration["UserHacks_Disable_Safe_Features"] = "0";
m_default_configuration["UserHacks_DisablePartialInvalidation"] = "0";
m_default_configuration["UserHacks_CPU_FB_Conversion"] = "0";
m_default_configuration["UserHacks_Half_Bottom_Override"] = "-1";
m_default_configuration["UserHacks_HalfPixelOffset"] = "0";
m_default_configuration["UserHacks_merge_pp_sprite"] = "0";
m_default_configuration["UserHacks_round_sprite_offset"] = "0";
m_default_configuration["UserHacks_SkipDraw"] = "0";
m_default_configuration["UserHacks_SkipDraw_Offset"] = "0";
m_default_configuration["UserHacks_TCOffsetX"] = "0";
m_default_configuration["UserHacks_TCOffsetY"] = "0";
m_default_configuration["UserHacks_TextureInsideRt"] = "0";
m_default_configuration["UserHacks_TriFilter"] = std::to_string(static_cast<int8>(TriFiltering::None));
m_default_configuration["UserHacks_WildHack"] = "0";
m_default_configuration["wrap_gs_mem"] = "0";
m_default_configuration["vsync"] = "0";
// clang-format on
}
void GSApp::ReloadConfig()
{
if (m_configuration_map.empty())
return;
auto file = m_configuration_map.find("inifile");
if (file == m_configuration_map.end())
return;
// A map was built so reload it
std::string filename = file->second;
m_configuration_map.clear();
BuildConfigurationMap(filename.c_str());
}
void GSApp::BuildConfigurationMap(const char* lpFileName)
{
// Check if the map was already built
std::string inifile_value(lpFileName);
if (inifile_value.compare(m_configuration_map["inifile"]) == 0)
return;
m_configuration_map["inifile"] = inifile_value;
// Load config from file
#ifdef _WIN32
std::ifstream file(convert_utf8_to_utf16(lpFileName));
#else
std::ifstream file(lpFileName);
#endif
if (!file.is_open())
return;
std::string line;
while (std::getline(file, line))
{
const auto separator = line.find('=');
if (separator == std::string::npos)
continue;
std::string key = line.substr(0, separator);
// Trim trailing whitespace
key.erase(key.find_last_not_of(" \r\t") + 1);
if (key.empty())
continue;
// Only keep options that have a default value so older, no longer used
// ini options can be purged.
if (m_default_configuration.find(key) == m_default_configuration.end())
continue;
std::string value = line.substr(separator + 1);
// Trim leading whitespace
value.erase(0, value.find_first_not_of(" \r\t"));
m_configuration_map[key] = value;
}
}
void* GSApp::GetModuleHandlePtr()
{
return s_hModule;
}
void GSApp::SetConfigDir(const char* dir)
{
if (dir == NULL)
{
m_ini = "inis/GS.ini";
}
else
{
m_ini = dir;
if (m_ini[m_ini.length() - 1] != DIRECTORY_SEPARATOR)
{
m_ini += DIRECTORY_SEPARATOR;
}
m_ini += "GS.ini";
}
}
std::string GSApp::GetConfigS(const char* entry)
{
char buff[4096] = {0};
auto def = m_default_configuration.find(entry);
if (def != m_default_configuration.end())
{
GetIniString(m_section.c_str(), entry, def->second.c_str(), buff, countof(buff), m_ini.c_str());
}
else
{
fprintf(stderr, "Option %s doesn't have a default value\n", entry);
GetIniString(m_section.c_str(), entry, "", buff, countof(buff), m_ini.c_str());
}
return {buff};
}
void GSApp::SetConfig(const char* entry, const char* value)
{
WriteIniString(m_section.c_str(), entry, value, m_ini.c_str());
}
int GSApp::GetConfigI(const char* entry)
{
auto def = m_default_configuration.find(entry);
if (def != m_default_configuration.end())
{
return GetIniInt(m_section.c_str(), entry, std::stoi(def->second), m_ini.c_str());
}
else
{
fprintf(stderr, "Option %s doesn't have a default value\n", entry);
return GetIniInt(m_section.c_str(), entry, 0, m_ini.c_str());
}
}
bool GSApp::GetConfigB(const char* entry)
{
return !!GetConfigI(entry);
}
void GSApp::SetConfig(const char* entry, int value)
{
char buff[32] = {0};
sprintf(buff, "%d", value);
SetConfig(entry, buff);
}
void GSApp::SetCurrentRendererType(GSRendererType type)
{
m_current_renderer_type = type;
}
GSRendererType GSApp::GetCurrentRendererType() const
{
return m_current_renderer_type;
}

View File

@ -27,6 +27,7 @@
#include "config.h" #include "config.h"
#include "Pcsx2Types.h" #include "Pcsx2Types.h"
#include "GS_types.h" #include "GS_types.h"
#include "Window/GSSetting.h"
#ifdef _WIN32 #ifdef _WIN32
@ -211,7 +212,7 @@
// sse // sse
#if defined(__GNUC__) #if defined(__GNUC__)
// Convert gcc see define into GSdx (windows) define // Convert gcc see define into GS (windows) define
#if defined(__AVX2__) #if defined(__AVX2__)
#if defined(__x86_64__) #if defined(__x86_64__)
#define _M_SSE 0x500 // TODO #define _M_SSE 0x500 // TODO
@ -1907,3 +1908,84 @@ void GSgetTitleInfo2(char* dest, size_t length);
void GSsetFrameSkip(int frameskip); void GSsetFrameSkip(int frameskip);
void GSsetVsync(int vsync); void GSsetVsync(int vsync);
void GSsetExclusive(int enabled); void GSsetExclusive(int enabled);
class GSApp
{
std::string m_ini;
std::string m_section;
std::map<std::string, std::string> m_default_configuration;
std::map<std::string, std::string> m_configuration_map;
GSRendererType m_current_renderer_type;
public:
GSApp();
void Init();
void* GetModuleHandlePtr();
#ifdef _WIN32
HMODULE GetModuleHandle()
{
return (HMODULE)GetModuleHandlePtr();
}
#endif
void BuildConfigurationMap(const char* lpFileName);
void ReloadConfig();
size_t GetIniString(const char* lpAppName, const char* lpKeyName, const char* lpDefault, char* lpReturnedString, size_t nSize, const char* lpFileName);
bool WriteIniString(const char* lpAppName, const char* lpKeyName, const char* pString, const char* lpFileName);
int GetIniInt(const char* lpAppName, const char* lpKeyName, int nDefault, const char* lpFileName);
#ifdef _WIN32
bool LoadResource(int id, std::vector<char>& buff, const wchar_t* type = nullptr);
#else
bool LoadResource(int id, std::vector<char>& buff, const char* type = nullptr);
#endif
void SetConfig(const char* entry, const char* value);
void SetConfig(const char* entry, int value);
// Avoid issue with overloading
template <typename T>
T GetConfigT(const char* entry)
{
return static_cast<T>(GetConfigI(entry));
}
int GetConfigI(const char* entry);
bool GetConfigB(const char* entry);
std::string GetConfigS(const char* entry);
void SetCurrentRendererType(GSRendererType type);
GSRendererType GetCurrentRendererType() const;
void SetConfigDir(const char* dir);
std::vector<GSSetting> m_gs_renderers;
std::vector<GSSetting> m_gs_interlace;
std::vector<GSSetting> m_gs_aspectratio;
std::vector<GSSetting> m_gs_upscale_multiplier;
std::vector<GSSetting> m_gs_max_anisotropy;
std::vector<GSSetting> m_gs_dithering;
std::vector<GSSetting> m_gs_bifilter;
std::vector<GSSetting> m_gs_trifilter;
std::vector<GSSetting> m_gs_hack;
std::vector<GSSetting> m_gs_generic_list;
std::vector<GSSetting> m_gs_offset_hack;
std::vector<GSSetting> m_gs_hw_mipmapping;
std::vector<GSSetting> m_gs_crc_level;
std::vector<GSSetting> m_gs_acc_blend_level;
std::vector<GSSetting> m_gs_acc_blend_level_d3d11;
std::vector<GSSetting> m_gs_tv_shaders;
};
struct GSError
{
};
struct GSRecoverableError : GSError
{
};
struct GSErrorGlVertexArrayTooSmall : GSError
{
};
extern GSApp theApp;

View File

@ -23,6 +23,7 @@
#include "GSCapture.h" #include "GSCapture.h"
#include "GSPng.h" #include "GSPng.h"
#include "GSUtil.h" #include "GSUtil.h"
#include "GS_types.h"
#ifdef _WIN32 #ifdef _WIN32
@ -406,7 +407,7 @@ static IPin* GetFirstPin(IBaseFilter* pBF, PIN_DIRECTION dir)
GSCapture::GSCapture() GSCapture::GSCapture()
: m_capturing(false), m_frame(0) : m_capturing(false), m_frame(0)
, m_out_dir("/tmp/GSdx_Capture") // FIXME Later add an option , m_out_dir("/tmp/GS_Capture") // FIXME Later add an option
{ {
m_out_dir = theApp.GetConfigS("capture_out_dir"); m_out_dir = theApp.GetConfigS("capture_out_dir");
m_threads = theApp.GetConfigI("capture_threads"); m_threads = theApp.GetConfigI("capture_threads");

View File

@ -21,6 +21,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSCodeBuffer.h" #include "GSCodeBuffer.h"
#include "GS_types.h"
GSCodeBuffer::GSCodeBuffer(size_t blocksize) GSCodeBuffer::GSCodeBuffer(size_t blocksize)
: m_blocksize(blocksize) : m_blocksize(blocksize)
@ -40,8 +41,8 @@ GSCodeBuffer::~GSCodeBuffer()
void* GSCodeBuffer::GetBuffer(size_t size) void* GSCodeBuffer::GetBuffer(size_t size)
{ {
ASSERT(size < m_blocksize); pxAssert(size < m_blocksize);
ASSERT(m_reserved == 0); pxAssert(m_reserved == 0);
size = (size + 15) & ~15; size = (size + 15) & ~15;
@ -63,11 +64,11 @@ void* GSCodeBuffer::GetBuffer(size_t size)
void GSCodeBuffer::ReleaseBuffer(size_t size) void GSCodeBuffer::ReleaseBuffer(size_t size)
{ {
ASSERT(size <= m_reserved); pxAssert(size <= m_reserved);
m_pos = ((m_pos + size) + 15) & ~15; m_pos = ((m_pos + size) + 15) & ~15;
ASSERT(m_pos < m_blocksize); pxAssert(m_pos < m_blocksize);
m_reserved = 0; m_reserved = 0;
} }

View File

@ -21,6 +21,8 @@
#pragma once #pragma once
#include "GS_types.h"
class GSCodeBuffer class GSCodeBuffer
{ {
std::vector<void*> m_buffers; std::vector<void*> m_buffers;

View File

@ -20,7 +20,7 @@
*/ */
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSdx.h" #include "GS.h"
#include "GSCrc.h" #include "GSCrc.h"
CRC::Game CRC::m_games[] = CRC::Game CRC::m_games[] =
@ -535,12 +535,12 @@ bool IsCrcExcluded(std::string exclusionList, uint32 crc)
CRC::Game CRC::Lookup(uint32 crc) CRC::Game CRC::Lookup(uint32 crc)
{ {
printf("GSdx Lookup CRC:%08X\n", crc); printf("GS Lookup CRC:%08X\n", crc);
if (m_map.empty()) if (m_map.empty())
{ {
std::string exclusions = theApp.GetConfigS("CrcHacksExclusions"); std::string exclusions = theApp.GetConfigS("CrcHacksExclusions");
if (exclusions.length() != 0) if (exclusions.length() != 0)
printf("GSdx: CrcHacksExclusions: %s\n", exclusions.c_str()); printf("GS: CrcHacksExclusions: %s\n", exclusions.c_str());
int crcDups = 0; int crcDups = 0;
for (size_t i = 0; i < countof(m_games); i++) for (size_t i = 0; i < countof(m_games); i++)
{ {
@ -548,17 +548,17 @@ CRC::Game CRC::Lookup(uint32 crc)
{ {
if (m_map[m_games[i].crc]) if (m_map[m_games[i].crc])
{ {
printf("[FIXME] GSdx: Duplicate CRC: 0x%08X: (game-id/region-id) %d/%d overrides %d/%d\n", m_games[i].crc, m_games[i].title, m_games[i].region, m_map[m_games[i].crc]->title, m_map[m_games[i].crc]->region); printf("[FIXME] GS: Duplicate CRC: 0x%08X: (game-id/region-id) %d/%d overrides %d/%d\n", m_games[i].crc, m_games[i].title, m_games[i].region, m_map[m_games[i].crc]->title, m_map[m_games[i].crc]->region);
crcDups++; crcDups++;
} }
m_map[m_games[i].crc] = &m_games[i]; m_map[m_games[i].crc] = &m_games[i];
} }
//else //else
// printf( "GSdx: excluding CRC hack for 0x%08x\n", m_games[i].crc ); // printf( "GS: excluding CRC hack for 0x%08x\n", m_games[i].crc );
} }
if (crcDups) if (crcDups)
printf("[FIXME] GSdx: Duplicate CRC: Overall: %d\n", crcDups); printf("[FIXME] GS: Duplicate CRC: Overall: %d\n", crcDups);
} }
auto i = m_map.find(crc); auto i = m_map.find(crc);

View File

@ -21,7 +21,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSDrawingContext.h" #include "GSDrawingContext.h"
#include "GSdx.h" #include "GS.h"
static int findmax(int tl, int br, int limit, int wm, int minuv, int maxuv) static int findmax(int tl, int br, int limit, int wm, int minuv, int maxuv)
{ {

View File

@ -26,7 +26,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSLocalMemory.h" #include "GSLocalMemory.h"
#include "GSdx.h" #include "GS.h"
#define ASSERT_BLOCK(r, w, h) \ #define ASSERT_BLOCK(r, w, h) \
ASSERT((r).width() >= (w) && (r).height() >= (h) && !((r).left & ((w) - 1)) && !((r).top & ((h) - 1)) && !((r).right & ((w) - 1)) && !((r).bottom & ((h) - 1))); \ ASSERT((r).width() >= (w) && (r).height() >= (h) && !((r).left & ((w) - 1)) && !((r).top & ((h) - 1)) && !((r).right & ((w) - 1)) && !((r).bottom & ((h) - 1))); \

View File

@ -21,6 +21,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSPerfMon.h" #include "GSPerfMon.h"
#include "GS_types.h"
GSPerfMon::GSPerfMon() GSPerfMon::GSPerfMon()
: m_frame(0) : m_frame(0)

View File

@ -21,6 +21,8 @@
#pragma once #pragma once
#include "GS_types.h"
class GSPerfMon class GSPerfMon
{ {
public: public:

View File

@ -65,14 +65,14 @@ namespace GSPng
try try
{ {
if (png_ptr == nullptr) if (png_ptr == nullptr)
throw GSDXRecoverableError(); throw GSRecoverableError();
info_ptr = png_create_info_struct(png_ptr); info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == nullptr) if (info_ptr == nullptr)
throw GSDXRecoverableError(); throw GSRecoverableError();
if (setjmp(png_jmpbuf(png_ptr))) if (setjmp(png_jmpbuf(png_ptr)))
throw GSDXRecoverableError(); throw GSRecoverableError();
png_init_io(png_ptr, fp); png_init_io(png_ptr, fp);
png_set_compression_level(png_ptr, compression); png_set_compression_level(png_ptr, compression);
@ -96,7 +96,7 @@ namespace GSPng
success = true; success = true;
} }
catch (GSDXRecoverableError&) catch (GSRecoverableError&)
{ {
fprintf(stderr, "Failed to write image %s\n", file.c_str()); fprintf(stderr, "Failed to write image %s\n", file.c_str());

View File

@ -21,7 +21,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSState.h" #include "GSState.h"
#include "GSdx.h" #include "GS.h"
#include "GSUtil.h" #include "GSUtil.h"
//#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering //#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering
@ -235,7 +235,7 @@ void GSState::SetFrameSkip(int skip)
void GSState::Reset() void GSState::Reset()
{ {
//printf("GSdx info: GS reset\n"); //printf("GS info: GS reset\n");
// FIXME: memset(m_mem.m_vm8, 0, m_mem.m_vmsize); // bios logo not shown cut in half after reset, missing graphics in GoW after first FMV // FIXME: memset(m_mem.m_vm8, 0, m_mem.m_vmsize); // bios logo not shown cut in half after reset, missing graphics in GoW after first FMV
memset(&m_path[0], 0, sizeof(m_path[0]) * countof(m_path)); memset(&m_path[0], 0, sizeof(m_path[0]) * countof(m_path));
@ -1684,7 +1684,7 @@ void GSState::FlushPrim()
{ {
Draw(); Draw();
} }
catch (GSDXRecoverableError&) catch (GSRecoverableError&)
{ {
// could be an unsupported draw call // could be an unsupported draw call
} }
@ -1692,7 +1692,7 @@ void GSState::FlushPrim()
{ {
// Texture Out Of Memory // Texture Out Of Memory
PurgePool(); PurgePool();
fprintf(stderr, "GSDX OUT OF MEMORY\n"); fprintf(stderr, "GS OUT OF MEMORY\n");
} }
m_context->RestoreReg(); m_context->RestoreReg();
@ -1745,7 +1745,7 @@ void GSState::Write(const uint8* mem, int len)
* *
* #Bug number 2. (darker screen) * #Bug number 2. (darker screen)
* The game will restore the previously saved buffer at position 0x0 to * The game will restore the previously saved buffer at position 0x0 to
* 0x7F8. Because of the extra RT pixels, GSdx will partialy invalidate * 0x7F8. Because of the extra RT pixels, GS will partialy invalidate
* the texture located at 0x700. Next access will generate a cache miss * the texture located at 0x700. Next access will generate a cache miss
* *
* The no-solution: instead to handle garbage (aka RT) at the end of the * The no-solution: instead to handle garbage (aka RT) at the end of the
@ -2393,7 +2393,7 @@ void GSState::Transfer(const uint8* mem, uint32 size)
} }
else else
{ {
// Unused in 0.9.7 and above, but might as well keep this for now; allows GSdx // Unused in 0.9.7 and above, but might as well keep this for now; allows GS
// to work with legacy editions of PCSX2. // to work with legacy editions of PCSX2.
Transfer<0>(mem - 0x4000, 0x4000 / 16); Transfer<0>(mem - 0x4000, 0x4000 / 16);
@ -2518,7 +2518,7 @@ int GSState::Defrost(const GSFreezeData* fd)
if (version > m_version) if (version > m_version)
{ {
printf("GSdx: Savestate version is incompatible. Load aborted.\n"); printf("GS: Savestate version is incompatible. Load aborted.\n");
return -1; return -1;
} }
@ -2689,8 +2689,8 @@ void GSState::GrowVertexBuffer()
if (vertex == NULL || index == NULL) if (vertex == NULL || index == NULL)
{ {
printf("GSdx: failed to allocate %d bytes for verticles and %d for indices.\n", (int)sizeof(GSVertex) * maxcount, (int)sizeof(uint32) * maxcount * 3); printf("GS: failed to allocate %d bytes for verticles and %d for indices.\n", (int)sizeof(GSVertex) * maxcount, (int)sizeof(uint32) * maxcount * 3);
throw GSDXError(); throw GSError();
} }
if (m_vertex.buff != NULL) if (m_vertex.buff != NULL)

View File

@ -23,6 +23,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSTables.h" #include "GSTables.h"
#include "GS_types.h"
const uint8 blockTable32[4][8] = const uint8 blockTable32[4][8] =
{ {

View File

@ -21,6 +21,8 @@
#pragma once #pragma once
#include "GS_types.h"
extern const uint8 blockTable32[4][8]; extern const uint8 blockTable32[4][8];
extern const uint8 blockTable32Z[4][8]; extern const uint8 blockTable32Z[4][8];
extern const uint8 blockTable16[8][4]; extern const uint8 blockTable16[8][4];

View File

@ -21,7 +21,7 @@
#pragma once #pragma once
#include "GSdx.h" #include "GS.h"
// http://software.intel.com/en-us/blogs/2012/11/06/exploring-intel-transactional-synchronization-extensions-with-intel-software // http://software.intel.com/en-us/blogs/2012/11/06/exploring-intel-transactional-synchronization-extensions-with-intel-software
#if 0 #if 0

View File

@ -21,7 +21,7 @@
#pragma once #pragma once
#include "GSdx.h" #include "GS.h"
#include "Utilities/boost_spsc_queue.hpp" #include "Utilities/boost_spsc_queue.hpp"
template <class T, int CAPACITY> template <class T, int CAPACITY>

View File

@ -47,7 +47,7 @@ const char* GSUtil::GetLibName()
g_cpu.has(Xbyak::util::Cpu::tSSSE3) ? "SSSE3" : "SSE2"; g_cpu.has(Xbyak::util::Cpu::tSSSE3) ? "SSSE3" : "SSE2";
#endif #endif
snprintf(name, sizeof(name), "GSdx " snprintf(name, sizeof(name), "GS "
#ifdef _WIN32 #ifdef _WIN32
"%lld " "%lld "

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include <cfloat>
typedef unsigned char uint8; typedef unsigned char uint8;
typedef signed char int8; typedef signed char int8;
typedef unsigned short uint16; typedef unsigned short uint16;
@ -31,3 +33,39 @@ typedef signed long long int64;
#endif #endif
#endif #endif
#define _MM_TRANSPOSE4_SI128(row0, row1, row2, row3) \
{ \
__m128 tmp0 = _mm_shuffle_ps(_mm_castsi128_ps(row0), _mm_castsi128_ps(row1), 0x44); \
__m128 tmp2 = _mm_shuffle_ps(_mm_castsi128_ps(row0), _mm_castsi128_ps(row1), 0xEE); \
__m128 tmp1 = _mm_shuffle_ps(_mm_castsi128_ps(row2), _mm_castsi128_ps(row3), 0x44); \
__m128 tmp3 = _mm_shuffle_ps(_mm_castsi128_ps(row2), _mm_castsi128_ps(row3), 0xEE); \
(row0) = _mm_castps_si128(_mm_shuffle_ps(tmp0, tmp1, 0x88)); \
(row1) = _mm_castps_si128(_mm_shuffle_ps(tmp0, tmp1, 0xDD)); \
(row2) = _mm_castps_si128(_mm_shuffle_ps(tmp2, tmp3, 0x88)); \
(row3) = _mm_castps_si128(_mm_shuffle_ps(tmp2, tmp3, 0xDD)); \
}
extern void* vmalloc(size_t size, bool code);
extern void vmfree(void* ptr, size_t size);
// _wfopen has to be used on Windows for pathnames containing non-ASCII characters.
inline FILE* px_fopen(const std::string& filename, const std::string& mode)
{
#ifdef _WIN32
return _wfopen(convert_utf8_to_utf16(filename).c_str(), convert_utf8_to_utf16(mode).c_str());
#else
return fopen(filename.c_str(), mode.c_str());
#endif
}
#define countof(a) (sizeof(a) / sizeof(a[0]))
#ifdef __cpp_constinit
#define CONSTINIT constinit
#elif __has_attribute(require_constant_initialization)
#define CONSTINIT __attribute__((require_constant_initialization))
#else
#define CONSTINIT
#endif

View File

@ -1,581 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "PrecompiledHeader.h"
#include "GSdx.h"
#include "GS.h"
#include <fstream>
static void* s_hModule;
#ifdef _WIN32
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
s_hModule = hModule;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
bool GSdxApp::LoadResource(int id, std::vector<char>& buff, const wchar_t* type)
{
buff.clear();
HRSRC hRsrc = FindResource((HMODULE)s_hModule, MAKEINTRESOURCE(id), type != NULL ? type : (LPWSTR)RT_RCDATA);
if (!hRsrc)
return false;
HGLOBAL hGlobal = ::LoadResource((HMODULE)s_hModule, hRsrc);
if (!hGlobal)
return false;
DWORD size = SizeofResource((HMODULE)s_hModule, hRsrc);
if (!size)
return false;
// On Linux resources are always NULL terminated
// Add + 1 on size to do the same for compatibility sake (required by GSDeviceOGL)
buff.resize(size + 1);
memcpy(buff.data(), LockResource(hGlobal), size);
return true;
}
#else
#include "GSdxResources.h"
bool GSdxApp::LoadResource(int id, std::vector<char>& buff, const char* type)
{
std::string path;
switch (id)
{
case IDR_COMMON_GLSL:
path = "/GSdx/res/glsl/common_header.glsl";
break;
case IDR_CONVERT_GLSL:
path = "/GSdx/res/glsl/convert.glsl";
break;
case IDR_FXAA_FX:
path = "/GSdx/res/fxaa.fx";
break;
case IDR_INTERLACE_GLSL:
path = "/GSdx/res/glsl/interlace.glsl";
break;
case IDR_MERGE_GLSL:
path = "/GSdx/res/glsl/merge.glsl";
break;
case IDR_SHADEBOOST_GLSL:
path = "/GSdx/res/glsl/shadeboost.glsl";
break;
case IDR_TFX_VGS_GLSL:
path = "/GSdx/res/glsl/tfx_vgs.glsl";
break;
case IDR_TFX_FS_GLSL:
path = "/GSdx/res/glsl/tfx_fs.glsl";
break;
case IDR_FONT_ROBOTO:
path = "/GSdx/res/fonts-roboto/Roboto-Regular.ttf";
break;
default:
printf("LoadResource not implemented for id %d\n", id);
return false;
}
GBytes* bytes = g_resource_lookup_data(GSdx_res_get_resource(), path.c_str(), G_RESOURCE_LOOKUP_FLAGS_NONE, nullptr);
size_t size = 0;
const void* data = g_bytes_get_data(bytes, &size);
if (data == nullptr || size == 0)
{
printf("Failed to get data for resource: %d\n", id);
return false;
}
buff.clear();
buff.resize(size + 1);
memcpy(buff.data(), data, size + 1);
g_bytes_unref(bytes);
return true;
}
#endif
size_t GSdxApp::GetIniString(const char* lpAppName, const char* lpKeyName, const char* lpDefault, char* lpReturnedString, size_t nSize, const char* lpFileName)
{
BuildConfigurationMap(lpFileName);
std::string key(lpKeyName);
std::string value = m_configuration_map[key];
if (value.empty())
{
// save the value for futur call
m_configuration_map[key] = std::string(lpDefault);
strcpy(lpReturnedString, lpDefault);
}
else
strcpy(lpReturnedString, value.c_str());
return 0;
}
bool GSdxApp::WriteIniString(const char* lpAppName, const char* lpKeyName, const char* pString, const char* lpFileName)
{
BuildConfigurationMap(lpFileName);
std::string key(lpKeyName);
std::string value(pString);
m_configuration_map[key] = value;
// Save config to a file
FILE* f = px_fopen(lpFileName, "w");
if (f == NULL)
return false; // FIXME print a nice message
// Maintain compatibility with GSDumpGUI/old Windows ini.
#ifdef _WIN32
fprintf(f, "[Settings]\n");
#endif
for (const auto& entry : m_configuration_map)
{
// Do not save the inifile key which is not an option
if (entry.first.compare("inifile") == 0)
continue;
// Only keep option that have a default value (allow to purge old option of the GSdx.ini)
if (!entry.second.empty() && m_default_configuration.find(entry.first) != m_default_configuration.end())
fprintf(f, "%s = %s\n", entry.first.c_str(), entry.second.c_str());
}
fclose(f);
return false;
}
int GSdxApp::GetIniInt(const char* lpAppName, const char* lpKeyName, int nDefault, const char* lpFileName)
{
BuildConfigurationMap(lpFileName);
std::string value = m_configuration_map[std::string(lpKeyName)];
if (value.empty())
{
// save the value for futur call
SetConfig(lpKeyName, nDefault);
return nDefault;
}
else
return atoi(value.c_str());
}
GSdxApp theApp;
GSdxApp::GSdxApp()
{
// Empty constructor causes an illegal instruction exception on an SSE4.2 machine on Windows.
// Non-empty doesn't, but raises a SIGILL signal when compiled against GCC 6.1.1.
// So here's a compromise.
#ifdef _WIN32
Init();
#endif
}
void GSdxApp::Init()
{
static bool is_initialised = false;
if (is_initialised)
return;
is_initialised = true;
m_current_renderer_type = GSRendererType::Undefined;
if (m_ini.empty())
m_ini = "inis/GSdx.ini";
m_section = "Settings";
#ifdef _WIN32
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::DX1011_HW), "Direct3D 11", ""));
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_HW), "OpenGL", ""));
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_SW), "Software", ""));
#else // Linux
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_HW), "OpenGL", ""));
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_SW), "Software", ""));
#endif
// The null renderer goes third, it has use for benchmarking purposes in a release build
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::Null), "Null", ""));
m_gs_interlace.push_back(GSSetting(0, "None", ""));
m_gs_interlace.push_back(GSSetting(1, "Weave tff", "saw-tooth"));
m_gs_interlace.push_back(GSSetting(2, "Weave bff", "saw-tooth"));
m_gs_interlace.push_back(GSSetting(3, "Bob tff", "use blend if shaking"));
m_gs_interlace.push_back(GSSetting(4, "Bob bff", "use blend if shaking"));
m_gs_interlace.push_back(GSSetting(5, "Blend tff", "slight blur, 1/2 fps"));
m_gs_interlace.push_back(GSSetting(6, "Blend bff", "slight blur, 1/2 fps"));
m_gs_interlace.push_back(GSSetting(7, "Automatic", "Default"));
m_gs_aspectratio.push_back(GSSetting(0, "Stretch", ""));
m_gs_aspectratio.push_back(GSSetting(1, "4:3", ""));
m_gs_aspectratio.push_back(GSSetting(2, "16:9", ""));
m_gs_upscale_multiplier.push_back(GSSetting(1, "Native", "PS2"));
m_gs_upscale_multiplier.push_back(GSSetting(2, "2x Native", "~720p"));
m_gs_upscale_multiplier.push_back(GSSetting(3, "3x Native", "~1080p"));
m_gs_upscale_multiplier.push_back(GSSetting(4, "4x Native", "~1440p 2K"));
m_gs_upscale_multiplier.push_back(GSSetting(5, "5x Native", "~1620p 3K"));
m_gs_upscale_multiplier.push_back(GSSetting(6, "6x Native", "~2160p 4K"));
m_gs_upscale_multiplier.push_back(GSSetting(8, "8x Native", "~2880p 5K"));
m_gs_max_anisotropy.push_back(GSSetting(0, "Off", "Default"));
m_gs_max_anisotropy.push_back(GSSetting(2, "2x", ""));
m_gs_max_anisotropy.push_back(GSSetting(4, "4x", ""));
m_gs_max_anisotropy.push_back(GSSetting(8, "8x", ""));
m_gs_max_anisotropy.push_back(GSSetting(16, "16x", ""));
m_gs_dithering.push_back(GSSetting(0, "Off", ""));
m_gs_dithering.push_back(GSSetting(2, "Unscaled", "Default"));
m_gs_dithering.push_back(GSSetting(1, "Scaled", ""));
m_gs_bifilter.push_back(GSSetting(static_cast<uint32>(BiFiltering::Nearest), "Nearest", ""));
m_gs_bifilter.push_back(GSSetting(static_cast<uint32>(BiFiltering::Forced_But_Sprite), "Bilinear", "Forced excluding sprite"));
m_gs_bifilter.push_back(GSSetting(static_cast<uint32>(BiFiltering::Forced), "Bilinear", "Forced"));
m_gs_bifilter.push_back(GSSetting(static_cast<uint32>(BiFiltering::PS2), "Bilinear", "PS2"));
m_gs_trifilter.push_back(GSSetting(static_cast<uint32>(TriFiltering::None), "None", "Default"));
m_gs_trifilter.push_back(GSSetting(static_cast<uint32>(TriFiltering::PS2), "Trilinear", ""));
m_gs_trifilter.push_back(GSSetting(static_cast<uint32>(TriFiltering::Forced), "Trilinear", "Ultra/Slow"));
m_gs_generic_list.push_back(GSSetting(-1, "Automatic", "Default"));
m_gs_generic_list.push_back(GSSetting(0, "Force-Disabled", ""));
m_gs_generic_list.push_back(GSSetting(1, "Force-Enabled", ""));
m_gs_hack.push_back(GSSetting(0, "Off", "Default"));
m_gs_hack.push_back(GSSetting(1, "Half", ""));
m_gs_hack.push_back(GSSetting(2, "Full", ""));
m_gs_offset_hack.push_back(GSSetting(0, "Off", "Default"));
m_gs_offset_hack.push_back(GSSetting(1, "Normal", "Vertex"));
m_gs_offset_hack.push_back(GSSetting(2, "Special", "Texture"));
m_gs_offset_hack.push_back(GSSetting(3, "Special", "Texture - aggressive"));
m_gs_hw_mipmapping = {
GSSetting(HWMipmapLevel::Automatic, "Automatic", "Default"),
GSSetting(HWMipmapLevel::Off, "Off", ""),
GSSetting(HWMipmapLevel::Basic, "Basic", "Fast"),
GSSetting(HWMipmapLevel::Full, "Full", "Slow"),
};
m_gs_crc_level = {
GSSetting(CRCHackLevel::Automatic, "Automatic", "Default"),
GSSetting(CRCHackLevel::None, "None", "Debug"),
GSSetting(CRCHackLevel::Minimum, "Minimum", "Debug"),
#ifdef _DEBUG
GSSetting(CRCHackLevel::Partial, "Partial", "OpenGL"),
GSSetting(CRCHackLevel::Full, "Full", "Direct3D"),
#endif
GSSetting(CRCHackLevel::Aggressive, "Aggressive", ""),
};
m_gs_acc_blend_level.push_back(GSSetting(0, "None", "Fastest"));
m_gs_acc_blend_level.push_back(GSSetting(1, "Basic", "Recommended"));
m_gs_acc_blend_level.push_back(GSSetting(2, "Medium", ""));
m_gs_acc_blend_level.push_back(GSSetting(3, "High", ""));
m_gs_acc_blend_level.push_back(GSSetting(4, "Full", "Very Slow"));
m_gs_acc_blend_level.push_back(GSSetting(5, "Ultra", "Ultra Slow"));
m_gs_acc_blend_level_d3d11.push_back(GSSetting(0, "None", "Fastest"));
m_gs_acc_blend_level_d3d11.push_back(GSSetting(1, "Basic", "Recommended"));
m_gs_acc_blend_level_d3d11.push_back(GSSetting(2, "Medium", "Debug"));
m_gs_acc_blend_level_d3d11.push_back(GSSetting(3, "High", "Debug"));
m_gs_tv_shaders.push_back(GSSetting(0, "None", ""));
m_gs_tv_shaders.push_back(GSSetting(1, "Scanline filter", ""));
m_gs_tv_shaders.push_back(GSSetting(2, "Diagonal filter", ""));
m_gs_tv_shaders.push_back(GSSetting(3, "Triangular filter", ""));
m_gs_tv_shaders.push_back(GSSetting(4, "Wave filter", ""));
// Avoid to clutter the ini file with useless options
#ifdef _WIN32
// Per OS option.
m_default_configuration["Adapter"] = "default";
m_default_configuration["CaptureFileName"] = "";
m_default_configuration["CaptureVideoCodecDisplayName"] = "";
m_default_configuration["dx_break_on_severity"] = "0";
// D3D Blending option
m_default_configuration["accurate_blending_unit_d3d11"] = "1";
#else
m_default_configuration["linux_replay"] = "1";
#endif
m_default_configuration["aa1"] = "0";
m_default_configuration["accurate_date"] = "1";
m_default_configuration["accurate_blending_unit"] = "1";
m_default_configuration["AspectRatio"] = "1";
m_default_configuration["autoflush_sw"] = "1";
m_default_configuration["capture_enabled"] = "0";
m_default_configuration["capture_out_dir"] = "/tmp/GSdx_Capture";
m_default_configuration["capture_threads"] = "4";
m_default_configuration["CaptureHeight"] = "480";
m_default_configuration["CaptureWidth"] = "640";
m_default_configuration["clut_load_before_draw"] = "0";
m_default_configuration["crc_hack_level"] = std::to_string(static_cast<int8>(CRCHackLevel::Automatic));
m_default_configuration["CrcHacksExclusions"] = "";
m_default_configuration["debug_glsl_shader"] = "0";
m_default_configuration["debug_opengl"] = "0";
m_default_configuration["disable_hw_gl_draw"] = "0";
m_default_configuration["dithering_ps2"] = "2";
m_default_configuration["dump"] = "0";
m_default_configuration["extrathreads"] = "2";
m_default_configuration["extrathreads_height"] = "4";
m_default_configuration["filter"] = std::to_string(static_cast<int8>(BiFiltering::PS2));
m_default_configuration["force_texture_clear"] = "0";
m_default_configuration["fxaa"] = "0";
m_default_configuration["interlace"] = "7";
m_default_configuration["conservative_framebuffer"] = "1";
m_default_configuration["linear_present"] = "1";
m_default_configuration["MaxAnisotropy"] = "0";
m_default_configuration["mipmap"] = "1";
m_default_configuration["mipmap_hw"] = std::to_string(static_cast<int>(HWMipmapLevel::Automatic));
m_default_configuration["ModeHeight"] = "480";
m_default_configuration["ModeWidth"] = "640";
m_default_configuration["NTSC_Saturation"] = "1";
#ifdef _WIN32
m_default_configuration["osd_fontname"] = "C:\\Windows\\Fonts\\my_favorite_font_e_g_tahoma.ttf";
#else
m_default_configuration["osd_fontname"] = "/usr/share/fonts/truetype/my_favorite_font_e_g_DejaVu Sans.ttf";
#endif
m_default_configuration["osd_color_r"] = "0";
m_default_configuration["osd_color_g"] = "160";
m_default_configuration["osd_color_b"] = "255";
m_default_configuration["osd_color_opacity"] = "100";
m_default_configuration["osd_fontsize"] = "25";
m_default_configuration["osd_log_enabled"] = "1";
m_default_configuration["osd_log_timeout"] = "4";
m_default_configuration["osd_monitor_enabled"] = "0";
m_default_configuration["osd_max_log_messages"] = "2";
m_default_configuration["override_geometry_shader"] = "-1";
m_default_configuration["override_GL_ARB_compute_shader"] = "-1";
m_default_configuration["override_GL_ARB_copy_image"] = "-1";
m_default_configuration["override_GL_ARB_clear_texture"] = "-1";
m_default_configuration["override_GL_ARB_clip_control"] = "-1";
m_default_configuration["override_GL_ARB_direct_state_access"] = "-1";
m_default_configuration["override_GL_ARB_draw_buffers_blend"] = "-1";
m_default_configuration["override_GL_ARB_get_texture_sub_image"] = "-1";
m_default_configuration["override_GL_ARB_gpu_shader5"] = "-1";
m_default_configuration["override_GL_ARB_multi_bind"] = "-1";
m_default_configuration["override_GL_ARB_shader_image_load_store"] = "-1";
m_default_configuration["override_GL_ARB_shader_storage_buffer_object"] = "-1";
m_default_configuration["override_GL_ARB_sparse_texture"] = "-1";
m_default_configuration["override_GL_ARB_sparse_texture2"] = "-1";
m_default_configuration["override_GL_ARB_texture_view"] = "-1";
m_default_configuration["override_GL_ARB_vertex_attrib_binding"] = "-1";
m_default_configuration["override_GL_ARB_texture_barrier"] = "-1";
m_default_configuration["paltex"] = "0";
m_default_configuration["png_compression_level"] = std::to_string(Z_BEST_SPEED);
m_default_configuration["preload_frame_with_gs_data"] = "0";
m_default_configuration["Renderer"] = std::to_string(static_cast<int>(GSRendererType::Default));
m_default_configuration["resx"] = "1024";
m_default_configuration["resy"] = "1024";
m_default_configuration["save"] = "0";
m_default_configuration["savef"] = "0";
m_default_configuration["savel"] = "5000";
m_default_configuration["saven"] = "0";
m_default_configuration["savet"] = "0";
m_default_configuration["savez"] = "0";
m_default_configuration["ShadeBoost"] = "0";
m_default_configuration["ShadeBoost_Brightness"] = "50";
m_default_configuration["ShadeBoost_Contrast"] = "50";
m_default_configuration["ShadeBoost_Saturation"] = "50";
m_default_configuration["shaderfx"] = "0";
m_default_configuration["shaderfx_conf"] = "shaders/GSdx_FX_Settings.ini";
m_default_configuration["shaderfx_glsl"] = "shaders/GSdx.fx";
m_default_configuration["TVShader"] = "0";
m_default_configuration["upscale_multiplier"] = "1";
m_default_configuration["UserHacks"] = "0";
m_default_configuration["UserHacks_align_sprite_X"] = "0";
m_default_configuration["UserHacks_AutoFlush"] = "0";
m_default_configuration["UserHacks_DisableDepthSupport"] = "0";
m_default_configuration["UserHacks_Disable_Safe_Features"] = "0";
m_default_configuration["UserHacks_DisablePartialInvalidation"] = "0";
m_default_configuration["UserHacks_CPU_FB_Conversion"] = "0";
m_default_configuration["UserHacks_Half_Bottom_Override"] = "-1";
m_default_configuration["UserHacks_HalfPixelOffset"] = "0";
m_default_configuration["UserHacks_merge_pp_sprite"] = "0";
m_default_configuration["UserHacks_round_sprite_offset"] = "0";
m_default_configuration["UserHacks_SkipDraw"] = "0";
m_default_configuration["UserHacks_SkipDraw_Offset"] = "0";
m_default_configuration["UserHacks_TCOffsetX"] = "0";
m_default_configuration["UserHacks_TCOffsetY"] = "0";
m_default_configuration["UserHacks_TextureInsideRt"] = "0";
m_default_configuration["UserHacks_TriFilter"] = std::to_string(static_cast<int8>(TriFiltering::None));
m_default_configuration["UserHacks_WildHack"] = "0";
m_default_configuration["wrap_gs_mem"] = "0";
m_default_configuration["vsync"] = "0";
}
void GSdxApp::ReloadConfig()
{
if (m_configuration_map.empty())
return;
auto file = m_configuration_map.find("inifile");
if (file == m_configuration_map.end())
return;
// A map was built so reload it
std::string filename = file->second;
m_configuration_map.clear();
BuildConfigurationMap(filename.c_str());
}
void GSdxApp::BuildConfigurationMap(const char* lpFileName)
{
// Check if the map was already built
std::string inifile_value(lpFileName);
if (inifile_value.compare(m_configuration_map["inifile"]) == 0)
return;
m_configuration_map["inifile"] = inifile_value;
// Load config from file
#ifdef _WIN32
std::ifstream file(convert_utf8_to_utf16(lpFileName));
#else
std::ifstream file(lpFileName);
#endif
if (!file.is_open())
return;
std::string line;
while (std::getline(file, line))
{
const auto separator = line.find('=');
if (separator == std::string::npos)
continue;
std::string key = line.substr(0, separator);
// Trim trailing whitespace
key.erase(key.find_last_not_of(" \r\t") + 1);
if (key.empty())
continue;
// Only keep options that have a default value so older, no longer used
// ini options can be purged.
if (m_default_configuration.find(key) == m_default_configuration.end())
continue;
std::string value = line.substr(separator + 1);
// Trim leading whitespace
value.erase(0, value.find_first_not_of(" \r\t"));
m_configuration_map[key] = value;
}
}
void* GSdxApp::GetModuleHandlePtr()
{
return s_hModule;
}
void GSdxApp::SetConfigDir(const char* dir)
{
if (dir == NULL)
{
m_ini = "inis/GSdx.ini";
}
else
{
m_ini = dir;
if (m_ini[m_ini.length() - 1] != DIRECTORY_SEPARATOR)
{
m_ini += DIRECTORY_SEPARATOR;
}
m_ini += "GSdx.ini";
}
}
std::string GSdxApp::GetConfigS(const char* entry)
{
char buff[4096] = {0};
auto def = m_default_configuration.find(entry);
if (def != m_default_configuration.end())
{
GetIniString(m_section.c_str(), entry, def->second.c_str(), buff, countof(buff), m_ini.c_str());
}
else
{
fprintf(stderr, "Option %s doesn't have a default value\n", entry);
GetIniString(m_section.c_str(), entry, "", buff, countof(buff), m_ini.c_str());
}
return {buff};
}
void GSdxApp::SetConfig(const char* entry, const char* value)
{
WriteIniString(m_section.c_str(), entry, value, m_ini.c_str());
}
int GSdxApp::GetConfigI(const char* entry)
{
auto def = m_default_configuration.find(entry);
if (def != m_default_configuration.end())
{
return GetIniInt(m_section.c_str(), entry, std::stoi(def->second), m_ini.c_str());
}
else
{
fprintf(stderr, "Option %s doesn't have a default value\n", entry);
return GetIniInt(m_section.c_str(), entry, 0, m_ini.c_str());
}
}
bool GSdxApp::GetConfigB(const char* entry)
{
return !!GetConfigI(entry);
}
void GSdxApp::SetConfig(const char* entry, int value)
{
char buff[32] = {0};
sprintf(buff, "%d", value);
SetConfig(entry, buff);
}
void GSdxApp::SetCurrentRendererType(GSRendererType type)
{
m_current_renderer_type = type;
}
GSRendererType GSdxApp::GetCurrentRendererType() const
{
return m_current_renderer_type;
}

View File

@ -1,4 +1,4 @@
; GSdx.def : Declares the module parameters for the DLL. ; GS.def : Declares the module parameters for the DLL.
EXPORTS EXPORTS
; Explicit exports can go here ; Explicit exports can go here

View File

@ -24,7 +24,7 @@
#include "Window/GSSetting.h" #include "Window/GSSetting.h"
#include "GS.h" #include "GS.h"
class GSdxApp class GSApp
{ {
std::string m_ini; std::string m_ini;
std::string m_section; std::string m_section;
@ -33,7 +33,7 @@ class GSdxApp
GSRendererType m_current_renderer_type; GSRendererType m_current_renderer_type;
public: public:
GSdxApp(); GSApp();
void Init(); void Init();
void* GetModuleHandlePtr(); void* GetModuleHandlePtr();
@ -93,14 +93,14 @@ public:
std::vector<GSSetting> m_gs_tv_shaders; std::vector<GSSetting> m_gs_tv_shaders;
}; };
struct GSDXError struct GSError
{ {
}; };
struct GSDXRecoverableError : GSDXError struct GSRecoverableError : GSError
{ {
}; };
struct GSDXErrorGlVertexArrayTooSmall : GSDXError struct GSErrorGlVertexArrayTooSmall : GSError
{ {
}; };
extern GSdxApp theApp; extern GSApp theApp;

View File

@ -254,7 +254,7 @@ END
IDD_CONFIG DIALOGEX 0, 0, 242, 360 IDD_CONFIG DIALOGEX 0, 0, 242, 360
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "GSdx Settings" CAPTION "GS Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
// General Settings: // General Settings:
@ -393,10 +393,10 @@ BEGIN
VALUE "CompanyName", "Gabest" VALUE "CompanyName", "Gabest"
VALUE "FileDescription", "GS plugin for ps2 emulators" VALUE "FileDescription", "GS plugin for ps2 emulators"
VALUE "FileVersion", "1, 2, 0, 0" VALUE "FileVersion", "1, 2, 0, 0"
VALUE "InternalName", "GSdx.dll" VALUE "InternalName", "GS.dll"
VALUE "LegalCopyright", "Copyright (c) 2007-2008 Gabest. All rights reserved." VALUE "LegalCopyright", "Copyright (c) 2007-2008 Gabest. All rights reserved."
VALUE "OriginalFilename", "GSdx.dll" VALUE "OriginalFilename", "GS.dll"
VALUE "ProductName", "GSdx" VALUE "ProductName", "GS"
VALUE "ProductVersion", "1, 2, 0, 0" VALUE "ProductVersion", "1, 2, 0, 0"
END END
END END

View File

@ -20,7 +20,7 @@
*/ */
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSdx.h" #include "../GS.h"
#include "GSDevice.h" #include "GSDevice.h"
GSDevice::GSDevice() GSDevice::GSDevice()
@ -279,7 +279,7 @@ void GSDevice::Merge(GSTexture* sTex[3], GSVector4* sRect, GSVector4* dRect, con
} }
else else
{ {
printf("GSdx: m_merge is NULL!\n"); printf("GS: m_merge is NULL!\n");
} }
m_current = m_merge; m_current = m_merge;
@ -525,4 +525,4 @@ std::array<HWBlend, 3*3*3*3 + 1> GSDevice::m_blendMap =
{ 0 , OP_ADD , CONST_ZERO , CONST_ONE} , // 2221: (0 - 0)*F + Cd ==> Cd { 0 , OP_ADD , CONST_ZERO , CONST_ONE} , // 2221: (0 - 0)*F + Cd ==> Cd
{ BLEND_NO_REC , OP_ADD , CONST_ZERO , CONST_ZERO} , // 2222: (0 - 0)*F + 0 ==> 0 { BLEND_NO_REC , OP_ADD , CONST_ZERO , CONST_ZERO} , // 2222: (0 - 0)*F + 0 ==> 0
{ 0 , OP_ADD , SRC_ALPHA , INV_SRC_ALPHA} , // extra for merge operation { 0 , OP_ADD , SRC_ALPHA , INV_SRC_ALPHA} , // extra for merge operation
}}; }};

View File

@ -22,6 +22,8 @@
#pragma once #pragma once
#include "../../GS_types.h"
template <class T> template <class T>
struct Element struct Element
{ {

View File

@ -20,7 +20,7 @@
*/ */
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSdx.h" #include "../GS.h"
#include "GSOsdManager.h" #include "GSOsdManager.h"
#ifdef _WIN32 #ifdef _WIN32
#include "resource.h" #include "resource.h"
@ -366,8 +366,7 @@ size_t GSOsdManager::Size()
} }
float ratio = (elapsed - std::chrono::seconds(m_log_timeout / 2)).count() / std::chrono::seconds(m_log_timeout / 2).count(); float ratio = (elapsed - std::chrono::seconds(m_log_timeout / 2)).count() / std::chrono::seconds(m_log_timeout / 2).count();
ratio = ratio > 1.0f ? 1.0f : ratio < 0.0f ? 0.0f : ratio = ratio > 1.0f ? 1.0f : ratio < 0.0f ? 0.0f : ratio;
ratio;
y += offset += ((m_size + 2) * (2.0f / m_real_size.y)) * ratio; y += offset += ((m_size + 2) * (2.0f / m_real_size.y)) * ratio;
sum += it->msg.size(); sum += it->msg.size();

View File

@ -361,7 +361,7 @@ void GSRenderer::VSync(int field)
if (m_wnd->IsManaged()) if (m_wnd->IsManaged())
#endif #endif
{ {
//GSdx owns the window's title, be verbose. //GS owns the window's title, be verbose.
std::string s2 = m_regs->SMODE2.INT ? (std::string("Interlaced ") + (m_regs->SMODE2.FFMD ? "(frame)" : "(field)")) : "Progressive"; std::string s2 = m_regs->SMODE2.INT ? (std::string("Interlaced ") + (m_regs->SMODE2.FFMD ? "(frame)" : "(field)")) : "Progressive";
@ -590,7 +590,7 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
case VK_F5: case VK_F5:
m_interlace = (m_interlace + s_interlace_nb + step) % s_interlace_nb; m_interlace = (m_interlace + s_interlace_nb + step) % s_interlace_nb;
theApp.SetConfig("interlace", m_interlace); theApp.SetConfig("interlace", m_interlace);
printf("GSdx: Set deinterlace mode to %d (%s).\n", m_interlace, theApp.m_gs_interlace.at(m_interlace).name.c_str()); printf("GS: Set deinterlace mode to %d (%s).\n", m_interlace, theApp.m_gs_interlace.at(m_interlace).name.c_str());
return; return;
case VK_F6: case VK_F6:
if (m_wnd->IsManaged()) if (m_wnd->IsManaged())
@ -599,27 +599,27 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
case VK_DELETE: case VK_DELETE:
m_aa1 = !m_aa1; m_aa1 = !m_aa1;
theApp.SetConfig("aa1", m_aa1); theApp.SetConfig("aa1", m_aa1);
printf("GSdx: (Software) Edge anti-aliasing is now %s.\n", m_aa1 ? "enabled" : "disabled"); printf("GS: (Software) Edge anti-aliasing is now %s.\n", m_aa1 ? "enabled" : "disabled");
return; return;
case VK_INSERT: case VK_INSERT:
m_mipmap = (m_mipmap + s_mipmap_nb + step) % s_mipmap_nb; m_mipmap = (m_mipmap + s_mipmap_nb + step) % s_mipmap_nb;
theApp.SetConfig("mipmap_hw", m_mipmap); theApp.SetConfig("mipmap_hw", m_mipmap);
printf("GSdx: Mipmapping is now %s.\n", theApp.m_gs_hack.at(m_mipmap).name.c_str()); printf("GS: Mipmapping is now %s.\n", theApp.m_gs_hack.at(m_mipmap).name.c_str());
return; return;
case VK_PRIOR: case VK_PRIOR:
m_fxaa = !m_fxaa; m_fxaa = !m_fxaa;
theApp.SetConfig("fxaa", m_fxaa); theApp.SetConfig("fxaa", m_fxaa);
printf("GSdx: FXAA anti-aliasing is now %s.\n", m_fxaa ? "enabled" : "disabled"); printf("GS: FXAA anti-aliasing is now %s.\n", m_fxaa ? "enabled" : "disabled");
return; return;
case VK_HOME: case VK_HOME:
m_shaderfx = !m_shaderfx; m_shaderfx = !m_shaderfx;
theApp.SetConfig("shaderfx", m_shaderfx); theApp.SetConfig("shaderfx", m_shaderfx);
printf("GSdx: External post-processing is now %s.\n", m_shaderfx ? "enabled" : "disabled"); printf("GS: External post-processing is now %s.\n", m_shaderfx ? "enabled" : "disabled");
return; return;
case VK_NEXT: // As requested by Prafull, to be removed later case VK_NEXT: // As requested by Prafull, to be removed later
char dither_msg[3][16] = {"disabled", "auto", "auto unscaled"}; char dither_msg[3][16] = {"disabled", "auto", "auto unscaled"};
m_dithering = (m_dithering + 1) % 3; m_dithering = (m_dithering + 1) % 3;
printf("GSdx: Dithering is now %s.\n", dither_msg[m_dithering]); printf("GS: Dithering is now %s.\n", dither_msg[m_dithering]);
return; return;
} }
} }

View File

@ -58,7 +58,7 @@ public:
virtual operator bool() virtual operator bool()
{ {
ASSERT(0); pxAssert(0);
return false; return false;
} }

View File

@ -20,7 +20,7 @@
*/ */
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSdx.h" #include "GS.h"
#include "GSDevice11.h" #include "GSDevice11.h"
#include "GSUtil.h" #include "GSUtil.h"
#include "resource.h" #include "resource.h"
@ -922,7 +922,7 @@ void GSDevice11::InitExternalFX()
if (fconfig.good()) if (fconfig.good())
shader << fconfig.rdbuf() << "\n"; shader << fconfig.rdbuf() << "\n";
else else
fprintf(stderr, "GSdx: External shader config '%s' not loaded.\n", config_name.c_str()); fprintf(stderr, "GS: External shader config '%s' not loaded.\n", config_name.c_str());
std::string shader_name(theApp.GetConfigS("shaderfx_glsl")); std::string shader_name(theApp.GetConfigS("shaderfx_glsl"));
std::ifstream fshader(shader_name); std::ifstream fshader(shader_name);
@ -936,12 +936,12 @@ void GSDevice11::InitExternalFX()
} }
else else
{ {
fprintf(stderr, "GSdx: External shader '%s' not loaded and will be disabled!\n", shader_name.c_str()); fprintf(stderr, "GS: External shader '%s' not loaded and will be disabled!\n", shader_name.c_str());
} }
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
printf("GSdx: failed to compile external post-processing shader. \n"); printf("GS: failed to compile external post-processing shader. \n");
} }
ExShader_Compiled = true; ExShader_Compiled = true;
} }
@ -980,9 +980,9 @@ void GSDevice11::InitFXAA()
ShaderMacro sm(m_shader.model); ShaderMacro sm(m_shader.model);
CreateShader(shader, "fxaa.fx", nullptr, "ps_main", sm.GetPtr(), &m_fxaa.ps); CreateShader(shader, "fxaa.fx", nullptr, "ps_main", sm.GetPtr(), &m_fxaa.ps);
} }
catch (GSDXRecoverableError) catch (GSRecoverableError)
{ {
printf("GSdx: failed to compile fxaa shader.\n"); printf("GS: failed to compile fxaa shader.\n");
} }
FXAA_Compiled = true; FXAA_Compiled = true;
} }
@ -1372,7 +1372,7 @@ void GSDevice11::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector
ID3D11DepthStencilView* dsv = NULL; ID3D11DepthStencilView* dsv = NULL;
if (!rt && !ds) if (!rt && !ds)
throw GSDXRecoverableError(); throw GSRecoverableError();
if (rt) rtv = *(GSTexture11*)rt; if (rt) rtv = *(GSTexture11*)rt;
if (ds) dsv = *(GSTexture11*)ds; if (ds) dsv = *(GSTexture11*)ds;
@ -1448,14 +1448,14 @@ void GSDevice11::CreateShader(const std::vector<char>& source, const char* fn, I
if (FAILED(hr)) if (FAILED(hr))
{ {
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
hr = m_dev->CreateInputLayout(layout, count, shader->GetBufferPointer(), shader->GetBufferSize(), il); hr = m_dev->CreateInputLayout(layout, count, shader->GetBufferPointer(), shader->GetBufferSize(), il);
if (FAILED(hr)) if (FAILED(hr))
{ {
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
} }
@ -1471,7 +1471,7 @@ void GSDevice11::CreateShader(const std::vector<char>& source, const char* fn, I
if (FAILED(hr)) if (FAILED(hr))
{ {
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
} }
@ -1487,7 +1487,7 @@ void GSDevice11::CreateShader(const std::vector<char>& source, const char* fn, I
if (FAILED(hr)) if (FAILED(hr))
{ {
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
} }
@ -1510,7 +1510,7 @@ void GSDevice11::CompileShader(const std::vector<char>& source, const char* fn,
fprintf(stderr, "%s\n", (const char*)error->GetBufferPointer()); fprintf(stderr, "%s\n", (const char*)error->GetBufferPointer());
if (FAILED(hr)) if (FAILED(hr))
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
uint16 GSDevice11::ConvertBlendEnum(uint16 generic) uint16 GSDevice11::ConvertBlendEnum(uint16 generic)

View File

@ -1015,7 +1015,7 @@ void GSRendererDX11::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sou
{ {
// Note potentially we can limit to TBP0:0x2800 // Note potentially we can limit to TBP0:0x2800
// Depth buffer was moved so GSdx will invalide it which means a // Depth buffer was moved so GS will invalide it which means a
// downscale. ICO uses the MSB depth bits as the texture alpha // downscale. ICO uses the MSB depth bits as the texture alpha
// channel. However this depth of field effect requires // channel. However this depth of field effect requires
// texel:pixel mapping accuracy. // texel:pixel mapping accuracy.

View File

@ -21,7 +21,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSState.h" #include "GSState.h"
#include "GSdx.h" #include "GS.h"
bool s_nativeres; bool s_nativeres;
static CRCHackLevel s_crc_hack_level = CRCHackLevel::Full; static CRCHackLevel s_crc_hack_level = CRCHackLevel::Full;
@ -75,7 +75,7 @@ bool GSC_DBZBT3(const GSFrameInfo& fi, int& skip)
bool GSC_DeathByDegreesTekkenNinaWilliams(const GSFrameInfo& fi, int& skip) bool GSC_DeathByDegreesTekkenNinaWilliams(const GSFrameInfo& fi, int& skip)
{ {
// Note: Game also has issues with texture shuffle not supported on strange clamp mode. // Note: Game also has issues with texture shuffle not supported on strange clamp mode.
// See https://forums.pcsx2.net/Thread-GSDX-Texture-Cache-Bug-Report-Death-By-Degrees-SLUS-20934-NTSC // See https://forums.pcsx2.net/Thread-GS-Texture-Cache-Bug-Report-Death-By-Degrees-SLUS-20934-NTSC
if (skip == 0) if (skip == 0)
{ {
if ((Aggressive || !s_nativeres) && fi.TME && fi.FBP == 0 && fi.TBP0 == 0x34a0 && fi.TPSM == PSM_PSMCT32) if ((Aggressive || !s_nativeres) && fi.TME && fi.FBP == 0 && fi.TBP0 == 0x34a0 && fi.TPSM == PSM_PSMCT32)

View File

@ -115,7 +115,7 @@ GSTextureCache::Source* GSTextureCache::LookupDepthSource(const GIFRegTEX0& TEX0
} }
else else
{ {
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
} }
@ -212,7 +212,7 @@ GSTextureCache::Source* GSTextureCache::LookupDepthSource(const GIFRegTEX0& TEX0
// The game tries to emulate a texture shuffle with an old depth buffer // The game tries to emulate a texture shuffle with an old depth buffer
// (don't exists yet for us due to the cache) // (don't exists yet for us due to the cache)
// Rendering is nicer (less garbage) if we skip the draw call. // Rendering is nicer (less garbage) if we skip the draw call.
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
//ASSERT(0); //ASSERT(0);
@ -1509,7 +1509,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
GSTexture* dTex = m_renderer->m_dev->CreateRenderTarget(w, h); GSTexture* dTex = m_renderer->m_dev->CreateRenderTarget(w, h);
src->m_texture = dTex; src->m_texture = dTex;
// GH: by default (m_paltex == 0) GSdx converts texture to the 32 bit format // GH: by default (m_paltex == 0) GS converts texture to the 32 bit format
// However it is different here. We want to reuse a Render Target as a texture. // However it is different here. We want to reuse a Render Target as a texture.
// Because the texture is already on the GPU, CPU can't convert it. // Because the texture is already on the GPU, CPU can't convert it.
if (psm.pal > 0) if (psm.pal > 0)
@ -1576,7 +1576,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
else else
ASSERT(0); ASSERT(0);
// Offset hack. Can be enabled via GSdx options. // Offset hack. Can be enabled via GS options.
// The offset will be used in Draw(). // The offset will be used in Draw().
float modx = 0.0f; float modx = 0.0f;

View File

@ -20,7 +20,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GLLoader.h" #include "GLLoader.h"
#include "GSdx.h" #include "GS.h"
#include "GS.h" #include "GS.h"
#if defined(__unix__) || defined(__APPLE__) #if defined(__unix__) || defined(__APPLE__)
@ -190,7 +190,7 @@ namespace GLLoader
if (!GLExtension::Has(ext)) if (!GLExtension::Has(ext))
{ {
fprintf(stderr, "ERROR: %s is NOT SUPPORTED\n", ext.c_str()); fprintf(stderr, "ERROR: %s is NOT SUPPORTED\n", ext.c_str());
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
return; return;
@ -228,7 +228,7 @@ namespace GLLoader
if (s == NULL) if (s == NULL)
{ {
fprintf(stderr, "Error: GLLoader failed to get GL version\n"); fprintf(stderr, "Error: GLLoader failed to get GL version\n");
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
GLuint v = 1; GLuint v = 1;
while (s[v] != '\0' && s[v - 1] != ' ') while (s[v] != '\0' && s[v - 1] != ' ')
@ -279,7 +279,7 @@ namespace GLLoader
if ((major_gl < major) || (major_gl == major && minor_gl < minor)) if ((major_gl < major) || (major_gl == major && minor_gl < minor))
{ {
fprintf(stderr, "OpenGL %d.%d is not supported. Only OpenGL %d.%d\n was found", major, minor, major_gl, minor_gl); fprintf(stderr, "OpenGL %d.%d is not supported. Only OpenGL %d.%d\n was found", major, minor, major_gl, minor_gl);
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
} }

View File

@ -31,7 +31,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include "resource.h" #include "resource.h"
#else #else
#include "GSdxResources.h" #include "GSResources.h"
#endif #endif
// TODO port those value into PerfMon API // TODO port those value into PerfMon API
@ -84,9 +84,9 @@ GSDeviceOGL::GSDeviceOGL()
// Reset the debug file // Reset the debug file
#ifdef ENABLE_OGL_DEBUG #ifdef ENABLE_OGL_DEBUG
if (theApp.GetCurrentRendererType() == GSRendererType::OGL_SW) if (theApp.GetCurrentRendererType() == GSRendererType::OGL_SW)
m_debug_gl_file = fopen("GSdx_opengl_debug_sw.txt", "w"); m_debug_gl_file = fopen("GS_opengl_debug_sw.txt", "w");
else else
m_debug_gl_file = fopen("GSdx_opengl_debug_hw.txt", "w"); m_debug_gl_file = fopen("GS_opengl_debug_hw.txt", "w");
#endif #endif
m_debug_gl_call = theApp.GetConfigB("debug_opengl"); m_debug_gl_call = theApp.GetConfigB("debug_opengl");
@ -229,7 +229,7 @@ void GSDeviceOGL::GenerateProfilerData()
fprintf(stderr, "%3u ms => %3u ms\t%4u\n", 2 * i, 2 * (i + 1), time_repartition[i]); fprintf(stderr, "%3u ms => %3u ms\t%4u\n", 2 * i, 2 * (i + 1), time_repartition[i]);
} }
FILE* csv = fopen("GSdx_profile.csv", "w"); FILE* csv = fopen("GS_profile.csv", "w");
if (csv) if (csv)
{ {
for (size_t i = 0; i < times.size(); i++) for (size_t i = 0; i < times.size(); i++)
@ -1040,7 +1040,7 @@ GLuint GSDeviceOGL::CompilePS(PSSelector sel)
void GSDeviceOGL::SelfShaderTestRun(const std::string& dir, const std::string& file, const PSSelector& sel, int& nb_shader) void GSDeviceOGL::SelfShaderTestRun(const std::string& dir, const std::string& file, const PSSelector& sel, int& nb_shader)
{ {
#ifdef __unix__ #ifdef __unix__
std::string out = "/tmp/GSdx_Shader/"; std::string out = "/tmp/GS_Shader/";
GSmkdir(out.c_str()); GSmkdir(out.c_str());
out += dir + "/"; out += dir + "/";
@ -1412,7 +1412,7 @@ void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture
// Flip y axis only when we render in the backbuffer // Flip y axis only when we render in the backbuffer
// By default everything is render in the wrong order (ie dx). // By default everything is render in the wrong order (ie dx).
// 1/ consistency between several pass rendering (interlace) // 1/ consistency between several pass rendering (interlace)
// 2/ in case some GSdx code expect thing in dx order. // 2/ in case some GS code expect thing in dx order.
// Only flipping the backbuffer is transparent (I hope)... // Only flipping the backbuffer is transparent (I hope)...
GSVector4 flip_sr = sRect; GSVector4 flip_sr = sRect;
if (static_cast<GSTextureOGL*>(dTex)->IsBackbuffer()) if (static_cast<GSTextureOGL*>(dTex)->IsBackbuffer())

View File

@ -1038,7 +1038,7 @@ void GSRendererOGL::SendDraw()
else else
{ {
// FIXME: Investigate: a dynamic check to pack as many primitives as possibles // FIXME: Investigate: a dynamic check to pack as many primitives as possibles
// I'm nearly sure GSdx already have this kind of code (maybe we can adapt GSDirtyRect) // I'm nearly sure GS already have this kind of code (maybe we can adapt GSDirtyRect)
const size_t nb_vertex = GSUtil::GetClassVertexCount(m_vt.m_primclass); const size_t nb_vertex = GSUtil::GetClassVertexCount(m_vt.m_primclass);
GL_PUSH("Split the draw"); GL_PUSH("Split the draw");
@ -1392,7 +1392,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
{ {
// Note potentially we can limit to TBP0:0x2800 // Note potentially we can limit to TBP0:0x2800
// Depth buffer was moved so GSdx will invalide it which means a // Depth buffer was moved so GS will invalide it which means a
// downscale. ICO uses the MSB depth bits as the texture alpha // downscale. ICO uses the MSB depth bits as the texture alpha
// channel. However this depth of field effect requires // channel. However this depth of field effect requires
// texel:pixel mapping accuracy. // texel:pixel mapping accuracy.

View File

@ -26,7 +26,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include "resource.h" #include "resource.h"
#else #else
#include "GSdxResources.h" #include "GSResources.h"
#endif #endif
GSShaderOGL::GSShaderOGL(bool debug) GSShaderOGL::GSShaderOGL(bool debug)

View File

@ -471,7 +471,7 @@ bool GSTextureOGL::Map(GSMap& m, const GSVector4i* _r, int layer)
if (m_type == GSTexture::Offscreen) if (m_type == GSTexture::Offscreen)
{ {
// The fastest way will be to use a PBO to read the data asynchronously. Unfortunately GSdx // The fastest way will be to use a PBO to read the data asynchronously. Unfortunately GS
// architecture is waiting the data right now. // architecture is waiting the data right now.
#if 0 #if 0

View File

@ -86,7 +86,7 @@ public:
if (!m_buffer_ptr) if (!m_buffer_ptr)
{ {
fprintf(stderr, "Failed to map buffer\n"); fprintf(stderr, "Failed to map buffer\n");
throw GSDXError(); throw GSError();
} }
} }
@ -109,7 +109,7 @@ public:
m_count = count; m_count = count;
if (m_count >= m_limit) if (m_count >= m_limit)
throw GSDXErrorGlVertexArrayTooSmall(); throw GSErrorGlVertexArrayTooSmall();
size_t offset = m_start * STRIDE; size_t offset = m_start * STRIDE;
size_t length = m_count * STRIDE; size_t length = m_count * STRIDE;
@ -315,7 +315,7 @@ public:
ptr = m_vb->map(count); ptr = m_vb->map(count);
break; break;
} }
catch (GSDXErrorGlVertexArrayTooSmall) catch (GSErrorGlVertexArrayTooSmall)
{ {
GL_INS("GL vertex buffer is too small"); GL_INS("GL vertex buffer is too small");
@ -337,7 +337,7 @@ public:
m_vb->upload(vertices, count); m_vb->upload(vertices, count);
break; break;
} }
catch (GSDXErrorGlVertexArrayTooSmall) catch (GSErrorGlVertexArrayTooSmall)
{ {
GL_INS("GL vertex buffer is too small"); GL_INS("GL vertex buffer is too small");
@ -357,7 +357,7 @@ public:
m_ib->upload(index, count); m_ib->upload(index, count);
break; break;
} }
catch (GSDXErrorGlVertexArrayTooSmall) catch (GSErrorGlVertexArrayTooSmall)
{ {
GL_INS("GL index buffer is too small"); GL_INS("GL index buffer is too small");

View File

@ -1551,7 +1551,7 @@ void GSRendererSW::SharedData::UpdateSource()
} }
else else
{ {
printf("GSdx: out-of-memory, texturing temporarily disabled\n"); printf("GS: out-of-memory, texturing temporarily disabled\n");
global.sel.tfx = TFX_NONE; global.sel.tfx = TFX_NONE;
} }

View File

@ -21,7 +21,7 @@
#pragma once #pragma once
#include "Renderers/Common/GSTexture.h" #include "../Common/GSTexture.h"
class GSTextureSW final : public GSTexture class GSTextureSW final : public GSTexture
{ {

View File

@ -20,7 +20,7 @@
*/ */
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSdx.h" #include "GS.h"
#include "GSCaptureDlg.h" #include "GSCaptureDlg.h"
#define BeginEnumSysDev(clsid, pMoniker) \ #define BeginEnumSysDev(clsid, pMoniker) \
@ -37,8 +37,8 @@
void GSCaptureDlg::InvalidFile() void GSCaptureDlg::InvalidFile()
{ {
const std::wstring message = L"GSdx couldn't open file for capturing: " + m_filename + L".\nCapture aborted."; const std::wstring message = L"GS couldn't open file for capturing: " + m_filename + L".\nCapture aborted.";
MessageBox(GetActiveWindow(), message.c_str(), L"GSdx System Message", MB_OK | MB_SETFOREGROUND); MessageBox(GetActiveWindow(), message.c_str(), L"GS System Message", MB_OK | MB_SETFOREGROUND);
} }
GSCaptureDlg::GSCaptureDlg() GSCaptureDlg::GSCaptureDlg()

View File

@ -22,7 +22,7 @@
#include "StdAfx.h" #include "StdAfx.h"
#include <Shlwapi.h> #include <Shlwapi.h>
#include <CommCtrl.h> #include <CommCtrl.h>
#include "GSdx.h" #include "GS.h"
#include "GSDialog.h" #include "GSDialog.h"
#include "GSVector.h" #include "GSVector.h"

View File

@ -22,8 +22,8 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "GS.h" #include "GS.h"
#include "GSdx.h" #include "GS.h"
#include "GSdxResources.h" #include "GSResources.h"
#include "GSSetting.h" #include "GSSetting.h"
// Port of deprecated GTK2 API to recent GTK3. Those defines // Port of deprecated GTK2 API to recent GTK3. Those defines
@ -650,7 +650,7 @@ bool RunLinuxDialog()
/* Create the widgets */ /* Create the widgets */
dialog = gtk_dialog_new_with_buttons( dialog = gtk_dialog_new_with_buttons(
"GSdx Config", "GS Config",
NULL, /* parent window*/ NULL, /* parent window*/
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
"OK", GTK_RESPONSE_ACCEPT, "OK", GTK_RESPONSE_ACCEPT,
@ -668,8 +668,8 @@ bool RunLinuxDialog()
// Grab a logo, to make things look nice. // Grab a logo, to make things look nice.
if (BigEnough()) if (BigEnough())
{ {
GResource* resources = GSdx_res_get_resource(); GResource* resources = GS_res_get_resource();
GInputStream* ogl_stream = g_resource_open_stream(resources, "/GSdx/res/logo-ogl.bmp", G_RESOURCE_LOOKUP_FLAGS_NONE, NULL); GInputStream* ogl_stream = g_resource_open_stream(resources, "/GS/res/logo-ogl.bmp", G_RESOURCE_LOOKUP_FLAGS_NONE, NULL);
GdkPixbuf* ogl_logo = gdk_pixbuf_new_from_stream(ogl_stream, NULL, NULL); GdkPixbuf* ogl_logo = gdk_pixbuf_new_from_stream(ogl_stream, NULL, NULL);
g_object_unref(ogl_stream); g_object_unref(ogl_stream);
GtkWidget* logo_image = gtk_image_new_from_pixbuf(ogl_logo); GtkWidget* logo_image = gtk_image_new_from_pixbuf(ogl_logo);
@ -685,7 +685,7 @@ bool RunLinuxDialog()
GtkWidget* gl_table = CreateTableInBox(advanced_box, "OpenGL Very Advanced Custom Settings", 6, 2); GtkWidget* gl_table = CreateTableInBox(advanced_box, "OpenGL Very Advanced Custom Settings", 6, 2);
GtkWidget* record_table = CreateTableInBox(debug_box, "Recording Settings", 4, 3); GtkWidget* record_table = CreateTableInBox(debug_box, "Recording Settings", 4, 3);
GtkWidget* debug_table = CreateTableInBox(debug_box, "OpenGL / GSdx Debug Settings", 6, 3); GtkWidget* debug_table = CreateTableInBox(debug_box, "OpenGL / GS Debug Settings", 6, 3);
GtkWidget* shader_table = CreateTableInBox(shader_box, "Custom Shader Settings", 9, 2); GtkWidget* shader_table = CreateTableInBox(shader_box, "Custom Shader Settings", 9, 2);
GtkWidget* osd_table = CreateTableInBox(osd_box, "OSD", 6, 2); GtkWidget* osd_table = CreateTableInBox(osd_box, "OSD", 6, 2);

View File

@ -20,7 +20,7 @@
*/ */
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "GSdx.h" #include "GS.h"
#include "GSSettingsDlg.h" #include "GSSettingsDlg.h"
#include "GSUtil.h" #include "GSUtil.h"
#include "Renderers/DX11/GSDevice11.h" #include "Renderers/DX11/GSDevice11.h"

View File

@ -82,7 +82,7 @@ LRESULT GSWndDX::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
bool GSWndDX::Create(const std::string& title, int w, int h) bool GSWndDX::Create(const std::string& title, int w, int h)
{ {
if (m_hWnd) if (m_hWnd)
throw GSDXRecoverableError(); throw GSRecoverableError();
m_managed = true; m_managed = true;
@ -102,7 +102,7 @@ bool GSWndDX::Create(const std::string& title, int w, int h)
{ {
if (!RegisterClass(&wc)) if (!RegisterClass(&wc))
{ {
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
} }
@ -136,7 +136,7 @@ bool GSWndDX::Create(const std::string& title, int w, int h)
m_hWnd = CreateWindow(wc.lpszClassName, tmp.c_str(), style, r.left, r.top, r.width(), r.height(), NULL, NULL, wc.hInstance, (LPVOID)this); m_hWnd = CreateWindow(wc.lpszClassName, tmp.c_str(), style, r.left, r.top, r.width(), r.height(), NULL, NULL, wc.hInstance, (LPVOID)this);
if (!m_hWnd) if (!m_hWnd)
throw GSDXRecoverableError(); throw GSRecoverableError();
return true; return true;
} }
@ -155,7 +155,7 @@ void GSWndDX::Detach()
{ {
if (m_hWnd && m_managed) if (m_hWnd && m_managed)
{ {
// close the window, since it's under GSdx care. It's not taking messages anyway, and // close the window, since it's under GS care. It's not taking messages anyway, and
// that means its big, ugly, and in the way. // that means its big, ugly, and in the way.
DestroyWindow(m_hWnd); DestroyWindow(m_hWnd);

View File

@ -103,14 +103,14 @@ void GSWndEGL::CreateContext(int major, int minor)
if (numConfigs == 0) if (numConfigs == 0)
{ {
fprintf(stderr, "EGL: Failed to get a frame buffer config! (0x%x)\n", eglGetError()); fprintf(stderr, "EGL: Failed to get a frame buffer config! (0x%x)\n", eglGetError());
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
m_eglSurface = eglCreatePlatformWindowSurface(m_eglDisplay, eglConfig, m_native_window, nullptr); m_eglSurface = eglCreatePlatformWindowSurface(m_eglDisplay, eglConfig, m_native_window, nullptr);
if (m_eglSurface == EGL_NO_SURFACE) if (m_eglSurface == EGL_NO_SURFACE)
{ {
fprintf(stderr, "EGL: Failed to get a window surface\n"); fprintf(stderr, "EGL: Failed to get a window surface\n");
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
m_eglContext = eglCreateContext(m_eglDisplay, eglConfig, EGL_NO_CONTEXT, contextAttribs); m_eglContext = eglCreateContext(m_eglDisplay, eglConfig, EGL_NO_CONTEXT, contextAttribs);
@ -127,12 +127,12 @@ void GSWndEGL::CreateContext(int major, int minor)
{ {
fprintf(stderr, "EGL: Failed to create the context\n"); fprintf(stderr, "EGL: Failed to create the context\n");
fprintf(stderr, "EGL STATUS: %x\n", status); fprintf(stderr, "EGL STATUS: %x\n", status);
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
if (!eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext)) if (!eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext))
{ {
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
} }
@ -171,7 +171,7 @@ void GSWndEGL::BindAPI()
if (api != EGL_OPENGL_API) if (api != EGL_OPENGL_API)
{ {
fprintf(stderr, "EGL: Failed to bind the OpenGL API got 0x%x instead\n", api); fprintf(stderr, "EGL: Failed to bind the OpenGL API got 0x%x instead\n", api);
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
} }
@ -232,7 +232,7 @@ void* GSWndEGL::GetProcAddress(const char* name, bool opt)
fprintf(stderr, "Failed to find %s\n", name); fprintf(stderr, "Failed to find %s\n", name);
if (!opt) if (!opt)
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
return ptr; return ptr;
} }
@ -280,13 +280,13 @@ void GSWndEGL::OpenEGLDisplay()
if (m_eglDisplay == EGL_NO_DISPLAY) if (m_eglDisplay == EGL_NO_DISPLAY)
{ {
fprintf(stderr, "EGL: Failed to open a display! (0x%x)\n", eglGetError()); fprintf(stderr, "EGL: Failed to open a display! (0x%x)\n", eglGetError());
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
if (!eglInitialize(m_eglDisplay, nullptr, nullptr)) if (!eglInitialize(m_eglDisplay, nullptr, nullptr))
{ {
fprintf(stderr, "EGL: Failed to initialize the display! (0x%x)\n", eglGetError()); fprintf(stderr, "EGL: Failed to initialize the display! (0x%x)\n", eglGetError());
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
} }
@ -320,7 +320,7 @@ void* GSWndEGL_X11::CreateNativeWindow(int w, int h)
if (m_NativeDisplay == nullptr) if (m_NativeDisplay == nullptr)
{ {
fprintf(stderr, "EGL X11: display wasn't created before the window\n"); fprintf(stderr, "EGL X11: display wasn't created before the window\n");
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
xcb_connection_t* c = XGetXCBConnection(m_NativeDisplay); xcb_connection_t* c = XGetXCBConnection(m_NativeDisplay);
@ -334,7 +334,7 @@ void* GSWndEGL_X11::CreateNativeWindow(int w, int h)
if (m_NativeWindow == 0) if (m_NativeWindow == 0)
{ {
fprintf(stderr, "EGL X11: failed to create the native window\n"); fprintf(stderr, "EGL X11: failed to create the native window\n");
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
xcb_create_window(c, depth, m_NativeWindow, screen->root, x, y, w, h, xcb_create_window(c, depth, m_NativeWindow, screen->root, x, y, w, h,

View File

@ -33,7 +33,7 @@ static void win_error(const wchar_t* msg, bool fatal = true)
if (fatal) if (fatal)
{ {
MessageBox(NULL, msg, L"ERROR", MB_OK | MB_ICONEXCLAMATION); MessageBox(NULL, msg, L"ERROR", MB_OK | MB_ICONEXCLAMATION);
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
else else
{ {
@ -343,7 +343,7 @@ void* GSWndWGL::GetProcAddress(const char* name, bool opt)
fprintf(stderr, "Failed to find %s\n", name); fprintf(stderr, "Failed to find %s\n", name);
if (!opt) if (!opt)
throw GSDXRecoverableError(); throw GSRecoverableError();
} }
return ptr; return ptr;
} }

View File

@ -28,7 +28,7 @@ static void* handle;
void help() void help()
{ {
fprintf(stderr, "Loader gs file\n"); fprintf(stderr, "Loader gs file\n");
fprintf(stderr, "ARG1 GSdx plugin\n"); fprintf(stderr, "ARG1 GS plugin\n");
fprintf(stderr, "ARG2 .gs file\n"); fprintf(stderr, "ARG2 .gs file\n");
fprintf(stderr, "ARG3 Ini directory\n"); fprintf(stderr, "ARG3 Ini directory\n");
if (handle) if (handle)

View File

@ -4,7 +4,7 @@
#define FXAA_GLSL_130 0 #define FXAA_GLSL_130 0
#endif #endif
#define UHQ_FXAA 1 //High Quality Fast Approximate Anti Aliasing. Adapted for GSdx from Timothy Lottes FXAA 3.11. #define UHQ_FXAA 1 //High Quality Fast Approximate Anti Aliasing. Adapted for GS from Timothy Lottes FXAA 3.11.
#define FxaaSubpixMax 0.0 //[0.00 to 1.00] Amount of subpixel aliasing removal. 0.00: Edge only antialiasing (no blurring) #define FxaaSubpixMax 0.0 //[0.00 to 1.00] Amount of subpixel aliasing removal. 0.00: Edge only antialiasing (no blurring)
#define FxaaEarlyExit 1 //[0 or 1] Use Fxaa early exit pathing. When disabled, the entire scene is antialiased(FSAA). 0 is off, 1 is on. #define FxaaEarlyExit 1 //[0 or 1] Use Fxaa early exit pathing. When disabled, the entire scene is antialiased(FSAA). 0 is off, 1 is on.

View File

@ -187,7 +187,7 @@ vec4 sample_4_index(vec4 uv)
{ {
vec4 c; vec4 c;
// Either GSdx will send a texture that contains a single channel // Either GS will send a texture that contains a single channel
// in this case the red channel is remapped as alpha channel // in this case the red channel is remapped as alpha channel
// //
// Or we have an old RT (ie RGBA8) that contains index (4/8) in the alpha channel // Or we have an old RT (ie RGBA8) that contains index (4/8) in the alpha channel

View File

@ -2,7 +2,7 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file. // Microsoft Visual C++ generated include file.
// Used by GSdx.rc // Used by GS.rc
// //
// General Dialog: // General Dialog:
#define IDD_CONFIG 2001 #define IDD_CONFIG 2001