Skip to content

Commit

Permalink
Add 4/3 schrink in panel misk
Browse files Browse the repository at this point in the history
  • Loading branch information
Chips-fr committed May 23, 2015
1 parent 6cbdde5 commit 0cf597e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
43 changes: 29 additions & 14 deletions src/od-pandora/gui/PanelMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -99,7 +110,9 @@ void ExitPanelMisc(void)
{
delete chkStatusLine;
delete chkShowGUI;
#ifndef RASPBERRY
#ifdef RASPBERRY
delete chkAspect;
#else
delete lblPandoraSpeed;
delete sldPandoraSpeed;
delete lblPandoraSpeedInfo;
Expand All @@ -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);
Expand Down
16 changes: 9 additions & 7 deletions src/od-rasp/rasp_gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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,
Expand All @@ -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 ,
Expand All @@ -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 );
}

Expand Down

0 comments on commit 0cf597e

Please sign in to comment.