Grabmouse now has a hotkey (again). Fixed mouse motion handling in

several cases (fixes problems when moving the mouse too fast or
when changing between video modes).  Added extra signature to the
bankswitch autodetection for the 4A50 scheme.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2249 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2011-06-07 13:40:59 +00:00
parent 2b9f625f76
commit 4c59d810f1
8 changed files with 67 additions and 34 deletions

View File

@ -16,11 +16,20 @@
* Re-enabled 'grabmouse' commandline argument and associated
functionality with the following changes:
- it doesn't have a hotkey anymore
- it is changed in the "Input Settings' UI, not in 'Video Settings'
- it only has meaning while in emulation mode
- it is enabled by default
* Fixed bug with emulation of paddles using the mouse in Warlords;
movement was being filtered out if the mouse was moved too fast.
* Fixed bug whereby switching to the debugger and back again would
sometimes cause an extra mouse motion event (which would cause the
emulation to think the mouse was moved and move the player
accordingly).
* Tweaked bankswitch autodetection code for 4A50 bankswitching.
-Have fun!

View File

@ -325,17 +325,11 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
else if((size == 2048) ||
(size == 4096 && memcmp(image, image + 2048, 2048) == 0))
{
if(isProbablyCV(image, size))
type = "CV";
else
type = "2K";
type = isProbablyCV(image, size) ? "CV" : "2K";
}
else if(size == 4096)
{
if(isProbablyCV(image, size))
type = "CV";
else
type = "4K";
type = isProbablyCV(image, size) ? "CV" : "4K";
}
else if(size == 8*1024) // 8K
{
@ -405,11 +399,7 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
else if(isProbably4A50(image, size))
type = "4A50";
else if(isProbablyEF(image, size))
{
type = "EF";
if(isProbablySC(image, size))
type = "EFSC";
}
type = isProbablySC(image, size) ? "EFSC" : "EF";
else if(isProbablyX07(image, size))
type = "X07";
else
@ -548,8 +538,16 @@ bool Cartridge::isProbably4A50(const uInt8* image, uInt32 size)
// 4A50 carts store address $4A50 at the NMI vector, which
// in this scheme is always in the last page of ROM at
// $1FFA - $1FFB (at least this is true in rev 1 of the format)
int idx = size - 6; // $1FFA
return (image[idx] == 0x50 && image[idx+1] == 0x4A);
if(image[size-6] == 0x50 && image[size-5] == 0x4A)
return true;
// Program starts at $1Fxx with NOP $6Exx or NOP $6Fxx?
if(((image[0xfffd] & 0x1f) == 0x1f) &&
(image[image[0xfffd] * 256 + image[0xfffc]] == 0x0c) &&
((image[image[0xfffd] * 256 + image[0xfffc] + 2] & 0xfe) == 0x6e))
return true;
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -1355,7 +1355,7 @@ static const char* DefProps[DEF_PROPS_SIZE][20] = {
{ "683bb0d0f0c5df58557fba9dffc32c40", "Arcadia Corporation, Scott Nelson", "AR-4300", "Fireball (1982) (Arcadia) [a]", "Uses the Paddle Controllers", "", "", "", "", "", "", "", "PADDLES", "", "", "", "", "", "", "" },
{ "683dc64ef7316c13ba04ee4398e2b93a", "Ed Federmeyer", "", "Edtris (1995) (Ed Federmeyer)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "68449e4aaba677abcd7cde4264e02168", "", "", "Horizonal Color Bars Demo 2 (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "6847ce70819b74febcfd03e99610243b", "", "", "Ruby Runner 4A50", "", "", "", "4A50", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "6847ce70819b74febcfd03e99610243b", "", "", "Ruby Runner 4A50", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "68489e60268a5e6e052bad9c62681635", "Bit Corporation", "PG201", "Sea Monster (1982) (BitCorp) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "36", "256", "", "" },
{ "68597264c8e57ada93be3a5be4565096", "Data Age", "DA1005", "Bugs (1982) (Data Age)", "Uses the Paddle Controllers", "Uncommon", "", "", "", "", "", "", "PADDLES", "", "", "", "", "", "", "" },
{ "685e9668dc270b6deeb9cfbfd4d633c3", "CommaVid, Irwin Gaines - Ariola", "CM-004 - 712 004-720", "Room of Doom (1982) (CommaVid) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },

View File

@ -59,7 +59,8 @@ EventHandler::EventHandler(OSystem* osystem)
myOverlay(NULL),
myState(S_NONE),
myAllowAllDirectionsFlag(false),
myFryingFlag(false)
myFryingFlag(false),
mySkipMouseMotion(true)
{
// Create the event object which will be used for this handler
myEvent = new Event();
@ -565,6 +566,11 @@ void EventHandler::poll(uInt64 time)
myOSystem->console().toggleFormat();
break;
case SDLK_g: // Ctrl-g (un)grabs mouse
if(!myOSystem->frameBuffer().fullScreen())
myOSystem->frameBuffer().toggleGrabMouse();
break;
case SDLK_l: // Ctrl-l toggles PAL color-loss effect
myOSystem->console().toggleColorLoss();
break;
@ -645,20 +651,17 @@ void EventHandler::poll(uInt64 time)
{
if(myMouseEnabled)
{
int x = event.motion.xrel, y = event.motion.yrel;
// Filter out extremely large movement, which is usually caused
// by a screen being re-created
if(abs(x) < 50)
myEvent->set(Event::MouseAxisXValue, x);
if(abs(y) < 50)
myEvent->set(Event::MouseAxisYValue, y);
if(!mySkipMouseMotion)
{
myEvent->set(Event::MouseAxisXValue, event.motion.xrel);
myEvent->set(Event::MouseAxisYValue, event.motion.yrel);
}
mySkipMouseMotion = false;
}
}
else if(myOverlay)
{
int x = event.motion.x, y = event.motion.y;
myOverlay->handleMouseMotionEvent(x, y, 0);
}
myOverlay->handleMouseMotionEvent(event.motion.x, event.motion.y, 0);
break; // SDL_MOUSEMOTION
case SDL_MOUSEBUTTONUP:
@ -2179,6 +2182,7 @@ void EventHandler::leaveDebugMode()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setEventState(State state)
{
cerr << "setEventState:" << state << endl;
myState = state;
switch(myState)
@ -2225,6 +2229,10 @@ void EventHandler::setEventState(State state)
// Always clear any pending events when changing states
myEvent->clear();
// Sometimes an extraneous mouse motion event is generated
// after a state change, which should be surpressed
mySkipMouseMotion = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -477,6 +477,11 @@ class EventHandler
// a Ctrl combo when it isn't wanted)
bool myUseCtrlKeyFlag;
// A bug in the SDL video handler creates an extraneous mouse motion
// event after a video state change
// We detect when this happens and discard the event
bool mySkipMouseMotion;
// Used for continuous snapshot mode
uInt32 myContSnapshotInterval;
uInt32 myContSnapshotCounter;

View File

@ -67,7 +67,8 @@ FrameBuffer::~FrameBuffer(void)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBInitStatus FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height)
FBInitStatus FrameBuffer::initialize(const string& title,
uInt32 width, uInt32 height)
{
ostringstream buf;
@ -286,7 +287,6 @@ void FrameBuffer::update()
default:
return;
break;
}
// Draw any pending messages
@ -752,6 +752,14 @@ void FrameBuffer::setCursorState()
showCursor(!emulation);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::toggleGrabMouse()
{
bool state = myOSystem->settings().getBool("grabmouse");
myOSystem->settings().setBool("grabmouse", !state);
setCursorState();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::showCursor(bool show)
{
@ -842,7 +850,7 @@ void FrameBuffer::setWindowIcon()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 FrameBuffer::getPhosphor(uInt8 c1, uInt8 c2)
uInt8 FrameBuffer::getPhosphor(uInt8 c1, uInt8 c2) const
{
if(c2 > c1)
BSPF_swap(c1, c2);

View File

@ -235,6 +235,12 @@ class FrameBuffer
*/
void setCursorState();
/**
Toggles the use of grabmouse (only has effect in emulation mode).
The method changes the 'grabmouse' setting and saves it.
*/
void toggleGrabMouse();
/**
Shows or hides the cursor based on the given boolean value.
*/
@ -488,7 +494,7 @@ class FrameBuffer
@return Averaged value of the two colors
*/
uInt8 getPhosphor(uInt8 c1, uInt8 c2);
uInt8 getPhosphor(uInt8 c1, uInt8 c2) const;
/**
Calculate the maximum level by which the base window can be zoomed and

View File

@ -7940,7 +7940,6 @@
"Cartridge.MD5" "6847ce70819b74febcfd03e99610243b"
"Cartridge.Name" "Ruby Runner 4A50"
"Cartridge.Type" "4A50"
""
"Cartridge.MD5" "68c80e7e1d30df98a0cf67ecbf39cc67"