|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
4: * BeBox port specific stuff
5: *
6: * (c) 1996 Christian Bauer
7: * (c) 1996 Patrick Hanevold
8: */
9:
10: extern "C" {
11: #include "sysconfig.h"
12: #include "sysdeps.h"
13: #include "config.h"
14: #include "options.h"
15: #include "memory.h"
16: #include "custom.h"
17: #include "newcpu.h"
18: #include "disk.h"
19: #include "debug.h"
20: #include "xwin.h"
21: #include "os.h"
22: #include "filesys.h"
23: #include "keybuf.h"
24: #include "keyboard.h"
25: #include "gui.h"
26: extern void usage(void);
27: extern void parse_cmdline(int,char**);
28: extern unsigned long frametime,timeframes;
29: }
30:
31: class UAEWindow;
32: class BitmapView;
33: class Emulator;
34:
35:
36: /*
37: * The BeOS application object
38: */
39:
40: class UAE : public BApplication {
41: public:
42: UAE();
43: virtual void ArgvReceived(int argc, char **argv);
44: virtual void ReadyToRun(void);
45: virtual bool QuitRequested(void);
46: virtual void AboutRequested(void);
47: // virtual void MessageReceived(BMessage*);
48: virtual void RefsReceived(BMessage*);
49: virtual void FilePanelClosed(BMessage*);
50: void RequestFile(char*,int);
51: private:
52: BBitmap *the_bitmap;
53: UAEWindow *main_window;
54: Emulator *the_emulator;
55: };
56:
57:
58: /*
59: * The window in which the Amiga graphics are displayed, handles I/O
60: */
61:
62: class UAEWindow : public BWindow {
63: public:
64: UAEWindow(BRect frame, BBitmap *bitmap);
65: virtual bool QuitRequested(void);
66: virtual void WindowActivated(bool active);
67: virtual void MessageReceived(BMessage*);
68: private:
69: BitmapView *main_view;
70: };
71:
72: /*
73: * A simple view class for blitting a bitmap on the screen
74: */
75:
76: class BitmapView : public BView {
77: public:
78: BitmapView(BRect frame, BBitmap *bitmap);
79: virtual void Draw(BRect update);
80: virtual void KeyDown(ulong);
81: void Draw(BRect from, BRect to);
82: private:
83: BBitmap *the_bitmap;
84: };
85:
86: /*
87: * LED
88: */
89:
90: struct Color{
91: int R;
92: int G;
93: int B;
94: };
95:
96: class LEDView : public BView {
97: public:
98: LEDView(BRect,int,int,int,int,int,int);
99: virtual void AttachedToWindow(void);
100: virtual void Draw(BRect);
101: void SetState(bool);
102: private:
103: void Refresh(void);
104: BRect bounds;
105: Color ActiveColor;
106: Color IdleColor;
107: bool State;
108: };
109:
110: /*
111: * Meter
112: */
113:
114: class MeterView : public BView {
115: public:
116: MeterView(BRect);
117: virtual void AttachedToWindow(void);
118: virtual void Draw(BRect);
119: virtual void Pulse(void);
120: private:
121: void Refresh(void);
122: BRect bounds;
123: };
124:
125: /*
126: * For running the emulation in its own thread
127: */
128:
129: class Emulator {
130: public:
131: Emulator() {thread_running = FALSE;}
132: void Run(void);
133: void Quit(void);
134:
135: private:
136: static long thread_invoc(void*); //Emulator *obj);
137: void thread_func(void);
138:
139: thread_id the_thread;
140: bool thread_running;
141: };
142:
143:
144: // Keyboard and mouse
145: int buttonstate[3];
146: int newmousecounters;
147: int lastmx, lastmy;
148:
149: key_info old_key_info;
150: bool inwindow;
151: bool window_open;
152:
153: struct Event{
154: Event *Next;
155: int Age;
156: char Key;
157: };
158:
159: Event *CurentEvent,*LastEvent;
160:
161: // Color map and bitmap
162: xcolnr xcolors[4096];
163: struct vidbuf_description gfxvidinfo;
164:
165: int vsize, hsize, hpixels;
166:
167: BitmapView *bitmap_view;
168: UAEWindow *bitmap_window;
169:
170:
171: // Array for converting Be keycodes to Amiga keycodes
172: int keycode2amiga[128] = {
173: -1, AK_ESC, AK_F1, AK_F2, AK_F3, AK_F4, AK_F5, AK_F6,
174: AK_F7, AK_F8, AK_F9, AK_F10, AK_LALT, AK_mousestuff, AK_RALT, -1,
175:
176: -1, AK_BACKQUOTE, AK_1, AK_2, AK_3, AK_4, AK_5, AK_6,
177: AK_7, AK_8, AK_9, AK_0, AK_MINUS, AK_EQUAL, AK_BS, AK_HELP,
178:
179: AK_NPLPAREN, AK_RAMI, AK_NPLPAREN, AK_NPDIV, AK_NPMUL, AK_NPSUB, AK_TAB, AK_Q,
180: AK_W, AK_E, AK_R, AK_T, AK_Y, AK_U, AK_I, AK_O,
181:
182: AK_P, AK_LBRACKET, AK_RBRACKET, AK_BACKSLASH, AK_DEL, AK_NPRPAREN, AK_LAMI, AK_NP7,
183: AK_NP8, AK_NP9, AK_NPADD, AK_CAPSLOCK, AK_A, AK_S, AK_D, AK_F,
184:
185: AK_G, AK_H, AK_J, AK_K, AK_L, AK_SEMICOLON, AK_QUOTE, AK_RET,
186: AK_NP4, AK_NP5, AK_NP6, AK_LSH, AK_Z, AK_X, AK_C, AK_V,
187:
188: AK_B, AK_N, AK_M, AK_COMMA, AK_PERIOD, AK_SLASH, AK_RSH, AK_UP,
189: AK_NP1, AK_NP2, AK_NP3, AK_ENT, AK_CTRL, AK_LAMI, AK_SPC, AK_RAMI,
190:
191: AK_RALT, AK_LF, AK_DN, AK_RT, AK_NP0, AK_NPDEL, AK_LALT, AK_RALT,
192: AK_LTGT, -1, -1, -1, -1, -1, -1, -1,
193:
194: -1, -1, -1, -1, -1, -1, -1, -1,
195: -1, -1, -1, -1, -1, -1, -1, -1
196: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.