mirror of https://github.com/stella-emu/stella.git
fix crash when light gun game is started from command line
This commit is contained in:
parent
7c938de49b
commit
c147588a7d
|
@ -42,8 +42,13 @@ bool Lightgun::read(DigitalPin pin)
|
||||||
{
|
{
|
||||||
case DigitalPin::Six: // INPT4/5
|
case DigitalPin::Six: // INPT4/5
|
||||||
{
|
{
|
||||||
TIA& tia = mySystem.tia();
|
|
||||||
const Common::Rect& rect = myFrameBuffer.imageRect();
|
const Common::Rect& rect = myFrameBuffer.imageRect();
|
||||||
|
|
||||||
|
// abort when no valid framebuffer exists
|
||||||
|
if (rect.w() == 0 || rect.h() == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
TIA& tia = mySystem.tia();
|
||||||
// scale mouse coordinates into TIA coordinates
|
// scale mouse coordinates into TIA coordinates
|
||||||
Int32 xMouse = (myEvent.get(Event::MouseAxisXValue) - rect.x())
|
Int32 xMouse = (myEvent.get(Event::MouseAxisXValue) - rect.x())
|
||||||
* tia.width() / rect.w();
|
* tia.width() / rect.w();
|
||||||
|
@ -72,5 +77,7 @@ void Lightgun::update()
|
||||||
// we allow left and right mouse buttons for fire button
|
// we allow left and right mouse buttons for fire button
|
||||||
setPin(DigitalPin::One, myEvent.get(Event::MouseButtonLeftValue)
|
setPin(DigitalPin::One, myEvent.get(Event::MouseButtonLeftValue)
|
||||||
|| myEvent.get(Event::MouseButtonRightValue));
|
|| myEvent.get(Event::MouseButtonRightValue));
|
||||||
|
|
||||||
|
cerr << mySystem.tia().startLine() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,15 @@ public:
|
||||||
private:
|
private:
|
||||||
const FrameBuffer& myFrameBuffer;
|
const FrameBuffer& myFrameBuffer;
|
||||||
|
|
||||||
|
// Shooting Arcade:
|
||||||
static constexpr Int32 X_OFS = -21;
|
static constexpr Int32 X_OFS = -21;
|
||||||
static constexpr Int32 Y_OFS = 5;
|
static constexpr Int32 Y_OFS = 5; // 260 scanlines
|
||||||
|
// Guntest:
|
||||||
|
//static constexpr Int32 X_OFS = -25;
|
||||||
|
//static constexpr Int32 Y_OFS = 1; // 262 scanlines
|
||||||
|
// Sentinel:
|
||||||
|
//static constexpr Int32 X_OFS = -24;
|
||||||
|
//static constexpr Int32 Y_OFS = -5; // 268 scanlines
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
Loading…
Reference in New Issue