|
|
1.1 ! root 1: /*========================================================================== ! 2: * ! 3: * Copyright (C) 1996 Brian King ! 4: * ! 5: * File: wingui.c ! 6: * Content: Win32-specific gui features for UAE port. ! 7: * ! 8: -U 4 -c 4 -F 8 -n i3 -w 2 -m system3.1:d:\amiga\hd0 -m work:d:\amiga\hd1 ! 9: ***************************************************************************/ ! 10: #ifdef __GNUC__ ! 11: #define NONAMELESSUNION ! 12: #define __int64 long long ! 13: #include "machdep/winstuff.h" ! 14: #else ! 15: #include <stdio.h> ! 16: #include <stdlib.h> ! 17: #include <io.h> ! 18: #include <windows.h> ! 19: #include <windowsx.h> ! 20: #include <mmsystem.h> ! 21: #include <commctrl.h> ! 22: #include <commdlg.h> ! 23: #include <dlgs.h> ! 24: #include <winuser.h> ! 25: #include <ddraw.h> ! 26: #include <process.h> ! 27: #include <shlobj.h> ! 28: #include <prsht.h> ! 29: #include <richedit.h> ! 30: #endif ! 31: #include "config.h" ! 32: #include "resource.h" ! 33: #include "sysconfig.h" ! 34: #include "sysdeps.h" ! 35: #include "gui.h" ! 36: #include "options.h" ! 37: #include "memory.h" ! 38: #ifdef __GNUC__ ! 39: #include "machdep/memory.h" ! 40: #endif ! 41: #include "custom.h" ! 42: #include "readcpu.h" ! 43: #include "newcpu.h" ! 44: #include "disk.h" ! 45: #include "uae.h" ! 46: #include "autoconf.h" ! 47: ! 48: #include "picasso96.h" ! 49: #include "osdep/win32.h" ! 50: #include "osdep/win32gui.h" ! 51: ! 52: extern LONG GetDisplayModeLogicalNumber( int w, int h ); ! 53: extern LONG GetDisplayModeNumber( LONG logical ); ! 54: ! 55: extern HANDLE hEmuThread; ! 56: extern BOOL viewing_child; ! 57: extern BOOL allow_quit_from_property_sheet; ! 58: extern BOOL viewing_child; ! 59: extern HDC hBackDC; ! 60: extern HBITMAP hBackBM; ! 61: extern HINSTANCE hInst; ! 62: extern HWND hMainWnd, hAmigaWnd; ! 63: extern uae_u32 fastmem_size, chipmem_size, bogomem_size, gfxmem_size, z3fastmem_size; // BDK ! 64: extern int new_fullscreen_flag; ! 65: extern int mouseactive; ! 66: extern char *start_path; ! 67: HANDLE win32uae_key = NULL; ! 68: ! 69: #define Error(x) MessageBox( NULL, (x), "WinUAE Error", MB_OK ) ! 70: ! 71: #ifdef __GNUC__ ! 72: #define DUN DUMMYUNIONNAME ## . ! 73: #define DUN2 DUMMYUNIONNAME2 ## . ! 74: #define DUN3 DUMMYUNIONNAME3 ## . ! 75: #else ! 76: #define DUN ! 77: #define DUN2 ! 78: #define DUN3 ! 79: #endif ! 80: BOOL GetSettings(void) ! 81: { ! 82: BOOL rc = TRUE; ! 83: PROPSHEETPAGE pages[C_PAGES]; ! 84: PROPSHEETHEADER pHeader; ! 85: ! 86: pages[ LOADSAVE_ID ].dwSize = sizeof(PROPSHEETPAGE); ! 87: pages[ LOADSAVE_ID ].dwFlags = PSP_USETITLE | PSP_USEICONID; ! 88: pages[ LOADSAVE_ID ].hInstance = hInst; ! 89: pages[ LOADSAVE_ID ].DUN pszTemplate = MAKEINTRESOURCE(IDD_LOADSAVE); ! 90: pages[ LOADSAVE_ID ].DUN2 pszIcon = MAKEINTRESOURCE(IDI_LOADSAVE); ! 91: pages[ LOADSAVE_ID ].pszTitle = MAKEINTRESOURCE(IDS_LOADSAVE); ! 92: pages[ LOADSAVE_ID ].pfnDlgProc = (LPFNPSPCALLBACK) LoadSaveDlgProc; ! 93: pages[ LOADSAVE_ID ].lParam = 0; ! 94: pages[ LOADSAVE_ID ].pfnCallback = NULL; ! 95: pages[ LOADSAVE_ID ].pcRefParent = NULL; ! 96: ! 97: pages[ STARTUP_ID ].dwSize = sizeof(PROPSHEETPAGE); ! 98: pages[ STARTUP_ID ].dwFlags = PSP_USETITLE | PSP_USEICONID; ! 99: pages[ STARTUP_ID ].hInstance = hInst; ! 100: pages[ STARTUP_ID ].DUN pszTemplate = MAKEINTRESOURCE(IDD_STARTUP); ! 101: pages[ STARTUP_ID ].DUN2 pszIcon = MAKEINTRESOURCE(IDI_STARTUP); ! 102: pages[ STARTUP_ID ].pszTitle = MAKEINTRESOURCE(IDS_STARTUP); ! 103: pages[ STARTUP_ID ].pfnDlgProc = (LPFNPSPCALLBACK)StartupDlgProc; ! 104: pages[ STARTUP_ID ].lParam = 0; ! 105: pages[ STARTUP_ID ].pfnCallback = NULL; ! 106: pages[ STARTUP_ID ].pcRefParent = NULL; ! 107: ! 108: pages[ SOUND_ID ].dwSize = sizeof(PROPSHEETPAGE); ! 109: pages[ SOUND_ID ].dwFlags = PSP_USETITLE | PSP_USEICONID; ! 110: pages[ SOUND_ID ].hInstance = hInst; ! 111: pages[ SOUND_ID ].DUN pszTemplate = MAKEINTRESOURCE(IDD_SOUND); ! 112: pages[ SOUND_ID ].DUN2 pszIcon = MAKEINTRESOURCE(IDI_SOUND); ! 113: pages[ SOUND_ID ].pszTitle = MAKEINTRESOURCE(IDS_SOUND); ! 114: pages[ SOUND_ID ].pfnDlgProc = (LPFNPSPCALLBACK)SoundDlgProc; ! 115: pages[ SOUND_ID ].lParam = 0; ! 116: pages[ SOUND_ID ].pfnCallback = NULL; ! 117: pages[ SOUND_ID ].pcRefParent = NULL; ! 118: ! 119: pages[ DISPLAY_ID ].dwSize = sizeof(PROPSHEETPAGE); ! 120: pages[ DISPLAY_ID ].dwFlags = PSP_USETITLE | PSP_USEICONID; ! 121: pages[ DISPLAY_ID ].hInstance = hInst; ! 122: pages[ DISPLAY_ID ].DUN pszTemplate = MAKEINTRESOURCE(IDD_DISPLAY); ! 123: pages[ DISPLAY_ID ].DUN2 pszIcon = MAKEINTRESOURCE(IDI_DISPLAY); ! 124: pages[ DISPLAY_ID ].pszTitle = MAKEINTRESOURCE(IDS_DISPLAY); ! 125: pages[ DISPLAY_ID ].pfnDlgProc = (LPFNPSPCALLBACK)DisplayDlgProc; ! 126: pages[ DISPLAY_ID ].lParam = 0; ! 127: pages[ DISPLAY_ID ].pfnCallback = NULL; ! 128: pages[ DISPLAY_ID ].pcRefParent = NULL; ! 129: ! 130: pages[ HARDDISK_ID ].dwSize = sizeof(PROPSHEETPAGE); ! 131: pages[ HARDDISK_ID ].dwFlags = PSP_USETITLE | PSP_USEICONID; ! 132: pages[ HARDDISK_ID ].hInstance = hInst; ! 133: pages[ HARDDISK_ID ].DUN pszTemplate = MAKEINTRESOURCE(IDD_HARDDISK); ! 134: pages[ HARDDISK_ID ].DUN2 pszIcon = MAKEINTRESOURCE(IDI_HARDDRIVE); ! 135: pages[ HARDDISK_ID ].pszTitle = MAKEINTRESOURCE(IDS_HARDDRIVES); ! 136: pages[ HARDDISK_ID ].pfnDlgProc = (LPFNPSPCALLBACK)HarddiskDlgProc; ! 137: pages[ HARDDISK_ID ].lParam = 0; ! 138: pages[ HARDDISK_ID ].pfnCallback = NULL; ! 139: pages[ HARDDISK_ID ].pcRefParent = NULL; ! 140: ! 141: pages[ FLOPPY_ID ].dwSize = sizeof(PROPSHEETPAGE); ! 142: pages[ FLOPPY_ID ].dwFlags = PSP_USETITLE | PSP_USEICONID; ! 143: pages[ FLOPPY_ID ].hInstance = hInst; ! 144: pages[ FLOPPY_ID ].DUN pszTemplate = MAKEINTRESOURCE(IDD_FLOPPIES); ! 145: pages[ FLOPPY_ID ].DUN2 pszIcon = MAKEINTRESOURCE(IDI_FLOPPYDRIVE); ! 146: pages[ FLOPPY_ID ].pszTitle = MAKEINTRESOURCE(IDS_FLOPPIES); ! 147: pages[ FLOPPY_ID ].pfnDlgProc = (LPFNPSPCALLBACK)FloppiesDlgProc; ! 148: pages[ FLOPPY_ID ].lParam = 0; ! 149: pages[ FLOPPY_ID ].pfnCallback = NULL; ! 150: pages[ FLOPPY_ID ].pcRefParent = NULL; ! 151: ! 152: pages[ PORTS_ID ].dwSize = sizeof(PROPSHEETPAGE); ! 153: pages[ PORTS_ID ].dwFlags = PSP_USETITLE | PSP_USEICONID; ! 154: pages[ PORTS_ID ].hInstance = hInst; ! 155: pages[ PORTS_ID ].DUN pszTemplate = MAKEINTRESOURCE(IDD_PORTS); ! 156: pages[ PORTS_ID ].DUN2 pszIcon = MAKEINTRESOURCE(IDI_PORTS); ! 157: pages[ PORTS_ID ].pszTitle = MAKEINTRESOURCE(IDS_PORTS); ! 158: pages[ PORTS_ID ].pfnDlgProc = (LPFNPSPCALLBACK)PortsDlgProc; ! 159: pages[ PORTS_ID ].lParam = 0; ! 160: pages[ PORTS_ID ].pfnCallback = NULL; ! 161: pages[ PORTS_ID ].pcRefParent = NULL; ! 162: ! 163: pages[ ADVANCED_ID ].dwSize = sizeof(PROPSHEETPAGE); ! 164: pages[ ADVANCED_ID ].dwFlags = PSP_USETITLE | PSP_USEICONID; ! 165: pages[ ADVANCED_ID ].hInstance = hInst; ! 166: pages[ ADVANCED_ID ].DUN pszTemplate = MAKEINTRESOURCE(IDD_ADVANCED); ! 167: pages[ ADVANCED_ID ].DUN2 pszIcon = MAKEINTRESOURCE(IDI_ADVANCED); ! 168: pages[ ADVANCED_ID ].pszTitle = MAKEINTRESOURCE(IDS_ADVANCED); ! 169: pages[ ADVANCED_ID ].pfnDlgProc = (LPFNPSPCALLBACK)AdvancedDlgProc; ! 170: pages[ ADVANCED_ID ].lParam = 0; ! 171: pages[ ADVANCED_ID ].pfnCallback = NULL; ! 172: pages[ ADVANCED_ID ].pcRefParent = NULL; ! 173: ! 174: pages[ ABOUT_ID ].dwSize = sizeof(PROPSHEETPAGE); ! 175: pages[ ABOUT_ID ].dwFlags = PSP_USETITLE | PSP_USEICONID; ! 176: pages[ ABOUT_ID ].hInstance = hInst; ! 177: pages[ ABOUT_ID ].DUN pszTemplate = MAKEINTRESOURCE(IDD_ABOUTME); ! 178: pages[ ABOUT_ID ].DUN2 pszIcon = MAKEINTRESOURCE(IDI_UAEINFO); ! 179: pages[ ABOUT_ID ].pszTitle = MAKEINTRESOURCE(IDS_ABOUTME); ! 180: pages[ ABOUT_ID ].pfnDlgProc = (LPFNPSPCALLBACK) AboutDlgProc; ! 181: pages[ ABOUT_ID ].lParam = 0; ! 182: pages[ ABOUT_ID ].pfnCallback = NULL; ! 183: pages[ ABOUT_ID ].pcRefParent = NULL; ! 184: ! 185: pHeader.dwSize = sizeof(PROPSHEETHEADER); ! 186: pHeader.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK | PSH_NOAPPLYNOW; ! 187: pHeader.hwndParent = hAmigaWnd; ! 188: pHeader.hInstance = hInst; ! 189: pHeader.DUN pszIcon = MAKEINTRESOURCE(IDI_UAEICON); ! 190: pHeader.pszCaption = "WinUAE"; ! 191: pHeader.nPages = C_PAGES; ! 192: pHeader.DUN2 nStartPage = 0; ! 193: pHeader.DUN3 ppsp = (LPCPROPSHEETPAGE)pages; ! 194: pHeader.pfnCallback= (PFNPROPSHEETCALLBACK)InitPropertySheet; ! 195: if(PropertySheet(&pHeader)==-1 || quit_program) ! 196: rc = FALSE; ! 197: return rc; ! 198: } ! 199: ! 200: void SetupVolumes( void ) ! 201: { ! 202: int loop; ! 203: for( loop = 0; loop < 4; loop++ ) ! 204: { ! 205: if( *drives[loop].name && *drives[loop].path ) ! 206: add_filesys_unit( drives[loop].name, drives[loop].path, !drives[loop].rw, 0, 0, 0 ); ! 207: } ! 208: } ! 209: ! 210: HWND pages[C_PAGES]; ! 211: ! 212: void CALLBACK InitPropertySheet( HWND hDlg, UINT msg, LPARAM lParam ) ! 213: { ! 214: int i; ! 215: static BOOL first_time = TRUE; ! 216: ! 217: if( __argc != 1 ) ! 218: { ! 219: first_time = FALSE; ! 220: } ! 221: ! 222: if( !first_time ) ! 223: { ! 224: // Remove the configurations page ! 225: PropSheet_RemovePage( hDlg, 0, NULL ); ! 226: ! 227: // Remove the startup property-sheet page ! 228: PropSheet_RemovePage(hDlg,0,NULL); ! 229: ! 230: // Remove the sound property-sheet page ! 231: PropSheet_RemovePage(hDlg,0,NULL); ! 232: ! 233: // Remove the harddrives property-sheet page ! 234: PropSheet_RemovePage(hDlg,2,NULL); ! 235: ! 236: // Remove the advanced property-sheet page ! 237: PropSheet_RemovePage(hDlg,3,NULL); ! 238: ! 239: allow_quit_from_property_sheet = FALSE; ! 240: } ! 241: ! 242: switch(msg) ! 243: { ! 244: case PSCB_INITIALIZED: ! 245: if( first_time ) ! 246: { ! 247: first_time = FALSE; ! 248: for( i=0;i<C_PAGES;pages[i++]=NULL); ! 249: } ! 250: break; ! 251: } ! 252: } ! 253: ! 254: void CalculateFPS( DWORD setting, char *buffer ) ! 255: { ! 256: char nth[10]; ! 257: switch( setting ) ! 258: { ! 259: case 1: ! 260: strcpy( nth, "" ); ! 261: break; ! 262: case 2: ! 263: strcpy( nth, "second " ); ! 264: break; ! 265: case 3: ! 266: strcpy( nth, "third " ); ! 267: break; ! 268: case 4: ! 269: strcpy( nth, "fourth " ); ! 270: break; ! 271: case 5: ! 272: strcpy( nth, "fifth " ); ! 273: break; ! 274: case 6: ! 275: strcpy( nth, "sixth " ); ! 276: break; ! 277: case 7: ! 278: strcpy( nth, "seventh " ); ! 279: break; ! 280: case 8: ! 281: strcpy( nth, "eighth " ); ! 282: break; ! 283: case 9: ! 284: strcpy( nth, "ninth " ); ! 285: break; ! 286: default: ! 287: strcpy( nth, "tenth " ); ! 288: break; ! 289: } ! 290: ! 291: sprintf( buffer, "Every %sFrame", nth ); ! 292: } ! 293: ! 294: void CalculateSpeed( DWORD setting, char *buffer ) ! 295: { ! 296: sprintf( buffer, "%d", setting ); ! 297: currprefs.m68k_speed = setting; ! 298: } ! 299: ! 300: void CalculateRealMem(DWORD setting, int *size, char *buffer, int memtype) ! 301: { ! 302: if( memtype == 0 ) ! 303: { ! 304: switch(setting) ! 305: { ! 306: case 0: ! 307: if( buffer ) ! 308: strcpy(buffer,"512 K"); ! 309: if( size ) ! 310: *size = 0x00080000; ! 311: break; ! 312: case 1: ! 313: if( buffer ) ! 314: strcpy(buffer,"1 Meg"); ! 315: if( size ) ! 316: *size = 0x00100000; ! 317: break; ! 318: case 2: ! 319: if( buffer ) ! 320: strcpy(buffer,"2 Megs"); ! 321: if( size ) ! 322: *size = 0x00200000; ! 323: break; ! 324: case 3: ! 325: if( buffer ) ! 326: strcpy(buffer,"4 Megs"); ! 327: if( size ) ! 328: *size = 0x00400000; ! 329: break; ! 330: default: ! 331: if( buffer ) ! 332: strcpy(buffer,"8 Megs"); ! 333: if( size ) ! 334: *size = 0x00800000; ! 335: break; ! 336: } ! 337: } ! 338: else ! 339: { ! 340: switch(setting) ! 341: { ! 342: case 0: ! 343: if( buffer ) ! 344: strcpy(buffer,"None"); ! 345: if( size ) ! 346: *size = 0x00000000; ! 347: break; ! 348: case 1: ! 349: if( buffer ) ! 350: strcpy(buffer,"1 Meg"); ! 351: if( size ) ! 352: *size = 0x00100000; ! 353: break; ! 354: case 2: ! 355: if( buffer ) ! 356: strcpy(buffer,"2 Megs"); ! 357: if( size ) ! 358: *size = 0x00200000; ! 359: break; ! 360: case 3: ! 361: if( buffer ) ! 362: strcpy(buffer,"4 Megs"); ! 363: if( size ) ! 364: *size = 0x00400000; ! 365: break; ! 366: case 4: ! 367: if( buffer ) ! 368: strcpy(buffer,"8 Megs"); ! 369: if( size ) ! 370: *size = 0x00800000; ! 371: break; ! 372: case 5: ! 373: if( memtype == 3 ) ! 374: { ! 375: if( buffer ) ! 376: strcpy( buffer, "16 Megs" ); ! 377: if( size ) ! 378: *size = 0x01000000; ! 379: } ! 380: break; ! 381: case 6: ! 382: if( memtype == 3 ) ! 383: { ! 384: if( buffer ) ! 385: strcpy( buffer, "32 Megs" ); ! 386: if( size ) ! 387: *size = 0x02000000; ! 388: } ! 389: break; ! 390: } ! 391: } ! 392: } ! 393: ! 394: void UpdateRadioButtons( HWND hDlg, HWND lParam ) ! 395: { ! 396: int which_button; ! 397: ! 398: if( GetDlgItem( hDlg, IDC_FREQUENCY ) == lParam ) ! 399: { ! 400: switch( currprefs.sound_freq ) ! 401: { ! 402: case 11025: ! 403: which_button = IDC_11KHZ; ! 404: break; ! 405: case 44100: ! 406: which_button = IDC_44KHZ; ! 407: break; ! 408: case 48000: ! 409: which_button = IDC_48KHZ; ! 410: break; ! 411: default: ! 412: which_button = IDC_22KHZ; ! 413: break; ! 414: } ! 415: CheckRadioButton( hDlg, IDC_11KHZ, IDC_48KHZ, which_button ); ! 416: } ! 417: else if( GetDlgItem( hDlg, IDC_SOUNDSIZE ) == lParam ) ! 418: { ! 419: switch( currprefs.sound_bits ) ! 420: { ! 421: case 16: ! 422: which_button = IDC_16BIT; ! 423: break; ! 424: default: ! 425: which_button = IDC_8BIT; ! 426: break; ! 427: } ! 428: CheckRadioButton( hDlg, IDC_8BIT, IDC_16BIT, which_button ); ! 429: } ! 430: else if( GetDlgItem( hDlg, IDC_SOUND ) == lParam ) ! 431: { ! 432: switch( currprefs.produce_sound ) ! 433: { ! 434: case -1: ! 435: which_button = IDC_SOUND0; ! 436: break; ! 437: case 1: ! 438: which_button = IDC_SOUND2; ! 439: break; ! 440: case 2: ! 441: which_button = IDC_SOUND3; ! 442: break; ! 443: case 3: ! 444: which_button = IDC_SOUND4; ! 445: break; ! 446: default: ! 447: which_button = IDC_SOUND1; ! 448: break; ! 449: } ! 450: if( CheckRadioButton( hDlg, IDC_SOUND0, IDC_SOUND4, which_button ) == 0 ) ! 451: which_button = 0; ! 452: } ! 453: else if( GetDlgItem( hDlg, IDC_PORT0 ) == lParam ) ! 454: { ! 455: switch( currprefs.fake_joystick & 0x00FF ) ! 456: { ! 457: case 0: ! 458: which_button = IDC_PORT0_JOY0; ! 459: break; ! 460: case 1: ! 461: which_button = IDC_PORT0_JOY1; ! 462: break; ! 463: case 2: ! 464: which_button = IDC_PORT0_MOUSE; ! 465: break; ! 466: case 3: ! 467: which_button = IDC_PORT0_KBDA; ! 468: break; ! 469: case 4: ! 470: which_button = IDC_PORT0_KBDB; ! 471: break; ! 472: default: ! 473: which_button = IDC_PORT0_KBDC; ! 474: break; ! 475: } ! 476: if( CheckRadioButton( hDlg, IDC_PORT0_JOY0, IDC_PORT0_KBDC, which_button ) == 0 ) ! 477: which_button = 0; ! 478: } ! 479: else if( GetDlgItem( hDlg, IDC_PORT1 ) == lParam ) ! 480: { ! 481: switch( ( currprefs.fake_joystick & 0xFF00 ) >> 8 ) ! 482: { ! 483: case 0: ! 484: which_button = IDC_PORT1_JOY0; ! 485: break; ! 486: case 1: ! 487: which_button = IDC_PORT1_JOY1; ! 488: break; ! 489: case 2: ! 490: which_button = IDC_PORT1_MOUSE; ! 491: break; ! 492: case 3: ! 493: which_button = IDC_PORT1_KBDA; ! 494: break; ! 495: case 4: ! 496: which_button = IDC_PORT1_KBDB; ! 497: break; ! 498: default: ! 499: which_button = IDC_PORT1_KBDC; ! 500: break; ! 501: } ! 502: if( CheckRadioButton( hDlg, IDC_PORT1_JOY0, IDC_PORT1_KBDC, which_button ) == 0 ) ! 503: which_button = 0; ! 504: } ! 505: } ! 506: ! 507: void UpdateScroller(HWND hDlg, HWND lParam) ! 508: { ! 509: char buffer[32]; ! 510: DWORD dwPos = SendMessage( (HWND)lParam, TBM_GETPOS, 0 ,0 ), dwPos2; ! 511: ! 512: if( GetDlgItem( hDlg, IDC_CHIPMEM ) == lParam ) ! 513: { ! 514: CalculateRealMem( dwPos, NULL, buffer, 0 ); ! 515: SetDlgItemText( hDlg, IDC_CHIPRAM, buffer ); ! 516: ! 517: dwPos2 = SendDlgItemMessage( hDlg, IDC_FASTMEM, TBM_GETPOS, 0, 0 ); ! 518: if( ( dwPos > 2 ) && ! 519: ( dwPos2 > 0 ) ) ! 520: { ! 521: SendDlgItemMessage( hDlg, IDC_FASTMEM, TBM_SETPOS, TRUE, 0 ); ! 522: UpdateScroller( hDlg, GetDlgItem( hDlg, IDC_FASTMEM ) ); ! 523: } ! 524: } ! 525: else if( GetDlgItem( hDlg, IDC_FASTMEM ) == lParam ) ! 526: { ! 527: CalculateRealMem( dwPos, NULL, buffer, 1 ); ! 528: SetDlgItemText( hDlg, IDC_FASTRAM, buffer ); ! 529: ! 530: dwPos2 = SendDlgItemMessage( hDlg, IDC_CHIPMEM, TBM_GETPOS, 0, 0 ); ! 531: if( ( dwPos > 0 ) && ! 532: ( dwPos2 > 2 ) ) ! 533: { ! 534: SendDlgItemMessage( hDlg, IDC_CHIPMEM, TBM_SETPOS, TRUE, 2 ); ! 535: UpdateScroller( hDlg, GetDlgItem( hDlg, IDC_CHIPMEM ) ); ! 536: } ! 537: } ! 538: else if( GetDlgItem( hDlg, IDC_FRAMERATE ) == lParam ) ! 539: { ! 540: CalculateFPS( dwPos, buffer ); ! 541: SetDlgItemText(hDlg,IDC_RATETEXT,buffer); ! 542: } ! 543: else if( GetDlgItem( hDlg, IDC_SPEED ) == lParam ) ! 544: { ! 545: CalculateSpeed( dwPos, buffer ); ! 546: SetDlgItemText( hDlg, IDC_SPEEDBOX, buffer ); ! 547: } ! 548: else if( GetDlgItem( hDlg, IDC_P96MEM ) == lParam ) ! 549: { ! 550: CalculateRealMem( dwPos, NULL, buffer, 2 ); ! 551: SetDlgItemText( hDlg, IDC_P96RAM, buffer ); ! 552: } ! 553: else if( GetDlgItem( hDlg, IDC_Z3FASTMEM ) == lParam ) ! 554: { ! 555: CalculateRealMem( dwPos, NULL, buffer, 3 ); ! 556: SetDlgItemText( hDlg, IDC_Z3FASTRAM, buffer ); ! 557: } ! 558: } ! 559: ! 560: ConfigStructPtr AllocateConfigStruct( void ) ! 561: { ! 562: ConfigStructPtr ptr = NULL; ! 563: if( ptr = malloc( sizeof( ConfigStruct ) ) ) ! 564: { ! 565: ptr->Size = sizeof( ConfigStruct ); ! 566: ptr->VersionMajor = CONFIG_VERSION_MAJOR; ! 567: ptr->VersionMinor = CONFIG_VERSION_MINOR; ! 568: } ! 569: return ptr; ! 570: } ! 571: ! 572: void FreeConfigStruct( ConfigStructPtr cfgptr ) ! 573: { ! 574: free( cfgptr ); ! 575: } ! 576: ! 577: // Get a ptr to a ConfigStruct based on entry-number ! 578: // Return NULL if invalid entry-number ! 579: ConfigStructPtr GetFirstConfigEntry( HANDLE *file_handle, LPWIN32_FIND_DATA find_data ) ! 580: { ! 581: HANDLE cfg_file; ! 582: ConfigStructPtr config = NULL; ! 583: DWORD num_bytes = 0; ! 584: char init_path[MAX_PATH] = "", *posn; ! 585: ! 586: if( start_path ) ! 587: { ! 588: strncpy( init_path, start_path, MAX_PATH ); ! 589: strncat( init_path, "\\Configurations\\*.CFG", MAX_PATH ); ! 590: } ! 591: ! 592: if( ( *file_handle = FindFirstFile( init_path, find_data ) ) != INVALID_HANDLE_VALUE ) ! 593: { ! 594: config = AllocateConfigStruct(); ! 595: sprintf( init_path, "%s\\Configurations\\%s", start_path, find_data->cFileName ); ! 596: cfg_file = CreateFile( init_path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); ! 597: ReadFile( cfg_file, config, config->Size, &num_bytes, NULL ); ! 598: if( num_bytes == config->Size ) ! 599: { ! 600: if( posn = strrchr( find_data->cFileName, '.' ) ) ! 601: *posn = '\0'; ! 602: strcpy( config->Name, find_data->cFileName ); ! 603: } ! 604: else ! 605: { ! 606: FreeConfigStruct( config ); ! 607: config = NULL; ! 608: } ! 609: CloseHandle( cfg_file ); ! 610: } ! 611: else ! 612: { ! 613: ! 614: } ! 615: return config; ! 616: } ! 617: ! 618: ConfigStructPtr GetNextConfigEntry( HANDLE *file_handle, LPWIN32_FIND_DATA find_data ) ! 619: { ! 620: HANDLE cfg_file; ! 621: ConfigStructPtr config = NULL; ! 622: DWORD num_bytes = 0; ! 623: char init_path[MAX_PATH] = "", *posn; ! 624: ! 625: if( FindNextFile( *file_handle, find_data ) == 0 ) ! 626: { ! 627: FindClose( *file_handle ); ! 628: } ! 629: else ! 630: { ! 631: config = AllocateConfigStruct(); ! 632: sprintf( init_path, "%s\\Configurations\\%s", start_path, find_data->cFileName ); ! 633: cfg_file = CreateFile( init_path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); ! 634: ReadFile( cfg_file, config, config->Size, &num_bytes, NULL ); ! 635: if( posn = strrchr( find_data->cFileName, '.' ) ) ! 636: *posn = '\0'; ! 637: strcpy( config->Name, find_data->cFileName ); ! 638: CloseHandle( cfg_file ); ! 639: } ! 640: return config; ! 641: } ! 642: ! 643: // This function basically sets up the defaults in our ConfigStruct... it follows the same ! 644: // procedure as each DlgProc() does for a WM_INITDIALOG msg... ! 645: void GetDefaultsForPage( ConfigStructPtr cfgptr, int page ) ! 646: { ! 647: int i; ! 648: ! 649: switch( page ) ! 650: { ! 651: case ADVANCED_ID: ! 652: cfgptr->NoAutoConfig = !currprefs.automount_uaedev; ! 653: cfgptr->CopperHack = currprefs.copper_pos; ! 654: //cfgptr->DebuggerEnabled = use_debugger; ! 655: cfgptr->InvalidAddresses = currprefs.illegal_mem; ! 656: cfgptr->M68KSpeed = currprefs.m68k_speed; ! 657: cfgptr->AddressingIs24Bit = address_space_24; ! 658: break; ! 659: case STARTUP_ID: ! 660: cfgptr->ChipMem = chipmem_size; ! 661: cfgptr->FastMem = fastmem_size; ! 662: cfgptr->P96Mem = gfxmem_size; ! 663: cfgptr->Z3Mem = z3fastmem_size; ! 664: strncpy( cfgptr->KickstartName, romfile, CFG_ROM_LENGTH ); ! 665: strncpy( cfgptr->KeyFileName, keyfile, CFG_KEY_LENGTH ); ! 666: break; ! 667: case DISPLAY_ID: ! 668: cfgptr->FrameRate = currprefs.framerate; ! 669: cfgptr->LineDouble = currprefs.gfx_linedbl; ! 670: cfgptr->FullScreen = amiga_fullscreen; ! 671: cfgptr->CorrectAspect = currprefs.gfx_correct_aspect; ! 672: cfgptr->CenterY = currprefs.gfx_ycenter; ! 673: cfgptr->CenterX = currprefs.gfx_xcenter; ! 674: cfgptr->Blit32 = currprefs.blits_32bit_enabled; ! 675: cfgptr->BlitImmediate = currprefs.immediate_blits; ! 676: cfgptr->Lores = currprefs.gfx_lores; ! 677: cfgptr->CustomSize = customsize; ! 678: cfgptr->ScreenWidth = currprefs.gfx_width; ! 679: cfgptr->ScreenHeight = currprefs.gfx_height; ! 680: break; ! 681: case HARDDISK_ID: ! 682: for( i = 0; i < NUM_DRIVES; i++ ) ! 683: { ! 684: memcpy( &(cfgptr->drives[i]), &drives[i], sizeof( drive_specs ) ); ! 685: } ! 686: cfgptr->HardFileBootPri = hf_bootpri; ! 687: break; ! 688: case FLOPPY_ID: ! 689: for( i = 0; i < NUM_DRIVES; i++ ) ! 690: { ! 691: memcpy( cfgptr->df[i], currprefs.df[i], 256 ); ! 692: } ! 693: break; ! 694: case SOUND_ID: ! 695: cfgptr->SoundSupport = currprefs.produce_sound; ! 696: cfgptr->SoundBits = currprefs.sound_bits; ! 697: cfgptr->SoundFreq = currprefs.sound_freq; ! 698: cfgptr->SoundStereo = currprefs.stereo; ! 699: break; ! 700: case PORTS_ID: ! 701: cfgptr->FakeJoystick = currprefs.fake_joystick; ! 702: cfgptr->SerialPort = currprefs.use_serial; ! 703: strncpy( cfgptr->SerialName, sername, CFG_SER_LENGTH ); ! 704: strncpy( cfgptr->PrinterName, prtname, CFG_PAR_LENGTH ); ! 705: break; ! 706: case LOADSAVE_ID: ! 707: case ABOUT_ID: ! 708: default: ! 709: break; ! 710: } ! 711: } ! 712: ! 713: // flag = 0 - save ! 714: // = 1 - load ! 715: // = 2 - delete ! 716: // = 3 - import ! 717: void ConfigurationFile( HWND hDlg, ConfigStructPtr cfgptr, int flag ) ! 718: { ! 719: HANDLE file_handle; ! 720: DWORD byte_count; ! 721: OPENFILENAME openFileName; ! 722: char full_path[MAX_PATH] = ""; ! 723: char file_name[MAX_PATH] = ""; ! 724: char init_path[MAX_PATH] = ""; ! 725: ! 726: if( start_path ) ! 727: { ! 728: strncpy( init_path, start_path, MAX_PATH ); ! 729: strncat( init_path, "\\Configurations\\", MAX_PATH ); ! 730: strcpy( full_path, cfgptr->Name ); ! 731: } ! 732: ! 733: if( flag == 3 ) ! 734: { ! 735: openFileName.lStructSize = sizeof(OPENFILENAME); ! 736: openFileName.hwndOwner = hDlg; ! 737: openFileName.hInstance = hInst; ! 738: openFileName.lpstrFilter = "WinUAE Configuration Files (*.ACF)\0*.ACF\0\0"; ! 739: openFileName.lpstrTitle = "Choose the configuration file to import..."; ! 740: openFileName.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_LONGNAMES | OFN_HIDEREADONLY | OFN_NOCHANGEDIR; ! 741: openFileName.lpstrDefExt = "ACF"; ! 742: openFileName.lpstrCustomFilter = NULL; ! 743: openFileName.nMaxCustFilter = 0; ! 744: openFileName.nFilterIndex = 0; ! 745: openFileName.lpstrFile = full_path; ! 746: openFileName.nMaxFile = MAX_PATH; ! 747: openFileName.lpstrFileTitle = file_name; ! 748: openFileName.nMaxFileTitle = MAX_PATH; ! 749: if( start_path ) ! 750: openFileName.lpstrInitialDir = init_path; ! 751: else ! 752: openFileName.lpstrInitialDir = NULL; ! 753: openFileName.lpfnHook = NULL; ! 754: openFileName.lpTemplateName = NULL; ! 755: openFileName.lCustData = 0; ! 756: ! 757: if( GetOpenFileName( &openFileName ) ) ! 758: { ! 759: // Do the import stuff here... ! 760: } ! 761: } ! 762: if( flag == 1 ) ! 763: { ! 764: SetCursor( LoadCursor( NULL, IDC_WAIT ) ); ! 765: ! 766: // full_path is our path to load the file from... ! 767: sprintf( full_path, "%s%s.CFG", init_path, cfgptr->Name ); ! 768: if( ( file_handle = CreateFile( full_path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ) ) == INVALID_HANDLE_VALUE ) ! 769: { ! 770: // handle error ! 771: } ! 772: else ! 773: { ! 774: if( ReadFile( file_handle, cfgptr, cfgptr->Size, &byte_count, NULL ) == FALSE ) ! 775: { ! 776: // handle error ! 777: } ! 778: CloseHandle( file_handle ); ! 779: } ! 780: SetCursor( LoadCursor( NULL, IDC_ARROW ) ); ! 781: } ! 782: else if( flag == 0 ) ! 783: { ! 784: SetCursor( LoadCursor( NULL, IDC_WAIT ) ); ! 785: ! 786: // full_path is our path to save the file into... ! 787: sprintf( full_path, "%s%s.CFG", init_path, cfgptr->Name ); ! 788: if( ( file_handle = CreateFile( full_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ) ) == INVALID_HANDLE_VALUE ) ! 789: { ! 790: // handle error ! 791: } ! 792: else ! 793: { ! 794: if( WriteFile( file_handle, cfgptr, cfgptr->Size, &byte_count, NULL ) == FALSE ) ! 795: { ! 796: // handle error ! 797: } ! 798: CloseHandle( file_handle ); ! 799: } ! 800: SetCursor( LoadCursor( NULL, IDC_ARROW ) ); ! 801: } ! 802: else ! 803: { ! 804: // full_path is our file to delete... ! 805: sprintf( full_path, "%s%s.CFG", init_path, cfgptr->Name ); ! 806: DeleteFile( full_path ); ! 807: } ! 808: } ! 809: ! 810: // the flag is a 1 if we're transferring from a cfgptr to the dialog stuff, or a 0 if the other way... ! 811: void TransferConfiguration( HWND hDlg, int flag ) ! 812: { ! 813: int i; ! 814: ConfigStructPtr cfgptr; ! 815: ! 816: if( cfgptr = AllocateConfigStruct() ) ! 817: { ! 818: switch( flag ) ! 819: { ! 820: case 0: // we're doing a save... ! 821: GetDlgItemText( hDlg, IDC_EDITNAME, cfgptr->Name, MAX_PATH ); ! 822: if( cfgptr->Name[0] == '\0' ) ! 823: { ! 824: MessageBox( hDlg, "You must enter a name for your configuration...", "Save Error", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND ); ! 825: } ! 826: else ! 827: { ! 828: GetDlgItemText( hDlg, IDC_EDITDESCRIPTION, cfgptr->Description, CFG_DESCRIPTION_LENGTH ); ! 829: ! 830: // The for() loop below handles the other pages that were never viewed... ! 831: for( i = 0; i < C_PAGES; i++ ) ! 832: { ! 833: if( pages[i] == NULL ) ! 834: GetDefaultsForPage( cfgptr, i ); ! 835: else ! 836: SendMessage( pages[i], PSM_QUERYSIBLINGS, 0, (LPARAM)cfgptr ); ! 837: } ! 838: ConfigurationFile( hDlg, cfgptr, flag ); ! 839: } ! 840: break; ! 841: ! 842: case 1: // we're doing a load... ! 843: GetDlgItemText( hDlg, IDC_EDITNAME, cfgptr->Name, MAX_PATH ); ! 844: if( cfgptr->Name[0] == '\0' ) ! 845: { ! 846: MessageBox( hDlg, "You must select a configuration...", "Load Error", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND ); ! 847: } ! 848: else ! 849: { ! 850: ConfigurationFile( hDlg, cfgptr, flag ); ! 851: ! 852: // Do a sanity-test on the loaded config file: ! 853: // - check its Size member ! 854: // - check its VersionMajor ! 855: // - check its VersionMinor ! 856: if( ( cfgptr->Size != sizeof( ConfigStruct ) ) || ! 857: ( cfgptr->VersionMajor != CONFIG_VERSION_MAJOR ) || ! 858: ( cfgptr->VersionMinor != CONFIG_VERSION_MINOR ) ) ! 859: { ! 860: // Dire error situation... ! 861: MessageBox( hDlg, "This configuration is of the wrong version... automatic conversion is not yet available, sorry!", "Config-File Error", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND ); ! 862: } ! 863: else ! 864: { ! 865: // Insert stuff here to take the cfgptr contents and put them into the right configuration variables (currprefs, etc). ! 866: ! 867: // Basically ripped from GetDefaultsForPage() function above... and reversed direction ! 868: currprefs.automount_uaedev = !cfgptr->NoAutoConfig; ! 869: currprefs.fake_joystick = cfgptr->FakeJoystick; ! 870: currprefs.illegal_mem = cfgptr->InvalidAddresses; ! 871: currprefs.use_serial = cfgptr->SerialPort; ! 872: currprefs.gfx_correct_aspect = cfgptr->CorrectAspect; ! 873: currprefs.gfx_ycenter = cfgptr->CenterY; ! 874: currprefs.gfx_xcenter = cfgptr->CenterX; ! 875: currprefs.copper_pos = cfgptr->CopperHack; ! 876: currprefs.blits_32bit_enabled = cfgptr->Blit32; ! 877: currprefs.immediate_blits = cfgptr->BlitImmediate; ! 878: currprefs.gfx_lores = cfgptr->Lores; ! 879: currprefs.framerate = cfgptr->FrameRate; ! 880: currprefs.gfx_linedbl = cfgptr->LineDouble; ! 881: currprefs.gfx_width = cfgptr->ScreenWidth; ! 882: currprefs.gfx_height = cfgptr->ScreenHeight; ! 883: currprefs.produce_sound = (int)(cfgptr->SoundSupport); ! 884: currprefs.sound_bits = cfgptr->SoundBits; ! 885: currprefs.sound_freq = cfgptr->SoundFreq; ! 886: currprefs.stereo = cfgptr->SoundStereo; ! 887: ! 888: //use_debugger = cfgptr->DebuggerEnabled; ! 889: amiga_fullscreen = cfgptr->FullScreen; ! 890: chipmem_size = cfgptr->ChipMem; ! 891: fastmem_size = cfgptr->FastMem; ! 892: gfxmem_size = cfgptr->P96Mem; ! 893: z3fastmem_size = cfgptr->Z3Mem; ! 894: currprefs.m68k_speed = cfgptr->M68KSpeed; ! 895: hf_bootpri = cfgptr->HardFileBootPri; ! 896: customsize = cfgptr->CustomSize; ! 897: address_space_24 = cfgptr->AddressingIs24Bit; ! 898: ! 899: strncpy( sername, cfgptr->SerialName, CFG_SER_LENGTH ); ! 900: strncpy( prtname, cfgptr->PrinterName, CFG_PAR_LENGTH ); ! 901: strncpy( romfile, cfgptr->KickstartName, CFG_ROM_LENGTH ); ! 902: strncpy( keyfile, cfgptr->KeyFileName, CFG_KEY_LENGTH ); ! 903: ! 904: for( i = 0; i < NUM_DRIVES; i++ ) ! 905: { ! 906: memcpy( &drives[i], &(cfgptr->drives[i]), sizeof( drive_specs ) ); ! 907: } ! 908: ! 909: for( i = 0; i < NUM_DRIVES; i++ ) ! 910: { ! 911: memcpy( currprefs.df[i], cfgptr->df[i], 256 ); ! 912: } ! 913: ! 914: // Now, re-init the pages to have the right visual state... not done when a page is viewed ! 915: // Only needs to be sent to those pages which have been viewed so far. ! 916: for( i = 0; i < C_PAGES; i++ ) ! 917: { ! 918: if( pages[i] != NULL ) ! 919: SendMessage( pages[i], WM_USER, 0, 0 ); ! 920: } ! 921: } ! 922: } ! 923: break; ! 924: ! 925: case 2: // we're doing a delete... ! 926: GetDlgItemText( hDlg, IDC_EDITNAME, cfgptr->Name, MAX_PATH ); ! 927: if( cfgptr->Name[0] == '\0' ) ! 928: { ! 929: MessageBox( hDlg, "You must select a configuration to delete...", "Delete Error", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND ); ! 930: } ! 931: else ! 932: { ! 933: ConfigurationFile( hDlg, cfgptr, flag ); ! 934: } ! 935: break; ! 936: ! 937: case 3: // we're doing an import... ! 938: default: ! 939: ConfigurationFile( hDlg, cfgptr, flag ); ! 940: break; ! 941: } ! 942: FreeConfigStruct( cfgptr ); ! 943: } ! 944: } ! 945: ! 946: void InitializeListView( HWND hDlg ) ! 947: { ! 948: #define NUM_COLUMNS 2 ! 949: HANDLE file_handle = NULL; ! 950: WIN32_FIND_DATA find_data; ! 951: BOOL rc = TRUE; ! 952: HWND list; ! 953: LV_ITEM lvstruct; ! 954: LV_COLUMN lvcolumn; ! 955: RECT rect; ! 956: char *column_heading[ NUM_COLUMNS ] = { "Name", "Description" }; ! 957: int width = 0, column_width[ NUM_COLUMNS ] = { 0, 0 }; ! 958: int items = 0, result = 0, i, entry = 0, temp = 0; ! 959: ConfigStructPtr config = NULL; ! 960: ! 961: list = GetDlgItem( hDlg, IDC_CONFIGLIST ); ! 962: ListView_DeleteAllItems( list ); ! 963: ! 964: for( i = 0; i < NUM_COLUMNS; i++ ) ! 965: column_width[i] = ListView_GetStringWidth( list, column_heading[i] ) + 15; ! 966: ! 967: // If there are no columns, then insert some ! 968: lvcolumn.mask = LVCF_WIDTH; ! 969: if( ListView_GetColumn( list, 1, &lvcolumn ) == FALSE ) ! 970: { ! 971: for( i = 0; i < NUM_COLUMNS; i++ ) ! 972: { ! 973: lvcolumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; ! 974: lvcolumn.iSubItem = i; ! 975: lvcolumn.fmt = LVCFMT_CENTER; ! 976: lvcolumn.pszText = column_heading[i]; ! 977: lvcolumn.cx = column_width[i]; ! 978: ListView_InsertColumn( list, i, &lvcolumn ); ! 979: } ! 980: } ! 981: if( config = GetFirstConfigEntry( &file_handle, &find_data ) ) ! 982: { ! 983: do ! 984: { ! 985: lvstruct.mask = LVIF_TEXT | LVIF_PARAM; ! 986: lvstruct.pszText = config->Name; ! 987: lvstruct.lParam = 0; ! 988: lvstruct.iItem = entry; ! 989: lvstruct.iSubItem = 0; ! 990: result = ListView_InsertItem( list, &lvstruct ); ! 991: if( result != -1 ) ! 992: { ! 993: width = ListView_GetStringWidth( list, lvstruct.pszText ) + 15; ! 994: if( width > column_width[ lvstruct.iSubItem ] ) ! 995: column_width[ lvstruct.iSubItem ] = width; ! 996: ! 997: ListView_SetItemText( list, result, 1, config->Description ); ! 998: width = ListView_GetStringWidth( list, config->Description ) + 15; ! 999: if( width > column_width[ 1 ] ) ! 1000: column_width[ 1 ] = width; ! 1001: ! 1002: entry++; ! 1003: } ! 1004: FreeConfigStruct( config ); ! 1005: } ! 1006: while( config = GetNextConfigEntry( &file_handle, &find_data ) ); ! 1007: } ! 1008: if( rc == FALSE ) ! 1009: { ! 1010: FreeConfigStruct( config ); ! 1011: } ! 1012: ! 1013: if( result != -1 ) ! 1014: { ! 1015: if( GetWindowRect( list, &rect ) ) ! 1016: { ! 1017: ScreenToClient( hDlg, (LPPOINT)&rect ); ! 1018: ScreenToClient( hDlg, (LPPOINT)&rect.right ); ! 1019: if( ( temp = rect.right - rect.left - column_width[ 0 ] - 4 ) > column_width[1] ) ! 1020: column_width[1] = temp; ! 1021: } ! 1022: ! 1023: // Adjust our column widths so that we can see the contents... ! 1024: for( i = 0; i < NUM_COLUMNS; i++ ) ! 1025: { ! 1026: ListView_SetColumnWidth( list, i, column_width[i] ); ! 1027: } ! 1028: ! 1029: // Redraw the items in the list... ! 1030: items = ListView_GetItemCount( list ); ! 1031: ListView_RedrawItems( list, 0, items ); ! 1032: } ! 1033: } ! 1034: ! 1035: BOOL CALLBACK LoadSaveDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) ! 1036: { ! 1037: #define NUM_COLUMNS 2 ! 1038: char name_buf[ MAX_PATH ] = "", desc_buf[ 128 ] = ""; ! 1039: int found = 0; ! 1040: BOOL rc = TRUE; ! 1041: RECT rect; ! 1042: DWORD pos; ! 1043: POINT point; ! 1044: HWND list; ! 1045: UINT flag, dblclick = 0; ! 1046: NM_LISTVIEW *nmlistview; ! 1047: int items = 0, result = 0, entry = 0; ! 1048: ConfigStructPtr config = NULL; ! 1049: ! 1050: switch(msg) ! 1051: { ! 1052: case WM_INITDIALOG: ! 1053: InitializeListView( hDlg ); ! 1054: if( hEmuThread ) ! 1055: { ! 1056: EnableWindow( GetDlgItem( hDlg, IDC_SAVE ), FALSE ); ! 1057: EnableWindow( GetDlgItem( hDlg, IDC_IMPORT ), FALSE ); ! 1058: } ! 1059: return(TRUE); ! 1060: break; ! 1061: ! 1062: case WM_COMMAND: ! 1063: switch( wParam ) ! 1064: { ! 1065: case IDC_SAVE: ! 1066: TransferConfiguration( hDlg, 0 ); ! 1067: InitializeListView( hDlg ); ! 1068: break; ! 1069: case IDC_LOAD: ! 1070: TransferConfiguration( hDlg, 1 ); ! 1071: break; ! 1072: case IDC_DELETE: ! 1073: TransferConfiguration( hDlg, 2 ); ! 1074: InitializeListView( hDlg ); ! 1075: break; ! 1076: case IDC_IMPORT: ! 1077: TransferConfiguration( hDlg, 3 ); ! 1078: break; ! 1079: } ! 1080: break; ! 1081: case WM_NOTIFY: ! 1082: if( ((LPNMHDR)lParam)->idFrom == IDC_CONFIGLIST ) ! 1083: { ! 1084: nmlistview = (NM_LISTVIEW *)lParam; ! 1085: list = nmlistview->hdr.hwndFrom; ! 1086: ! 1087: switch( nmlistview->hdr.code ) ! 1088: { ! 1089: case NM_DBLCLK: ! 1090: dblclick = 1; ! 1091: // fall-through ! 1092: case NM_CLICK: ! 1093: pos = GetMessagePos(); ! 1094: point.x = LOWORD( pos ); ! 1095: point.y = HIWORD( pos ); ! 1096: ScreenToClient( list, &point ); ! 1097: entry = ListView_GetTopIndex( list ); ! 1098: items = entry + ListView_GetCountPerPage( list ); ! 1099: if( items > ListView_GetItemCount( list ) ) ! 1100: items = ListView_GetItemCount( list ); ! 1101: ! 1102: while( entry <= items ) ! 1103: { ! 1104: // Get the bounding rectangle of an item. If the mouse ! 1105: // location is within the bounding rectangle of the item, ! 1106: // you know you have found the item that was being clicked. ! 1107: ListView_GetItemRect( list, entry, &rect, LVIR_BOUNDS); ! 1108: if( PtInRect( &rect, point ) ) ! 1109: { ! 1110: flag = LVIS_SELECTED | LVIS_FOCUSED; ! 1111: ListView_SetItemState( list, entry, flag, flag); ! 1112: found = 1; ! 1113: break; ! 1114: } ! 1115: ! 1116: // Get the next item in listview control. ! 1117: entry++; ! 1118: } ! 1119: ! 1120: // Copy the item's name and description to the gadgets at the bottom... ! 1121: if( entry >= 0 && found) ! 1122: { ! 1123: ListView_GetItemText( list, entry, 0, name_buf, MAX_PATH ); ! 1124: ListView_GetItemText( list, entry, 1, desc_buf, 128 ); ! 1125: SetDlgItemText( hDlg, IDC_EDITNAME, name_buf ); ! 1126: SetDlgItemText( hDlg, IDC_EDITDESCRIPTION, desc_buf ); ! 1127: ListView_RedrawItems( list, 0, items ); ! 1128: ! 1129: if( dblclick ) ! 1130: { ! 1131: // do the config-loading ! 1132: TransferConfiguration( hDlg, 1 ); ! 1133: ! 1134: // start the emulation... ! 1135: } ! 1136: } ! 1137: break; ! 1138: } ! 1139: } ! 1140: else ! 1141: { ! 1142: switch(((NMHDR *)lParam)->code) ! 1143: { ! 1144: case PSN_RESET: ! 1145: if(allow_quit_from_property_sheet) ! 1146: { ! 1147: quit_program = 1; ! 1148: regs.spcflags |= SPCFLAG_BRK; ! 1149: } ! 1150: break; ! 1151: } ! 1152: } ! 1153: break; ! 1154: } ! 1155: ! 1156: return(FALSE); ! 1157: } ! 1158: ! 1159: int CALLBACK ContributorsProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) ! 1160: { ! 1161: CHARFORMAT CharFormat; ! 1162: ! 1163: switch( msg ) ! 1164: { ! 1165: case WM_COMMAND: ! 1166: if( wParam == IDC_GREATWORK ) ! 1167: { ! 1168: EndDialog( hDlg, 1 ); ! 1169: return TRUE; ! 1170: } ! 1171: break; ! 1172: case WM_INITDIALOG: ! 1173: CharFormat.cbSize = sizeof( CharFormat ); ! 1174: ! 1175: SetDlgItemText( hDlg, IDC_CONTRIBUTORS, ! 1176: "Bernd Schmidt - The Grand-Master\n" ! 1177: "Mathias Ortmann - WinUAE Main Guy\n" ! 1178: "Brian King - Picasso96 Support, Integrated GUI for WinUAE, AHI (Working on it)\n" ! 1179: "Gustavo Goedert/Peter Remmers/Michael Sontheimer/Tomi Hakala/Tim Gunn/Nemo Pohle - DOS Port Stuff\n" ! 1180: "Samuel Devulder/Olaf Barthel - Amiga Port\n" ! 1181: "Krister Bergman - XFree86 and OS/2 Port\n" ! 1182: "A. Blanchard/Ernesto Corvi - MacOS Port\n" ! 1183: "Christian Bauer - BeOS Port\n" ! 1184: "Ian Stephenson - NextStep Port\n" ! 1185: "Peter Teichmann - Acorn/RiscOS Port\n" ! 1186: "Stefan Reinauer - ZorroII/III AutoConfig, Serial Support\n" ! 1187: "Christian Schmitt/Chris Hames - Serial Support\n" ! 1188: "Herman ten Brugge - 68020/68881 Emulation Code\n" ! 1189: "Tauno Taipaleenmaki - Various UAE-Control/UAE-Library Support\n" ! 1190: "Brett Eden/Tim Gunn/Paolo Besser/Nemo Pohle - Various Docs and Web-Sites\n" ! 1191: "Special thanks to Alexander Kneer and Tobias Abt (The Picasso96 Team)" ! 1192: ); ! 1193: SendDlgItemMessage(hDlg, IDC_CONTRIBUTORS, EM_GETCHARFORMAT,0,(LPARAM)&CharFormat); ! 1194: CharFormat.dwMask |= CFM_SIZE | CFM_FACE; ! 1195: CharFormat.yHeight = 10*20; // height in twips, where a twip is 1/20th of a point - for a pt.size of 18 ! 1196: strcpy( CharFormat.szFaceName, "Times New Roman" ); ! 1197: SendDlgItemMessage(hDlg, IDC_CONTRIBUTORS, EM_SETCHARFORMAT,SCF_ALL,(LPARAM)&CharFormat); ! 1198: //SendDlgItemMessage(hDlg, IDC_CONTRIBUTORS, EM_SETBKGNDCOLOR,0,GetSysColor( COLOR_3DFACE ) ); ! 1199: ! 1200: return TRUE; ! 1201: break; ! 1202: } ! 1203: return FALSE; ! 1204: } ! 1205: ! 1206: void DisplayContributors( HWND hDlg ) ! 1207: { ! 1208: DialogBox( hInst, MAKEINTRESOURCE( IDD_CONTRIBUTORS ), hDlg, ContributorsProc ); ! 1209: } ! 1210: ! 1211: BOOL CALLBACK AboutDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) ! 1212: { ! 1213: POINT point; ! 1214: RECT rect; ! 1215: CHARFORMAT CharFormat; ! 1216: switch(msg) ! 1217: { ! 1218: case WM_INITDIALOG: ! 1219: CharFormat.cbSize = sizeof( CharFormat ); ! 1220: ! 1221: SetDlgItemText( hDlg, IDC_RICHEDIT1, "UAE for Win32/DirectX" ); ! 1222: SendDlgItemMessage(hDlg, IDC_RICHEDIT1, EM_GETCHARFORMAT,0,(LPARAM)&CharFormat); ! 1223: CharFormat.dwMask |= CFM_BOLD | CFM_SIZE | CFM_FACE; ! 1224: CharFormat.dwEffects = CFE_BOLD; ! 1225: CharFormat.yHeight = 18*20; // height in twips, where a twip is 1/20th of a point - for a pt.size of 18 ! 1226: strcpy( CharFormat.szFaceName, "Times New Roman" ); ! 1227: SendDlgItemMessage(hDlg, IDC_RICHEDIT1, EM_SETCHARFORMAT,SCF_ALL,(LPARAM)&CharFormat); ! 1228: SendDlgItemMessage(hDlg, IDC_RICHEDIT1, EM_SETBKGNDCOLOR,0,GetSysColor( COLOR_3DFACE ) ); ! 1229: ! 1230: SetDlgItemText( hDlg, IDC_RICHEDIT2, PROGNAME ); ! 1231: SendDlgItemMessage(hDlg, IDC_RICHEDIT2, EM_GETCHARFORMAT,0,(LPARAM)&CharFormat); ! 1232: CharFormat.dwMask |= CFM_SIZE | CFM_FACE; ! 1233: CharFormat.yHeight = 10*20; ! 1234: strcpy( CharFormat.szFaceName, "Times New Roman" ); ! 1235: SendDlgItemMessage(hDlg, IDC_RICHEDIT2, EM_SETCHARFORMAT,SCF_ALL,(LPARAM)&CharFormat); ! 1236: SendDlgItemMessage(hDlg, IDC_RICHEDIT2, EM_SETBKGNDCOLOR,0,GetSysColor( COLOR_3DFACE ) ); ! 1237: ! 1238: SetDlgItemText( hDlg, IDC_AMIGAHOME, "Amiga" ); ! 1239: SendDlgItemMessage(hDlg, IDC_AMIGAHOME, EM_GETCHARFORMAT,0,(LPARAM)&CharFormat); ! 1240: CharFormat.dwMask |= CFM_UNDERLINE | CFM_SIZE | CFM_FACE | CFM_COLOR; ! 1241: CharFormat.dwEffects = CFE_UNDERLINE; ! 1242: CharFormat.yHeight = 12*20; // height in twips, where a twip is 1/20th of a point - for a pt.size of 18 ! 1243: CharFormat.crTextColor = GetSysColor( COLOR_ACTIVECAPTION ); ! 1244: strcpy( CharFormat.szFaceName, "Times New Roman" ); ! 1245: SendDlgItemMessage(hDlg, IDC_AMIGAHOME, EM_SETCHARFORMAT,SCF_ALL,(LPARAM)&CharFormat); ! 1246: SendDlgItemMessage(hDlg, IDC_AMIGAHOME, EM_SETBKGNDCOLOR,0,GetSysColor( COLOR_3DFACE ) ); ! 1247: ! 1248: SetDlgItemText( hDlg, IDC_CLOANTOHOME, "Cloanto" ); ! 1249: SendDlgItemMessage(hDlg, IDC_CLOANTOHOME, EM_GETCHARFORMAT,0,(LPARAM)&CharFormat); ! 1250: CharFormat.dwMask |= CFM_UNDERLINE | CFM_SIZE | CFM_FACE | CFM_COLOR; ! 1251: CharFormat.dwEffects = CFE_UNDERLINE; ! 1252: CharFormat.yHeight = 12*20; // height in twips, where a twip is 1/20th of a point - for a pt.size of 18 ! 1253: CharFormat.crTextColor = GetSysColor( COLOR_ACTIVECAPTION ); ! 1254: strcpy( CharFormat.szFaceName, "Times New Roman" ); ! 1255: SendDlgItemMessage(hDlg, IDC_CLOANTOHOME, EM_SETCHARFORMAT,SCF_ALL,(LPARAM)&CharFormat); ! 1256: SendDlgItemMessage(hDlg, IDC_CLOANTOHOME, EM_SETBKGNDCOLOR,0,GetSysColor( COLOR_3DFACE ) ); ! 1257: ! 1258: SetDlgItemText( hDlg, IDC_WINUAEHOME, "WinUAE" ); ! 1259: SendDlgItemMessage(hDlg, IDC_WINUAEHOME, EM_GETCHARFORMAT,0,(LPARAM)&CharFormat); ! 1260: CharFormat.dwMask |= CFM_UNDERLINE | CFM_SIZE | CFM_FACE | CFM_COLOR; ! 1261: CharFormat.dwEffects = CFE_UNDERLINE; ! 1262: CharFormat.yHeight = 12*20; // height in twips, where a twip is 1/20th of a point - for a pt.size of 18 ! 1263: CharFormat.crTextColor = GetSysColor( COLOR_ACTIVECAPTION ); ! 1264: strcpy( CharFormat.szFaceName, "Times New Roman" ); ! 1265: SendDlgItemMessage(hDlg, IDC_WINUAEHOME, EM_SETCHARFORMAT,SCF_ALL,(LPARAM)&CharFormat); ! 1266: SendDlgItemMessage(hDlg, IDC_WINUAEHOME, EM_SETBKGNDCOLOR,0,GetSysColor( COLOR_3DFACE ) ); ! 1267: ! 1268: SetDlgItemText( hDlg, IDC_UAEHOME, "UAE" ); ! 1269: SendDlgItemMessage(hDlg, IDC_UAEHOME, EM_GETCHARFORMAT,0,(LPARAM)&CharFormat); ! 1270: CharFormat.dwMask |= CFM_UNDERLINE | CFM_SIZE | CFM_FACE | CFM_COLOR; ! 1271: CharFormat.dwEffects = CFE_UNDERLINE; ! 1272: CharFormat.yHeight = 12*20; // height in twips, where a twip is 1/20th of a point - for a pt.size of 18 ! 1273: CharFormat.crTextColor = GetSysColor( COLOR_ACTIVECAPTION ); ! 1274: strcpy( CharFormat.szFaceName, "Times New Roman" ); ! 1275: SendDlgItemMessage(hDlg, IDC_UAEHOME, EM_SETCHARFORMAT,SCF_ALL,(LPARAM)&CharFormat); ! 1276: SendDlgItemMessage(hDlg, IDC_UAEHOME, EM_SETBKGNDCOLOR,0,GetSysColor( COLOR_3DFACE ) ); ! 1277: ! 1278: SetDlgItemText( hDlg, IDC_PICASSOHOME, "Picasso96" ); ! 1279: SendDlgItemMessage(hDlg, IDC_PICASSOHOME, EM_GETCHARFORMAT,0,(LPARAM)&CharFormat); ! 1280: CharFormat.dwMask |= CFM_UNDERLINE | CFM_SIZE | CFM_FACE | CFM_COLOR; ! 1281: CharFormat.dwEffects = CFE_UNDERLINE; ! 1282: CharFormat.yHeight = 12*20; // height in twips, where a twip is 1/20th of a point - for a pt.size of 18 ! 1283: CharFormat.crTextColor = GetSysColor( COLOR_ACTIVECAPTION ); ! 1284: strcpy( CharFormat.szFaceName, "Times New Roman" ); ! 1285: SendDlgItemMessage(hDlg, IDC_PICASSOHOME, EM_SETCHARFORMAT,SCF_ALL,(LPARAM)&CharFormat); ! 1286: SendDlgItemMessage(hDlg, IDC_PICASSOHOME, EM_SETBKGNDCOLOR,0,GetSysColor( COLOR_3DFACE ) ); ! 1287: break; ! 1288: ! 1289: case WM_COMMAND: ! 1290: if( wParam == IDC_CONTRIBUTORS ) ! 1291: { ! 1292: DisplayContributors( hDlg ); ! 1293: } ! 1294: break; ! 1295: case WM_LBUTTONDOWN: ! 1296: point.x = LOWORD( lParam ); ! 1297: point.y = HIWORD( lParam ); ! 1298: GetWindowRect( GetDlgItem( hDlg, IDC_CLOANTOHOME ), &rect ); ! 1299: ScreenToClient( hDlg, (POINT *)&rect ); ! 1300: ScreenToClient( hDlg, (POINT *)&(rect.right) ); ! 1301: if( PtInRect( &rect, point ) ) ! 1302: { ! 1303: ShellExecute( NULL, NULL, "http://www.cloanto.com/amiga/forever", NULL, NULL, SW_SHOWNORMAL ); ! 1304: break; ! 1305: } ! 1306: ! 1307: GetWindowRect( GetDlgItem( hDlg, IDC_AMIGAHOME ), &rect ); ! 1308: ScreenToClient( hDlg, (POINT *)&rect ); ! 1309: ScreenToClient( hDlg, (POINT *)&(rect.right) ); ! 1310: if( PtInRect( &rect, point ) ) ! 1311: { ! 1312: ShellExecute( NULL, NULL, "http://www.amiga.de", NULL, NULL, SW_SHOWNORMAL ); ! 1313: break; ! 1314: } ! 1315: ! 1316: GetWindowRect( GetDlgItem( hDlg, IDC_PICASSOHOME ), &rect ); ! 1317: ScreenToClient( hDlg, (POINT *)&rect ); ! 1318: ScreenToClient( hDlg, (POINT *)&(rect.right) ); ! 1319: if( PtInRect( &rect, point ) ) ! 1320: { ! 1321: ShellExecute( NULL, NULL, "http://www.villagetronic.com/amiga/support/ftp96.html", NULL, NULL, SW_SHOWNORMAL ); ! 1322: break; ! 1323: } ! 1324: ! 1325: GetWindowRect( GetDlgItem( hDlg, IDC_UAEHOME ), &rect ); ! 1326: ScreenToClient( hDlg, (POINT *)&rect ); ! 1327: ScreenToClient( hDlg, (POINT *)&(rect.right) ); ! 1328: if( PtInRect( &rect, point ) ) ! 1329: { ! 1330: ShellExecute( NULL, NULL, "http://www.freiburg.linux.de/~uae/", NULL, NULL, SW_SHOWNORMAL ); ! 1331: break; ! 1332: } ! 1333: ! 1334: GetWindowRect( GetDlgItem( hDlg, IDC_WINUAEHOME ), &rect ); ! 1335: ScreenToClient( hDlg, (POINT *)&rect ); ! 1336: ScreenToClient( hDlg, (POINT *)&(rect.right) ); ! 1337: if( PtInRect( &rect, point ) ) ! 1338: { ! 1339: ShellExecute( NULL, NULL, "http://www.informatik.tu-muenchen.de/~ortmann/uae/", NULL, NULL, SW_SHOWNORMAL ); ! 1340: break; ! 1341: } ! 1342: ! 1343: break; ! 1344: case WM_NOTIFY: ! 1345: switch(((NMHDR *)lParam)->code) ! 1346: { ! 1347: case PSN_RESET: ! 1348: if(allow_quit_from_property_sheet) ! 1349: { ! 1350: quit_program = 1; ! 1351: regs.spcflags |= SPCFLAG_BRK; ! 1352: } ! 1353: break; ! 1354: } ! 1355: break; ! 1356: } ! 1357: ! 1358: return(FALSE); ! 1359: } ! 1360: ! 1361: // Handle messages for the Display Settings page of our property-sheet ! 1362: BOOL CALLBACK DisplayDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) ! 1363: { ! 1364: int i, item_height; ! 1365: RECT rect; ! 1366: LONG posn; ! 1367: ConfigStructPtr cfgptr; ! 1368: ! 1369: switch(msg) ! 1370: { ! 1371: case PSM_QUERYSIBLINGS: ! 1372: cfgptr = (ConfigStructPtr)lParam; ! 1373: cfgptr->FrameRate = SendDlgItemMessage(hDlg,IDC_FRAMERATE,TBM_GETPOS,0,0); ! 1374: cfgptr->LineDouble = IsDlgButtonChecked(hDlg, IDC_LINEDBL); ! 1375: cfgptr->FullScreen = IsDlgButtonChecked( hDlg, IDC_FULLSCREEN ); ! 1376: cfgptr->CorrectAspect = IsDlgButtonChecked(hDlg, IDC_ASPECT); ! 1377: cfgptr->CenterY = IsDlgButtonChecked(hDlg, IDC_YCENTER); ! 1378: cfgptr->CenterX = IsDlgButtonChecked(hDlg, IDC_XCENTER); ! 1379: cfgptr->Blit32 = IsDlgButtonChecked(hDlg, IDC_BLIT32); ! 1380: cfgptr->BlitImmediate = IsDlgButtonChecked(hDlg, IDC_BLITIMM); ! 1381: cfgptr->Lores = IsDlgButtonChecked(hDlg, IDC_LORES); ! 1382: cfgptr->CustomSize = 0; ! 1383: if( IsDlgButtonChecked( hDlg, IDC_CUSTOMSIZE ) && !cfgptr->FullScreen ) ! 1384: { ! 1385: cfgptr->ScreenWidth = SendDlgItemMessage( hDlg, IDC_XSPIN, UDM_GETPOS, 0, 0 ); ! 1386: cfgptr->ScreenHeight = SendDlgItemMessage( hDlg, IDC_YSPIN, UDM_GETPOS, 0, 0 ); ! 1387: cfgptr->CustomSize = 1; ! 1388: } ! 1389: else if( ( posn = SendDlgItemMessage( hDlg, IDC_RESOLUTION, CB_GETCURSEL, 0, 0 ) ) != CB_ERR ) ! 1390: { ! 1391: posn = GetDisplayModeNumber( posn ); ! 1392: cfgptr->ScreenWidth = DisplayModes[posn].res.width; ! 1393: cfgptr->ScreenHeight = DisplayModes[posn].res.height; ! 1394: } ! 1395: else ! 1396: { ! 1397: cfgptr->ScreenWidth = currprefs.gfx_width; ! 1398: cfgptr->ScreenHeight = currprefs.gfx_height; ! 1399: } ! 1400: break; ! 1401: ! 1402: case WM_INITDIALOG: ! 1403: pages[ DISPLAY_ID ] = hDlg; ! 1404: case WM_USER: ! 1405: SendDlgItemMessage(hDlg, IDC_FRAMERATE, TBM_SETRANGE,TRUE,MAKELONG(MIN_REFRESH_RATE,MAX_REFRESH_RATE)); ! 1406: SendDlgItemMessage(hDlg,IDC_FRAMERATE,TBM_SETPOS,TRUE,currprefs.framerate); ! 1407: SendDlgItemMessage( hDlg, IDC_FRAMERATE, TBM_SETPAGESIZE, 0, 1 ); ! 1408: UpdateScroller(hDlg, GetDlgItem(hDlg, IDC_FRAMERATE) ); ! 1409: CheckDlgButton(hDlg, IDC_LINEDBL, currprefs.gfx_linedbl); ! 1410: CheckDlgButton( hDlg, IDC_FULLSCREEN, amiga_fullscreen ); ! 1411: CheckDlgButton( hDlg, IDC_CUSTOMSIZE, customsize ); ! 1412: ! 1413: if( pages[ STARTUP_ID ] && wParam == 1 ) ! 1414: { ! 1415: if( SendDlgItemMessage( pages[ STARTUP_ID ], IDC_P96MEM, TBM_GETPOS, 0, 0 ) > 0 ) ! 1416: { ! 1417: CheckDlgButton( hDlg, IDC_FULLSCREEN, TRUE ); ! 1418: EnableWindow( GetDlgItem( hDlg, IDC_FULLSCREEN ), FALSE ); ! 1419: } ! 1420: else ! 1421: { ! 1422: EnableWindow( GetDlgItem( hDlg, IDC_FULLSCREEN ), TRUE ); ! 1423: } ! 1424: } ! 1425: else ! 1426: { ! 1427: if( gfxmem_size ) ! 1428: { ! 1429: CheckDlgButton( hDlg, IDC_FULLSCREEN, TRUE ); ! 1430: EnableWindow( GetDlgItem( hDlg, IDC_FULLSCREEN ), FALSE ); ! 1431: } ! 1432: } ! 1433: ! 1434: SendDlgItemMessage(hDlg,IDC_RESOLUTION,CB_RESETCONTENT,0,0); ! 1435: for(i=0;i<mode_count;i++) ! 1436: { ! 1437: if( DisplayModes[i].depth == 2 && ! 1438: DisplayModes[i].res.width <= 800 && ! 1439: DisplayModes[i].res.height <= 600 ) ! 1440: SendDlgItemMessage(hDlg,IDC_RESOLUTION,CB_ADDSTRING,0,(LPARAM)(LPCTSTR)DisplayModes[i].name); ! 1441: } ! 1442: ! 1443: SendDlgItemMessage( hDlg, IDC_XSPIN, UDM_SETRANGE, 0, MAKELONG( 800, 320 ) ); ! 1444: SendDlgItemMessage( hDlg, IDC_XSPIN, UDM_SETPOS, TRUE, currprefs.gfx_width ); ! 1445: SendDlgItemMessage( hDlg, IDC_YSPIN, UDM_SETRANGE, 0, MAKELONG( 600, 200 ) ); ! 1446: SendDlgItemMessage( hDlg, IDC_YSPIN, UDM_SETPOS, TRUE, currprefs.gfx_height ); ! 1447: ! 1448: CheckDlgButton( hDlg, IDC_CUSTOMSIZE, customsize ); ! 1449: ! 1450: if( !amiga_fullscreen ) ! 1451: { ! 1452: EnableWindow( GetDlgItem( hDlg, IDC_CUSTOMSIZE ), TRUE ); ! 1453: EnableWindow( GetDlgItem( hDlg, IDC_XSPIN ), TRUE ); ! 1454: EnableWindow( GetDlgItem( hDlg, IDC_YSPIN ), TRUE ); ! 1455: SendDlgItemMessage( hDlg, IDC_RESOLUTION, CB_SETCURSEL, GetDisplayModeLogicalNumber( 800, 600 ), 0 ); ! 1456: } ! 1457: else ! 1458: { ! 1459: EnableWindow( GetDlgItem( hDlg, IDC_CUSTOMSIZE ), FALSE ); ! 1460: EnableWindow( GetDlgItem( hDlg, IDC_XSPIN ), FALSE ); ! 1461: EnableWindow( GetDlgItem( hDlg, IDC_YSPIN ), FALSE ); ! 1462: SendDlgItemMessage( hDlg, IDC_RESOLUTION, CB_SETCURSEL, GetDisplayModeLogicalNumber( currprefs.gfx_width, currprefs.gfx_height ), 0 ); ! 1463: } ! 1464: ! 1465: // Retrieve the height, in pixels, of a list item. ! 1466: item_height = SendDlgItemMessage(hDlg,IDC_RESOLUTION,CB_GETITEMHEIGHT,0,0); ! 1467: if( item_height != CB_ERR ) ! 1468: { ! 1469: // Get actual box position and size ! 1470: GetWindowRect( GetDlgItem(hDlg,IDC_RESOLUTION), &rect); ! 1471: rect.bottom = rect.top + item_height*mode_count + SendDlgItemMessage(hDlg,IDC_RESOLUTION,CB_GETITEMHEIGHT,(WPARAM)-1,0) + item_height; ! 1472: SetWindowPos( GetDlgItem(hDlg,IDC_RESOLUTION), 0, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE|SWP_NOZORDER); ! 1473: } ! 1474: ! 1475: CheckDlgButton(hDlg, IDC_ASPECT, currprefs.gfx_correct_aspect); ! 1476: CheckDlgButton(hDlg, IDC_YCENTER, currprefs.gfx_ycenter); ! 1477: CheckDlgButton(hDlg, IDC_XCENTER, currprefs.gfx_xcenter); ! 1478: CheckDlgButton(hDlg, IDC_BLIT32, currprefs.blits_32bit_enabled); ! 1479: CheckDlgButton(hDlg, IDC_BLITIMM, currprefs.immediate_blits); ! 1480: CheckDlgButton(hDlg, IDC_LORES, currprefs.gfx_lores); ! 1481: if(hEmuThread) ! 1482: { // Disable certain controls which are only to be set once at start-up... ! 1483: EnableWindow(GetDlgItem(hDlg, IDC_LORES), FALSE); ! 1484: EnableWindow(GetDlgItem(hDlg, IDC_XCENTER), FALSE); ! 1485: EnableWindow(GetDlgItem(hDlg, IDC_YCENTER), FALSE); ! 1486: EnableWindow(GetDlgItem(hDlg, IDC_ASPECT), FALSE); ! 1487: EnableWindow(GetDlgItem(hDlg, IDC_LINEDBL), FALSE); ! 1488: EnableWindow(GetDlgItem(hDlg, IDC_RESOLUTION), FALSE); ! 1489: EnableWindow( GetDlgItem( hDlg, IDC_CUSTOMSIZE ), FALSE ); ! 1490: EnableWindow( GetDlgItem( hDlg, IDC_XSPIN ), FALSE ); ! 1491: EnableWindow( GetDlgItem( hDlg, IDC_YSPIN ), FALSE ); ! 1492: EnableWindow( GetDlgItem( hDlg, IDC_XSIZE ), FALSE ); ! 1493: EnableWindow( GetDlgItem( hDlg, IDC_YSIZE ), FALSE ); ! 1494: } ! 1495: break; ! 1496: case WM_HSCROLL: ! 1497: UpdateScroller( hDlg, (HWND)lParam ); ! 1498: break; ! 1499: case WM_COMMAND: ! 1500: if( LOWORD(wParam) == IDC_FULLSCREEN ) ! 1501: { ! 1502: if( hEmuThread == NULL ) ! 1503: { ! 1504: EnableWindow( GetDlgItem( hDlg, IDC_CUSTOMSIZE ), !IsDlgButtonChecked( hDlg, IDC_FULLSCREEN ) ); ! 1505: EnableWindow( GetDlgItem( hDlg, IDC_XSPIN ), !IsDlgButtonChecked( hDlg, IDC_FULLSCREEN ) ); ! 1506: EnableWindow( GetDlgItem( hDlg, IDC_YSPIN ), !IsDlgButtonChecked( hDlg, IDC_FULLSCREEN ) ); ! 1507: EnableWindow( GetDlgItem( hDlg, IDC_XSIZE ), !IsDlgButtonChecked( hDlg, IDC_FULLSCREEN ) ); ! 1508: EnableWindow( GetDlgItem( hDlg, IDC_YSIZE ), !IsDlgButtonChecked( hDlg, IDC_FULLSCREEN ) ); ! 1509: } ! 1510: } ! 1511: break; ! 1512: ! 1513: case WM_NOTIFY: ! 1514: switch(((NMHDR *)lParam)->code) ! 1515: { ! 1516: case PSN_APPLY: ! 1517: if( amiga_fullscreen != IsDlgButtonChecked( hDlg, IDC_FULLSCREEN ) ) ! 1518: { ! 1519: if( hEmuThread ) ! 1520: new_fullscreen_flag = 1; ! 1521: else ! 1522: amiga_fullscreen = IsDlgButtonChecked( hDlg, IDC_FULLSCREEN ); ! 1523: } ! 1524: ! 1525: customsize = IsDlgButtonChecked( hDlg, IDC_CUSTOMSIZE ); ! 1526: if( customsize && !amiga_fullscreen ) ! 1527: { ! 1528: currprefs.gfx_width = SendDlgItemMessage( hDlg, IDC_XSPIN, UDM_GETPOS, 0, 0 ); ! 1529: currprefs.gfx_height = SendDlgItemMessage( hDlg, IDC_YSPIN, UDM_GETPOS, 0, 0 ); ! 1530: } ! 1531: else if( ( posn = SendDlgItemMessage( hDlg, IDC_RESOLUTION, CB_GETCURSEL, 0, 0 ) ) != CB_ERR ) ! 1532: { ! 1533: posn = GetDisplayModeNumber( posn ); ! 1534: currprefs.gfx_width = DisplayModes[posn].res.width; ! 1535: currprefs.gfx_height = DisplayModes[posn].res.height; ! 1536: } ! 1537: currprefs.gfx_ycenter = IsDlgButtonChecked(hDlg, IDC_YCENTER); ! 1538: currprefs.gfx_xcenter = IsDlgButtonChecked(hDlg, IDC_XCENTER); ! 1539: currprefs.blits_32bit_enabled = IsDlgButtonChecked(hDlg, IDC_BLIT32); ! 1540: currprefs.immediate_blits = IsDlgButtonChecked(hDlg, IDC_BLITIMM); ! 1541: currprefs.gfx_lores = IsDlgButtonChecked(hDlg, IDC_LORES); ! 1542: currprefs.framerate = SendDlgItemMessage(hDlg,IDC_FRAMERATE,TBM_GETPOS,0,0); ! 1543: currprefs.gfx_correct_aspect = IsDlgButtonChecked(hDlg, IDC_ASPECT); ! 1544: currprefs.gfx_linedbl = IsDlgButtonChecked(hDlg, IDC_LINEDBL); ! 1545: break; ! 1546: ! 1547: case PSN_RESET: ! 1548: if(allow_quit_from_property_sheet) ! 1549: { ! 1550: quit_program = 1; ! 1551: regs.spcflags |= SPCFLAG_BRK; ! 1552: } ! 1553: break; ! 1554: } ! 1555: } ! 1556: return(FALSE); ! 1557: } ! 1558: ! 1559: BOOL CALLBACK StartupDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) ! 1560: { ! 1561: ConfigStructPtr cfgptr; ! 1562: LONG mem_size; ! 1563: ! 1564: switch(msg) ! 1565: { ! 1566: case PSM_QUERYSIBLINGS: ! 1567: cfgptr = (ConfigStructPtr)lParam; ! 1568: ! 1569: CalculateRealMem( SendMessage(GetDlgItem(hDlg, IDC_CHIPMEM),TBM_GETPOS,0,0), &cfgptr->ChipMem, NULL, 0 ); ! 1570: CalculateRealMem( SendMessage(GetDlgItem(hDlg, IDC_FASTMEM),TBM_GETPOS,0,0), &cfgptr->FastMem, NULL, 1 ); ! 1571: #if CPU_LEVEL > 1 ! 1572: CalculateRealMem( SendMessage(GetDlgItem(hDlg, IDC_P96MEM), TBM_GETPOS, 0, 0 ), &cfgptr->P96Mem, NULL, 2 ); ! 1573: CalculateRealMem( SendMessage(GetDlgItem(hDlg, IDC_Z3FASTMEM), TBM_GETPOS, 0, 0 ), &cfgptr->Z3Mem, NULL, 3 ); ! 1574: #endif ! 1575: GetDlgItemText( hDlg, IDC_ROMFILE, cfgptr->KickstartName, CFG_ROM_LENGTH ); ! 1576: GetDlgItemText( hDlg, IDC_KEYFILE, cfgptr->KeyFileName, CFG_KEY_LENGTH ); ! 1577: break; ! 1578: ! 1579: case WM_INITDIALOG: ! 1580: pages[ STARTUP_ID ] = hDlg; ! 1581: case WM_USER: ! 1582: SetDlgItemText( hDlg, IDC_ROMFILE, romfile ); ! 1583: SetDlgItemText( hDlg, IDC_KEYFILE, keyfile ); ! 1584: SendDlgItemMessage(hDlg, IDC_CHIPMEM, TBM_SETRANGE,TRUE,MAKELONG(MIN_CHIP_MEM,MAX_CHIP_MEM)); ! 1585: SendDlgItemMessage(hDlg, IDC_FASTMEM, TBM_SETRANGE,TRUE,MAKELONG(MIN_FAST_MEM,MAX_FAST_MEM)); ! 1586: #if CPU_LEVEL > 1 ! 1587: SendDlgItemMessage(hDlg, IDC_P96MEM, TBM_SETRANGE,TRUE,MAKELONG(MIN_P96_MEM,MAX_P96_MEM)); ! 1588: SendDlgItemMessage(hDlg, IDC_Z3FASTMEM, TBM_SETRANGE, TRUE,MAKELONG(MIN_Z3_MEM, MAX_Z3_MEM )); ! 1589: #else ! 1590: EnableWindow( GetDlgItem( hDlg, IDC_P96MEM ), FALSE ); ! 1591: EnableWindow( GetDlgItem( hDlg, IDC_Z3FASTMEM ), FALSE ); ! 1592: #endif ! 1593: switch( chipmem_size ) ! 1594: { ! 1595: case 0x00080000: ! 1596: mem_size = 0; ! 1597: break; ! 1598: case 0x00100000: ! 1599: mem_size = 1; ! 1600: break; ! 1601: case 0x00200000: ! 1602: mem_size = 2; ! 1603: break; ! 1604: case 0x00400000: ! 1605: mem_size = 3; ! 1606: break; ! 1607: case 0x00800000: ! 1608: mem_size = 4; ! 1609: break; ! 1610: } ! 1611: SendDlgItemMessage(hDlg, IDC_CHIPMEM, TBM_SETPOS, TRUE, mem_size ); ! 1612: ! 1613: switch( fastmem_size ) ! 1614: { ! 1615: case 0x00000000: ! 1616: mem_size = 0; ! 1617: break; ! 1618: case 0x00100000: ! 1619: mem_size = 1; ! 1620: break; ! 1621: case 0x00200000: ! 1622: mem_size = 2; ! 1623: break; ! 1624: case 0x00400000: ! 1625: mem_size = 3; ! 1626: break; ! 1627: case 0x00800000: ! 1628: mem_size = 4; ! 1629: break; ! 1630: case 0x01000000: ! 1631: mem_size = 5; ! 1632: break; ! 1633: } ! 1634: SendDlgItemMessage(hDlg, IDC_FASTMEM, TBM_SETPOS, TRUE, mem_size ); ! 1635: ! 1636: switch( gfxmem_size ) ! 1637: { ! 1638: case 0x00000000: ! 1639: mem_size = 0; ! 1640: break; ! 1641: case 0x00100000: ! 1642: mem_size = 1; ! 1643: break; ! 1644: case 0x00200000: ! 1645: mem_size = 2; ! 1646: break; ! 1647: case 0x00400000: ! 1648: mem_size = 3; ! 1649: break; ! 1650: case 0x00800000: ! 1651: mem_size = 4; ! 1652: break; ! 1653: } ! 1654: SendDlgItemMessage(hDlg, IDC_P96MEM, TBM_SETPOS, TRUE, mem_size ); ! 1655: #if CPU_LEVEL > 1 ! 1656: switch( z3fastmem_size ) ! 1657: { ! 1658: case 0x00000000: ! 1659: mem_size = 0; ! 1660: break; ! 1661: case 0x00100000: ! 1662: mem_size = 1; ! 1663: break; ! 1664: case 0x00200000: ! 1665: mem_size = 2; ! 1666: break; ! 1667: case 0x00400000: ! 1668: mem_size = 3; ! 1669: break; ! 1670: case 0x00800000: ! 1671: mem_size = 4; ! 1672: break; ! 1673: case 0x01000000: ! 1674: mem_size = 5; ! 1675: break; ! 1676: case 0x02000000: ! 1677: mem_size = 6; ! 1678: break; ! 1679: } ! 1680: SendDlgItemMessage(hDlg, IDC_Z3FASTMEM, TBM_SETPOS, TRUE, mem_size ); ! 1681: UpdateScroller(hDlg, GetDlgItem(hDlg, IDC_P96MEM)); ! 1682: UpdateScroller(hDlg, GetDlgItem(hDlg, IDC_Z3FASTMEM)); ! 1683: #endif ! 1684: UpdateScroller(hDlg, GetDlgItem(hDlg, IDC_CHIPMEM)); ! 1685: UpdateScroller(hDlg, GetDlgItem(hDlg, IDC_FASTMEM)); ! 1686: ! 1687: return(TRUE); ! 1688: ! 1689: case WM_COMMAND: ! 1690: switch( wParam ) ! 1691: { ! 1692: case IDC_KICKCHOOSER: ! 1693: KickStuffSelection( hDlg, 1 ); ! 1694: break; ! 1695: case IDC_KEYCHOOSER: ! 1696: KickStuffSelection( hDlg, 0 ); ! 1697: break; ! 1698: } ! 1699: break; ! 1700: ! 1701: case WM_HSCROLL: ! 1702: UpdateScroller(hDlg, (HWND)lParam); ! 1703: #if CPU_LEVEL > 1 ! 1704: if( ( GetDlgItem( hDlg, IDC_P96MEM) == lParam ) && pages[ DISPLAY_ID ] ) ! 1705: { ! 1706: SendMessage( pages[ DISPLAY_ID ], WM_USER, 1, 0 ); ! 1707: } ! 1708: #endif ! 1709: break; ! 1710: ! 1711: case WM_NOTIFY: ! 1712: switch(((NMHDR *)lParam)->code) ! 1713: { ! 1714: case PSN_APPLY: ! 1715: // OK or Apply has been pressed ! 1716: GetDlgItemText( hDlg, IDC_ROMFILE, romfile, CFG_ROM_LENGTH ); ! 1717: GetDlgItemText( hDlg, IDC_KEYFILE, keyfile, CFG_KEY_LENGTH ); ! 1718: break; ! 1719: case PSN_RESET: ! 1720: if(allow_quit_from_property_sheet) ! 1721: { ! 1722: quit_program = 1; ! 1723: regs.spcflags |= SPCFLAG_BRK; ! 1724: } ! 1725: break; ! 1726: } ! 1727: } ! 1728: return(FALSE); ! 1729: } ! 1730: ! 1731: BOOL CALLBACK AdvancedDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) ! 1732: { ! 1733: ConfigStructPtr cfgptr; ! 1734: DWORD dwPos; ! 1735: ! 1736: switch(msg) ! 1737: { ! 1738: case PSM_QUERYSIBLINGS: ! 1739: cfgptr = (ConfigStructPtr)lParam; ! 1740: ! 1741: cfgptr->NoAutoConfig = IsDlgButtonChecked( hDlg, IDC_NOAUTOCONFIG ); ! 1742: cfgptr->CopperHack = (int)(short)(SendDlgItemMessage( hDlg, IDC_COPPERSPIN, UDM_GETPOS, 0, 0 )); ! 1743: cfgptr->DebugLogging = IsDlgButtonChecked( hDlg, IDC_LOGGING ); ! 1744: cfgptr->InvalidAddresses = IsDlgButtonChecked( hDlg, IDC_ILLEGAL); ! 1745: // cfgptr->DebuggerEnabled = IsDlgButtonChecked( hDlg, IDC_DEBUGGER ); ! 1746: #if CPU_LEVEL > 1 ! 1747: cfgptr->AddressingIs24Bit = IsDlgButtonChecked( hDlg, IDC_24BIT ); ! 1748: #endif ! 1749: cfgptr->M68KSpeed = (char)SendDlgItemMessage(hDlg, IDC_SPEED,TBM_GETPOS,0,0); ! 1750: break; ! 1751: ! 1752: case WM_INITDIALOG: ! 1753: pages[ ADVANCED_ID ] = hDlg; ! 1754: case WM_USER: ! 1755: #if CPU_LEVEL > 1 ! 1756: CheckDlgButton( hDlg, IDC_24BIT, address_space_24 ); ! 1757: #else ! 1758: CheckDlgButton( hDlg, IDC_24BIT, TRUE ); ! 1759: EnableWindow( GetDlgItem( hDlg, IDC_24BIT ), FALSE ); ! 1760: #endif ! 1761: //CheckDlgButton( hDlg, IDC_DEBUGGER, use_debugger ); ! 1762: CheckDlgButton( hDlg, IDC_ILLEGAL, currprefs.illegal_mem ); ! 1763: CheckDlgButton( hDlg, IDC_NOAUTOCONFIG, !currprefs.automount_uaedev ); ! 1764: SendDlgItemMessage(hDlg, IDC_SPEED, TBM_SETRANGE, TRUE, MAKELONG(MIN_M68K_PRIORITY,MAX_M68K_PRIORITY)); ! 1765: SendDlgItemMessage(hDlg, IDC_SPEED, TBM_SETPOS, TRUE, currprefs.m68k_speed ); ! 1766: SendDlgItemMessage( hDlg, IDC_SPEED, TBM_SETPAGESIZE, 0, 1 ); ! 1767: UpdateScroller(hDlg, GetDlgItem(hDlg, IDC_SPEED)); ! 1768: SendDlgItemMessage( hDlg, IDC_COPPERSPIN, UDM_SETRANGE, 0, MAKELONG( 224, -1 ) ); ! 1769: SendDlgItemMessage( hDlg, IDC_COPPERSPIN, UDM_SETPOS, TRUE, currprefs.copper_pos ); ! 1770: ! 1771: return(TRUE); ! 1772: ! 1773: case WM_HSCROLL: ! 1774: UpdateScroller(hDlg, (HWND)lParam); ! 1775: break; ! 1776: ! 1777: case WM_NOTIFY: ! 1778: switch(((NMHDR *)lParam)->code) ! 1779: { ! 1780: case PSN_APPLY: ! 1781: // OK or Apply has been pressed ! 1782: currprefs.illegal_mem = IsDlgButtonChecked( hDlg, IDC_ILLEGAL); ! 1783: currprefs.automount_uaedev = !IsDlgButtonChecked( hDlg, IDC_NOAUTOCONFIG ); ! 1784: currprefs.m68k_speed = SendMessage( GetDlgItem( hDlg, IDC_SPEED),TBM_GETPOS,0,0); ! 1785: currprefs.copper_pos = (int)(short)( SendDlgItemMessage( hDlg, IDC_COPPERSPIN, UDM_GETPOS, 0, 0 )); ! 1786: #if CPU_LEVEL > 1 ! 1787: address_space_24 = IsDlgButtonChecked( hDlg, IDC_24BIT ); ! 1788: #endif ! 1789: break; ! 1790: case PSN_RESET: ! 1791: if(allow_quit_from_property_sheet) ! 1792: { ! 1793: quit_program = 1; ! 1794: regs.spcflags |= SPCFLAG_BRK; ! 1795: } ! 1796: break; ! 1797: } ! 1798: } ! 1799: return(FALSE); ! 1800: } ! 1801: ! 1802: BOOL CALLBACK SoundDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) ! 1803: { ! 1804: ConfigStructPtr cfgptr; ! 1805: ! 1806: switch(msg) ! 1807: { ! 1808: case PSM_QUERYSIBLINGS: ! 1809: cfgptr = (ConfigStructPtr)lParam; ! 1810: if( IsDlgButtonChecked( hDlg, IDC_8BIT ) ) ! 1811: cfgptr->SoundBits = 8; ! 1812: if( IsDlgButtonChecked( hDlg, IDC_16BIT ) ) ! 1813: cfgptr->SoundBits = 16; ! 1814: if( IsDlgButtonChecked( hDlg, IDC_11KHZ ) ) ! 1815: cfgptr->SoundFreq = 11025; ! 1816: if( IsDlgButtonChecked( hDlg, IDC_22KHZ ) ) ! 1817: cfgptr->SoundFreq = 22050; ! 1818: if( IsDlgButtonChecked( hDlg, IDC_44KHZ ) ) ! 1819: cfgptr->SoundFreq = 44100; ! 1820: if( IsDlgButtonChecked( hDlg, IDC_48KHZ ) ) ! 1821: cfgptr->SoundFreq = 48000; ! 1822: if( IsDlgButtonChecked( hDlg, IDC_SOUND0 ) ) ! 1823: cfgptr->SoundSupport = -1; ! 1824: if( IsDlgButtonChecked( hDlg, IDC_SOUND1 ) ) ! 1825: cfgptr->SoundSupport = 0; ! 1826: if( IsDlgButtonChecked( hDlg, IDC_SOUND2 ) ) ! 1827: cfgptr->SoundSupport = 1; ! 1828: if( IsDlgButtonChecked( hDlg, IDC_SOUND3 ) ) ! 1829: cfgptr->SoundSupport = 2; ! 1830: if( IsDlgButtonChecked( hDlg, IDC_SOUND4 ) ) ! 1831: cfgptr->SoundSupport = 3; ! 1832: if( IsDlgButtonChecked( hDlg, IDC_STEREO ) ) ! 1833: cfgptr->SoundStereo = 1; ! 1834: break; ! 1835: ! 1836: case WM_INITDIALOG: ! 1837: pages[ SOUND_ID ] = hDlg; ! 1838: case WM_USER: ! 1839: UpdateRadioButtons( hDlg, GetDlgItem( hDlg, IDC_SOUND ) ); ! 1840: UpdateRadioButtons( hDlg, GetDlgItem( hDlg, IDC_FREQUENCY ) ); ! 1841: UpdateRadioButtons( hDlg, GetDlgItem( hDlg, IDC_SOUNDSIZE ) ); ! 1842: CheckDlgButton( hDlg, IDC_STEREO, currprefs.stereo ); ! 1843: return(TRUE); ! 1844: ! 1845: case WM_NOTIFY: ! 1846: switch(((NMHDR *)lParam)->code) ! 1847: { ! 1848: case PSN_APPLY: ! 1849: // OK or Apply has been pressed ! 1850: if( IsDlgButtonChecked( hDlg, IDC_8BIT ) ) ! 1851: currprefs.sound_bits = 8; ! 1852: if( IsDlgButtonChecked( hDlg, IDC_16BIT ) ) ! 1853: currprefs.sound_bits = 16; ! 1854: if( IsDlgButtonChecked( hDlg, IDC_11KHZ ) ) ! 1855: currprefs.sound_freq = 11025; ! 1856: if( IsDlgButtonChecked( hDlg, IDC_22KHZ ) ) ! 1857: currprefs.sound_freq = 22050; ! 1858: if( IsDlgButtonChecked( hDlg, IDC_44KHZ ) ) ! 1859: currprefs.sound_freq = 44100; ! 1860: if( IsDlgButtonChecked( hDlg, IDC_48KHZ ) ) ! 1861: currprefs.sound_freq = 48000; ! 1862: if( IsDlgButtonChecked( hDlg, IDC_SOUND0 ) ) ! 1863: currprefs.produce_sound = -1; ! 1864: if( IsDlgButtonChecked( hDlg, IDC_SOUND1 ) ) ! 1865: currprefs.produce_sound = 0; ! 1866: if( IsDlgButtonChecked( hDlg, IDC_SOUND2 ) ) ! 1867: currprefs.produce_sound = 1; ! 1868: if( IsDlgButtonChecked( hDlg, IDC_SOUND3 ) ) ! 1869: currprefs.produce_sound = 2; ! 1870: if( IsDlgButtonChecked( hDlg, IDC_SOUND4 ) ) ! 1871: currprefs.produce_sound = 3; ! 1872: if( IsDlgButtonChecked( hDlg, IDC_STEREO ) ) ! 1873: currprefs.stereo = 1; ! 1874: break; ! 1875: case PSN_RESET: ! 1876: if(allow_quit_from_property_sheet) ! 1877: { ! 1878: quit_program = 1; ! 1879: regs.spcflags |= SPCFLAG_BRK; ! 1880: } ! 1881: break; ! 1882: } ! 1883: break; ! 1884: } ! 1885: return(FALSE); ! 1886: } ! 1887: ! 1888: void KickStuffSelection( HWND hDlg, int which ) ! 1889: { ! 1890: OPENFILENAME openFileName; ! 1891: char full_path[MAX_PATH] = ""; ! 1892: char file_name[MAX_PATH] = ""; ! 1893: char init_path[MAX_PATH] = ""; ! 1894: char *amiga_path = NULL; ! 1895: ! 1896: if( amiga_path = getenv( "AmigaPath" ) ) ! 1897: { ! 1898: strncpy( init_path, amiga_path, MAX_PATH ); ! 1899: strncat( init_path, "\\ROMs\\", MAX_PATH ); ! 1900: } ! 1901: else if( start_path ) ! 1902: { ! 1903: strncpy( init_path, start_path, MAX_PATH ); ! 1904: strncat( init_path, "..\\ROMs\\", MAX_PATH ); ! 1905: } ! 1906: ! 1907: openFileName.lStructSize = sizeof(OPENFILENAME); ! 1908: openFileName.hwndOwner = hDlg; ! 1909: openFileName.hInstance = hInst; ! 1910: if( which ) ! 1911: { ! 1912: openFileName.lpstrFilter = "Amiga Kickstart Files (*.ROM)\0*.ROM\0\0"; ! 1913: openFileName.lpstrTitle = "Select an Amiga ROM file..."; ! 1914: openFileName.lpstrDefExt = "ROM"; ! 1915: } ! 1916: else ! 1917: { ! 1918: openFileName.lpstrFilter = "Amiga Kickstart Key-Files (*.KEY)\0*.KEY\0\0"; ! 1919: openFileName.lpstrTitle = "Select an Amiga Key-File..."; ! 1920: openFileName.lpstrDefExt = "KEY"; ! 1921: } ! 1922: openFileName.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_LONGNAMES | OFN_HIDEREADONLY | OFN_NOCHANGEDIR; ! 1923: openFileName.lpstrCustomFilter = NULL; ! 1924: openFileName.nMaxCustFilter = 0; ! 1925: openFileName.nFilterIndex = 0; ! 1926: openFileName.lpstrFile = full_path; ! 1927: openFileName.nMaxFile = MAX_PATH; ! 1928: openFileName.lpstrFileTitle = file_name; ! 1929: openFileName.nMaxFileTitle = MAX_PATH; ! 1930: if( start_path ) ! 1931: openFileName.lpstrInitialDir = init_path; ! 1932: else ! 1933: openFileName.lpstrInitialDir = NULL; ! 1934: openFileName.lpfnHook = NULL; ! 1935: openFileName.lpTemplateName = NULL; ! 1936: openFileName.lCustData = 0; ! 1937: if(GetOpenFileName(&openFileName)==FALSE) ! 1938: MyOutputDebugString("GetOpenFileName() failed.\n"); ! 1939: else ! 1940: { ! 1941: if( which ) ! 1942: SetDlgItemText(hDlg,IDC_ROMFILE,full_path); ! 1943: else ! 1944: SetDlgItemText(hDlg,IDC_KEYFILE,full_path); ! 1945: } ! 1946: } ! 1947: ! 1948: void DiskSelection( HWND hDlg, WPARAM wParam, int flag ) ! 1949: { ! 1950: OPENFILENAME openFileName; ! 1951: char full_path[MAX_PATH] = ""; ! 1952: char file_name[MAX_PATH] = ""; ! 1953: char init_path[MAX_PATH] = ""; ! 1954: BOOL result = FALSE; ! 1955: char *amiga_path = NULL; ! 1956: ! 1957: if( amiga_path = getenv( "AmigaPath" ) ) ! 1958: { ! 1959: strncpy( init_path, amiga_path, MAX_PATH ); ! 1960: strncat( init_path, "\\DiskFiles\\", MAX_PATH ); ! 1961: } ! 1962: else if( start_path ) ! 1963: { ! 1964: strncpy( init_path, start_path, MAX_PATH ); ! 1965: strncat( init_path, "..\\DiskFiles\\", MAX_PATH ); ! 1966: } ! 1967: ! 1968: openFileName.lStructSize = sizeof(OPENFILENAME); ! 1969: openFileName.hwndOwner = hDlg; ! 1970: openFileName.hInstance = hInst; ! 1971: openFileName.lpstrFilter = "Amiga Disk Files (*.ADF;*.ADZ)\0*.ADF;*.ADZ\0"; ! 1972: if( flag ) ! 1973: openFileName.lpstrTitle = "Choose your blank Amiga Disk File..."; ! 1974: else ! 1975: openFileName.lpstrTitle = "Select an Amiga Disk File image..."; ! 1976: openFileName.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_HIDEREADONLY | OFN_NOCHANGEDIR; ! 1977: openFileName.lpstrDefExt = "ADF"; ! 1978: openFileName.lpstrCustomFilter = NULL; ! 1979: openFileName.nMaxCustFilter = 0; ! 1980: openFileName.nFilterIndex = 0; ! 1981: openFileName.lpstrFile = full_path; ! 1982: openFileName.nMaxFile = MAX_PATH; ! 1983: openFileName.lpstrFileTitle = file_name; ! 1984: openFileName.nMaxFileTitle = MAX_PATH; ! 1985: if( start_path ) ! 1986: openFileName.lpstrInitialDir = init_path; ! 1987: else ! 1988: openFileName.lpstrInitialDir = NULL; ! 1989: openFileName.lpfnHook = NULL; ! 1990: openFileName.lpTemplateName = NULL; ! 1991: openFileName.lCustData = 0; ! 1992: if( flag ) ! 1993: result = GetSaveFileName( &openFileName ); ! 1994: else ! 1995: result = GetOpenFileName( &openFileName ); ! 1996: ! 1997: if( result == FALSE ) ! 1998: MyOutputDebugString("GetOpenFileName() failed.\n"); ! 1999: else ! 2000: { ! 2001: switch(wParam) ! 2002: { ! 2003: case IDC_DF0: ! 2004: SetDlgItemText(hDlg,IDC_DF0TEXT,full_path); ! 2005: break; ! 2006: case IDC_DF1: ! 2007: SetDlgItemText(hDlg,IDC_DF1TEXT,full_path); ! 2008: break; ! 2009: case IDC_DF2: ! 2010: SetDlgItemText(hDlg,IDC_DF2TEXT,full_path); ! 2011: break; ! 2012: case IDC_DF3: ! 2013: SetDlgItemText(hDlg,IDC_DF3TEXT,full_path); ! 2014: break; ! 2015: case IDC_CREATE: ! 2016: CreateDiskFile( full_path ); ! 2017: break; ! 2018: } ! 2019: } ! 2020: } ! 2021: ! 2022: void GetSetDriveValues( HWND hDlg, DWORD drive_id, BOOL set ) ! 2023: { ! 2024: int dlg_item1, dlg_item2, dlg_item3; ! 2025: ! 2026: switch(drive_id) ! 2027: { ! 2028: case 0: ! 2029: dlg_item1 = IDC_UAE0PATH; ! 2030: dlg_item2 = IDC_UAE0NAME; ! 2031: dlg_item3 = IDC_RW0; ! 2032: break; ! 2033: case 1: ! 2034: dlg_item1 = IDC_UAE1PATH; ! 2035: dlg_item2 = IDC_UAE1NAME; ! 2036: dlg_item3 = IDC_RW1; ! 2037: break; ! 2038: case 2: ! 2039: dlg_item1 = IDC_UAE2PATH; ! 2040: dlg_item2 = IDC_UAE2NAME; ! 2041: dlg_item3 = IDC_RW2; ! 2042: break; ! 2043: case 3: ! 2044: dlg_item1 = IDC_UAE3PATH; ! 2045: dlg_item2 = IDC_UAE3NAME; ! 2046: dlg_item3 = IDC_RW3; ! 2047: break; ! 2048: } ! 2049: if(set) ! 2050: { ! 2051: GetDlgItemText(hDlg, dlg_item1, drives[drive_id].path, MAX_PATH); ! 2052: GetDlgItemText(hDlg, dlg_item2, drives[drive_id].name, MAX_PATH); ! 2053: drives[drive_id].rw = IsDlgButtonChecked(hDlg, dlg_item3); ! 2054: } ! 2055: else ! 2056: { ! 2057: SetDlgItemText(hDlg, dlg_item1, drives[drive_id].path); ! 2058: SetDlgItemText(hDlg, dlg_item2, drives[drive_id].name); ! 2059: CheckDlgButton(hDlg, dlg_item3, drives[drive_id].rw); ! 2060: } ! 2061: } ! 2062: ! 2063: void CreateDiskFile( char *name ) ! 2064: { ! 2065: HANDLE adf; ! 2066: int i, file_size = 880 * 1024; // size in bytes ! 2067: char *chunk = NULL; ! 2068: DWORD count; ! 2069: ! 2070: SetCursor( LoadCursor( NULL, IDC_WAIT ) ); ! 2071: adf = CreateFile( name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL ); ! 2072: if( adf != INVALID_HANDLE_VALUE ) ! 2073: { ! 2074: if( chunk = malloc( 10240 ) ) ! 2075: { ! 2076: for( i = 0; i < file_size; i += 10240 ) ! 2077: { ! 2078: WriteFile( adf, chunk, 10240, &count, NULL ); ! 2079: } ! 2080: } ! 2081: CloseHandle( adf ); ! 2082: } ! 2083: SetCursor( LoadCursor( NULL, IDC_ARROW ) ); ! 2084: } ! 2085: ! 2086: long CreateHardFile( LONG hfsize ) ! 2087: { ! 2088: HANDLE hf; ! 2089: long result = 0; ! 2090: int i, file_size = hfsize * 1024 * 1024; // size in bytes ! 2091: char init_path[MAX_PATH] = ""; ! 2092: char *chunk = NULL; ! 2093: DWORD count; ! 2094: ! 2095: SetCursor( LoadCursor( NULL, IDC_WAIT ) ); ! 2096: ! 2097: if( start_path ) ! 2098: { ! 2099: strncpy( init_path, start_path, MAX_PATH ); ! 2100: strncat( init_path, "\\HardFile", MAX_PATH ); ! 2101: } ! 2102: else ! 2103: strcpy( init_path, "HardFile" ); ! 2104: ! 2105: if( file_size == 0 ) ! 2106: DeleteFile( init_path ); ! 2107: else ! 2108: { ! 2109: hf = CreateFile( init_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL ); ! 2110: if( hf != INVALID_HANDLE_VALUE ) ! 2111: { ! 2112: if( chunk = malloc( 16384 ) ) ! 2113: { ! 2114: for( i = 0; i < file_size; i += 16384 ) ! 2115: { ! 2116: WriteFile( hf, chunk, 16384, &count, NULL ); ! 2117: } ! 2118: } ! 2119: CloseHandle( hf ); ! 2120: result = i; ! 2121: } ! 2122: } ! 2123: SetCursor( LoadCursor( NULL, IDC_ARROW ) ); ! 2124: return result; ! 2125: } ! 2126: ! 2127: BOOL CALLBACK HarddiskDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) ! 2128: { ! 2129: UDACCEL accel[2] = { { 1, 1 }, { 3, 5 } }; ! 2130: char hfsize[9] = ""; ! 2131: ConfigStructPtr cfgptr; ! 2132: int i, result = IDYES; ! 2133: static BROWSEINFO browse_info; ! 2134: char directory_path[MAX_PATH]; ! 2135: LPITEMIDLIST browse; ! 2136: LONG setting; ! 2137: ! 2138: switch(msg) ! 2139: { ! 2140: case PSM_QUERYSIBLINGS: ! 2141: cfgptr = (ConfigStructPtr)lParam; ! 2142: for( i = 0; i < NUM_DRIVES; i++ ) ! 2143: { ! 2144: GetSetDriveValues( hDlg, i, TRUE ); ! 2145: memcpy( &(cfgptr->drives[i]), &drives[i], sizeof( drive_specs ) ); ! 2146: } ! 2147: cfgptr->HardFileBootPri = IsDlgButtonChecked( hDlg, IDC_BOOTPRI ); ! 2148: break; ! 2149: ! 2150: case WM_INITDIALOG: ! 2151: pages[ HARDDISK_ID ] = hDlg; ! 2152: case WM_USER: ! 2153: browse_info.hwndOwner = hDlg; ! 2154: browse_info.pidlRoot = NULL; ! 2155: browse_info.pszDisplayName = directory_path; ! 2156: browse_info.lpszTitle = "Please select your file-system root directory..."; ! 2157: browse_info.ulFlags = BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS; ! 2158: browse_info.lpfn = NULL; ! 2159: browse_info.iImage = 0; ! 2160: for(i=0;i<NUM_DRIVES;i++) ! 2161: GetSetDriveValues(hDlg, i, FALSE); // FALSE indicates Getting ! 2162: ! 2163: CheckDlgButton(hDlg, IDC_BOOTPRI, hf_bootpri); ! 2164: SendDlgItemMessage( hDlg, IDC_HFSPIN, UDM_SETRANGE, 0, MAKELONG( 256, 0 ) ); ! 2165: SendDlgItemMessage( hDlg, IDC_HFSPIN, UDM_SETPOS, 0, hardfile_size / 1048576 ); ! 2166: ! 2167: if( hardfile_size == 0) ! 2168: { ! 2169: // hardfile does not exist, so disable the "Hardfile priority" check-box ! 2170: EnableWindow( GetDlgItem( hDlg, IDC_BOOTPRI ), FALSE ); ! 2171: } ! 2172: break; ! 2173: ! 2174: case WM_COMMAND: ! 2175: switch(wParam) ! 2176: { ! 2177: case IDC_CREATEHF: ! 2178: setting = SendDlgItemMessage( hDlg, IDC_HFSPIN, UDM_GETPOS, 0, 0 ); ! 2179: if( hardfile_size != 0 ) ! 2180: { ! 2181: result = MessageBox( hDlg, "You already have a hardfile. Creating a new one will destroy the old one. Proceed?", "HardFile Warning...", MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2 | MB_APPLMODAL | MB_SETFOREGROUND ); ! 2182: } ! 2183: if( result == IDYES ) ! 2184: { ! 2185: hardfile_size = CreateHardFile( setting ); ! 2186: EnableWindow( GetDlgItem( hDlg, IDC_BOOTPRI ), hardfile_size ? TRUE:FALSE ); ! 2187: } ! 2188: break; ! 2189: case IDC_UAE0: ! 2190: case IDC_UAE1: ! 2191: case IDC_UAE2: ! 2192: case IDC_UAE3: ! 2193: if((browse=SHBrowseForFolder(&browse_info))!=NULL) ! 2194: { ! 2195: SHGetPathFromIDList( browse, directory_path ); ! 2196: if( directory_path[ strlen( directory_path ) - 1 ] == '\\' ) ! 2197: directory_path[ strlen( directory_path ) - 1 ] = 0; ! 2198: if( wParam == IDC_UAE0 ) ! 2199: SetDlgItemText( hDlg, IDC_UAE0PATH, directory_path ); ! 2200: else if( wParam == IDC_UAE1 ) ! 2201: SetDlgItemText( hDlg, IDC_UAE1PATH, directory_path ); ! 2202: else if( wParam == IDC_UAE2 ) ! 2203: SetDlgItemText( hDlg, IDC_UAE2PATH, directory_path ); ! 2204: else ! 2205: SetDlgItemText( hDlg, IDC_UAE3PATH, directory_path ); ! 2206: } ! 2207: break; ! 2208: } ! 2209: break; ! 2210: ! 2211: case WM_NOTIFY: ! 2212: switch(((NMHDR *)lParam)->code) ! 2213: { ! 2214: case PSN_APPLY: ! 2215: for(i=0;i<NUM_DRIVES;i++) ! 2216: GetSetDriveValues( hDlg, i, TRUE); // TRUE indicates Setting ! 2217: hf_bootpri = IsDlgButtonChecked( hDlg, IDC_BOOTPRI ); ! 2218: break; ! 2219: case PSN_RESET: ! 2220: if(allow_quit_from_property_sheet) ! 2221: { ! 2222: quit_program = 1; ! 2223: regs.spcflags |= SPCFLAG_BRK; ! 2224: } ! 2225: break; ! 2226: } ! 2227: return(TRUE); ! 2228: default: ! 2229: return(FALSE); ! 2230: } ! 2231: ! 2232: return(FALSE); ! 2233: } ! 2234: ! 2235: BOOL CALLBACK FloppiesDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) ! 2236: { ! 2237: ConfigStructPtr cfgptr; ! 2238: ! 2239: switch(msg) ! 2240: { ! 2241: case PSM_QUERYSIBLINGS: ! 2242: cfgptr = (ConfigStructPtr)lParam; ! 2243: GetDlgItemText(hDlg, IDC_DF0TEXT, cfgptr->df[0], MAX_PATH); ! 2244: GetDlgItemText(hDlg, IDC_DF1TEXT, cfgptr->df[1], MAX_PATH); ! 2245: GetDlgItemText(hDlg, IDC_DF2TEXT, cfgptr->df[2], MAX_PATH); ! 2246: GetDlgItemText(hDlg, IDC_DF3TEXT, cfgptr->df[3], MAX_PATH); ! 2247: break; ! 2248: ! 2249: case WM_INITDIALOG: ! 2250: pages[ FLOPPY_ID ] = hDlg; ! 2251: case WM_USER: ! 2252: SetDlgItemText(hDlg, IDC_DF0TEXT, currprefs.df[0]); ! 2253: SetDlgItemText(hDlg, IDC_DF1TEXT, currprefs.df[1]); ! 2254: SetDlgItemText(hDlg, IDC_DF2TEXT, currprefs.df[2]); ! 2255: SetDlgItemText(hDlg, IDC_DF3TEXT, currprefs.df[3]); ! 2256: break; ! 2257: ! 2258: case WM_COMMAND: ! 2259: switch(wParam) ! 2260: { ! 2261: case IDC_DF0: ! 2262: DiskSelection(hDlg,wParam,0); ! 2263: break; ! 2264: case IDC_DF1: ! 2265: DiskSelection(hDlg,wParam,0); ! 2266: break; ! 2267: case IDC_DF2: ! 2268: DiskSelection(hDlg,wParam,0); ! 2269: break; ! 2270: case IDC_DF3: ! 2271: DiskSelection(hDlg,wParam,0); ! 2272: break; ! 2273: case IDC_EJECT0: ! 2274: SetDlgItemText( hDlg, IDC_DF0TEXT, "" ); ! 2275: disk_eject( 0 ); ! 2276: break; ! 2277: case IDC_EJECT1: ! 2278: SetDlgItemText( hDlg, IDC_DF1TEXT, "" ); ! 2279: disk_eject( 1 ); ! 2280: break; ! 2281: case IDC_EJECT2: ! 2282: SetDlgItemText( hDlg, IDC_DF2TEXT, "" ); ! 2283: disk_eject( 2 ); ! 2284: break; ! 2285: case IDC_EJECT3: ! 2286: SetDlgItemText( hDlg, IDC_DF3TEXT, "" ); ! 2287: disk_eject( 3 ); ! 2288: break; ! 2289: case IDC_CREATE: ! 2290: DiskSelection( hDlg, wParam, 1 ); ! 2291: break; ! 2292: } ! 2293: break; ! 2294: ! 2295: case WM_NOTIFY: ! 2296: switch(((NMHDR *)lParam)->code) ! 2297: { ! 2298: case PSN_APPLY: ! 2299: GetDlgItemText(hDlg, IDC_DF0TEXT, currprefs.df[0], MAX_PATH); ! 2300: if( currprefs.df[0][0] ) ! 2301: { ! 2302: disk_insert(0,currprefs.df[0]); ! 2303: } ! 2304: GetDlgItemText(hDlg, IDC_DF1TEXT, currprefs.df[1], MAX_PATH); ! 2305: if( currprefs.df[1][0] ) ! 2306: { ! 2307: disk_insert(1,currprefs.df[1]); ! 2308: } ! 2309: GetDlgItemText(hDlg, IDC_DF2TEXT, currprefs.df[2], MAX_PATH); ! 2310: if( currprefs.df[2][0] ) ! 2311: { ! 2312: disk_insert(2,currprefs.df[2]); ! 2313: } ! 2314: GetDlgItemText(hDlg, IDC_DF3TEXT, currprefs.df[3], MAX_PATH); ! 2315: if( currprefs.df[3][0] ) ! 2316: { ! 2317: disk_insert(3,currprefs.df[3]); ! 2318: } ! 2319: break; ! 2320: case PSN_RESET: ! 2321: if(allow_quit_from_property_sheet) ! 2322: { ! 2323: quit_program = 1; ! 2324: regs.spcflags |= SPCFLAG_BRK; ! 2325: } ! 2326: break; ! 2327: } ! 2328: return(TRUE); ! 2329: default: ! 2330: return(FALSE); ! 2331: } ! 2332: ! 2333: return(FALSE); ! 2334: } ! 2335: ! 2336: // Handle messages for the Joystick Settings page of our property-sheet ! 2337: BOOL CALLBACK PortsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) ! 2338: { ! 2339: ConfigStructPtr cfgptr; ! 2340: char joyspec[3] = "MA"; ! 2341: LONG ser_port, item_height; ! 2342: RECT rect; ! 2343: ! 2344: switch(msg) ! 2345: { ! 2346: case PSM_QUERYSIBLINGS: ! 2347: cfgptr = (ConfigStructPtr)lParam; ! 2348: if( IsDlgButtonChecked( hDlg, IDC_PORT0_JOY0 ) ) ! 2349: joyspec[0] = '0'; ! 2350: if( IsDlgButtonChecked( hDlg, IDC_PORT0_JOY1 ) ) ! 2351: joyspec[0] = '1'; ! 2352: if( IsDlgButtonChecked( hDlg, IDC_PORT0_MOUSE ) ) ! 2353: joyspec[0] = 'M'; ! 2354: if( IsDlgButtonChecked( hDlg, IDC_PORT0_KBDA ) ) ! 2355: joyspec[0] = 'A'; ! 2356: if( IsDlgButtonChecked( hDlg, IDC_PORT0_KBDB ) ) ! 2357: joyspec[0] = 'B'; ! 2358: if( IsDlgButtonChecked( hDlg, IDC_PORT0_KBDC ) ) ! 2359: joyspec[0] = 'C'; ! 2360: ! 2361: if( IsDlgButtonChecked( hDlg, IDC_PORT1_JOY0 ) ) ! 2362: joyspec[1] = '0'; ! 2363: if( IsDlgButtonChecked( hDlg, IDC_PORT1_JOY1 ) ) ! 2364: joyspec[1] = '1'; ! 2365: if( IsDlgButtonChecked( hDlg, IDC_PORT1_MOUSE ) ) ! 2366: joyspec[1] = 'M'; ! 2367: if( IsDlgButtonChecked( hDlg, IDC_PORT1_KBDA ) ) ! 2368: joyspec[1] = 'A'; ! 2369: if( IsDlgButtonChecked( hDlg, IDC_PORT1_KBDB ) ) ! 2370: joyspec[1] = 'B'; ! 2371: if( IsDlgButtonChecked( hDlg, IDC_PORT1_KBDC ) ) ! 2372: joyspec[1] = 'C'; ! 2373: ! 2374: cfgptr->FakeJoystick = parse_joy_spec( joyspec ); ! 2375: ! 2376: GetDlgItemText( hDlg, IDC_PARALLEL, cfgptr->PrinterName, CFG_PAR_LENGTH ); ! 2377: ! 2378: switch( ser_port = SendDlgItemMessage( hDlg, IDC_SERIAL, CB_GETCURSEL, 0, 0L) ) ! 2379: { ! 2380: case 1: ! 2381: case 2: ! 2382: case 3: ! 2383: case 4: ! 2384: cfgptr->SerialPort = 1; ! 2385: #ifdef __GNUC__ ! 2386: sprintf( cfgptr->SerialName, "COM%d", ser_port ); ! 2387: #else ! 2388: _snprintf( cfgptr->SerialName, CFG_SER_LENGTH, "COM%d", ser_port ); ! 2389: #endif ! 2390: break; ! 2391: default: ! 2392: cfgptr->SerialPort = 0; ! 2393: break; ! 2394: } ! 2395: ! 2396: break; ! 2397: ! 2398: case WM_INITDIALOG: ! 2399: pages[ PORTS_ID ] = hDlg; ! 2400: case WM_USER: ! 2401: UpdateRadioButtons( hDlg, GetDlgItem( hDlg, IDC_PORT0 ) ); ! 2402: UpdateRadioButtons( hDlg, GetDlgItem( hDlg, IDC_PORT1 ) ); ! 2403: SetDlgItemText( hDlg, IDC_PARALLEL, prtname ); ! 2404: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_RESETCONTENT, 0, 0L); ! 2405: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)"None" ); ! 2406: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)"COM1" ); ! 2407: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)"COM2" ); ! 2408: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)"COM3" ); ! 2409: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)"COM4" ); ! 2410: if( currprefs.use_serial == 0 ) ! 2411: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_SETCURSEL, 0, 0L ); ! 2412: else ! 2413: { ! 2414: switch( sername[ strlen( sername ) - 1 ] ) ! 2415: { ! 2416: case '2': ! 2417: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_SETCURSEL, 2, 0L ); ! 2418: break; ! 2419: case '3': ! 2420: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_SETCURSEL, 3, 0L ); ! 2421: break; ! 2422: case '4': ! 2423: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_SETCURSEL, 4, 0L ); ! 2424: break; ! 2425: default: ! 2426: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_SETCURSEL, 1, 0L ); ! 2427: break; ! 2428: } ! 2429: } ! 2430: ! 2431: // Retrieve the height, in pixels, of a list item. ! 2432: item_height = SendDlgItemMessage( hDlg, IDC_SERIAL, CB_GETITEMHEIGHT, 0, 0L); ! 2433: if (item_height != CB_ERR) ! 2434: { ! 2435: // Get actual box position and size. ! 2436: GetWindowRect( GetDlgItem( hDlg, IDC_SERIAL ), &rect); ! 2437: rect.bottom = rect.top + item_height * 5 ! 2438: + SendDlgItemMessage( hDlg, IDC_SERIAL, CB_GETITEMHEIGHT, (WPARAM)-1, 0L) ! 2439: + item_height; ! 2440: SetWindowPos( GetDlgItem( hDlg, IDC_SERIAL ), 0, 0, 0, rect.right - rect.left, ! 2441: rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); ! 2442: } ! 2443: if( hEmuThread ) ! 2444: { ! 2445: EnableWindow( GetDlgItem( hDlg, IDC_SERIAL ), FALSE ); ! 2446: EnableWindow( GetDlgItem( hDlg, IDC_PARALLEL ), FALSE ); ! 2447: } ! 2448: return(TRUE); ! 2449: ! 2450: case WM_NOTIFY: ! 2451: switch(((NMHDR *)lParam)->code) ! 2452: { ! 2453: case PSN_APPLY: ! 2454: // OK or Apply has been pressed ! 2455: if( IsDlgButtonChecked( hDlg, IDC_PORT0_JOY0 ) ) ! 2456: joyspec[0] = '0'; ! 2457: if( IsDlgButtonChecked( hDlg, IDC_PORT0_JOY1 ) ) ! 2458: joyspec[0] = '1'; ! 2459: if( IsDlgButtonChecked( hDlg, IDC_PORT0_MOUSE ) ) ! 2460: joyspec[0] = 'M'; ! 2461: if( IsDlgButtonChecked( hDlg, IDC_PORT0_KBDA ) ) ! 2462: joyspec[0] = 'A'; ! 2463: if( IsDlgButtonChecked( hDlg, IDC_PORT0_KBDB ) ) ! 2464: joyspec[0] = 'B'; ! 2465: if( IsDlgButtonChecked( hDlg, IDC_PORT0_KBDC ) ) ! 2466: joyspec[0] = 'C'; ! 2467: ! 2468: if( IsDlgButtonChecked( hDlg, IDC_PORT1_JOY0 ) ) ! 2469: joyspec[1] = '0'; ! 2470: if( IsDlgButtonChecked( hDlg, IDC_PORT1_JOY1 ) ) ! 2471: joyspec[1] = '1'; ! 2472: if( IsDlgButtonChecked( hDlg, IDC_PORT1_MOUSE ) ) ! 2473: joyspec[1] = 'M'; ! 2474: if( IsDlgButtonChecked( hDlg, IDC_PORT1_KBDA ) ) ! 2475: joyspec[1] = 'A'; ! 2476: if( IsDlgButtonChecked( hDlg, IDC_PORT1_KBDB ) ) ! 2477: joyspec[1] = 'B'; ! 2478: if( IsDlgButtonChecked( hDlg, IDC_PORT1_KBDC ) ) ! 2479: joyspec[1] = 'C'; ! 2480: ! 2481: currprefs.fake_joystick = parse_joy_spec( joyspec ); ! 2482: ! 2483: GetDlgItemText( hDlg, IDC_PARALLEL, prtname, CFG_PAR_LENGTH ); ! 2484: ! 2485: switch( item_height = SendDlgItemMessage( hDlg, IDC_SERIAL, CB_GETCURSEL, 0, 0L) ) ! 2486: { ! 2487: case 1: ! 2488: case 2: ! 2489: case 3: ! 2490: case 4: ! 2491: currprefs.use_serial = 1; ! 2492: #ifdef __GNUC__ ! 2493: sprintf( sername, "COM%d", item_height ); ! 2494: #else ! 2495: _snprintf( sername, CFG_SER_LENGTH, "COM%d", item_height ); ! 2496: #endif ! 2497: break; ! 2498: default: ! 2499: currprefs.use_serial = 0; ! 2500: break; ! 2501: } ! 2502: ! 2503: ! 2504: break; ! 2505: case PSN_RESET: ! 2506: if(allow_quit_from_property_sheet) ! 2507: { ! 2508: quit_program = 1; ! 2509: regs.spcflags |= SPCFLAG_BRK; ! 2510: } ! 2511: break; ! 2512: } ! 2513: return(FALSE); ! 2514: } ! 2515: return(FALSE); ! 2516: } ! 2517: ! 2518: HWND AddStatusWindow(void) ! 2519: { ! 2520: HWND hwndStatus; ! 2521: RECT rcClient; ! 2522: HLOCAL hloc; ! 2523: LPINT lpParts; ! 2524: ! 2525: // Create the status window. ! 2526: hwndStatus = CreateWindowEx( ! 2527: 0, // no extended styles ! 2528: STATUSCLASSNAME, // name of status window class ! 2529: (LPCTSTR) NULL, // no text when first created ! 2530: WS_CHILD | WS_VISIBLE, // creates a child window ! 2531: 0, 0, 0, 0, // ignores size and position ! 2532: hMainWnd, // handle to parent window ! 2533: (HMENU) 0, // child window identifier ! 2534: hInst, // handle to application instance ! 2535: NULL); // no window creation data ! 2536: ! 2537: // Get the coordinates of the parent window's client area. ! 2538: GetClientRect(hMainWnd, &rcClient); ! 2539: ! 2540: // Allocate an array for holding the right edge coordinates. ! 2541: hloc = LocalAlloc(LHND, sizeof(int) * 6); // six parts for status-window ! 2542: lpParts = LocalLock(hloc); ! 2543: ! 2544: // Calculate the right edge coordinate for each part, and ! 2545: // copy the coordinates to the array. ! 2546: lpParts[0] = rcClient.right - 120; ! 2547: lpParts[1] = rcClient.right - 105; ! 2548: lpParts[2] = rcClient.right - 90; ! 2549: lpParts[3] = rcClient.right - 75; ! 2550: lpParts[4] = rcClient.right - 60; ! 2551: lpParts[5] = rcClient.right; ! 2552: ! 2553: // Tell the status window to create the six window parts. ! 2554: SendMessage(hwndStatus, SB_SETPARTS, (WPARAM) 6, ! 2555: (LPARAM) lpParts); ! 2556: ! 2557: // Free the array, and return. ! 2558: LocalUnlock(hloc); ! 2559: LocalFree(hloc); ! 2560: return hwndStatus; ! 2561: } ! 2562: ! 2563: /* ! 2564: void SetStatusText(char *text, int part) ! 2565: { ! 2566: if(status_window) ! 2567: { ! 2568: PostMessage(status_window, SB_SETTEXT, (WPARAM) part, (LPARAM) text); ! 2569: } ! 2570: } ! 2571: */ ! 2572: ! 2573: int gui_init (void) ! 2574: { ! 2575: #ifndef _WIN32 ! 2576: if (!GetSettings ()) { ! 2577: MyOutputDebugString ("GetSettings() trying to quit...\n"); ! 2578: return 0; ! 2579: } ! 2580: fprintf (stderr, "%lx %lx\n", gfxmem_size, z3fastmem_size); ! 2581: #endif ! 2582: return 1; ! 2583: } ! 2584: ! 2585: int gui_update (void) ! 2586: { ! 2587: } ! 2588: ! 2589: void gui_exit (void) ! 2590: { ! 2591: } ! 2592: ! 2593: void gui_led (int led, int on) ! 2594: { ! 2595: ! 2596: } ! 2597: ! 2598: void gui_filename (int num, const char *name) ! 2599: { ! 2600: } ! 2601: ! 2602: LONG GetDisplayModeLogicalNumber( int x, int y ) ! 2603: { ! 2604: LONG modenum = 0; ! 2605: int i; ! 2606: for( i = 0; i < mode_count; i++ ) ! 2607: { ! 2608: if( DisplayModes[i].depth == 2 ) ! 2609: { ! 2610: if( ( DisplayModes[i].res.width == x ) && ! 2611: ( DisplayModes[i].res.height == y ) ) ! 2612: return modenum; ! 2613: modenum++; ! 2614: } ! 2615: } ! 2616: return 0; ! 2617: } ! 2618: ! 2619: LONG GetDisplayModeNumber( LONG logical_number ) ! 2620: { ! 2621: LONG modenum = 0; ! 2622: int i; ! 2623: for( i = 0; i < mode_count; i++ ) ! 2624: { ! 2625: if( DisplayModes[i].depth == 2 && DisplayModes[i].res.width <= 800 && DisplayModes[i].res.height <= 600) ! 2626: { ! 2627: if( modenum == logical_number ) ! 2628: return i; ! 2629: modenum++; ! 2630: } ! 2631: } ! 2632: return 0; ! 2633: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.