--- uae/src/NeXTwin.m 2018/04/24 16:38:39 1.1 +++ 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,21 +16,31 @@ #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 -void setup_brkhandler(void) +int sigbrkhandler() { + activate_debugger(); + signal(SIGINT, sigbrkhandler); } -// If you are compiling on NeXTStep 3.2, uncomment the following line: -// #define NX_EightBitRGBDepth 514 +void setup_brkhandler(void) +{ + signal(SIGINT, sigbrkhandler); +} -struct vidbuf_description gfxvidinfo; /* Keyboard and mouse */ @@ -39,11 +49,6 @@ int commandKey = -1; int quit_program; -BOOL buttonstate[3]; -int lastmx, lastmy; -BOOL newmousecounters; -long int xcolors[4096]; - static NXCursor *cursor; static View *screen; @@ -81,19 +86,18 @@ static int keycode2amiga(NXEvent * theEv @implementation AmigaView -reset:sender { - MC68000_reset(); + uae_reset(); + //m68k_reset(); return self; } -quit:sender { - broken_in = TRUE; - specialflags |= SPCFLAG_BRK; - quit_program = 1; + uae_quit(); return self; } -joystick:sender { - fake_joystick=[sender state]; + currprefs.fake_joystick=[sender state]; return self; } -eject:sender @@ -231,7 +235,7 @@ static int keycode2amiga(NXEvent * theEv - resetCursorRects { NXRect visible; - + if ([self getVisibleRect:&visible]) @@ -275,8 +279,9 @@ void flush_block (int ystart, int ystop) [tmpBitmap free]; } -void flush_screen (void) +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]; @@ -287,19 +292,25 @@ void flush_screen (void) void flush_line(int y) { - + //printf("Flush Line:%d\n", y); return; } +int graphics_setup(void) +{ + return 1; +} -void graphics_init(void) +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]) { @@ -310,7 +321,8 @@ void graphics_init(void) [NXApp run]; screen=[NXApp delegate]; - + [NXApp setDelegate:nil]; + [[screen window] addToEventMask:NX_RMOUSEDOWNMASK|NX_RMOUSEUPMASK]; cursor=[[NXCursor alloc] initFromImage:[NXImage findImageNamed:"dummy"]]; @@ -366,6 +378,8 @@ void graphics_init(void) break; } case NX_EightBitGrayDepth: + case NX_TwoBitGrayDepth: + default: { for(i = 0; i < 4096; i++) { @@ -392,8 +406,13 @@ void graphics_init(void) gfxvidinfo.pixbytes=1; break; } +#if 0 + //Sorry 2bit screeners (self included!) + //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 bright side, it looks great (eventually!) case NX_TwoBitGrayDepth: - default: { for(i = 0; i < 4096; i++) { @@ -420,21 +439,27 @@ void graphics_init(void) ]; gfxvidinfo.pixbytes=0; //bit of a hack!... } +#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; } void graphics_leave(void) { -[bitmap free]; -[NXApp free]; + //[bitmap free]; + //[NXApp free]; } @@ -464,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; @@ -514,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; @@ -525,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; @@ -547,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) { @@ -573,12 +598,12 @@ void handle_events(void) } } -BOOL debuggable(void) +int debuggable(void) { return TRUE; } -BOOL needmousehack(void) +int needmousehack(void) { return TRUE; } @@ -590,27 +615,32 @@ void LED(int on) //Keep X gui happy! -int gui_init(void) +void gui_changesettings(void) { + +} +int gui_update(void) +{ + return 0; } -void gui_exit(void) +int gui_init(void) { } -void gui_led(int led, int on) +void gui_exit(void) { } -void gui_filename(int num, char *name) +void gui_led(int led, int on) { } -void calc_adjustment(void) +void gui_filename(int num, const char *name) { - gfxvidinfo.x_adjust = 0; } -void target_specific_usage(void) +void write_log (const char *buf) { + fprintf (stderr, buf); }