mirror of https://github.com/stella-emu/stella.git
Multiple events can now be assigned to combo events from the UI. Still TODO
is update the documentation for this. Fixed bug reported by Buzbard from AtariAge concerning very large images in the RomInfoWidget being clipped too small. Reworked 'center window' functionality. Using the SDL_VIDEO_CENTERED environment variable was always a hack, and a bug was introduced in X11 OpenGL mode in version 1.2.14. However, since SDL is now in maintenance mode and won't be receiving any further updates, we have to bypass it entirely. Added infrastructure for OSystem to center the application window. For now, only Linux X11 mode is supported. Still TODO is add support for Windows. OSX was never supported anyway. This also means that the center window variable no longer requires the application to be restarted. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2091 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
8199dddb6f
commit
6a5998c684
|
@ -39,8 +39,9 @@ FIXME
|
||||||
(previously, the app had to be restarted), and a vertical line
|
(previously, the app had to be restarted), and a vertical line
|
||||||
separates the disassembly from the raw bytes.
|
separates the disassembly from the raw bytes.
|
||||||
|
|
||||||
* Fixed behaviour of SWCHB and SWBCNT; the three unused bits can now be
|
* Fixed behaviour of SWCHB and SWBCNT; pins set to output now remember
|
||||||
configured as input or output. Some ROMs use this for extra storage.
|
the values previously written. Some ROMs use this functionality for
|
||||||
|
extra storage.
|
||||||
|
|
||||||
* Added 'finishing touches' to some of the UI descriptions, giving a
|
* Added 'finishing touches' to some of the UI descriptions, giving a
|
||||||
better explanation of the functions. Related to this, certain
|
better explanation of the functions. Related to this, certain
|
||||||
|
|
|
@ -686,6 +686,20 @@ case $_host_os in
|
||||||
DEFINES="$DEFINES -DBSPF_UNIX -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
|
DEFINES="$DEFINES -DBSPF_UNIX -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
|
||||||
MODULES="$MODULES $SRC/unix"
|
MODULES="$MODULES $SRC/unix"
|
||||||
INCLUDES="$INCLUDES -I$SRC/unix"
|
INCLUDES="$INCLUDES -I$SRC/unix"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check for X11
|
||||||
|
#
|
||||||
|
_x11=no
|
||||||
|
cat > $TMPC << EOF
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
int main(void) { return 0; }
|
||||||
|
EOF
|
||||||
|
cc_check $LDFLAGS $CXXFLAGS -lX11 && _x11=yes
|
||||||
|
if test "$_x11" = yes ; then
|
||||||
|
DEFINES="$DEFINES -DHAVE_X11"
|
||||||
|
LIBS="$LIBS -lX11"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
win32)
|
win32)
|
||||||
DEFINES="$DEFINES -DBSPF_WIN32 -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
|
DEFINES="$DEFINES -DBSPF_WIN32 -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
|
||||||
|
|
|
@ -145,7 +145,6 @@ void PNGLibrary::scaleImagetoSurface(uInt32 iwidth, uInt32 iheight, uInt8* buffe
|
||||||
uInt32 izoom = uInt32(ceil(iwidth/320.0)),
|
uInt32 izoom = uInt32(ceil(iwidth/320.0)),
|
||||||
szoom = surface.getWidth()/320;
|
szoom = surface.getWidth()/320;
|
||||||
|
|
||||||
// Set the surface size
|
|
||||||
uInt32 sw = iwidth / izoom * szoom,
|
uInt32 sw = iwidth / izoom * szoom,
|
||||||
sh = iheight / izoom * szoom;
|
sh = iheight / izoom * szoom;
|
||||||
sw = BSPF_min(sw, surface.getWidth());
|
sw = BSPF_min(sw, surface.getWidth());
|
||||||
|
@ -159,9 +158,10 @@ void PNGLibrary::scaleImagetoSurface(uInt32 iwidth, uInt32 iheight, uInt8* buffe
|
||||||
|
|
||||||
uInt32 buf_offset = ipitch * izoom;
|
uInt32 buf_offset = ipitch * izoom;
|
||||||
uInt32 i_offset = 3 * izoom;
|
uInt32 i_offset = 3 * izoom;
|
||||||
|
|
||||||
// We can only scan at most the height of the surface
|
// We can only scan at most the height of the image to the constraints of
|
||||||
iheight = BSPF_min(iheight, surface.getHeight());
|
// the surface height (some multiple of 256)
|
||||||
|
iheight = BSPF_min(iheight, izoom * 256);
|
||||||
|
|
||||||
// Grab each non-duplicate row of data from the image
|
// Grab each non-duplicate row of data from the image
|
||||||
for(uInt32 irow = 0, srow = 0; irow < iheight; irow += izoom, buffer += buf_offset)
|
for(uInt32 irow = 0, srow = 0; irow < iheight; irow += izoom, buffer += buf_offset)
|
||||||
|
|
|
@ -149,10 +149,6 @@ int main(int argc, char* argv[])
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request that the SDL window be centered, if possible
|
|
||||||
if(theOSystem->settings().getBool("center"))
|
|
||||||
putenv((char*)"SDL_VIDEO_CENTERED=1");
|
|
||||||
|
|
||||||
#ifdef BSPF_UNIX
|
#ifdef BSPF_UNIX
|
||||||
// Nvidia cards under UNIX don't currently support SDL_GL_SWAP_CONTROL
|
// Nvidia cards under UNIX don't currently support SDL_GL_SWAP_CONTROL
|
||||||
// So we need to do it with an Nvidia-specific environment variable
|
// So we need to do it with an Nvidia-specific environment variable
|
||||||
|
|
|
@ -1867,7 +1867,7 @@ StringMap EventHandler::getComboList(EventMode) const
|
||||||
StringMap l;
|
StringMap l;
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
|
|
||||||
l.push_back("None", "0");
|
l.push_back("None", "-1");
|
||||||
for(uInt32 i = 0; i < kEmulActionListSize; ++i)
|
for(uInt32 i = 0; i < kEmulActionListSize; ++i)
|
||||||
if(EventHandler::ourEmulActionList[i].allow_combo)
|
if(EventHandler::ourEmulActionList[i].allow_combo)
|
||||||
{
|
{
|
||||||
|
@ -1900,9 +1900,9 @@ StringList EventHandler::getComboListForEvent(Event::Type event) const
|
||||||
buf.str("");
|
buf.str("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make sure entries are 1-to-1, using Event::NoType when necessary
|
// Make sure entries are 1-to-1, using '-1' to indicate Event::NoType
|
||||||
if(i == l.size())
|
if(i == l.size())
|
||||||
l.push_back("0");
|
l.push_back("-1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
|
@ -1911,6 +1911,20 @@ StringList EventHandler::getComboListForEvent(Event::Type event) const
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::setComboListForEvent(Event::Type event, const StringList& events)
|
void EventHandler::setComboListForEvent(Event::Type event, const StringList& events)
|
||||||
{
|
{
|
||||||
|
if(event >= Event::Combo1 && event <= Event::Combo16)
|
||||||
|
{
|
||||||
|
assert(events.size() == 8);
|
||||||
|
int combo = event - Event::Combo1;
|
||||||
|
for(int i = 0; i < 8; ++i)
|
||||||
|
{
|
||||||
|
int idx = atoi(events[i].c_str());
|
||||||
|
if(idx >=0 && idx < kEmulActionListSize)
|
||||||
|
myComboTable[combo][i] = EventHandler::ourEmulActionList[idx].event;
|
||||||
|
else
|
||||||
|
myComboTable[combo][i] = Event::NoType;
|
||||||
|
}
|
||||||
|
saveComboMapping();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -127,13 +127,17 @@ FBInitStatus FrameBuffer::initialize(const string& title, uInt32 width, uInt32 h
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
if(myInitializedCount == 1) setWindowIcon();
|
if(myInitializedCount == 1) setWindowIcon();
|
||||||
|
|
||||||
if(!initSubsystem(mode))
|
if(initSubsystem(mode))
|
||||||
{
|
|
||||||
myOSystem->logMessage("ERROR: Couldn't initialize video subsystem\n", 0);
|
|
||||||
return kFailNotSupported;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
// Attempt to center the application window in non-fullscreen mode
|
||||||
|
if(!fullScreen() && myOSystem->settings().getBool("center"))
|
||||||
|
{
|
||||||
|
myOSystem->setAppWindowPos(
|
||||||
|
(myOSystem->desktopWidth() - mode.screen_w) / 2,
|
||||||
|
(myOSystem->desktopHeight() - mode.screen_h) / 2,
|
||||||
|
mode.screen_w, mode.screen_h);
|
||||||
|
}
|
||||||
|
|
||||||
myImageRect.setWidth(mode.image_w);
|
myImageRect.setWidth(mode.image_w);
|
||||||
myImageRect.setHeight(mode.image_h);
|
myImageRect.setHeight(mode.image_h);
|
||||||
myImageRect.moveTo(mode.image_x, mode.image_y);
|
myImageRect.moveTo(mode.image_x, mode.image_y);
|
||||||
|
@ -147,6 +151,11 @@ FBInitStatus FrameBuffer::initialize(const string& title, uInt32 width, uInt32 h
|
||||||
myOSystem->settings().setString("fullscreen", fullScreen() ? "1" : "0");
|
myOSystem->settings().setString("fullscreen", fullScreen() ? "1" : "0");
|
||||||
setCursorState();
|
setCursorState();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myOSystem->logMessage("ERROR: Couldn't initialize video subsystem\n", 0);
|
||||||
|
return kFailNotSupported;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return kFailTooLarge;
|
return kFailTooLarge;
|
||||||
|
|
|
@ -444,6 +444,12 @@ class OSystem
|
||||||
*/
|
*/
|
||||||
virtual void stateChanged(EventHandler::State state);
|
virtual void stateChanged(EventHandler::State state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the position of the application window, generally using
|
||||||
|
platform-specific code.
|
||||||
|
*/
|
||||||
|
virtual void setAppWindowPos(int x, int y, int w, int h) { };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
Query the OSystem video hardware for resolution information.
|
Query the OSystem video hardware for resolution information.
|
||||||
|
|
|
@ -120,20 +120,24 @@ void ComboDialog::loadConfig()
|
||||||
// Fill any remaining items to 'None'
|
// Fill any remaining items to 'None'
|
||||||
if(size < 8)
|
if(size < 8)
|
||||||
for(int i = size; i < 8; ++i)
|
for(int i = size; i < 8; ++i)
|
||||||
myEvents[i]->setSelected("None", "0");
|
myEvents[i]->setSelected("None", "-1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ComboDialog::saveConfig()
|
void ComboDialog::saveConfig()
|
||||||
{
|
{
|
||||||
Settings& settings = instance().settings();
|
StringList events;
|
||||||
|
for(int i = 0; i < 8; ++i)
|
||||||
|
events.push_back(myEvents[i]->getSelectedTag());
|
||||||
|
|
||||||
|
instance().eventHandler().setComboListForEvent(myComboEvent, events);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ComboDialog::setDefaults()
|
void ComboDialog::setDefaults()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 8; ++i)
|
for(int i = 0; i < 8; ++i)
|
||||||
myEvents[i]->setSelected("None", "0");
|
myEvents[i]->setSelected("None", "-1");
|
||||||
|
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
|
|
||||||
// Center window (in windowed mode)
|
// Center window (in windowed mode)
|
||||||
myCenterCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
myCenterCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||||
"Center window (*)");
|
"Center window");
|
||||||
wid.push_back(myCenterCheckbox);
|
wid.push_back(myCenterCheckbox);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,11 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#if defined(HAVE_X11)
|
||||||
|
#include <SDL_syswm.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
#include "OSystemUNIX.hxx"
|
#include "OSystemUNIX.hxx"
|
||||||
|
@ -43,3 +48,32 @@ OSystemUNIX::OSystemUNIX()
|
||||||
OSystemUNIX::~OSystemUNIX()
|
OSystemUNIX::~OSystemUNIX()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void OSystemUNIX::setAppWindowPos(int x, int y, int, int)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_X11)
|
||||||
|
SDL_SysWMinfo sdl_info;
|
||||||
|
memset(&sdl_info, 0, sizeof(sdl_info));
|
||||||
|
|
||||||
|
SDL_VERSION (&sdl_info.version);
|
||||||
|
if(SDL_GetWMInfo(&sdl_info) > 0 && sdl_info.subsystem == SDL_SYSWM_X11)
|
||||||
|
{
|
||||||
|
XSizeHints* hints = XAllocSizeHints();
|
||||||
|
if(hints)
|
||||||
|
{
|
||||||
|
Display* display = sdl_info.info.x11.display;
|
||||||
|
Window window = sdl_info.info.x11.wmwindow;
|
||||||
|
hints->flags |= USPosition;
|
||||||
|
hints->x = x;
|
||||||
|
hints->y = y;
|
||||||
|
XMoveWindow(display, window, hints->x, hints->y);
|
||||||
|
|
||||||
|
/* Flush the resize event so we don't catch it later */
|
||||||
|
XSync(display, True);
|
||||||
|
XSetWMNormalHints(display, window, hints);
|
||||||
|
XFree(hints);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,9 @@ class OSystemUNIX : public OSystem
|
||||||
Destructor
|
Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~OSystemUNIX();
|
virtual ~OSystemUNIX();
|
||||||
|
|
||||||
|
/** Move X11 window to given position. */
|
||||||
|
void setAppWindowPos(int x, int y, /* not used*/ int, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue