From 5d3ca7bc4754c519ce5b95c92ffef21b757767a5 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Wed, 17 Jan 2018 17:17:43 -0500 Subject: [PATCH] GBHawk: controller read fix --- .../Nintendo/GBHawk/GBHawkControllers.cs | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawkControllers.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawkControllers.cs index d33a82ac7c..87006a5539 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawkControllers.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawkControllers.cs @@ -44,12 +44,38 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk public byte Read(IController c) { byte result = 0xFF; - for (int i = 0; i < 8; i++) + + if (c.IsPressed(Definition.BoolButtons[0])) { - if (c.IsPressed(Definition.BoolButtons[i])) - { - result -= (byte)(1 << i); - } + result -= 4; + } + if (c.IsPressed(Definition.BoolButtons[1])) + { + result -= 8; + } + if (c.IsPressed(Definition.BoolButtons[2])) + { + result -= 2; + } + if (c.IsPressed(Definition.BoolButtons[3])) + { + result -= 1; + } + if (c.IsPressed(Definition.BoolButtons[4])) + { + result -= 128; + } + if (c.IsPressed(Definition.BoolButtons[5])) + { + result -= 64; + } + if (c.IsPressed(Definition.BoolButtons[6])) + { + result -= 32; + } + if (c.IsPressed(Definition.BoolButtons[7])) + { + result -= 16; } return result;