fix crash when screen scaling is custom. fix rpi3 build

DiscSwap and InitDrive are now the same
This commit is contained in:
Flyinghead 2020-01-31 18:33:16 +01:00
parent 2510964047
commit 80a0f467d7
5 changed files with 32 additions and 79 deletions

View File

@ -176,35 +176,3 @@ Disc* cdi_parse(const wchar* file)
return rv;
}
#if 0
SPfcToc* pstToc;
HMODULE pfctoc_mod=NULL;
pfctoc_mod=LoadLibrary("plugins\\pfctoc.dll");
if (pfctoc_mod==NULL)
pfctoc_mod=LoadLibrary("pfctoc.dll");
if(pfctoc_mod==NULL)
return false;
PfcFreeTocFP* PfcFreeToc;
PfcGetTocFP* PfcGetToc;
PfcFreeToc=(PfcFreeTocFP*)GetProcAddress(pfctoc_mod,"PfcFreeToc");
PfcGetToc=(PfcGetTocFP*)GetProcAddress(pfctoc_mod,"PfcGetToc");
verify(PfcFreeToc!=NULL && PfcGetToc!=NULL);
DWORD dwSize;//
DWORD dwErr = PfcGetToc(file, pstToc, dwSize);
if (dwErr == PFCTOC_OK)
{
rv= new CDIDisc(pstToc,file);
}
if (pstToc)
PfcFreeToc(pstToc);
if (pfctoc_mod)
FreeLibrary(pfctoc_mod);
pstToc=0;
pfctoc_mod=0;
return rv;
#endif

View File

@ -153,28 +153,9 @@ bool InitDrive_(wchar* fn)
return disc != NULL;
}
bool InitDrive(u32 fileflags)
bool InitDrive()
{
if (settings.imgread.ImagePath[0] == '\0')
{
NullDriveDiscType=NoDisk;
gd_setdisc();
sns_asc=0x29;
sns_ascq=0x00;
sns_key=0x6;
return true;
}
if (!InitDrive_(settings.imgread.ImagePath))
{
//msgboxf("Selected image failed to load",MBX_ICONERROR);
NullDriveDiscType = NoDisk;
gd_setdisc();
sns_asc = 0x29;
sns_ascq = 0x00;
sns_key = 0x6;
}
return true;
return DiscSwap();
}
void DiscOpenLid()
@ -187,7 +168,7 @@ void DiscOpenLid()
sns_key = 0x6;
}
bool DiscSwap(u32 fileflags)
bool DiscSwap()
{
// These Additional Sense Codes mean "The lid was closed"
sns_asc = 0x28;
@ -196,19 +177,18 @@ bool DiscSwap(u32 fileflags)
if (settings.imgread.ImagePath[0] == '\0')
{
NullDriveDiscType = Open;
NullDriveDiscType = NoDisk;
gd_setdisc();
return true;
}
if (!InitDrive_(settings.imgread.ImagePath))
{
//msgboxf("Selected image failed to load",MBX_ICONERROR);
NullDriveDiscType = Open;
gd_setdisc();
}
if (InitDrive_(settings.imgread.ImagePath))
return true;
return true;
NullDriveDiscType = NoDisk;
gd_setdisc();
return false;
}
void TermDrive()

View File

@ -83,9 +83,9 @@ enum SubcodeFormat
bool ConvertSector(u8* in_buff , u8* out_buff , int from , int to,int sector);
bool InitDrive(u32 fileflags=0);
bool InitDrive();
void TermDrive();
bool DiscSwap(u32 fileflags=0);
bool DiscSwap();
void DiscOpenLid();
extern signed int sns_asc;
extern signed int sns_ascq;

View File

