Replace Tmem_nasm.asm with C++ code. Patch by pyro.
[Glide64.git] / Config.cpp
blob3da4fcbd66ca0b633f4b17ba454c128fb3553274
1 /*
2 * Glide64 - Glide video plugin for Nintendo 64 emulators.
3 * Copyright (c) 2002 Dave2001
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //****************************************************************
22 // Glide64 - Glide Plugin for Nintendo 64 emulators (tested mostly with Project64)
23 // Project started on December 29th, 2001
25 // To modify Glide64:
26 // * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
27 // * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
29 // Official Glide64 development channel: #Glide64 on EFnet
31 // Original author: Dave2001 (Dave2999@hotmail.com)
32 // Other authors: Gonetz, Gugaman
34 //****************************************************************
36 #include "Gfx1.3.h"
38 #ifdef _WIN32
40 #include "resource.h"
41 #include "ToolTips.h"
43 PROPSHEETHEADER m_PropSheet;
44 PROPSHEETPAGE m_psp[3];
46 /******************************************************************
47 Function: DllConfig
48 Purpose: This function is optional function that is provided
49 to allow the user to configure the dll
50 input: a handle to the window that calls this function
51 output: none
52 *******************************************************************/
53 void CALL DllConfig ( HWND hParent )
55 ReadSettings ();
56 if (romopen)
58 char name[21] = "DEFAULT";
59 ReadSpecialSettings (name);
61 // get the name of the ROM
62 for (int i=0; i<20; i++)
63 name[i] = gfx.HEADER[(32+i)^3];
64 name[20] = 0;
66 // remove all trailing spaces
67 while (name[strlen(name)-1] == ' ')
68 name[strlen(name)-1] = 0;
70 ReadSpecialSettings (name);
72 m_PropSheet.hwndParent = hParent;
73 if (PropertySheet(&m_PropSheet))
75 // re-init evoodoo graphics to resize window
76 if (evoodoo && fullscreen && !ev_fullscreen) {
77 ReleaseGfx ();
78 InitGfx (TRUE);
85 // ConfigProc - window proceedure for the configuration dialog
87 BOOL CALLBACK ConfigPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
89 switch (uMsg)
91 case WM_NOTIFY:
92 switch (((NMHDR FAR *) lParam)->code) {
93 #ifdef USE_TOOLTIPS
94 case PSN_SETACTIVE:
95 if (!g_hhk)
97 g_hwndDlg = hwndDlg;
98 g_hinst = hInstance;
99 g_hwndTT = NULL;
100 DoCreateDialogTooltip ();
102 break;
103 case TTN_NEEDTEXT:
104 OnWMNotify (lParam);
105 break;
106 case PSN_KILLACTIVE:
107 case PSN_QUERYCANCEL:
108 //user clicked OK or selected another page
109 if (g_hwndDlg == hwndDlg)
111 if (g_hhk) UnhookWindowsHookEx (g_hhk);
112 g_hhk = NULL;
113 g_hwndTT = NULL;
114 g_hwndDlg = NULL;
116 break;
117 #endif
118 case PSN_APPLY:
119 // Save the resolution
120 HWND hwndRes = GetDlgItem (hwndDlg, IDC_RESOLUTION);
121 settings.res_data = SendMessage (hwndRes, CB_GETCURSEL, 0, 0);
122 HWND hwndWireframe = GetDlgItem (hwndDlg, IDC_WIREFRAME);
123 settings.wireframe = (SendMessage (hwndWireframe, BM_GETCHECK, 0, 0)==BST_CHECKED)?1:0;
124 HWND hwndWfmode = GetDlgItem (hwndDlg, IDC_WFMODE);
125 settings.wfmode = SendMessage (hwndWfmode, CB_GETCURSEL, 0, 0);
126 HWND hwndU = GetDlgItem (hwndDlg, IDC_UCODE);
127 settings.ucode = SendMessage (hwndU, CB_GETCURSEL, 0, 0);
129 // Actually set the new resolution numbers
130 settings.scr_res_x = settings.res_x = resolutions[settings.res_data][0];
131 settings.scr_res_y = settings.res_y = resolutions[settings.res_data][1];
133 // Rendering
134 // Filter modes
135 settings.filtering = (BYTE)SendMessage (GetDlgItem (hwndDlg, IDC_FILTER),
136 CB_GETCURSEL, 0, 0);
137 // Buffer swapping modes
138 settings.swapmode = (BYTE)SendMessage (GetDlgItem (hwndDlg, IDC_SWAP),
139 CB_GETCURSEL, 0, 0);
140 //LOD calculation modes
141 settings.lodmode = (BYTE)SendMessage (GetDlgItem (hwndDlg, IDC_LOD),
142 CB_GETCURSEL, 0, 0);
146 #define GETBN(id,var) var=((SendMessage(GetDlgItem(hwndDlg,id),BM_GETCHECK,0,0)==BST_CHECKED)?1:0)
148 GETBN (IDC_BUFFERCLEAR, settings.buff_clear);
150 // Autodetect
151 GETBN (IDC_AUTODETECT, settings.autodetect_ucode);
153 // Glide card #
154 if (SendMessage (GetDlgItem (hwndDlg, IDC_GID1),
155 BM_GETCHECK, 0, 0)==BST_CHECKED)
156 settings.card_id = 0;
157 if (SendMessage (GetDlgItem (hwndDlg, IDC_GID2),
158 BM_GETCHECK, 0, 0)==BST_CHECKED)
159 settings.card_id = 1;
160 if (SendMessage (GetDlgItem (hwndDlg, IDC_GID3),
161 BM_GETCHECK, 0, 0)==BST_CHECKED)
162 settings.card_id = 2;
163 if (SendMessage (GetDlgItem (hwndDlg, IDC_GID4),
164 BM_GETCHECK, 0, 0)==BST_CHECKED)
165 settings.card_id = 3;
167 GETBN (IDC_WRAP_BIG_TEX, settings.wrap_big_tex);
168 GETBN (IDC_CORONA, settings.flame_corona);
169 //GETBN (IDC_RE2_VIDEO, settings.RE2_native_video);
171 GETBN (IDC_FOG, settings.fog);
172 GETBN (IDC_VSYNC, settings.vsync);
173 GETBN (IDC_CRC, settings.fast_crc);
175 GETBN (IDC_FB_READ_ALWAYS, settings.fb_read_always);
176 GETBN (IDC_FB_INFO, settings.fb_get_info);
177 GETBN (IDC_FB_ALPHA, settings.fb_read_alpha);
178 GETBN (IDC_FB_SMART, settings.fb_smart);
179 GETBN (IDC_ENABLEMB, settings.fb_motionblur);
180 GETBN (IDC_HIRESFB, settings.fb_hires);
181 GETBN (IDC_DB_CLEAR, settings.fb_depth_clear);
182 GETBN (IDC_DB_RENDER, settings.fb_depth_render);
184 GETBN (IDC_CUSTOM, settings.custom_ini);
185 GETBN (IDC_HOTKEYS, settings.hotkeys);
187 WriteSettings ();
188 if (g_hwndDlg == hwndDlg)
190 #ifdef USE_TOOLTIPS
191 if (g_hhk) UnhookWindowsHookEx (g_hhk);
192 g_hhk = NULL;
193 #endif
194 g_hwndDlg = NULL;
196 break;
198 return 0;
200 case WM_INITDIALOG:
202 // Add the video modes to the list
203 HWND hwndRes = GetDlgItem (hwndDlg, IDC_RESOLUTION);
205 #define ADDRES(s,x) SendMessage(hwndRes,CB_ADDSTRING,0,(LPARAM)s);
207 // MUST be in this order (SST1VID.H)
208 ADDRES ("320x200", 0x00);
209 ADDRES ("320x240", 0x01);
210 ADDRES ("400x256", 0x02);
211 ADDRES ("512x384", 0x03);
212 ADDRES ("640x200", 0x04);
213 ADDRES ("640x350", 0x05);
214 ADDRES ("640x400", 0x06);
215 ADDRES ("640x480", 0x07);
216 ADDRES ("800x600", 0x08);
217 ADDRES ("960x720", 0x09);
218 ADDRES ("856x480", 0x0A);
219 ADDRES ("512x256", 0x0B);
220 ADDRES ("1024x768", 0x0C);
221 ADDRES ("1280x1024", 0x0D);
222 ADDRES ("1600x1200", 0x0E);
223 ADDRES ("400x300", 0x0F);
224 ADDRES ("1152x864", 0x10);
225 ADDRES ("1280x960", 0x11);
226 ADDRES ("1600x1024", 0x12);
227 ADDRES ("1792x1344", 0x13);
228 ADDRES ("1856x1392", 0x14);
229 ADDRES ("1920x1440", 0x15);
230 ADDRES ("2048x1536", 0x16);
231 ADDRES ("2048x2048", 0x17);
232 SendMessage (hwndRes, CB_SETCURSEL, settings.res_data, 0);
234 HWND hwndWireframe = GetDlgItem (hwndDlg, IDC_WIREFRAME);
235 SendMessage (hwndWireframe, BM_SETCHECK, settings.wireframe?BST_CHECKED:BST_UNCHECKED, 0);
236 HWND hwndWfmode = GetDlgItem (hwndDlg, IDC_WFMODE);
237 SendMessage (hwndWfmode, CB_ADDSTRING, 0, (LPARAM)"Original colors");
238 SendMessage (hwndWfmode, CB_ADDSTRING, 0, (LPARAM)"Vertex colors");
239 SendMessage (hwndWfmode, CB_ADDSTRING, 0, (LPARAM)"Red only");
240 SendMessage (hwndWfmode, CB_SETCURSEL, settings.wfmode, 0);
242 HWND hwndU = GetDlgItem (hwndDlg, IDC_UCODE);
243 SendMessage (hwndU, CB_ADDSTRING, 0, (LPARAM)"0: RSP SW 2.0X (ex. Mario)");
244 SendMessage (hwndU, CB_ADDSTRING, 0, (LPARAM)"1: F3DEX 1.XX (ex. Star Fox)");
245 SendMessage (hwndU, CB_ADDSTRING, 0, (LPARAM)"2: F3DEX 2.XX (ex. Zelda OOT)");
246 SendMessage (hwndU, CB_ADDSTRING, 0, (LPARAM)"3: RSP SW 2.0D EXT (ex. Waverace)");
247 SendMessage (hwndU, CB_ADDSTRING, 0, (LPARAM)"4: RSP SW 2.0D EXT (ex. Shadows of the Empire)");
248 SendMessage (hwndU, CB_ADDSTRING, 0, (LPARAM)"5: RSP SW 2.0 (ex. Diddy Kong Racing)");
249 SendMessage (hwndU, CB_ADDSTRING, 0, (LPARAM)"6: S2DEX 1.XX (ex. Yoshi's Story)");
250 SendMessage (hwndU, CB_ADDSTRING, 0, (LPARAM)"7: RSP SW PD Perfect Dark");
251 SendMessage (hwndU, CB_ADDSTRING, 0, (LPARAM)"8: F3DEXBG 2.08 Conker's Bad Fur Day");
252 SendMessage (hwndU, CB_SETCURSEL, settings.ucode, 0);
254 // Rendering
255 // Filter modes
256 HWND hwndFilter = GetDlgItem (hwndDlg, IDC_FILTER);
257 SendMessage (hwndFilter, CB_ADDSTRING, 0, (LPARAM)"Automatic");
258 SendMessage (hwndFilter, CB_ADDSTRING, 0, (LPARAM)"Force Bilinear");
259 SendMessage (hwndFilter, CB_ADDSTRING, 0, (LPARAM)"Force Point-sampled");
260 SendMessage (hwndFilter, CB_SETCURSEL, settings.filtering, 0);
262 // Buffer swapping modes
263 HWND hwndSwap = GetDlgItem (hwndDlg, IDC_SWAP);
264 SendMessage (hwndSwap, CB_ADDSTRING, 0, (LPARAM)"old");
265 SendMessage (hwndSwap, CB_ADDSTRING, 0, (LPARAM)"new");
266 SendMessage (hwndSwap, CB_ADDSTRING, 0, (LPARAM)"hybrid");
267 SendMessage (hwndSwap, CB_SETCURSEL, settings.swapmode, 0);
269 // LOD calculation modes modes
270 HWND hwndLOD = GetDlgItem (hwndDlg, IDC_LOD);
271 SendMessage (hwndLOD, CB_ADDSTRING, 0, (LPARAM)"off");
272 SendMessage (hwndLOD, CB_ADDSTRING, 0, (LPARAM)"fast");
273 SendMessage (hwndLOD, CB_ADDSTRING, 0, (LPARAM)"precise");
274 SendMessage (hwndLOD, CB_SETCURSEL, settings.lodmode, 0);
276 #define CHECKBN(id,set) SendMessage(GetDlgItem(hwndDlg,id),BM_SETCHECK,(set)?BST_CHECKED:BST_UNCHECKED, 0);
278 CHECKBN (IDC_BUFFERCLEAR, settings.buff_clear);
280 // Autodetect
281 CHECKBN (IDC_AUTODETECT, settings.autodetect_ucode);
283 // Glide card #
284 CHECKBN (IDC_GID1, settings.card_id==0);
285 CHECKBN (IDC_GID2, settings.card_id==1);
286 CHECKBN (IDC_GID3, settings.card_id==2);
287 CHECKBN (IDC_GID4, settings.card_id==3);
290 // Special fixes
291 CHECKBN (IDC_WRAP_BIG_TEX, settings.wrap_big_tex);
292 CHECKBN (IDC_CORONA, settings.flame_corona);
293 //CHECKBN (IDC_RE2_VIDEO, settings.RE2_native_video);
295 CHECKBN (IDC_FOG, settings.fog);
296 CHECKBN (IDC_VSYNC, settings.vsync);
297 CHECKBN (IDC_CRC, settings.fast_crc);
299 //Frame buffer
300 CHECKBN (IDC_FB_READ_ALWAYS, settings.fb_read_always);
301 CHECKBN (IDC_FB_INFO, settings.fb_get_info);
302 CHECKBN (IDC_FB_ALPHA, settings.fb_read_alpha);
303 CHECKBN (IDC_FB_SMART, settings.fb_smart);
304 CHECKBN (IDC_ENABLEMB, settings.fb_motionblur);
305 CHECKBN (IDC_HIRESFB, settings.fb_hires);
306 CHECKBN (IDC_DB_CLEAR, settings.fb_depth_clear);
307 CHECKBN (IDC_DB_RENDER, settings.fb_depth_render);
309 CHECKBN (IDC_CUSTOM, settings.custom_ini);
310 CHECKBN (IDC_HOTKEYS, settings.hotkeys);
312 BOOL enable = !settings.custom_ini;
313 EnableWindow(hwndFilter, enable);
315 HWND hwndFog = GetDlgItem (hwndDlg, IDC_FOG);
316 EnableWindow(hwndFog, enable);
318 HWND hwndBuffClear = GetDlgItem (hwndDlg, IDC_BUFFERCLEAR);
319 EnableWindow(hwndBuffClear, enable);
321 EnableWindow(hwndSwap, enable);
323 HWND hwndFBSmart = GetDlgItem (hwndDlg, IDC_FB_SMART);
324 EnableWindow(hwndFBSmart, enable);
326 HWND hwndAlpha = GetDlgItem (hwndDlg, IDC_FB_ALPHA);
327 EnableWindow(hwndAlpha, enable);
329 HWND hwndFBClear = GetDlgItem (hwndDlg, IDC_DB_CLEAR);
330 EnableWindow(hwndFBClear, enable);
332 return 1;
334 case WM_COMMAND:
335 if (HIWORD(wParam) == BN_CLICKED)
337 if (LOWORD(wParam) == IDC_CUSTOM)
339 HWND hwndCustom = GetDlgItem (hwndDlg, IDC_CUSTOM);
340 BOOL enable = (SendMessage(hwndCustom, BM_GETCHECK, 0, 0) != BST_CHECKED);
342 HWND hwndFilter = GetDlgItem (hwndDlg, IDC_FILTER);
343 EnableWindow(hwndFilter, enable);
345 HWND hwndFog = GetDlgItem (hwndDlg, IDC_FOG);
346 EnableWindow(hwndFog, enable);
348 HWND hwndBuffClear = GetDlgItem (hwndDlg, IDC_BUFFERCLEAR);
349 EnableWindow(hwndBuffClear, enable);
351 HWND hwndSwap = GetDlgItem (hwndDlg, IDC_SWAP);
352 EnableWindow(hwndSwap, enable);
354 HWND hwndFBSmart = GetDlgItem (hwndDlg, IDC_FB_SMART);
355 EnableWindow(hwndFBSmart, enable);
357 HWND hwndAlpha = GetDlgItem (hwndDlg, IDC_FB_ALPHA);
358 EnableWindow(hwndAlpha, enable);
360 HWND hwndFBClear = GetDlgItem (hwndDlg, IDC_DB_CLEAR);
361 EnableWindow(hwndFBClear, enable);
363 else if (LOWORD(wParam) == IDC_WRAPPER)
365 GRCONFIGWRAPPEREXT grConfigWrapperExt = (GRCONFIGWRAPPEREXT)grGetProcAddress("grConfigWrapperExt");
366 if (grConfigWrapperExt)
367 grConfigWrapperExt(hInstance, hwndDlg);
369 else if (LOWORD(wParam) == IDC_DB_RENDER)
371 if (SendMessage(GetDlgItem (hwndDlg, IDC_DB_RENDER), BM_GETCHECK, 0, 0) == BST_CHECKED)
373 settings.fb_depth_clear = TRUE;
374 HWND hwndFBClear = GetDlgItem (hwndDlg, IDC_DB_CLEAR);
375 SendMessage(hwndFBClear, BM_SETCHECK, BST_CHECKED, 0);
376 EnableWindow(hwndFBClear, 0);
378 else
380 HWND hwndCustom = GetDlgItem (hwndDlg, IDC_CUSTOM);
381 BOOL enable = (SendMessage(hwndCustom, BM_GETCHECK, 0, 0) != BST_CHECKED);
382 HWND hwndFBClear = GetDlgItem (hwndDlg, IDC_DB_CLEAR);
383 EnableWindow(hwndFBClear, enable);
387 return 0;
390 return 0;
394 BOOL CALLBACK DebugPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
396 switch (uMsg)
398 case WM_NOTIFY:
399 switch (((NMHDR FAR *) lParam)->code) {
400 #ifdef USE_TOOLTIPS
401 case PSN_SETACTIVE:
402 if (!g_hhk)
404 g_hwndDlg = hwndDlg;
405 g_hinst = hInstance;
406 g_hwndTT = NULL;
407 DoCreateDialogTooltip ();
409 break;
410 case TTN_NEEDTEXT:
411 OnWMNotify (lParam);
412 break;
413 case PSN_KILLACTIVE:
414 case PSN_QUERYCANCEL:
415 //user clicked OK or selected another page
416 if (g_hwndDlg == hwndDlg)
418 if (g_hhk) UnhookWindowsHookEx (g_hhk);
419 g_hhk = NULL;
420 g_hwndDlg = NULL;
422 break;
423 #endif
424 case PSN_APPLY:
425 // Debug/misc options
426 GETBN (IDC_LOGGING, settings.logging);
427 GETBN (IDC_LOGCLEAR, settings.log_clear);
428 GETBN (IDC_RUNINWINDOW, settings.run_in_window);
430 GETBN (IDC_CPU_HACK, settings.cpu_write_hack);
432 GETBN (IDC_LOG_E, settings.elogging);
433 GETBN (IDC_CACHEFILTER, settings.filter_cache);
435 GETBN (IDC_UNKRED, settings.unk_as_red);
436 GETBN (IDC_LOGUNK, settings.log_unk);
437 GETBN (IDC_UNKCLEAR, settings.unk_clear);
439 WriteSettings ();
440 if (g_hwndDlg == hwndDlg)
442 #ifdef USE_TOOLTIPS
443 if (g_hhk) UnhookWindowsHookEx (g_hhk);
444 g_hhk = NULL;
445 #endif
446 g_hwndDlg = NULL;
448 break;
450 return 0;
452 case WM_INITDIALOG:
454 // Debug/misc options
455 CHECKBN (IDC_LOGGING, settings.logging);
456 CHECKBN (IDC_LOGCLEAR, settings.log_clear);
457 CHECKBN (IDC_RUNINWINDOW, settings.run_in_window);
458 CHECKBN (IDC_LOG_E, settings.elogging);
459 CHECKBN (IDC_CPU_HACK, settings.cpu_write_hack);
460 CHECKBN (IDC_CACHEFILTER, settings.filter_cache);
461 CHECKBN (IDC_UNKRED, settings.unk_as_red);
462 CHECKBN (IDC_LOGUNK, settings.log_unk);
463 CHECKBN (IDC_UNKCLEAR, settings.unk_clear);
467 return 1;
469 case WM_COMMAND:
470 return 0;
473 return 0;
477 BOOL CALLBACK StatisticsPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
479 switch (uMsg)
481 case WM_NOTIFY:
482 switch (((NMHDR FAR *) lParam)->code) {
483 #ifdef USE_TOOLTIPS
484 case PSN_SETACTIVE:
485 if (!g_hhk)
487 g_hwndDlg = hwndDlg;
488 g_hinst = hInstance;
489 g_hwndTT = NULL;
490 DoCreateDialogTooltip ();
492 break;
493 case TTN_NEEDTEXT:
494 OnWMNotify (lParam);
495 break;
496 case PSN_KILLACTIVE:
497 case PSN_QUERYCANCEL:
498 //user clicked OK or selected another page
499 if (g_hwndDlg == hwndDlg)
501 if (g_hhk) UnhookWindowsHookEx (g_hhk);
502 g_hhk = NULL;
503 g_hwndDlg = NULL;
505 break;
506 #endif
507 case PSN_APPLY:
508 // speed counters
509 settings.show_fps =
510 ((SendMessage (GetDlgItem (hwndDlg, IDC_FPS),BM_GETCHECK, 0, 0)==BST_CHECKED)?1:0) |
511 ((SendMessage (GetDlgItem (hwndDlg, IDC_FPS1),BM_GETCHECK, 0, 0)==BST_CHECKED)?2:0) |
512 ((SendMessage (GetDlgItem (hwndDlg, IDC_FPS2),BM_GETCHECK, 0, 0)==BST_CHECKED)?4:0) |
513 ((SendMessage (GetDlgItem (hwndDlg, IDC_FPS3),BM_GETCHECK, 0, 0)==BST_CHECKED)?8:0);
515 GETBN (IDC_CLOCK, settings.clock);
516 GETBN (IDC_CLOCK24, settings.clock_24_hr);
518 WriteSettings ();
519 if (g_hwndDlg == hwndDlg)
521 #ifdef USE_TOOLTIPS
522 if (g_hhk) UnhookWindowsHookEx (g_hhk);
523 g_hhk = NULL;
524 #endif
525 g_hwndDlg = NULL;
527 break;
529 return 0;
531 case WM_INITDIALOG:
533 // speed counters
534 CHECKBN (IDC_FPS, settings.show_fps&1);
535 CHECKBN (IDC_FPS1, settings.show_fps&2);
536 CHECKBN (IDC_FPS2, settings.show_fps&4);
537 CHECKBN (IDC_FPS3, settings.show_fps&8);
539 CHECKBN (IDC_CLOCK, settings.clock);
540 CHECKBN (IDC_CLOCK24, settings.clock_24_hr);
542 return 1;
544 case WM_COMMAND:
545 return 0;
548 return 0;
551 #else // _WIN32
553 #include <string.h>
554 #include <gtk/gtk.h>
556 typedef struct
558 GtkWidget *dialog;
559 GtkWidget *autodetectCheckButton;
560 GtkWidget *forceCombo;
561 GtkWidget *windowResCombo;
562 GtkWidget *fullResCombo;
563 GtkWidget *texFilterCombo;
564 GtkWidget *filterCombo;
565 GtkWidget *lodCombo;
566 GtkWidget *fogCheckButton;
567 GtkWidget *bufferClearCheckButton;
568 GtkWidget *vSyncCheckButton;
569 GtkWidget *fastcrcCheckButton;
570 GtkWidget *noDitheredAlphaCheckButton;
571 GtkWidget *noGLSLCheckButton;
572 GtkWidget *swapCombo;
573 GtkWidget *customIniCheckButton;
574 GtkWidget *wrapCheckButton;
575 GtkWidget *coronaCheckButton;
576 GtkWidget *readAllCheckButton;
577 GtkWidget *CPUWriteHackCheckButton;
578 GtkWidget *FBGetInfoCheckButton;
579 GtkWidget *DepthRenderCheckButton;
580 GtkWidget *FPSCheckButton;
581 GtkWidget *VICheckButton;
582 GtkWidget *ratioCheckButton;
583 GtkWidget *FPStransCheckButton;
584 GtkWidget *clockCheckButton;
585 GtkWidget *clock24CheckButton;
586 GtkWidget *hiresFbCheckButton;
587 GtkWidget *hiresFBOCheckButton;
588 GList *windowResComboList;
589 GList *texFilterComboList;
590 GList *forceComboList;
591 GList *filterComboList;
592 GList *lodComboList;
593 GList *swapComboList;
594 } ConfigDialog;
596 static void customIniCheckButtonCallback(GtkWidget *widget, void *data)
598 ConfigDialog *configDialog = (ConfigDialog*)data;
600 BOOL enable = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->customIniCheckButton));
601 gtk_widget_set_sensitive(configDialog->filterCombo, enable);
602 gtk_widget_set_sensitive(configDialog->lodCombo, enable);
603 gtk_widget_set_sensitive(configDialog->fogCheckButton, enable);
604 gtk_widget_set_sensitive(configDialog->bufferClearCheckButton, enable);
605 gtk_widget_set_sensitive(configDialog->swapCombo, enable);
608 static void okButtonCallback(GtkWidget *widget, void *data)
610 ConfigDialog *configDialog = (ConfigDialog*)data;
611 char *s;
612 unsigned int i;
614 s = (char*)gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->windowResCombo)->entry));
615 for (i=0; i<g_list_length(configDialog->windowResComboList); i++)
616 if(!strcmp(s, (char*)g_list_nth_data(configDialog->windowResComboList, i)))
617 settings.res_data = i;
619 s = (char*)gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->fullResCombo)->entry));
620 for (i=0; i<g_list_length(configDialog->windowResComboList); i++)
621 if(!strcmp(s, (char*)g_list_nth_data(configDialog->windowResComboList, i)))
622 settings.full_res = i;
624 s = (char*)gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->texFilterCombo)->entry));
625 for (i=0; i<g_list_length(configDialog->texFilterComboList); i++)
626 if(!strcmp(s, (char*)g_list_nth_data(configDialog->texFilterComboList, i)))
627 settings.tex_filter = i;
629 s = (char*)gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->forceCombo)->entry));
630 for (i=0; i<g_list_length(configDialog->forceComboList); i++)
631 if(!strcmp(s, (char*)g_list_nth_data(configDialog->forceComboList, i)))
632 settings.ucode = i;
634 settings.scr_res_x = settings.res_x = resolutions[settings.res_data][0];
635 settings.scr_res_y = settings.res_y = resolutions[settings.res_data][1];
637 s = (char*)gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->filterCombo)->entry));
638 for (i=0; i<g_list_length(configDialog->filterComboList); i++)
639 if(!strcmp(s, (char*)g_list_nth_data(configDialog->filterComboList, i)))
640 settings.filtering = i;
642 s = (char*)gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->lodCombo)->entry));
643 for (i=0; i<g_list_length(configDialog->lodComboList); i++)
644 if(!strcmp(s, (char*)g_list_nth_data(configDialog->lodComboList, i)))
645 settings.lodmode = i;
647 s = (char*)gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->swapCombo)->entry));
648 for (i=0; i<g_list_length(configDialog->swapComboList); i++)
649 if(!strcmp(s, (char*)g_list_nth_data(configDialog->swapComboList, i)))
650 settings.swapmode = i;
652 settings.fog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->fogCheckButton));
653 settings.buff_clear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->bufferClearCheckButton));
654 settings.autodetect_ucode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->autodetectCheckButton));
655 settings.wrap_big_tex = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->wrapCheckButton));
656 settings.flame_corona = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->coronaCheckButton));
657 settings.vsync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->vSyncCheckButton));
658 settings.fast_crc = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->fastcrcCheckButton));
659 settings.noditheredalpha = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->noDitheredAlphaCheckButton));
660 settings.noglsl = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->noGLSLCheckButton));
661 settings.fb_read_always = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->readAllCheckButton));
662 settings.cpu_write_hack = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->CPUWriteHackCheckButton));
663 settings.fb_get_info = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->FBGetInfoCheckButton));
664 settings.fb_depth_render = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->DepthRenderCheckButton));
665 settings.custom_ini = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->customIniCheckButton));
666 settings.fb_hires = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->hiresFbCheckButton));
667 settings.FBO = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->hiresFBOCheckButton));
669 settings.show_fps =
670 (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->FPSCheckButton))?1:0) |
671 (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->VICheckButton))?2:0) |
672 (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->ratioCheckButton))?4:0) |
673 (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->FPStransCheckButton))?8:0);
675 settings.clock = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->clockCheckButton));
676 settings.clock_24_hr = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->clock24CheckButton));
678 WriteSettings();
680 // re-init evoodoo graphics to resize window
681 if (evoodoo && fullscreen && !ev_fullscreen) {
682 ReleaseGfx ();
683 InitGfx (TRUE);
686 gtk_widget_hide(configDialog->dialog);
689 static ConfigDialog *CreateConfigDialog()
691 // objects dialog
692 // dialog
693 GtkWidget *dialog;
694 dialog = gtk_dialog_new();
695 gtk_window_set_title(GTK_WINDOW(dialog), "Glide64 Configuration");
697 // ok button
698 GtkWidget *okButton;
699 okButton = gtk_button_new_with_label("OK");
700 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), okButton);
702 // cancel button
703 GtkWidget *cancelButton;
704 cancelButton = gtk_button_new_with_label("Cancel");
705 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), cancelButton);
707 // Autodetect ucode CheckButton
708 GtkWidget *autodetectCheckButton;
709 autodetectCheckButton = gtk_check_button_new_with_label("Autodetect Microcode");
710 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), autodetectCheckButton);
712 // Force Microcode Container
713 GtkWidget *forceContainer;
714 forceContainer = gtk_hbox_new(TRUE, 0);
715 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), forceContainer);
717 // Force Microcode Label
718 GtkWidget *forceLabel;
719 forceLabel = gtk_label_new("Force Microcode:");
720 gtk_container_add(GTK_CONTAINER(forceContainer), forceLabel);
722 // Force Microcode Combo
723 GtkWidget *forceCombo;
724 forceCombo = gtk_combo_new();
725 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(forceCombo)->entry), FALSE);
726 gtk_container_add(GTK_CONTAINER(forceContainer), forceCombo);
728 // horizontal container
729 GtkWidget *hContainer;
730 hContainer = gtk_hbox_new(0, 0);
731 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hContainer);
733 // vertical container
734 GtkWidget *vContainer;
735 vContainer = gtk_vbox_new(0, 0);
736 gtk_container_add(GTK_CONTAINER(hContainer), vContainer);
738 // Rendering Frame
739 GtkWidget *renderingFrame;
740 renderingFrame = gtk_frame_new("Rendering");
741 gtk_container_add(GTK_CONTAINER(vContainer), renderingFrame);
743 // Rendering Container
744 GtkWidget *renderingContainer;
745 renderingContainer = gtk_vbox_new(TRUE, 0);
746 gtk_container_add(GTK_CONTAINER(renderingFrame), renderingContainer);
748 // Window Mode Resolution Container
749 GtkWidget *windowResContainer;
750 windowResContainer = gtk_hbox_new(TRUE, 0);
751 gtk_container_add(GTK_CONTAINER(renderingContainer), windowResContainer);
753 // Window Mode Resolution Label
754 GtkWidget *windowResLabel;
755 windowResLabel = gtk_label_new("Window Resolution:");
756 gtk_container_add(GTK_CONTAINER(windowResContainer), windowResLabel);
758 // Window Mode Combo
759 GtkWidget *windowResCombo;
760 windowResCombo = gtk_combo_new();
761 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(windowResCombo)->entry), FALSE);
762 gtk_container_add(GTK_CONTAINER(windowResContainer), windowResCombo);
764 // FullScreen Mode Resolution Container
765 GtkWidget *fullResContainer;
766 fullResContainer = gtk_hbox_new(TRUE, 0);
767 gtk_container_add(GTK_CONTAINER(renderingContainer), fullResContainer);
769 // FullScreen Mode Resolution Label
770 GtkWidget *fullResLabel;
771 fullResLabel = gtk_label_new("Fullscreen Resolution:");
772 gtk_container_add(GTK_CONTAINER(fullResContainer), fullResLabel);
774 // FullScreen Mode Combo
775 GtkWidget *fullResCombo;
776 fullResCombo = gtk_combo_new();
777 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(fullResCombo)->entry), FALSE);
778 gtk_container_add(GTK_CONTAINER(fullResContainer), fullResCombo);
780 // Texture Filter Container
781 GtkWidget *texFilterContainer;
782 texFilterContainer = gtk_hbox_new(TRUE, 0);
783 gtk_container_add(GTK_CONTAINER(renderingContainer), texFilterContainer);
785 // Texture Filter Label
786 GtkWidget *texFilterLabel;
787 texFilterLabel = gtk_label_new("Texture Filter:");
788 gtk_container_add(GTK_CONTAINER(texFilterContainer), texFilterLabel);
790 // Texture Filter Combo
791 GtkWidget *texFilterCombo;
792 texFilterCombo = gtk_combo_new();
793 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(texFilterCombo)->entry), FALSE);
794 gtk_container_add(GTK_CONTAINER(texFilterContainer), texFilterCombo);
796 // Filter Container
797 GtkWidget *filterContainer;
798 filterContainer = gtk_hbox_new(TRUE, 0);
799 gtk_container_add(GTK_CONTAINER(renderingContainer), filterContainer);
801 // Filter Label
802 GtkWidget *filterLabel;
803 filterLabel = gtk_label_new("Filtering mode:");
804 gtk_container_add(GTK_CONTAINER(filterContainer), filterLabel);
806 // Filter Combo
807 GtkWidget *filterCombo;
808 filterCombo = gtk_combo_new();
809 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(filterCombo)->entry), FALSE);
810 gtk_container_add(GTK_CONTAINER(filterContainer), filterCombo);
812 // LOD Container
813 GtkWidget *lodContainer;
814 lodContainer = gtk_hbox_new(TRUE, 0);
815 gtk_container_add(GTK_CONTAINER(renderingContainer), lodContainer);
817 // LOD Label
818 GtkWidget *lodLabel;
819 lodLabel = gtk_label_new("LOD calculation:");
820 gtk_container_add(GTK_CONTAINER(lodContainer), lodLabel);
822 // LOD Combo
823 GtkWidget *lodCombo;
824 lodCombo = gtk_combo_new();
825 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(lodCombo)->entry), FALSE);
826 gtk_container_add(GTK_CONTAINER(lodContainer), lodCombo);
828 // Fog CheckButton
829 GtkWidget *fogCheckButton;
830 fogCheckButton = gtk_check_button_new_with_label("Fog enabled");
831 gtk_container_add(GTK_CONTAINER(renderingContainer), fogCheckButton);
833 // Buffer Clear CheckButton
834 GtkWidget *bufferClearCheckButton;
835 bufferClearCheckButton = gtk_check_button_new_with_label("Buffer clear on every frame");
836 gtk_container_add(GTK_CONTAINER(renderingContainer), bufferClearCheckButton);
838 // Vertical Sync CheckButton
839 GtkWidget *vSyncCheckButton;
840 vSyncCheckButton = gtk_check_button_new_with_label("Vertical Sync");
841 gtk_container_add(GTK_CONTAINER(renderingContainer), vSyncCheckButton);
843 // Fast CRC CheckButton
844 GtkWidget *fastcrcCheckButton;
845 fastcrcCheckButton = gtk_check_button_new_with_label("Fast CRC");
846 gtk_container_add(GTK_CONTAINER(renderingContainer), fastcrcCheckButton);
848 // hires framebuffer CheckButton
849 GtkWidget *hiresFbCheckButton;
850 hiresFbCheckButton = gtk_check_button_new_with_label("Hires Framebuffer");
851 gtk_container_add(GTK_CONTAINER(renderingContainer), hiresFbCheckButton);
853 // Swap Container
854 GtkWidget *swapContainer;
855 swapContainer = gtk_hbox_new(TRUE, 0);
856 gtk_container_add(GTK_CONTAINER(renderingContainer), swapContainer);
858 // Swap Combo
859 GtkWidget *swapCombo;
860 swapCombo = gtk_combo_new();
861 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(swapCombo)->entry), FALSE);
862 gtk_container_add(GTK_CONTAINER(swapContainer), swapCombo);
864 // Swap Label
865 GtkWidget *swapLabel;
866 swapLabel = gtk_label_new("Buffer swapping method");
867 gtk_container_add(GTK_CONTAINER(swapContainer), swapLabel);
869 // Rendering Frame
870 GtkWidget *wrapperFrame;
871 wrapperFrame = gtk_frame_new("Glide wrapper");
872 gtk_container_add(GTK_CONTAINER(vContainer), wrapperFrame);
874 // Wrapper Container
875 GtkWidget *wrapperContainer;
876 wrapperContainer = gtk_vbox_new(TRUE, 0);
877 gtk_container_add(GTK_CONTAINER(wrapperFrame), wrapperContainer);
879 // no dithered alpha CheckButton
880 GtkWidget *noDitheredAlphaCheckButton;
881 noDitheredAlphaCheckButton = gtk_check_button_new_with_label("Disable Dithered Alpha");
882 gtk_container_add(GTK_CONTAINER(wrapperContainer), noDitheredAlphaCheckButton);
884 // no glsl CheckButton
885 GtkWidget *noGLSLCheckButton;
886 noGLSLCheckButton = gtk_check_button_new_with_label("Disable GLSL Combiners");
887 gtk_container_add(GTK_CONTAINER(wrapperContainer), noGLSLCheckButton);
889 // FBO CheckButton
890 GtkWidget *hiresFBOCheckButton;
891 hiresFBOCheckButton = gtk_check_button_new_with_label("Use Framebuffer Objects");
892 gtk_container_add(GTK_CONTAINER(wrapperContainer), hiresFBOCheckButton);
894 // Other Frame
895 GtkWidget *otherFrame;
896 otherFrame = gtk_frame_new("Other");
897 gtk_container_add(GTK_CONTAINER(vContainer), otherFrame);
899 // Custom ini CheckButton
900 GtkWidget *customIniCheckButton;
901 customIniCheckButton = gtk_check_button_new_with_label("Custom ini settings");
902 gtk_container_add(GTK_CONTAINER(otherFrame), customIniCheckButton);
904 // vertical container
905 vContainer = gtk_vbox_new(0, 0);
906 gtk_container_add(GTK_CONTAINER(hContainer), vContainer);
908 // Special Fixes Frame
909 GtkWidget *specialFrame;
910 specialFrame = gtk_frame_new("Special Fixes");
911 gtk_container_add(GTK_CONTAINER(vContainer), specialFrame);
913 // Special Fixes Container
914 GtkWidget *specialContainer;
915 specialContainer = gtk_vbox_new(TRUE, 0);
916 gtk_container_add(GTK_CONTAINER(specialFrame), specialContainer);
918 // Wrap CheckButton
919 GtkWidget *wrapCheckButton;
920 wrapCheckButton = gtk_check_button_new_with_label("Wrap textures too big for tmem");
921 gtk_container_add(GTK_CONTAINER(specialContainer), wrapCheckButton);
923 // Corona CheckButton
924 GtkWidget *coronaCheckButton;
925 coronaCheckButton = gtk_check_button_new_with_label("Zelda. Corona fix");
926 gtk_container_add(GTK_CONTAINER(specialContainer), coronaCheckButton);
928 // Frame Buffer Frame
929 GtkWidget *framebufferFrame;
930 framebufferFrame = gtk_frame_new("Frame buffer emulation options");
931 gtk_container_add(GTK_CONTAINER(vContainer), framebufferFrame);
933 // Frame Buffer Container
934 GtkWidget *framebufferContainer;
935 framebufferContainer = gtk_vbox_new(TRUE, 0);
936 gtk_container_add(GTK_CONTAINER(framebufferFrame), framebufferContainer);
938 // Read All CheckButton
939 GtkWidget *readAllCheckButton;
940 readAllCheckButton = gtk_check_button_new_with_label("Read every frame (slow!)");
941 gtk_container_add(GTK_CONTAINER(framebufferContainer), readAllCheckButton);
943 // CPU Write Hack CheckButton
944 GtkWidget *CPUWriteHackCheckButton;
945 CPUWriteHackCheckButton = gtk_check_button_new_with_label("Detect CPU writes");
946 gtk_container_add(GTK_CONTAINER(framebufferContainer), CPUWriteHackCheckButton);
948 // FB Get Info CheckButton
949 GtkWidget *FBGetInfoCheckButton;
950 FBGetInfoCheckButton = gtk_check_button_new_with_label("Get frame buffer info");
951 gtk_container_add(GTK_CONTAINER(framebufferContainer), FBGetInfoCheckButton);
953 // Depth Render CheckButton
954 GtkWidget *DepthRenderCheckButton;
955 DepthRenderCheckButton = gtk_check_button_new_with_label("Depth buffer render");
956 gtk_container_add(GTK_CONTAINER(framebufferContainer), DepthRenderCheckButton);
958 // Speed Frame
959 GtkWidget *speedFrame;
960 speedFrame = gtk_frame_new("Speed");
961 gtk_container_add(GTK_CONTAINER(vContainer), speedFrame);
963 // Speed Container
964 GtkWidget *speedContainer;
965 speedContainer = gtk_vbox_new(TRUE, 0);
966 gtk_container_add(GTK_CONTAINER(speedFrame), speedContainer);
968 // FPS CheckButton
969 GtkWidget *FPSCheckButton;
970 FPSCheckButton = gtk_check_button_new_with_label("FPS counter");
971 gtk_container_add(GTK_CONTAINER(speedContainer), FPSCheckButton);
973 // VI CheckButton
974 GtkWidget *VICheckButton;
975 VICheckButton = gtk_check_button_new_with_label("VI/s counter");
976 gtk_container_add(GTK_CONTAINER(speedContainer), VICheckButton);
978 // ratio CheckButton
979 GtkWidget *ratioCheckButton;
980 ratioCheckButton = gtk_check_button_new_with_label("% speed");
981 gtk_container_add(GTK_CONTAINER(speedContainer), ratioCheckButton);
983 // FPS trans CheckButton
984 GtkWidget *FPStransCheckButton;
985 FPStransCheckButton = gtk_check_button_new_with_label("FPS transparent");
986 gtk_container_add(GTK_CONTAINER(speedContainer), FPStransCheckButton);
988 // Time Frame
989 GtkWidget *timeFrame;
990 timeFrame = gtk_frame_new("Time");
991 gtk_container_add(GTK_CONTAINER(vContainer), timeFrame);
993 // Time Container
994 GtkWidget *timeContainer;
995 timeContainer = gtk_vbox_new(TRUE, 0);
996 gtk_container_add(GTK_CONTAINER(timeFrame), timeContainer);
998 // clock CheckButton
999 GtkWidget *clockCheckButton;
1000 clockCheckButton = gtk_check_button_new_with_label("Clock enabled");
1001 gtk_container_add(GTK_CONTAINER(timeContainer), clockCheckButton);
1003 // clock24 CheckButton
1004 GtkWidget *clock24CheckButton;
1005 clock24CheckButton = gtk_check_button_new_with_label("Clock is 24-hour");
1006 gtk_container_add(GTK_CONTAINER(timeContainer), clock24CheckButton);
1008 // Filling lists
1009 // windowResCombo list
1010 GList *windowResComboList = NULL;
1011 windowResComboList = g_list_append(windowResComboList, (void*)"320x200");
1012 windowResComboList = g_list_append(windowResComboList, (void*)"320x240");
1013 windowResComboList = g_list_append(windowResComboList, (void*)"400x256");
1014 windowResComboList = g_list_append(windowResComboList, (void*)"512x384");
1015 windowResComboList = g_list_append(windowResComboList, (void*)"640x200");
1016 windowResComboList = g_list_append(windowResComboList, (void*)"640x350");
1017 windowResComboList = g_list_append(windowResComboList, (void*)"640x400");
1018 windowResComboList = g_list_append(windowResComboList, (void*)"640x480");
1019 windowResComboList = g_list_append(windowResComboList, (void*)"800x600");
1020 windowResComboList = g_list_append(windowResComboList, (void*)"960x720");
1021 windowResComboList = g_list_append(windowResComboList, (void*)"856x480");
1022 windowResComboList = g_list_append(windowResComboList, (void*)"512x256");
1023 windowResComboList = g_list_append(windowResComboList, (void*)"1024x768");
1024 windowResComboList = g_list_append(windowResComboList, (void*)"1280x1024");
1025 windowResComboList = g_list_append(windowResComboList, (void*)"1600x1200");
1026 windowResComboList = g_list_append(windowResComboList, (void*)"400x300");
1027 windowResComboList = g_list_append(windowResComboList, (void*)"1152x864");
1028 windowResComboList = g_list_append(windowResComboList, (void*)"1280x960");
1029 windowResComboList = g_list_append(windowResComboList, (void*)"1600x1024");
1030 windowResComboList = g_list_append(windowResComboList, (void*)"1792x1344");
1031 windowResComboList = g_list_append(windowResComboList, (void*)"1856x1392");
1032 windowResComboList = g_list_append(windowResComboList, (void*)"1920x1440");
1033 windowResComboList = g_list_append(windowResComboList, (void*)"2048x1536");
1034 windowResComboList = g_list_append(windowResComboList, (void*)"2048x2048");
1035 gtk_combo_set_popdown_strings(GTK_COMBO(windowResCombo),
1036 windowResComboList);
1038 // fullResCombo list
1039 gtk_combo_set_popdown_strings(GTK_COMBO(fullResCombo), windowResComboList);
1041 // texFilterCombo list
1042 GList *texFilterComboList = NULL;
1043 texFilterComboList = g_list_append(texFilterComboList, (void*)"None");
1044 texFilterComboList = g_list_append(texFilterComboList, (void*)"Blur edges");
1045 texFilterComboList = g_list_append(texFilterComboList, (void*)"Super 2xSai");
1046 texFilterComboList = g_list_append(texFilterComboList, (void*)"Hq2x");
1047 texFilterComboList = g_list_append(texFilterComboList, (void*)"Hq4x");
1048 gtk_combo_set_popdown_strings(GTK_COMBO(texFilterCombo),
1049 texFilterComboList);
1051 // forceCombo list
1052 GList *forceComboList = NULL;
1053 forceComboList = g_list_append(forceComboList, (void*)"0: RSP SW 2.0X (ex. Mario)");
1054 forceComboList = g_list_append(forceComboList, (void*)"1: F3DEX 1.XX (ex. Star Fox)");
1055 forceComboList = g_list_append(forceComboList, (void*)"2: F3DEX 2.XX (ex. Zelda OOT)");
1056 forceComboList = g_list_append(forceComboList, (void*)"3: RSP SW 2.0D EXT (ex. Waverace)");
1057 forceComboList = g_list_append(forceComboList, (void*)"4: RSP SW 2.0D EXT (ex. Shadows of the Empire)");
1058 forceComboList = g_list_append(forceComboList, (void*)"5: RSP SW 2.0 (ex. Diddy Kong Racing)");
1059 forceComboList = g_list_append(forceComboList, (void*)"6: S2DEX 1.XX (ex. Yoshi's Story)");
1060 forceComboList = g_list_append(forceComboList, (void*)"7: RSP SW PD Perfect Dark");
1061 forceComboList = g_list_append(forceComboList, (void*)"8: F3DEXBG 2.08 Conker's Bad Fur Day");
1062 gtk_combo_set_popdown_strings(GTK_COMBO(forceCombo), forceComboList);
1064 // filterCombo list
1065 GList *filterComboList = NULL;
1066 filterComboList = g_list_append(filterComboList, (void*)"Automatic");
1067 filterComboList = g_list_append(filterComboList, (void*)"Force Bilinear");
1068 filterComboList = g_list_append(filterComboList, (void*)"Force Point-sampled");
1069 gtk_combo_set_popdown_strings(GTK_COMBO(filterCombo), filterComboList);
1071 // lodCombo list
1072 GList *lodComboList = NULL;
1073 lodComboList = g_list_append(lodComboList, (void*)"Off");
1074 lodComboList = g_list_append(lodComboList, (void*)"Fast");
1075 lodComboList = g_list_append(lodComboList, (void*)"Precise");
1076 gtk_combo_set_popdown_strings(GTK_COMBO(lodCombo), lodComboList);
1078 // swapCombo list
1079 GList *swapComboList = NULL;
1080 swapComboList = g_list_append(swapComboList, (void*)"old");
1081 swapComboList = g_list_append(swapComboList, (void*)"new");
1082 swapComboList = g_list_append(swapComboList, (void*)"hybrid");
1083 gtk_combo_set_popdown_strings(GTK_COMBO(swapCombo), swapComboList);
1085 // ConfigDialog structure creation
1086 ConfigDialog *configDialog = new ConfigDialog;
1088 // signal callbacks
1089 gtk_signal_connect_object(GTK_OBJECT(dialog), "delete-event",
1090 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete),
1091 GTK_OBJECT(dialog));
1092 gtk_signal_connect(GTK_OBJECT(customIniCheckButton), "clicked",
1093 GTK_SIGNAL_FUNC(customIniCheckButtonCallback),
1094 (void*)configDialog);
1095 gtk_signal_connect(GTK_OBJECT(okButton), "clicked",
1096 GTK_SIGNAL_FUNC(okButtonCallback),
1097 (void*)configDialog);
1098 gtk_signal_connect_object(GTK_OBJECT(cancelButton), "clicked",
1099 GTK_SIGNAL_FUNC(gtk_widget_hide),
1100 GTK_OBJECT(dialog));
1102 // Outputing ConfigDialog structure
1103 configDialog->dialog = dialog;
1104 configDialog->autodetectCheckButton = autodetectCheckButton;
1105 configDialog->forceCombo = forceCombo;
1106 configDialog->windowResCombo = windowResCombo;
1107 configDialog->fullResCombo = fullResCombo;
1108 configDialog->texFilterCombo = texFilterCombo;
1109 configDialog->filterCombo = filterCombo;
1110 configDialog->lodCombo = lodCombo;
1111 configDialog->fogCheckButton = fogCheckButton;
1112 configDialog->bufferClearCheckButton = bufferClearCheckButton;
1113 configDialog->vSyncCheckButton = vSyncCheckButton;
1114 configDialog->fastcrcCheckButton = fastcrcCheckButton;
1115 configDialog->noDitheredAlphaCheckButton = noDitheredAlphaCheckButton;
1116 configDialog->noGLSLCheckButton = noGLSLCheckButton;
1117 configDialog->hiresFbCheckButton = hiresFbCheckButton;
1118 configDialog->hiresFBOCheckButton = hiresFBOCheckButton;
1119 configDialog->swapCombo = swapCombo;
1120 configDialog->customIniCheckButton = customIniCheckButton;
1121 configDialog->wrapCheckButton = wrapCheckButton;
1122 configDialog->coronaCheckButton = coronaCheckButton;
1123 configDialog->readAllCheckButton = readAllCheckButton;
1124 configDialog->CPUWriteHackCheckButton = CPUWriteHackCheckButton;
1125 configDialog->FBGetInfoCheckButton = FBGetInfoCheckButton;
1126 configDialog->DepthRenderCheckButton = DepthRenderCheckButton;
1127 configDialog->FPSCheckButton = FPSCheckButton;
1128 configDialog->VICheckButton = VICheckButton;
1129 configDialog->ratioCheckButton = ratioCheckButton;
1130 configDialog->FPStransCheckButton = FPStransCheckButton;
1131 configDialog->clockCheckButton = clockCheckButton;
1132 configDialog->clock24CheckButton = clock24CheckButton;
1133 configDialog->windowResComboList = windowResComboList;
1134 configDialog->texFilterComboList = texFilterComboList;
1135 configDialog->forceComboList = forceComboList;
1136 configDialog->filterComboList = filterComboList;
1137 configDialog->lodComboList = lodComboList;
1138 configDialog->swapComboList = swapComboList;
1139 return configDialog;
1142 void CALL DllConfig ( HWND hParent )
1144 static ConfigDialog *configDialog = NULL;
1145 if (configDialog == NULL) configDialog = CreateConfigDialog();
1147 ReadSettings ();
1149 char name[21] = "DEFAULT";
1150 ReadSpecialSettings (name);
1152 if (gfx.HEADER)
1154 // get the name of the ROM
1155 for (int i=0; i<20; i++)
1156 name[i] = gfx.HEADER[(32+i)^3];
1157 name[20] = 0;
1159 // remove all trailing spaces
1160 while (name[strlen(name)-1] == ' ')
1161 name[strlen(name)-1] = 0;
1163 ReadSpecialSettings (name);
1166 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->windowResCombo)->entry),
1167 (gchar*)g_list_nth_data(configDialog->windowResComboList,
1168 settings.res_data));
1170 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->fullResCombo)->entry),
1171 (gchar*)g_list_nth_data(configDialog->windowResComboList,
1172 settings.full_res));
1174 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->texFilterCombo)->entry),
1175 (gchar*)g_list_nth_data(configDialog->texFilterComboList,
1176 settings.tex_filter));
1178 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->forceCombo)->entry),
1179 (gchar*)g_list_nth_data(configDialog->forceComboList,
1180 settings.ucode));
1182 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->filterCombo)->entry),
1183 (gchar*)g_list_nth_data(configDialog->filterComboList,
1184 settings.filtering));
1186 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->lodCombo)->entry),
1187 (gchar*)g_list_nth_data(configDialog->lodComboList,
1188 settings.lodmode));
1190 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->swapCombo)->entry),
1191 (gchar*)g_list_nth_data(configDialog->swapComboList,
1192 settings.swapmode));
1194 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->fogCheckButton),
1195 settings.fog);
1197 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->bufferClearCheckButton),
1198 settings.buff_clear);
1200 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->autodetectCheckButton),
1201 settings.autodetect_ucode);
1203 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->wrapCheckButton),
1204 settings.wrap_big_tex);
1206 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->coronaCheckButton),
1207 settings.flame_corona);
1209 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->vSyncCheckButton),
1210 settings.vsync);
1212 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->fastcrcCheckButton),
1213 settings.fast_crc);
1215 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->noDitheredAlphaCheckButton),
1216 settings.noditheredalpha);
1218 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->noGLSLCheckButton),
1219 settings.noglsl);
1221 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->hiresFbCheckButton),
1222 settings.fb_hires);
1224 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->hiresFBOCheckButton),
1225 settings.FBO);
1227 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->readAllCheckButton),
1228 settings.fb_read_always);
1230 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->CPUWriteHackCheckButton),
1231 settings.cpu_write_hack);
1233 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->FBGetInfoCheckButton),
1234 settings.fb_get_info);
1236 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->DepthRenderCheckButton),
1237 settings.fb_depth_render);
1239 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->customIniCheckButton),
1240 settings.custom_ini);
1242 BOOL enable = !settings.custom_ini;
1243 gtk_widget_set_sensitive(configDialog->filterCombo, enable);
1244 gtk_widget_set_sensitive(configDialog->lodCombo, enable);
1245 gtk_widget_set_sensitive(configDialog->fogCheckButton, enable);
1246 gtk_widget_set_sensitive(configDialog->bufferClearCheckButton, enable);
1247 gtk_widget_set_sensitive(configDialog->swapCombo, enable);
1249 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->FPSCheckButton),
1250 settings.show_fps&1);
1251 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->VICheckButton),
1252 settings.show_fps&2);
1253 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->ratioCheckButton),
1254 settings.show_fps&4);
1255 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->FPStransCheckButton),
1256 settings.show_fps&8);
1257 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->clockCheckButton),
1258 settings.clock);
1259 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->clock24CheckButton),
1260 settings.clock_24_hr);
1262 gtk_widget_show_all(configDialog->dialog);
1265 #endif // _WIN32