@@ -63,6 +63,8 @@ public static void Main()
6363 case 1 : setValuesFromSADX ( ) ; break ;
6464
6565 case 2 : setValuesFromHeroes ( ) ; break ;
66+
67+ case 3 : setValuesFromMania ( ) ; break ;
6668
6769 default : attatchToGame ( ) ; break ;
6870 }
@@ -159,6 +161,26 @@ private static void setValuesFromHeroes()
159161 theDisplay . setControllerDataHeroes ( buttons , joyX , joyY , cameraPan ) ;
160162 }
161163
164+ private static void setValuesFromMania ( )
165+ {
166+ int bytesRead = 0 ;
167+ byte [ ] buffer = new byte [ 2 ] ;
168+ if ( ReadProcessMemory ( ( int ) processHandle , 0x0083251D , buffer , 2 , ref bytesRead ) == false || bytesRead != 2 )
169+ {
170+ theDisplay . setControllerDataMania ( 0 , 0 ) ;
171+ gameID = - 1 ;
172+ return ;
173+ }
174+
175+ int buttons = 0 ;
176+ buttons += buffer [ 0 ] ;
177+
178+ int stick = 0 ;
179+ stick += buffer [ 1 ] ;
180+
181+ theDisplay . setControllerDataMania ( buttons , stick ) ;
182+ }
183+
162184 private static void attatchToGame ( )
163185 {
164186 theDisplay . Text = "Searching for game..." ;
@@ -194,7 +216,15 @@ private static void attatchToGame()
194216 }
195217 catch
196218 {
197- gameID = - 1 ;
219+ try
220+ {
221+ process = Process . GetProcessesByName ( "SonicMania" ) [ 0 ] ;
222+ gameID = 3 ;
223+ }
224+ catch
225+ {
226+ gameID = - 1 ;
227+ }
198228 }
199229 }
200230 }
@@ -221,6 +251,8 @@ private static void attatchToGame()
221251 case 1 : theDisplay . Text = "SADX Input" ; break ;
222252
223253 case 2 : theDisplay . Text = "Heroes Input" ; break ;
254+
255+ case 3 : theDisplay . Text = "Mania Input" ; break ;
224256
225257 default : break ;
226258 }
0 commit comments