--- uae/src/NeXTwin.m 2018/04/24 16:39:08 1.1.1.2 +++ uae/src/NeXTwin.m 2018/04/24 16:40:02 1.1.1.3 @@ -6,7 +6,7 @@ * * Copyright 1995, 1996 Bernd Schmidt * Copyright 1996 Ed Hanway, Andre Beck - * Copyright 1996 Ian Stephenson + * Copyright 1996-97 Ian Stephenson */ #include "sysconfig.h" @@ -16,12 +16,17 @@ #include "config.h" #include "options.h" +#include "threaddep/penguin.h" +#include "uae.h" #include "memory.h" #include "custom.h" +#include "readcpu.h" #include "newcpu.h" #include "xwin.h" #include "keyboard.h" #include "keybuf.h" +#include "gui.h" +#include "debug.h" // If you are compiling on NeXTStep 3.2, uncomment the following line: //#define NX_EightBitRGBDepth 514 @@ -37,8 +42,6 @@ void setup_brkhandler(void) } -struct vidbuf_description gfxvidinfo; - /* Keyboard and mouse */ static BOOL keystate[256]; @@ -46,11 +49,6 @@ int commandKey = -1; int quit_program; -int buttonstate[3]; -int lastmx, lastmy; -int newmousecounters; -long int xcolors[4096]; - static NXCursor *cursor; static View *screen; @@ -88,19 +86,18 @@ static int keycode2amiga(NXEvent * theEv @implementation AmigaView -reset:sender { - m68k_reset(); + uae_reset(); + //m68k_reset(); return self; } -quit:sender { - broken_in = TRUE; - regs.spcflags |= SPCFLAG_BRK; - quit_program = 1; + uae_quit(); return self; } -joystick:sender { - fake_joystick=[sender state]; + currprefs.fake_joystick=[sender state]; return self; } -eject:sender @@ -238,7 +235,7 @@ static int keycode2amiga(NXEvent * theEv - resetCursorRects { NXRect visible; - + if ([self getVisibleRect:&visible]) @@ -284,6 +281,7 @@ void flush_block (int ystart, int ystop) void flush_screen (int from, int to) { + //printf("Flush Screen:%d->%d\n", from, to); return; //This simple version is no longer required... [screen lockFocus]; @@ -294,19 +292,25 @@ void flush_screen (int from, int to) void flush_line(int y) { - + //printf("Flush Line:%d\n", y); return; } +int graphics_setup(void) +{ + return 1; +} int graphics_init(void) { - int i; - NXRect rect; + int i; + NXRect rect; quit_program = NO; - fake_joystick = NO; - + currprefs.fake_joystick = NO; + + gfxvidinfo.can_double = 0; + [Application new]; if (![NXApp loadNibSection:"Uae.nib" owner:NXApp withNames:NO]) { @@ -407,7 +411,7 @@ int graphics_init(void) //Bernd won't support special code just for us NeXTStation owners //and I don't have time any more, //So we have to use 8bit, and dither :-( - //On the brigh side, it looks great (eventually!) + //On the bright side, it looks great (eventually!) case NX_TwoBitGrayDepth: { for(i = 0; i < 4096; i++) @@ -437,13 +441,16 @@ int graphics_init(void) } #endif } - gfxvidinfo.rowbytes=[bitmap bytesPerRow]; gfxvidinfo.bufmem=[bitmap data]; - gfxvidinfo.maxblocklines = 1000; /* whatever...??? */ - gfxvidinfo.maxlinetoscr = 0; - gfxvidinfo.x_adjust = 0; - gfxvidinfo.maxline = 100000; /* ??? */ - + gfxvidinfo.linemem = NULL; + gfxvidinfo.rowbytes=[bitmap bytesPerRow]; + gfxvidinfo.width = 800; + gfxvidinfo.height = (313-29); /* ??? */ + gfxvidinfo.maxblocklines = (313-29); /* ??? */ + + gfxvidinfo.can_double = FALSE; + + newmousecounters = 0; return 1; } @@ -451,8 +458,8 @@ int graphics_init(void) void graphics_leave(void) { -[bitmap free]; -[NXApp free]; + //[bitmap free]; + //[NXApp free]; } @@ -482,9 +489,9 @@ static int keycode2amiga(NXEvent * theEv switch ((char)(theEvent->data.key.charCode)) { case '0': return AK_NP0; - case '1': return fake_joystick?AK_LAMI:AK_NP1; + case '1': return currprefs.fake_joystick?AK_LAMI:AK_NP1; case '2': return AK_NP2; - case '3': return fake_joystick?AK_RAMI:AK_NP3; + case '3': return currprefs.fake_joystick?AK_RAMI:AK_NP3; case '4': return AK_NP4; case '5': return AK_NP5; case '6': return AK_NP6; @@ -532,7 +539,7 @@ static int keycode2amiga(NXEvent * theEv case '7':case '&': return AK_7; case '8':case '*': return AK_8; case '9':case '(': return AK_9; - + case ';': case ':': return AK_SEMICOLON; @@ -543,7 +550,7 @@ static int keycode2amiga(NXEvent * theEv case '=': case '+': return AK_EQUAL; case '[': case '{': return AK_LBRACKET; case ']': case '}': return AK_RBRACKET; - + case 127: return AK_BS; @@ -565,16 +572,16 @@ static int keycode2amiga(NXEvent * theEv void handle_events(void) { NXEvent dummy; // used for throwaway checks - NXPoint mouseLoc; + NXPoint mouseLoc; //Update Mouse Position - [[screen window] getMouseLocation:&mouseLoc]; - [screen convertPoint:&mouseLoc fromView:nil]; + [[screen window] getMouseLocation:&mouseLoc]; + [screen convertPoint:&mouseLoc fromView:nil]; + lastmx=mouseLoc.x; lastmy=(313-29)-mouseLoc.y; //COMMAND'd keypresses do not generate key ups! - //(at least not on my system - Black3.2) //We therefore have to fake the key up... if(commandKey != -1) { @@ -608,28 +615,32 @@ void LED(int on) //Keep X gui happy! -int gui_init(void) +void gui_changesettings(void) { -} -void gui_exit(void) +} +int gui_update(void) { + return 0; } -void gui_led(int led, int on) +int gui_init(void) { } -void gui_filename(int num, char *name) +void gui_exit(void) { } -void calc_adjustment(void) +void gui_led(int led, int on) { - gfxvidinfo.x_adjust = 0; } -void target_specific_usage(void) +void gui_filename(int num, const char *name) { } +void write_log (const char *buf) +{ + fprintf (stderr, buf); +}