From 0cf597e9aa75152e0ad334b6bac1cef6388041fb Mon Sep 17 00:00:00 2001 From: Chips-fr Date: Sat, 23 May 2015 19:31:44 +0000 Subject: [PATCH] Add 4/3 schrink in panel misk --- src/od-pandora/gui/PanelMisc.cpp | 43 +++++++++++++++++++++----------- src/od-rasp/rasp_gfx.cpp | 16 ++++++------ 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/src/od-pandora/gui/PanelMisc.cpp b/src/od-pandora/gui/PanelMisc.cpp index 1fba99fa8..7ef6d87e6 100644 --- a/src/od-pandora/gui/PanelMisc.cpp +++ b/src/od-pandora/gui/PanelMisc.cpp @@ -22,7 +22,9 @@ static gcn::UaeCheckBox* chkStatusLine; static gcn::UaeCheckBox* chkShowGUI; -#ifndef RASPBERRY +#ifdef RASPBERRY +static gcn::UaeCheckBox* chkAspect; +#else static gcn::Label* lblPandoraSpeed; static gcn::Label* lblPandoraSpeedInfo; static gcn::Slider* sldPandoraSpeed; @@ -39,7 +41,10 @@ class MiscActionListener : public gcn::ActionListener else if (actionEvent.getSource() == chkShowGUI) changed_prefs.start_gui = chkShowGUI->isSelected(); -#ifndef RASPBERRY +#ifdef RASPBERRY + else if (actionEvent.getSource() == chkAspect) + changed_prefs.gfx_correct_aspect = chkAspect->isSelected(); +#else else if (actionEvent.getSource() == sldPandoraSpeed) { int newspeed = (int) sldPandoraSpeed->getValue(); @@ -60,32 +65,38 @@ void InitPanelMisc(const struct _ConfigCategory& category) { miscActionListener = new MiscActionListener(); - chkStatusLine = new gcn::UaeCheckBox("Status Line"); + chkStatusLine = new gcn::UaeCheckBox("Status Line"); chkStatusLine->addActionListener(miscActionListener); - chkShowGUI = new gcn::UaeCheckBox("Show GUI on startup"); - chkShowGUI->setId("ShowGUI"); + chkShowGUI = new gcn::UaeCheckBox("Show GUI on startup"); + chkShowGUI->setId("ShowGUI"); chkShowGUI->addActionListener(miscActionListener); -#ifndef RASPBERRY - lblPandoraSpeed = new gcn::Label("Pandora Speed:"); +#ifdef RASPBERRY + chkAspect = new gcn::UaeCheckBox("4/3 ratio shrink"); + chkAspect->addActionListener(miscActionListener); +#else + lblPandoraSpeed = new gcn::Label("Pandora Speed:"); lblPandoraSpeed->setSize(110, LABEL_HEIGHT); lblPandoraSpeed->setAlignment(gcn::Graphics::RIGHT); sldPandoraSpeed = new gcn::Slider(500, 1260); sldPandoraSpeed->setSize(200, SLIDER_HEIGHT); sldPandoraSpeed->setBaseColor(gui_baseCol); - sldPandoraSpeed->setMarkerLength(20); - sldPandoraSpeed->setStepLength(20); - sldPandoraSpeed->setId("PandSpeed"); + sldPandoraSpeed->setMarkerLength(20); + sldPandoraSpeed->setStepLength(20); + sldPandoraSpeed->setId("PandSpeed"); sldPandoraSpeed->addActionListener(miscActionListener); lblPandoraSpeedInfo = new gcn::Label("1000 MHz"); #endif - int posY = DISTANCE_BORDER; + int posY = DISTANCE_BORDER; category.panel->add(chkStatusLine, DISTANCE_BORDER, posY); posY += chkStatusLine->getHeight() + DISTANCE_NEXT_Y; category.panel->add(chkShowGUI, DISTANCE_BORDER, posY); posY += chkShowGUI->getHeight() + DISTANCE_NEXT_Y; -#ifndef RASPBERRY +#ifdef RASPBERRY + category.panel->add(chkAspect, DISTANCE_BORDER, posY); + posY += chkAspect->getHeight() + DISTANCE_NEXT_Y; +#else category.panel->add(lblPandoraSpeed, DISTANCE_BORDER, posY); category.panel->add(sldPandoraSpeed, DISTANCE_BORDER + lblPandoraSpeed->getWidth() + 8, posY); category.panel->add(lblPandoraSpeedInfo, sldPandoraSpeed->getX() + sldPandoraSpeed->getWidth() + 12, posY); @@ -99,7 +110,9 @@ void ExitPanelMisc(void) { delete chkStatusLine; delete chkShowGUI; -#ifndef RASPBERRY +#ifdef RASPBERRY + delete chkAspect; +#else delete lblPandoraSpeed; delete sldPandoraSpeed; delete lblPandoraSpeedInfo; @@ -114,7 +127,9 @@ void RefreshPanelMisc(void) chkStatusLine->setSelected(changed_prefs.leds_on_screen); chkShowGUI->setSelected(changed_prefs.start_gui); -#ifndef RASPBERRY +#ifdef RASPBERRY + chkAspect->setSelected(changed_prefs.gfx_correct_aspect); +#else sldPandoraSpeed->setValue(changed_prefs.pandora_cpu_speed); snprintf(tmp, 20, "%d MHz", changed_prefs.pandora_cpu_speed); lblPandoraSpeedInfo->setCaption(tmp); diff --git a/src/od-rasp/rasp_gfx.cpp b/src/od-rasp/rasp_gfx.cpp index a79efaae9..888801ead 100644 --- a/src/od-rasp/rasp_gfx.cpp +++ b/src/od-rasp/rasp_gfx.cpp @@ -213,7 +213,8 @@ static void open_screen(struct uae_prefs *p) SDL_ShowCursor(SDL_DISABLE); // check if resolution hasn't change in menu. otherwise free the resources so that they will be re-generated with new resolution. - if ((dispmanxresource_amigafb_1 != 0) && ((blit_rect.width != width) || (blit_rect.height != height))) + if ((dispmanxresource_amigafb_1 != 0) && + ((blit_rect.width != width) || (blit_rect.height != height) || (currprefs.gfx_correct_aspect != changed_prefs.gfx_correct_aspect))) { printf("Emulation resolution change detected.\n"); if(prSDLScreen != NULL ) @@ -231,7 +232,7 @@ static void open_screen(struct uae_prefs *p) if (dispmanxresource_amigafb_1 == 0) { printf("Emulation resolution: Width %i Height: %i\n",width,height); - + currprefs.gfx_correct_aspect = changed_prefs.gfx_correct_aspect; prSDLScreen = SDL_CreateRGBSurface(SDL_SWSURFACE,width,height,16, Dummy_prSDLScreen->format->Rmask, Dummy_prSDLScreen->format->Gmask, @@ -252,10 +253,10 @@ static void open_screen(struct uae_prefs *p) vc_dispmanx_rect_set( &src_rect, 0, 0, width << 16, height << 16 ); } - // Currently on fullscreen is available in uae4all2/uae4arm, no 16/9 to 4/3 ratio adaptation is available. - //if (mainMenu_screenformat == 0) - if (1) + // 16/9 to 4/3 ratio adaptation. + if (currprefs.gfx_correct_aspect == 0) { + // Fullscreen. vc_dispmanx_rect_set( &dst_rect, (dispmanxdinfo.width * 2)/100, (dispmanxdinfo.height * 2)/100 , dispmanxdinfo.width - (dispmanxdinfo.width * 4)/100 , @@ -271,9 +272,10 @@ static void open_screen(struct uae_prefs *p) } else { - vc_dispmanx_rect_set( &dst_rect, ((dispmanxdinfo.width * 17)/100) , + // 4/3 scrink. + vc_dispmanx_rect_set( &dst_rect, ((dispmanxdinfo.width * 13)/100) , (dispmanxdinfo.height * 3)/100 , - (dispmanxdinfo.width - ((dispmanxdinfo.width * 36)/100)) , + (dispmanxdinfo.width - ((dispmanxdinfo.width * 32)/100)) , dispmanxdinfo.height - (dispmanxdinfo.height * 7)/100 ); }