@ -152,6 +152,9 @@ static void GDCC_HLE_GETSCD() {
{
gd_hle_state.status = BIOS_ERROR;
gd_hle_state.result[0] = 2; // ?
gd_hle_state.result[1] = 0;
gd_hle_state.result[2] = 0;
gd_hle_state.result[3] = 0;
return;
}
if (sns_asc != 0)
@ -160,8 +163,8 @@ static void GDCC_HLE_GETSCD() {
gd_hle_state.status = BIOS_ERROR;
gd_hle_state.result[0] = sns_key;
gd_hle_state.result[1] = sns_asc;
gd_hle_state.result[1] = 0x18; // ?
gd_hle_state.result[1] = sns_ascq; // ?
gd_hle_state.result[2] = 0x18; // ?
gd_hle_state.result[3] = sns_ascq; // ?
sns_key = 0;
sns_asc = 0;
sns_ascq = 0;

View File

@ -958,11 +958,13 @@ static void gui_display_settings()
{
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, normal_padding);
#if HOST_OS != OS_DARWIN
bool has_per_pixel;
bool has_per_pixel = false;
if (!vulkan)
has_per_pixel = !theGLContext.IsGLES() && theGLContext.GetMajorVersion() >= 4;
#ifdef USE_VULKAN
else
has_per_pixel = VulkanContext::Instance()->SupportsFragmentShaderStoresAndAtomics();
#endif
#else
bool has_per_pixel = false;
#endif
@ -1043,12 +1045,16 @@ static void gui_display_settings()
ShowHelpMarker("Useful to avoid flashing screen or glitchy videos. Not recommended on slow platforms");
ImGui::Checkbox("Use Vulkan Renderer", &vulkan);
ImGui::SameLine();
ShowHelpMarker("Use Vulkan instead of Open GL/GLES. Experimental");
ShowHelpMarker("Use Vulkan instead of Open GL/GLES");
const map<int, const char*> scalings { { 10, "0.1"}, { 20, "0.2" }, { 30, "0.3" }, { 40, "0.4" }, { 50, "0.5" }, { 60, "0.6" }, { 70, "0.7" }, { 80, "0.8" }, { 90, "0.9" }, { 100, "1.0 (Native)" }, { 200, "2.0 (2x SSAA)" }, { 300, "3.0 (3x SSAA)" }, { 400, "4.0 (4x SSAA)" }, { 600, "6.0 (6x SSAA)" }, { 800, "8.0 (8x SSAA)" }
const map<int, const char*> scalings {
{ 10, "0.1"}, { 20, "0.2" }, { 30, "0.3" }, { 40, "0.4" },
{ 50, "0.5" }, { 60, "0.6" }, { 70, "0.7" }, { 80, "0.8" }, { 90, "0.9" },
{ 100, "1.0 (Host native)" }, { 200, "2.0 (2x SSAA)" }, { 300, "3.0 (3x SSAA)" },
{ 400, "4.0 (4x SSAA)" }, { 600, "6.0 (6x SSAA)" }, { 800, "8.0 (8x SSAA)" }
};
if ( scalings.count(settings.rend.ScreenScaling == 0) )
if (scalings.count(settings.rend.ScreenScaling) == 0)
settings.rend.ScreenScaling = 100;
auto scalings_it = scalings.find(settings.rend.ScreenScaling);
@ -1057,12 +1063,11 @@ static void gui_display_settings()
ImGui::PushItemWidth(ImGui::CalcItemWidth() - scaling_spacing * 2.0f - ImGui::GetFrameHeight() * 2.0f);
if (ImGui::BeginCombo("##Scaling", scalings.at(settings.rend.ScreenScaling), ImGuiComboFlags_NoArrowButton))
{
for(auto& kv: scalings) {
for (const auto& kv : scalings)
{
bool is_selected = (kv.first == settings.rend.ScreenScaling);
if (ImGui::Selectable(kv.second, is_selected))
{
settings.rend.ScreenScaling = kv.first;
}
if (is_selected)
ImGui::SetItemDefaultFocus();
}
@ -1073,17 +1078,14 @@ static void gui_display_settings()
if (ImGui::ArrowButton("##Decrease Scaling", ImGuiDir_Left))
{
if ( scalings_it != scalings.begin() ){
if (scalings_it != scalings.begin())
settings.rend.ScreenScaling = (--scalings_it)->first;
}
}
ImGui::SameLine(0, scaling_spacing);
if (ImGui::ArrowButton("##Increase Scaling", ImGuiDir_Right))
{
if ( scalings_it != (--scalings.end()) ){
if (scalings_it != (--scalings.end()))
settings.rend.ScreenScaling = (++scalings_it)->first;
}
}
ImGui::SameLine(0, scaling_style.ItemInnerSpacing.x);
@ -1568,7 +1570,7 @@ static void gui_display_content()
if (gui_state == SelectDisk)
{
strcpy(settings.imgread.ImagePath, game.path.c_str());
DiscSwap(0);
DiscSwap();
gui_state = Closed;
}
else