Commit f6a9a66

Nick committed on
Organize project dir
commit f6a9a66f056cab966912a54fa9f929a8330d8f0b parent 3b4a8af
11 changed files +1−210
DeletedGameboy.lpr +0−209
@@ -1,209 +0,0 @@
1 program Gameboy;
2
3 {$MODE Delphi}
4
5 uses
6 directdraw in 'DirectX\directdraw.pas',
7 dxCommon in 'DirectX\dxCommon.pas',
8 ddraw_out in 'GPU\DDraw_out.pas',
9 dib_out in 'GPU\dib_out.pas',
10 vars in 'Global\Vars.pas',
11 gfx in 'GPU\gfx.pas',
12 z80Cpu in 'CPU\z80cpu.pas',
13 machine in 'CPU\Machine.pas',
14 debugger in 'Debugger\Debugger.pas',
15 sound in 'Sound\Sound.pas',
16 mainloop,
17 Messages,
18 Windows,
19 SysUtils;
20
21 const
22 game: string = '';
23
24 {$R *.res}
25
26 procedure displaydebugger(h_wnd: HWND);
27 var
28 hdc: HWND;
29 s: string;
30 begin
31 hdc := GetDC(h_wnd);
32 SetBkMode(hdc, TRANSPARENT);
33 SetTextColor(hdc, rgb(255, 255, 255));
34
35 disassemble(s, pc.w);
36 s := 'PC=' + inttohex(pc.w, 2) + ' - ' + s + #0;
37 textout(hdc, 0, 0, @s[1], length(s) - 1);
38 s := 'BC=' + inttohex(bc.w, 2) + ',DE=' + inttohex(de.w, 2) + ',HL=' + inttohex(hl.w, 2);
39 textout(hdc, 0, 15, @s[1], length(s) - 1);
40 end;
41
42 procedure ShowMessage(Msg: string);
43 begin
44 msg := msg + #0;
45 MessageBox(HWND_DESKTOP, @msg[1], 'Gameboy-Emulator', MB_OK or
46 MB_ICONEXCLAMATION or MB_SYSTEMMODAL);
47 end;
48
49 var
50 g_bactive: boolean;
51
52 function WindowProc(h_Wnd: HWND; aMSG: cardinal; wParam: cardinal;
53 lParam: integer): integer; stdcall;
54 var
55 r: trect;
56 begin
57 case aMSG of
58 // Pause if minimized
59 WM_ACTIVATE:
60 begin
61 if HIWORD(wParam) = 0 then
62 g_bActive := True
63 else
64 g_bActive := False;
65 Result := 0;
66 Exit;
67 end;
68
69 // allow user to move the window :)
70 WM_NCHITTEST: if (DefWindowProc(h_wnd, aMsg, wParam, lParam) = HTCLIENT)
71 then
72 begin
73 Result := HTCAPTION;
74 exit;
75 end;
76 WM_CREATE:
77 begin
78 start_dx(h_Wnd);
79 make_pix;
80
81 z80_reset;
82 setzewindow(h_Wnd);
83 th := CreateThread(nil, 0, @main_loop, nil, 0, tid);
84 Sleep(100);
85 GetClientRect(h_Wnd, R);
86 DW := 320 - (R.right - R.left);
87 DH := 288 - (R.bottom - R.top);
88 MoveWindow(h_Wnd, 50, 50, 320 + DW, 288 + DH, True);
89 if (cart <> nil) then
90 freemem(cart, cartsize);
91
92 z80_reset;
93 if paramcount > 0 then
94 game := ParamStr(1);
95 load(game);
96 //enablesound;
97 z80_reset;
98 z80_reset;
99 f_stopped := False;
100 end;
101
102 // Clean up and close the app
103 WM_DESTROY:
104 begin
105 f_stopped := True;
106 sleep(100);
107 ReleaseAllObjects;
108 PostQuitMessage(0);
109 Result := 0;
110 Exit;
111 end;
112 // Handle any non-accelerated key commands
113 WM_KEYDOWN:
114 begin
115 case wParam of
116 VK_ESCAPE,
117 VK_F12:
118 begin
119 PostMessage(h_Wnd, WM_CLOSE, 0, 0);
120 Result := 0;
121 Exit;
122 end;
123 Ord('Y'), Ord('Z'): k_b := 0;
124 Ord('X'): k_a := 0;
125 Ord('A'): k_start := 0;
126 Ord('S'): k_select := 0;
127 Ord('R'): z80_reset;
128 Ord('P'): f_stopped := not f_stopped;
129
130 VK_UP: k_up := 0;
131 VK_DOWN: k_down := 0;
132 VK_LEFT: k_left := 0;
133 VK_RIGHT: k_right := 0;
134
135 VK_TAB: displayDebugger(h_Wnd);
136 VK_F1: ShowMessage('M.o.G.E (C) 2000 Christian Hackbart'#13 +
137 'www.tu-ilmenau.de/~hackbart'#13#13 +
138 'Keys:'#13 +
139 'R - Reset, P - Pause,'#13 +
140 'S - Select, A - Start,'#13 +
141 'X/Y - Button A/B');
142 end;
143 end;
144 // Turn off the cursor since this is a full-screen app
145 VK_ESCAPE: PostMessage(h_Wnd, WM_DESTROY, 0, 0);
146 WM_KEYUP:
147 case wparam of
148 Ord('Y'), Ord('Z'): k_b := 1;
149 Ord('X'): k_a := 1;
150 Ord('A'): k_start := 1;
151 Ord('S'): k_select := 1;
152 VK_UP: k_up := 1;
153 VK_DOWN: k_down := 1;
154 VK_LEFT: k_left := 1;
155 VK_RIGHT: k_right := 1;
156 end;
157 end;
158 Result := DefWindowProc(h_Wnd, aMSG, wParam, lParam);
159 end;
160
161 function WinMain(in1: thandle; winm: integer): integer;
162 var
163 mess: msg;
164 wndcl: wndclass;
165 h_Wnd: Hwnd;
166 begin
167 Result := mess.wParam;
168
169 // Set up and register window class
170 wndcl.style := CS_HREDRAW or CS_VREDRAW;
171 wndcl.hbrBackground := HBRUSH(COLOR_WINDOW + 1);
172 wndcl.lpfnWndProc := @WindowProc;
173 wndcl.cbClsExtra := 0;
174 wndcl.cbWndExtra := 0;
175 wndcl.hInstance := in1;
176 wndcl.hIcon := 0; // LoadIcon(in1, 'MAINICON');
177 wndcl.hCursor := LoadCursor(0, IDC_ARROW);
178 wndcl.hbrBackground := GetStockObject(BLACK_BRUSH);
179 wndcl.lpszMenuName := nil;
180 wndcl.lpszClassName := 'Gameboy';
181 RegisterClass(wndcl);
182
183 // Create a window
184 h_Wnd := CreateWindowEx(//WS_EX_CLIENTEDGE,
185 WS_EX_TOPMOST, 'Gameboy',
186 'Gameboy', WS_POPUP or
187 WS_THICKFRAME or WS_SYSMENU or WS_MAXIMIZEBOX or WS_MINIMIZEBOX,
188 //WS_SIZEBOX or WS_OVERLAPPEDWINDOW or WS_VISIBLE,
189 50, 50, 160 * 2, 144 * 2, 0,
190 0, in1, nil);
191 ShowWindow(h_Wnd, winm);
192 UpdateWindow(h_Wnd);
193 while GetMessage(mess, 0, 0, 0) do
194 DispatchMessage(mess);
195 f_stopped := True;
196 thr_f := 0;
197 Sleep(100);
198 end;
199
200
201 begin
202 if paramcount = 0 then
203 begin
204 ShowMessage('Usage:' + ParamStr(0) + ' [romname]');
205 halt;
206 end;
207 if winmain(GetModuleHandle(nil), SW_SHOW) <> 0 then
208 Exit;
209 end.
RenamedManual.docx → Resources/docs/Manual.docx +0−0
File metadata changed without textual changes.
Renamedgb_note_table.xlsx → Resources/docs/gb_note_table.xlsx +0−0
File metadata changed without textual changes.
RenamedPIXELITE.FON → Resources/fonts/PIXELITE.FON +0−0
File metadata changed without textual changes.
RenamedPixeliteTTF.sfd → Resources/fonts/PixeliteTTF.sfd +0−0
File metadata changed without textual changes.
RenamedPixeliteTTF.ttf → Resources/fonts/PixeliteTTF.ttf +0−0
File metadata changed without textual changes.
RenamedhUGE Logo.ai → Resources/graphics/hUGE Logo.ai +0−0
File metadata changed without textual changes.
RenamedhUGE Logo.svg → Resources/graphics/hUGE Logo.svg +0−0
File metadata changed without textual changes.
ModifiedhUGEDriver +1−1
@@ -1 +1 @@
1 Subproject commit c29e7ab779f986d6bb944cd8ff4208eac9dc5594 1 Subproject commit 3425ea80ffb4dab6320e206b5938999f2fc41b49