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
|
||||
separates the disassembly from the raw bytes.
|
||||
|
||||
* Fixed behaviour of SWCHB and SWBCNT; the three unused bits can now be
|
||||
configured as input or output. Some ROMs use this for extra storage.
|
||||
* Fixed behaviour of SWCHB and SWBCNT; pins set to output now remember
|
||||
the values previously written. Some ROMs use this functionality for
|
||||
extra storage.
|
||||
|
||||
* Added 'finishing touches' to some of the UI descriptions, giving a
|
||||
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"
|
||||
MODULES="$MODULES $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)
|
||||
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)),
|
||||
szoom = surface.getWidth()/320;
|
||||
|
||||
// Set the surface size
|
||||
uInt32 sw = iwidth / izoom * szoom,
|
||||
sh = iheight / izoom * szoom;
|
||||
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 i_offset = 3 * izoom;
|
||||
|
||||
// We can only scan at most the height of the surface
|
||||
iheight = BSPF_min(iheight, surface.getHeight());
|
||||
|
||||
// We can only scan at most the height of the image to the constraints of
|
||||
// the surface height (some multiple of 256)
|
||||
iheight = BSPF_min(iheight, izoom * 256);
|
||||
|
||||
// Grab each non-duplicate row of data from the image
|
||||
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();
|
||||
}
|
||||
|
||||
// Request that the SDL window be centered, if possible
|
||||
if(theOSystem->settings().getBool("center"))
|
||||
putenv((char*)"SDL_VIDEO_CENTERED=1");
|
||||
|
||||
#ifdef BSPF_UNIX
|
||||
// Nvidia cards under UNIX don't currently support SDL_GL_SWAP_CONTROL
|
||||
// So we need to do it with an Nvidia-specific environment variable
|
||||
|
|
|
@ -1867,7 +1867,7 @@ StringMap EventHandler::getComboList(EventMode) const
|
|||
StringMap l;
|
||||
ostringstream buf;
|
||||
|
||||
l.push_back("None", "0");
|
||||
l.push_back("None", "-1");
|
||||
for(uInt32 i = 0; i < kEmulActionListSize; ++i)
|
||||
if(EventHandler::ourEmulActionList[i].allow_combo)
|
||||
{
|
||||
|
@ -1900,9 +1900,9 @@ StringList EventHandler::getComboListForEvent(Event::Type event) const
|
|||
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())
|
||||
l.push_back("0");
|
||||
l.push_back("-1");
|
||||
}
|
||||
}
|
||||
return l;
|
||||
|
@ -1911,6 +1911,20 @@ StringList EventHandler::getComboListForEvent(Event::Type event) const
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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);
|
||||
if(myInitializedCount == 1) setWindowIcon();
|
||||
|
||||
if(!initSubsystem(mode))
|
||||
{
|
||||
myOSystem->logMessage("ERROR: Couldn't initialize video subsystem\n", 0);
|
||||
return kFailNotSupported;
|
||||
}
|
||||
else
|
||||
if(initSubsystem(mode))
|
||||
{
|
||||
// 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.setHeight(mode.image_h);
|
||||
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");
|
||||
setCursorState();
|
||||
}
|
||||
else
|
||||
{
|
||||
myOSystem->logMessage("ERROR: Couldn't initialize video subsystem\n", 0);
|
||||
return kFailNotSupported;
|
||||
}
|
||||
}
|
||||
else
|
||||
return kFailTooLarge;
|
||||
|
|
|
@ -444,6 +444,12 @@ class OSystem
|
|||
*/
|
||||
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:
|
||||
/**
|
||||
Query the OSystem video hardware for resolution information.
|
||||
|
|
|
@ -120,20 +120,24 @@ void ComboDialog::loadConfig()
|
|||
// Fill any remaining items to 'None'
|
||||
if(size < 8)
|
||||
for(int i = size; i < 8; ++i)
|
||||
myEvents[i]->setSelected("None", "0");
|
||||
myEvents[i]->setSelected("None", "-1");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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()
|
||||
{
|
||||
for(int i = 0; i < 8; ++i)
|
||||
myEvents[i]->setSelected("None", "0");
|
||||
myEvents[i]->setSelected("None", "-1");
|
||||
|
||||
_dirty = true;
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
|
||||
// Center window (in windowed mode)
|
||||
myCenterCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"Center window (*)");
|
||||
"Center window");
|
||||
wid.push_back(myCenterCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
// $Id$
|
||||
//============================================================================
|
||||
|
||||
#if defined(HAVE_X11)
|
||||
#include <SDL_syswm.h>
|
||||
#include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "OSystemUNIX.hxx"
|
||||
|
@ -43,3 +48,32 @@ 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
|
||||
*/
|
||||
virtual ~OSystemUNIX();
|
||||
|
||||
/** Move X11 window to given position. */
|
||||
void setAppWindowPos(int x, int y, /* not used*/ int, int);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue