22using System . Numerics ;
33
44using ImGuiNET ;
5-
6- using ImGuiOpenTK ;
5+ using ImGuiNET . OpenTK ;
76
87using Monoboy . Constants ;
98using Monoboy . Utility ;
109
1110using OpenTK . Graphics . OpenGL ;
1211using OpenTK . Windowing . Common ;
13- using OpenTK . Windowing . Common . Input ;
1412using OpenTK . Windowing . Desktop ;
13+ using OpenTK . Windowing . GraphicsLibraryFramework ;
1514
1615namespace Monoboy . Application
1716{
@@ -38,10 +37,8 @@ public class Application : Window
3837
3938 public Application ( GameWindowSettings gameWindow , NativeWindowSettings nativeWindow ) : base ( gameWindow , nativeWindow )
4039 {
41-
4240 emulator = new Emulator ( ) ;
4341
44- // opentk 4.0 bug!
4542 MakeCurrent ( ) ;
4643
4744 framebufferTexture = new Texture ( "FrameBuffer" , Constant . WindowWidth , Constant . WindowHeight , emulator . bus . gpu . framebuffer . Pixels ) ;
@@ -76,14 +73,14 @@ protected override void OnUpdateFrame(FrameEventArgs args)
7673
7774 void UpdateJoypad ( )
7875 {
79- emulator . bus . joypad . SetButton ( Joypad . Button . A , KeyboardState . IsKeyDown ( Key . Space ) ) ;
80- emulator . bus . joypad . SetButton ( Joypad . Button . B , KeyboardState . IsKeyDown ( Key . ShiftLeft ) ) ;
81- emulator . bus . joypad . SetButton ( Joypad . Button . Select , KeyboardState . IsKeyDown ( Key . Escape ) ) ;
82- emulator . bus . joypad . SetButton ( Joypad . Button . Start , KeyboardState . IsKeyDown ( Key . Enter ) ) ;
83- emulator . bus . joypad . SetButton ( Joypad . Button . Up , KeyboardState . IsKeyDown ( Key . W ) ) ;
84- emulator . bus . joypad . SetButton ( Joypad . Button . Down , KeyboardState . IsKeyDown ( Key . S ) ) ;
85- emulator . bus . joypad . SetButton ( Joypad . Button . Left , KeyboardState . IsKeyDown ( Key . A ) ) ;
86- emulator . bus . joypad . SetButton ( Joypad . Button . Right , KeyboardState . IsKeyDown ( Key . D ) ) ;
76+ emulator . bus . joypad . SetButton ( Joypad . Button . A , KeyboardState . IsKeyDown ( Keys . Space ) ) ;
77+ emulator . bus . joypad . SetButton ( Joypad . Button . B , KeyboardState . IsKeyDown ( Keys . LeftShift ) ) ;
78+ emulator . bus . joypad . SetButton ( Joypad . Button . Select , KeyboardState . IsKeyDown ( Keys . Escape ) ) ;
79+ emulator . bus . joypad . SetButton ( Joypad . Button . Start , KeyboardState . IsKeyDown ( Keys . Enter ) ) ;
80+ emulator . bus . joypad . SetButton ( Joypad . Button . Up , KeyboardState . IsKeyDown ( Keys . W ) ) ;
81+ emulator . bus . joypad . SetButton ( Joypad . Button . Down , KeyboardState . IsKeyDown ( Keys . S ) ) ;
82+ emulator . bus . joypad . SetButton ( Joypad . Button . Left , KeyboardState . IsKeyDown ( Keys . A ) ) ;
83+ emulator . bus . joypad . SetButton ( Joypad . Button . Right , KeyboardState . IsKeyDown ( Keys . D ) ) ;
8784 }
8885
8986 void DrawFrame ( )
@@ -242,7 +239,7 @@ private void TilemapWindow()
242239 byte data1 = emulator . bus . gpu . VideoRam [ tileGraphicAddress + line ] ;
243240 byte data2 = emulator . bus . gpu . VideoRam [ tileGraphicAddress + line + 1 ] ;
244241
245- byte bit = ( byte ) ( 0b00000001 << ( ( ( ( int ) x % 8 ) - 7 ) * 0xff ) ) ;
242+ byte bit = ( byte ) ( 0b00000001 << ( ( ( x % 8 ) - 7 ) * 0xff ) ) ;
246243 byte palletIndex = ( byte ) ( ( ( data2 . GetBit ( bit ) ? 1 : 0 ) << 1 ) | ( data1 . GetBit ( bit ) ? 1 : 0 ) ) ;
247244 byte colorIndex = ( byte ) ( ( emulator . bus . gpu . BGP >> palletIndex * 2 ) & 0b11 ) ;
248245 tilemapBuffer . SetPixel ( x , y , palette [ colorIndex ] ) ;
0 commit comments