diff --git a/src/emucore/Lightgun.cxx b/src/emucore/Lightgun.cxx index e7e3a5b74..f151074eb 100644 --- a/src/emucore/Lightgun.cxx +++ b/src/emucore/Lightgun.cxx @@ -42,8 +42,13 @@ bool Lightgun::read(DigitalPin pin) { case DigitalPin::Six: // INPT4/5 { - TIA& tia = mySystem.tia(); 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 Int32 xMouse = (myEvent.get(Event::MouseAxisXValue) - rect.x()) * tia.width() / rect.w(); @@ -72,5 +77,7 @@ void Lightgun::update() // we allow left and right mouse buttons for fire button setPin(DigitalPin::One, myEvent.get(Event::MouseButtonLeftValue) || myEvent.get(Event::MouseButtonRightValue)); + + cerr << mySystem.tia().startLine() << endl; } diff --git a/src/emucore/Lightgun.hxx b/src/emucore/Lightgun.hxx index fc997242c..6d3f36cd6 100644 --- a/src/emucore/Lightgun.hxx +++ b/src/emucore/Lightgun.hxx @@ -62,8 +62,15 @@ public: private: const FrameBuffer& myFrameBuffer; + // Shooting Arcade: 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: // Following constructors and assignment operators not supported