|
|
1.1.1.2 root 1: /*==========================================================================
2: *
3: * Copyright (C) 1996 Brian King
4: *
1.1.1.4 ! root 5: * File: win32gui.c
1.1.1.2 root 6: * Content: Win32-specific gui features for UAE port.
7: *
8: ***************************************************************************/
9:
10: #include <stdio.h>
11: #include <stdlib.h>
12: #include <io.h>
13: #include <windows.h>
1.1.1.4 ! root 14: #include <winspool.h>
! 15: #include <winuser.h>
! 16: #ifdef _MSC_VER
1.1.1.2 root 17: #include <mmsystem.h>
1.1.1.4 ! root 18: #include <shlobj.h>
1.1.1.2 root 19: #include <commdlg.h>
20: #include <dlgs.h>
21: #include <process.h>
22: #include <prsht.h>
23: #include <richedit.h>
1.1.1.4 ! root 24: #include <shellapi.h>
! 25: #else
! 26: #include <shlobj.h>
! 27: #include <commdlg.h>
! 28: #include <richedit.h>
! 29: #endif
1.1.1.2 root 30:
31: #include "config.h"
32: #include "resource.h"
33: #include "sysconfig.h"
34: #include "sysdeps.h"
35: #include "gui.h"
36: #include "options.h"
1.1.1.4 ! root 37: #include "memory.h"
1.1.1.2 root 38: #include "custom.h"
39: #include "newcpu.h"
40: #include "disk.h"
41: #include "uae.h"
1.1.1.4 ! root 42: #include "threaddep/thread.h"
! 43: #include "filesys.h"
1.1.1.2 root 44: #include "autoconf.h"
45:
46: #include "picasso96.h"
47: #include "osdep/win32gui.h"
48: #include "osdep/win32.h"
1.1.1.4 ! root 49: #include "osdep/win32gfx.h"
! 50: #include "osdep/dxwrap.h"
1.1.1.2 root 51: #include "sounddep/sound.h"
1.1.1.4 ! root 52: #include "target.h"
! 53: #include "savestate.h"
1.1.1.2 root 54:
1.1.1.4 ! root 55: #define DISK_FORMAT_STRING "(*.ADF;*.ADZ;*.GZ;*.DMS;*.FDI)\0*.ADF;*.ADZ;*.GZ;*.DMS;*.FDI\0"
1.1.1.2 root 56:
57: static int allow_quit;
58: static int full_property_sheet;
59: static struct uae_prefs *pguiprefs;
60: static struct uae_prefs workprefs;
61:
1.1.1.4 ! root 62: extern HWND (WINAPI *pHtmlHelp)(HWND, LPCSTR, UINT, LPDWORD );
! 63: #undef HtmlHelp
! 64: #ifndef HH_DISPLAY_TOPIC
! 65: #define HH_DISPLAY_TOPIC 0
! 66: #endif
! 67: #define HtmlHelp(a,b,c,d) if( pHtmlHelp ) (*pHtmlHelp)(a,b,c,(LPDWORD)d); else \
! 68: { char szMessage[ MAX_PATH ]; WIN32GUI_LoadUIString( IDS_NOHELP, szMessage, MAX_PATH ); gui_message( szMessage ); }
! 69:
1.1.1.2 root 70: extern HWND hAmigaWnd;
1.1.1.4 ! root 71: extern char help_file[ MAX_PATH ];
1.1.1.2 root 72:
73: extern int mouseactive;
74: extern char *start_path;
1.1.1.4 ! root 75:
! 76: extern char configname[256];
! 77: char config_filename[ MAX_PATH ] = "";
1.1.1.2 root 78:
79: HANDLE win32uae_key = NULL;
1.1.1.4 ! root 80:
1.1.1.2 root 81: drive_specs blankdrive =
82: {"", "", 1, 32, 1, 2, 0, 0};
83:
84: #define Error(x) MessageBox( NULL, (x), "WinUAE Error", MB_OK )
85:
1.1.1.4 ! root 86: void WIN32GUI_LoadUIString( DWORD id, char *string, DWORD dwStringLen )
! 87: {
! 88: if( LoadString( hUIDLL ? hUIDLL : hInst, id, string, dwStringLen ) == 0 )
! 89: LoadString( hInst, id, string, dwStringLen );
! 90: }
! 91:
! 92: HWND hPropertySheet = NULL;
! 93:
! 94: /* C_PAGES must be last */
1.1.1.2 root 95: enum {
1.1.1.4 ! root 96: LOADSAVE_ID, MEMORY_ID, KICKSTART_ID, CPU_ID,
! 97: DISPLAY_ID, CHIPSET_ID, SOUND_ID, FLOPPY_ID, HARDDISK_ID,
! 98: PORTS_ID, MISC_ID, ABOUT_ID, C_PAGES
1.1.1.2 root 99: };
100:
1.1.1.4 ! root 101: static HWND pages[C_PAGES];
! 102:
1.1.1.2 root 103: #define MIN_CHIP_MEM 0
104: #define MAX_CHIP_MEM 4
105: #define MIN_FAST_MEM 0
106: #define MAX_FAST_MEM 4
107: #define MIN_SLOW_MEM 0
108: #define MAX_SLOW_MEM 2
109: #define MIN_Z3_MEM 0
1.1.1.4 ! root 110: #define MAX_Z3_MEM 10
1.1.1.2 root 111: #define MIN_P96_MEM 0
1.1.1.4 ! root 112: #define MAX_P96_MEM 6
1.1.1.2 root 113: #define MIN_M68K_PRIORITY 1
114: #define MAX_M68K_PRIORITY 16
1.1.1.4 ! root 115: #define MIN_CACHE_SIZE 0
! 116: #define MAX_CACHE_SIZE 8
1.1.1.2 root 117: #define MIN_REFRESH_RATE 1
118: #define MAX_REFRESH_RATE 10
1.1.1.4 ! root 119: #define MIN_SOUND_MEM 0
! 120: #define MAX_SOUND_MEM 6
! 121:
! 122: static char szNone[ MAX_PATH ] = "None";
! 123:
! 124: /* if drive is -1, show the full GUI, otherwise file-requester for DF[drive] */
! 125: void WIN32GUI_DisplayGUI( int drive )
! 126: {
! 127: HRESULT ddrval;
! 128: int flipflop = 0;
! 129:
! 130: if( ( !WIN32GFX_IsPicassoScreen() && currprefs.gfx_afullscreen && ( currprefs.gfx_width < 640 ) ) ||
! 131: ( WIN32GFX_IsPicassoScreen() && currprefs.gfx_pfullscreen && ( picasso96_state.Width < 640 ) ) )
! 132: flipflop = 1;
! 133:
! 134: WIN32GFX_ClearPalette();
! 135:
! 136: if( !WIN32GFX_IsFullScreen() )
! 137: setmouseactive (FALSE);
! 138: else
! 139: {
! 140: if( DirectDraw_GetLockableType() == primary_surface )
! 141: {
! 142: /* Blit our primary to our secondary, so we can then use the secondary to refresh from */
! 143: ddrval = DirectDraw_Blt( secondary_surface, NULL, primary_surface, NULL, DDBLT_WAIT, NULL );
! 144: }
! 145: }
! 146: manual_painting_needed = 1; /* So that WM_PAINT will refresh the display */
! 147: pause_sound(0);
! 148:
! 149: DirectDraw_FlipToGDISurface();
! 150:
! 151: if( drive == -1 )
! 152: {
! 153: if( flipflop )
! 154: ShowWindow( hAmigaWnd, SW_MINIMIZE );
! 155: GetSettings(0);
! 156: if( flipflop )
! 157: ShowWindow( hAmigaWnd, SW_RESTORE );
! 158: }
! 159: else
! 160: {
! 161: DiskSelection( hAmigaWnd, IDC_DF0+drive, 0, &changed_prefs );
! 162: }
! 163: resume_sound();
! 164: WIN32GFX_SetPalette();
! 165: manual_painting_needed = 0; /* So that WM_PAINT doesn't need to use custom refreshing */
! 166: if( !WIN32GFX_IsFullScreen() || !mouseactive)
! 167: SetCursor (NULL);
! 168:
! 169: // This is a hack to fix the fact that time is passing while the GUI was present,
! 170: // and we don't want our frames-per-second calculation in drawing.c to get skewed.
! 171: #ifdef HAVE_GETTIMEOFDAY
! 172: {
! 173: struct timeval tv;
! 174: gettimeofday(&tv,NULL);
! 175: msecs = (tv.tv_sec-seconds_base) * 1000 + tv.tv_usec / 1000;
! 176: }
! 177: #endif
! 178: }
! 179:
! 180: static void prefs_to_gui (struct uae_prefs *p)
! 181: {
! 182: workprefs = *p;
! 183: workprefs.mountinfo = dup_mountinfo (p->mountinfo);
! 184: /* Could also duplicate unknown lines, but no need - we never
! 185: modify those. */
! 186: }
! 187:
! 188: static void gui_to_prefs (void)
! 189: {
! 190: /* Always copy our prefs to changed_prefs, ... */
! 191: changed_prefs = workprefs;
1.1.1.2 root 192:
1.1.1.4 ! root 193: /* ... but use currprefs for the mountinfo. The filesystem code
! 194: keeps a private copy, and only looks at currprefs once per reset.
! 195: It never looks at changed_prefs. */
! 196: free_mountinfo (currprefs.mountinfo);
! 197: currprefs.mountinfo = dup_mountinfo (workprefs.mountinfo);
! 198: }
! 199:
! 200: #define TRACK_WRITE_LEN (6250*2)
1.1.1.2 root 201:
1.1.1.4 ! root 202: static void disk_checksum(uae_u8 *p, uae_u8 *c)
1.1.1.2 root 203: {
1.1.1.4 ! root 204: uae_u32 cs = 0;
! 205: int i;
! 206:
! 207: for (i = 0; i < 512; i+= 4) cs += (p[i] << 24) | (p[i+1] << 16) | (p[i+2] << 8) | (p[i+3] << 0);
! 208: cs = -cs;
! 209: c[0] = cs >> 24; c[1] = cs >> 16; c[2] = cs >> 8; c[3] = cs >> 0;
! 210: }
! 211:
! 212: static void disk_date (uae_u8 *p)
! 213: {
! 214: time_t t;
! 215: struct tm *today;
! 216: int year, days, minutes, ticks;
! 217: char tmp[10];
! 218:
! 219: time (&t);
! 220: today = localtime( &t );
! 221: strftime (tmp, sizeof(tmp), "%Y", today);
! 222: year = atol (tmp);
! 223: strftime (tmp, sizeof(tmp), "%j", today);
! 224: days = atol (tmp) - 1;
! 225: strftime (tmp, sizeof(tmp), "%H", today);
! 226: minutes = atol (tmp) * 60;
! 227: strftime (tmp, sizeof(tmp), "%M", today);
! 228: minutes += atol (tmp);
! 229: strftime (tmp, sizeof(tmp), "%S", today);
! 230: ticks = atol (tmp) * 50;
! 231:
! 232: while (year > 1978) {
! 233: if ( !(year % 100) ? !(year % 400) : !(year % 4) ) days++;
! 234: days += 365;
! 235: year--;
! 236: }
! 237:
! 238: p[0] = days >> 24; p[1] = days >> 16; p[2] = days >> 8; p[3] = days >> 0;
! 239: p[4] = minutes >> 24; p[5] = minutes >> 16; p[6] = minutes >> 8; p[7] = minutes >> 0;
! 240: p[8] = ticks >> 24; p[9] = ticks >> 16; p[10] = ticks >> 8; p[11] = ticks >> 0;
1.1.1.2 root 241: }
242:
1.1.1.4 ! root 243: static void CreateDiskFile (char *name, int type)
1.1.1.2 root 244: {
245: HANDLE adf;
1.1.1.4 ! root 246: int i, j, file_size = 880 * 1024, tracks;
1.1.1.2 root 247: char *chunk = NULL;
248: DWORD count;
1.1.1.4 ! root 249: uae_u8 tmp[3*4];
! 250: char *disk_name = "empty";
1.1.1.2 root 251:
252: SetCursor (LoadCursor (NULL, IDC_WAIT));
253: adf = CreateFile (name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
254: if (adf != INVALID_HANDLE_VALUE) {
1.1.1.4 ! root 255: if ((chunk = xmalloc (16384)) != NULL) {
! 256: memset(chunk,0,16384);
! 257: switch(type)
! 258: {
! 259: case 0:
! 260: for (i = 0; i < file_size; i += 11264) {
! 261: memset(chunk, 0, 11264);
! 262: if (i == 0) {
! 263: /* boot block */
! 264: strcpy (chunk, "DOS");
! 265: } else if (i == 880 * 512) {
! 266: /* root block */
! 267: chunk[0+3] = 2;
! 268: chunk[12+3] = 0x48;
! 269: chunk[312] = chunk[313] = chunk[314] = chunk[315] = 0xff;
! 270: chunk[316+2] = 881 >> 8; chunk[316+3] = 881 & 255;
! 271: chunk[432] = strlen (disk_name);
! 272: strcpy (chunk + 433, disk_name);
! 273: chunk[508 + 3] = 1;
! 274: disk_date (chunk + 420);
! 275: memcpy (chunk + 472, chunk + 420, 3 * 4);
! 276: memcpy (chunk + 484, chunk + 420, 3 * 4);
! 277: disk_checksum(chunk, chunk + 20);
! 278: /* bitmap block */
! 279: memset (chunk + 512 + 4, 0xff, 220);
! 280: chunk[512 + 112 + 2] = 0x3f;
! 281: disk_checksum(chunk + 512, chunk + 512);
! 282:
! 283: }
! 284: WriteFile (adf, chunk, 11264, &count, NULL);
! 285: }
! 286: break;
! 287: case 1:
! 288: tracks=2*80;
! 289: WriteFile(adf,"UAE-1ADF",8,&count,0);
! 290: tmp[0]=0;tmp[1]=0; /* flags (reserved) */
! 291: tmp[2]=0;tmp[3]=tracks; /* number of tracks */
! 292: WriteFile(adf,tmp,4,&count,0);
! 293: tmp[0]=0;tmp[1]=0; /* flags (reserved) */
! 294: tmp[2]=0;tmp[3]=1; /* track type */
! 295: tmp[4]=0;tmp[5]=0;tmp[6]=TRACK_WRITE_LEN>>8;tmp[7]=TRACK_WRITE_LEN;
! 296: tmp[8]=0;tmp[9]=(TRACK_WRITE_LEN*8)>>16;tmp[10]=(TRACK_WRITE_LEN*8)>>8;tmp[11]=(TRACK_WRITE_LEN*8);
! 297: for (i=0;i<tracks;i++) WriteFile(adf,tmp,sizeof(tmp),&count,0);
! 298: for (i=0;i<tracks;i++) WriteFile(adf,chunk,TRACK_WRITE_LEN,&count,NULL);
! 299: break;
1.1.1.2 root 300: }
301: }
302: CloseHandle (adf);
303: }
304: SetCursor (LoadCursor (NULL, IDC_ARROW));
305: }
306:
1.1.1.4 ! root 307: // Common routine for popping up a file-requester
! 308: // flag - 0 for floppy loading, 1 for floppy creation, 2 for loading hdf, 3 for saving hdf
! 309: // flag - 4 for loading .uae config-files, 5 for saving .uae config-files
! 310: // flag = 6 for loading .rom files, 7 for loading .key files
! 311: // flag = 8 for loading anything you want
! 312: // flag = 9 for saving snapshots
! 313: // flag = 10 for loading snapshots
! 314: void DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs )
1.1.1.2 root 315: {
316: OPENFILENAME openFileName;
1.1.1.4 ! root 317: char regfloppypath[MAX_PATH] = "";
! 318: char regrompath[MAX_PATH] = "";
! 319: char reghdfpath[MAX_PATH] = "";
! 320: DWORD dwType = REG_SZ;
! 321: DWORD dwRFPsize = MAX_PATH;
! 322: DWORD dwRRPsize = MAX_PATH;
! 323: DWORD dwRHPsize = MAX_PATH;
! 324:
1.1.1.2 root 325: char full_path[MAX_PATH] = "";
326: char file_name[MAX_PATH] = "";
327: char init_path[MAX_PATH] = "";
328: BOOL result = FALSE;
329: char *amiga_path = NULL;
1.1.1.4 ! root 330: char description[ CFG_DESCRIPTION_LENGTH ] = "";
! 331: int i;
1.1.1.2 root 332:
1.1.1.4 ! root 333: char szTitle[ MAX_PATH ];
! 334: char szFormat[ MAX_PATH ];
! 335: char szFilter[ MAX_PATH ];
! 336:
! 337: if( hWinUAEKey )
! 338: {
! 339: RegQueryValueEx( hWinUAEKey, "FloppyPath", 0, &dwType, (LPBYTE)regfloppypath, &dwRFPsize );
! 340: RegQueryValueEx( hWinUAEKey, "KickstartPath", 0, &dwType, (LPBYTE)regrompath, &dwRRPsize );
! 341: RegQueryValueEx( hWinUAEKey, "hdfPath", 0, &dwType, (LPBYTE)reghdfpath, &dwRHPsize );
! 342: }
! 343:
! 344: strncpy( init_path, start_path, MAX_PATH );
! 345: switch( flag )
! 346: {
! 347: case 0:
! 348: case 1:
! 349: if( regfloppypath[0] )
! 350: strncpy( init_path, regfloppypath, MAX_PATH );
! 351: else
! 352: strncat( init_path, "\\..\\shared\\adf\\", MAX_PATH );
! 353: break;
! 354: case 2:
! 355: case 3:
! 356: if( reghdfpath[0] )
! 357: strncpy( init_path, reghdfpath, MAX_PATH );
! 358: else
! 359: strncat( init_path, "\\..\\shared\\hdf\\", MAX_PATH );
! 360: break;
! 361: case 6:
! 362: case 7:
! 363: if( regrompath[0] )
! 364: strncpy( init_path, regrompath, MAX_PATH );
! 365: else
! 366: strncat( init_path, "\\..\\shared\\rom\\", MAX_PATH );
! 367: break;
! 368: case 4:
! 369: case 5:
! 370: default:
! 371: strncat( init_path, "\\Configurations\\", MAX_PATH );
! 372: break;
1.1.1.2 root 373: }
1.1.1.4 ! root 374:
1.1.1.2 root 375: openFileName.lStructSize = sizeof (OPENFILENAME);
376: openFileName.hwndOwner = hDlg;
377: openFileName.hInstance = hInst;
1.1.1.4 ! root 378:
1.1.1.2 root 379: switch (flag) {
1.1.1.4 ! root 380: case 0:
! 381: WIN32GUI_LoadUIString( IDS_SELECTADF, szTitle, MAX_PATH );
! 382: WIN32GUI_LoadUIString( IDS_ADF, szFormat, MAX_PATH );
! 383: sprintf( szFilter, "%s ", szFormat );
! 384: memcpy( szFilter + strlen( szFilter ), DISK_FORMAT_STRING, sizeof( DISK_FORMAT_STRING ) + 1 );
! 385:
! 386: openFileName.lpstrTitle = szTitle;
1.1.1.2 root 387: openFileName.lpstrDefExt = "ADF";
1.1.1.4 ! root 388: openFileName.lpstrFilter = szFilter;
1.1.1.2 root 389: break;
1.1.1.4 ! root 390: case 1:
! 391: WIN32GUI_LoadUIString( IDS_CHOOSEBLANK, szTitle, MAX_PATH );
! 392: WIN32GUI_LoadUIString( IDS_ADF, szFormat, MAX_PATH );
! 393: sprintf( szFilter, "%s ", szFormat );
! 394: memcpy( szFilter + strlen( szFilter ), "(*.ADF)\0*.ADF\0", 15 );
! 395:
! 396: openFileName.lpstrTitle = szTitle;
1.1.1.2 root 397: openFileName.lpstrDefExt = "ADF";
1.1.1.4 ! root 398: openFileName.lpstrFilter = szFilter;
1.1.1.2 root 399: break;
1.1.1.4 ! root 400: case 2:
! 401: case 3:
! 402: WIN32GUI_LoadUIString( IDS_SELECTHDF, szTitle, MAX_PATH );
! 403: WIN32GUI_LoadUIString( IDS_HDF, szFormat, MAX_PATH );
! 404: sprintf( szFilter, "%s ", szFormat );
! 405: memcpy( szFilter + strlen( szFilter ), "(*.HDF)\0*.HDF\0", 15 );
! 406:
! 407: openFileName.lpstrTitle = szTitle;
1.1.1.2 root 408: openFileName.lpstrDefExt = "HDF";
1.1.1.4 ! root 409: openFileName.lpstrFilter = szFilter;
! 410: break;
! 411: case 4:
! 412: case 5:
! 413: WIN32GUI_LoadUIString( IDS_SELECTUAE, szTitle, MAX_PATH );
! 414: WIN32GUI_LoadUIString( IDS_UAE, szFormat, MAX_PATH );
! 415: sprintf( szFilter, "%s ", szFormat );
! 416: memcpy( szFilter + strlen( szFilter ), "(*.UAE)\0*.UAE\0", 15 );
! 417:
! 418: openFileName.lpstrTitle = szTitle;
! 419: openFileName.lpstrDefExt = "UAE";
! 420: openFileName.lpstrFilter = szFilter;
! 421: break;
! 422: case 6:
! 423: WIN32GUI_LoadUIString( IDS_SELECTROM, szTitle, MAX_PATH );
! 424: WIN32GUI_LoadUIString( IDS_ROM, szFormat, MAX_PATH );
! 425: sprintf( szFilter, "%s ", szFormat );
! 426: memcpy( szFilter + strlen( szFilter ), "(*.ROM)\0*.ROM\0", 15 );
! 427:
! 428: openFileName.lpstrTitle = szTitle;
! 429: openFileName.lpstrDefExt = "ROM";
! 430: openFileName.lpstrFilter = szFilter;
! 431: break;
! 432: case 7:
! 433: WIN32GUI_LoadUIString( IDS_SELECTKEY, szTitle, MAX_PATH );
! 434: WIN32GUI_LoadUIString( IDS_KEY, szFormat, MAX_PATH );
! 435: sprintf( szFilter, "%s ", szFormat );
! 436: memcpy( szFilter + strlen( szFilter ), "(*.KEY)\0*.KEY\0", 15 );
! 437:
! 438: openFileName.lpstrTitle = szTitle;
! 439: openFileName.lpstrDefExt = "KEY";
! 440: openFileName.lpstrFilter = szFilter;
! 441: break;
! 442: case 9:
! 443: case 10:
! 444: WIN32GUI_LoadUIString( IDS_SELECTUSS, szTitle, MAX_PATH );
! 445: WIN32GUI_LoadUIString( IDS_USS, szFormat, MAX_PATH );
! 446: sprintf( szFilter, "%s ", szFormat );
! 447: memcpy( szFilter + strlen( szFilter ), "(*.USS)\0*.USS\0", 15 );
! 448:
! 449: openFileName.lpstrTitle = szTitle;
! 450: openFileName.lpstrDefExt = "USS";
! 451: openFileName.lpstrFilter = szFilter;
! 452: break;
! 453: case 8:
! 454: default:
! 455: WIN32GUI_LoadUIString( IDS_SELECTINFO, szTitle, MAX_PATH );
! 456:
! 457: openFileName.lpstrTitle = szTitle;
! 458: openFileName.lpstrFilter = NULL;
! 459: openFileName.lpstrDefExt = NULL;
1.1.1.2 root 460: break;
461: }
1.1.1.4 ! root 462: openFileName.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_LONGNAMES | OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
1.1.1.2 root 463: openFileName.lpstrCustomFilter = NULL;
464: openFileName.nMaxCustFilter = 0;
465: openFileName.nFilterIndex = 0;
466: openFileName.lpstrFile = full_path;
467: openFileName.nMaxFile = MAX_PATH;
468: openFileName.lpstrFileTitle = file_name;
469: openFileName.nMaxFileTitle = MAX_PATH;
1.1.1.4 ! root 470: openFileName.lpstrInitialDir = init_path;
1.1.1.2 root 471: openFileName.lpfnHook = NULL;
472: openFileName.lpTemplateName = NULL;
473: openFileName.lCustData = 0;
1.1.1.4 ! root 474: if (flag == 1 || flag == 3 || flag == 5 || flag == 9)
! 475: {
! 476: if( !(result = GetSaveFileName (&openFileName)) )
! 477: write_log ("GetSaveFileName() failed.\n");
! 478: }
1.1.1.2 root 479: else
1.1.1.4 ! root 480: {
! 481: if( !(result = GetOpenFileName (&openFileName)) )
! 482: write_log ("GetOpenFileName() failed.\n");
! 483: }
1.1.1.2 root 484:
1.1.1.4 ! root 485: if (result)
! 486: {
! 487: switch (wParam)
! 488: {
! 489: case IDC_PATH_NAME:
! 490: if( flag == 8 )
! 491: {
! 492: if( strstr( full_path, "Configurations\\" ) )
! 493: {
! 494: strcpy( full_path, init_path );
! 495: strcat( full_path, file_name );
! 496: }
! 497: }
1.1.1.2 root 498: SetDlgItemText (hDlg, wParam, full_path);
1.1.1.4 ! root 499: break;
! 500: case IDC_DF0:
1.1.1.2 root 501: SetDlgItemText (hDlg, IDC_DF0TEXT, full_path);
1.1.1.4 ! root 502: strcpy( prefs->df[0], full_path );
! 503: disk_insert( 0, full_path );
! 504: break;
! 505: case IDC_DF1:
1.1.1.2 root 506: SetDlgItemText (hDlg, IDC_DF1TEXT, full_path);
1.1.1.4 ! root 507: strcpy( prefs->df[1], full_path );
! 508: disk_insert( 1, full_path );
! 509: break;
! 510: case IDC_DF2:
1.1.1.2 root 511: SetDlgItemText (hDlg, IDC_DF2TEXT, full_path);
1.1.1.4 ! root 512: strcpy( prefs->df[2], full_path );
! 513: disk_insert( 2, full_path );
! 514: break;
! 515: case IDC_DF3:
1.1.1.2 root 516: SetDlgItemText (hDlg, IDC_DF3TEXT, full_path);
1.1.1.4 ! root 517: strcpy( prefs->df[3], full_path );
! 518: disk_insert( 3, full_path );
! 519: break;
! 520: case IDC_DOSAVESTATE:
! 521: case IDC_DOLOADSTATE:
! 522: strcpy( savestate_filename, full_path );
! 523: break;
! 524: case IDC_CREATE:
! 525: CreateDiskFile( full_path, 0 );
! 526: break;
! 527: case IDC_CREATE_RAW:
! 528: CreateDiskFile( full_path, 1 );
! 529: break;
! 530: case IDC_LOAD:
! 531: if( cfgfile_load( &workprefs, full_path ) == 0 )
! 532: {
! 533: char szMessage[ MAX_PATH ];
! 534: WIN32GUI_LoadUIString( IDS_COULDNOTLOADCONFIG, szMessage, MAX_PATH );
! 535: gui_message( szMessage );
! 536: }
! 537: else
! 538: {
! 539: cfgfile_get_description( full_path, description );
! 540: for( i = 0; i < C_PAGES; i++ )
! 541: {
! 542: if( pages[i] )
! 543: SendMessage( pages[i], WM_USER, 0, 0 );
! 544: }
! 545:
! 546: SetDlgItemText( hDlg, IDC_EDITDESCRIPTION, description );
! 547: SetDlgItemText( hDlg, IDC_EDITNAME, full_path );
! 548: }
! 549: break;
! 550: case IDC_SAVE:
! 551: SetDlgItemText( hDlg, IDC_EDITNAME, full_path );
! 552: break;
! 553: case IDC_ROMFILE:
! 554: SetDlgItemText( hDlg, IDC_ROMFILE, full_path );
! 555: strcpy( workprefs.romfile, full_path );
! 556: break;
! 557: case IDC_KEYFILE:
! 558: SetDlgItemText( hDlg, IDC_KEYFILE, full_path );
! 559: strcpy( workprefs.keyfile, full_path );
! 560: break;
! 561: }
! 562: if( flag == 0 || flag == 1 )
! 563: {
! 564: amiga_path = strstr( openFileName.lpstrFile, openFileName.lpstrFileTitle );
! 565: if( amiga_path && amiga_path != openFileName.lpstrFile )
! 566: {
! 567: *amiga_path = 0;
! 568: if( hWinUAEKey )
! 569: RegSetValueEx( hWinUAEKey, "FloppyPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen( openFileName.lpstrFile ) );
! 570: }
! 571: }
! 572: else if( flag == 2 || flag == 3 )
! 573: {
! 574: amiga_path = strstr( openFileName.lpstrFile, openFileName.lpstrFileTitle );
! 575: if( amiga_path && amiga_path != openFileName.lpstrFile )
! 576: {
! 577: *amiga_path = 0;
! 578: if( hWinUAEKey )
! 579: RegSetValueEx( hWinUAEKey, "hdfPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen( openFileName.lpstrFile ) );
! 580: }
! 581: }
! 582: else if( flag == 6 || flag == 7 )
! 583: {
! 584: amiga_path = strstr( openFileName.lpstrFile, openFileName.lpstrFileTitle );
! 585: if( amiga_path && amiga_path != openFileName.lpstrFile )
! 586: {
! 587: *amiga_path = 0;
! 588: if( hWinUAEKey )
! 589: RegSetValueEx( hWinUAEKey, "KickstartPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen( openFileName.lpstrFile ) );
! 590: }
! 591: }
1.1.1.2 root 592: }
593: }
594:
1.1.1.4 ! root 595: static BOOL CreateHardFile (HWND hDlg, UINT hfsize)
1.1.1.2 root 596: {
597: HANDLE hf;
1.1.1.4 ! root 598: int i = 0;
! 599: BOOL result = FALSE;
1.1.1.2 root 600:
601: char init_path[MAX_PATH] = "";
602:
1.1.1.4 ! root 603: DiskSelection (hDlg, IDC_PATH_NAME, 3, &workprefs);
1.1.1.2 root 604: GetDlgItemText (hDlg, IDC_PATH_NAME, init_path, MAX_PATH);
1.1.1.4 ! root 605: if( *init_path && hfsize )
! 606: {
! 607: SetCursor( LoadCursor( NULL, IDC_WAIT ) );
! 608: if( ( hf = CreateFile (init_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL) ) != INVALID_HANDLE_VALUE )
! 609: {
! 610: if( SetFilePointer( hf, hfsize, NULL, FILE_BEGIN ) == hfsize )
! 611: {
! 612: result = SetEndOfFile( hf );
! 613: }
! 614: else
! 615: {
! 616: write_log( "SetFilePointer() failure for %s to posn %d\n", init_path, hfsize );
! 617: }
! 618: CloseHandle( hf );
! 619: }
! 620: else
! 621: {
! 622: write_log( "CreateFile() failed to create %s\n", init_path );
! 623: }
! 624: SetCursor( LoadCursor( NULL, IDC_ARROW ) );
1.1.1.2 root 625: }
626: return result;
627: }
628:
629: static const char *memsize_names[] = {
1.1.1.4 ! root 630: /* 0 */ szNone,
! 631: /* 1 */ "256 K",
! 632: /* 2 */ "512 K",
! 633: /* 3 */ "1 MB",
! 634: /* 4 */ "2 MB",
! 635: /* 5 */ "4 MB",
! 636: /* 6 */ "8 MB",
! 637: /* 7 */ "16 MB",
! 638: /* 8 */ "32 MB",
! 639: /* 9 */ "64 MB",
! 640: /* 10*/ "128 MB",
! 641: /* 11*/ "256 MB",
! 642: /* 12*/ "512 MB",
! 643: /* 13*/ "1 GB",
! 644:
1.1.1.2 root 645: };
646:
647: static unsigned long memsizes[] = {
1.1.1.4 ! root 648: /* 0 */ 0,
! 649: /* 1 */ 0x00040000, /* 256-K */
! 650: /* 2 */ 0x00080000, /* 512-K */
! 651: /* 3 */ 0x00100000, /* 1-meg */
! 652: /* 4 */ 0x00200000, /* 2-meg */
! 653: /* 5 */ 0x00400000, /* 4-meg */
! 654: /* 6 */ 0x00800000, /* 8-meg */
! 655: /* 7 */ 0x01000000, /* 16-meg */
! 656: /* 8 */ 0x02000000, /* 32-meg */
! 657: /* 9 */ 0x04000000, /* 64-meg */
! 658: /* 10*/ 0x08000000, //128 Meg
! 659: /* 11*/ 0x10000000, //256 Meg
! 660: /* 12*/ 0x20000000, //512 Meg The correct size is set in mman.c
! 661: /* 13*/ 0x40000000, //1GB Meg
1.1.1.2 root 662: };
663:
1.1.1.4 ! root 664: static int msi_chip[] = { 2, 3, 4, 5, 6 };
1.1.1.2 root 665: static int msi_bogo[] = { 0, 2, 3 };
666: static int msi_fast[] = { 0, 3, 4, 5, 6 };
1.1.1.4 ! root 667: static int msi_z3fast[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13 };
! 668: static int msi_gfx[] = { 0, 3, 4, 5, 6,7,8};
1.1.1.2 root 669:
1.1.1.4 ! root 670: static UINT CalculateHardfileSize (HWND hDlg)
1.1.1.2 root 671: {
1.1.1.4 ! root 672: BOOL Translated = FALSE;
! 673: UINT bytes = 0;
! 674: bytes = GetDlgItemInt( hDlg, IDC_HFSIZE, &Translated, FALSE );
! 675: if( !Translated )
! 676: bytes = 0;
! 677: return bytes;
1.1.1.2 root 678: }
679:
680:
1.1.1.4 ! root 681: static const char *nth[] = {
! 682: "", "second ", "third ", "fourth ", "fifth ", "sixth ", "seventh ", "eighth ", "ninth ", "tenth "
1.1.1.2 root 683: };
684:
1.1.1.4 ! root 685: ConfigStructPtr AllocateConfigStruct( void )
1.1.1.2 root 686: {
1.1.1.4 ! root 687: return xmalloc( sizeof( ConfigStruct ) );
! 688: }
! 689:
! 690: void FreeConfigStruct( ConfigStructPtr cfgptr )
! 691: {
! 692: free( cfgptr );
! 693: }
1.1.1.2 root 694:
1.1.1.4 ! root 695: ConfigStructPtr GetFirstConfigEntry( HANDLE *file_handle, LPWIN32_FIND_DATA find_data )
! 696: {
! 697: ConfigStructPtr config = NULL;
! 698: DWORD num_bytes = 0;
! 699: char init_path[ MAX_PATH ] = "", *posn;
! 700: char description[ CFG_DESCRIPTION_LENGTH ] = "";
! 701:
! 702: if( start_path )
! 703: {
! 704: strncpy( init_path, start_path, MAX_PATH );
! 705: strncat( init_path, "\\Configurations\\*.UAE", MAX_PATH );
! 706: }
! 707:
! 708: if( ( *file_handle = FindFirstFile( init_path, find_data ) ) != INVALID_HANDLE_VALUE )
! 709: {
! 710: config = AllocateConfigStruct();
! 711: sprintf( init_path, "%s\\Configurations\\%s", start_path, find_data->cFileName );
! 712: if( cfgfile_get_description( init_path, description ) )
! 713: {
! 714: if( ( posn = strrchr( find_data->cFileName, '.' ) ) != NULL )
! 715: *posn = '\0';
! 716: strcpy( config->Name, find_data->cFileName );
! 717:
! 718: strcpy( config->Description, description );
! 719: }
! 720: else
! 721: {
! 722: FreeConfigStruct( config );
! 723: config = NULL;
! 724: }
1.1.1.2 root 725: }
1.1.1.4 ! root 726: else
! 727: {
! 728: // Either the directory has no .CFG files, or doesn't exist.
! 729:
! 730: // Create the directory, even if it already exists. No harm, and don't check return codes, because
! 731: // we may be doing this on a read-only media like CD-ROM.
! 732: sprintf( init_path, "%s\\Configurations", start_path );
! 733: CreateDirectory( init_path, NULL );
! 734: }
! 735: return config;
1.1.1.2 root 736: }
737:
1.1.1.4 ! root 738: ConfigStructPtr GetNextConfigEntry( HANDLE *file_handle, LPWIN32_FIND_DATA find_data )
! 739: {
! 740: ConfigStructPtr config = NULL;
! 741: char init_path[ MAX_PATH ] = "";
! 742: char desc[ CFG_DESCRIPTION_LENGTH ] = "";
! 743: char *posn;
! 744:
! 745: if( FindNextFile( *file_handle, find_data ) == 0 )
! 746: {
! 747: FindClose( *file_handle );
! 748: }
! 749: else
! 750: {
! 751: config = AllocateConfigStruct();
! 752: sprintf( init_path, "%s\\Configurations\\%s", start_path, find_data->cFileName );
! 753: if( cfgfile_get_description( init_path, desc ) )
! 754: {
! 755: if( ( posn = strrchr( find_data->cFileName, '.' ) ) != NULL )
! 756: *posn = '\0';
! 757: strcpy( config->Name, find_data->cFileName );
! 758:
! 759: strcpy( config->Description, desc );
! 760: }
! 761: else
! 762: {
! 763: FreeConfigStruct( config );
! 764: config = NULL;
! 765: }
! 766: }
! 767: return config;
! 768: }
! 769:
! 770: void HandleConfiguration( HWND hDlg, int flag )
! 771: {
! 772: char full_path[MAX_PATH] = "";
! 773: char file_name[MAX_PATH] = "";
! 774: char init_path[MAX_PATH] = "";
! 775: ConfigStructPtr cfgptr = NULL;
! 776: int i;
! 777:
! 778: if( ( cfgptr = AllocateConfigStruct() ) != NULL )
! 779: {
! 780: switch( flag )
! 781: {
! 782: case CONFIG_SAVE_FULL:
! 783: DiskSelection( hDlg, IDC_SAVE, 5, &workprefs );
! 784: GetDlgItemText( hDlg, IDC_EDITNAME, full_path, MAX_PATH );
! 785: GetDlgItemText( hDlg, IDC_EDITDESCRIPTION, workprefs.description, 256 );
! 786: cfgfile_save( &workprefs, full_path );
! 787: break;
! 788:
! 789: case CONFIG_LOAD_FULL:
! 790: DiskSelection( hDlg, IDC_LOAD, 4, &workprefs );
! 791: for( i = 0; i < C_PAGES; i++ )
! 792: {
! 793: if( pages[i] )
! 794: SendMessage( pages[i], WM_USER, 0, 0 );
! 795: }
! 796: EnableWindow( GetDlgItem( hDlg, IDC_VIEWINFO ), workprefs.info[0] );
! 797: break;
! 798:
! 799: case CONFIG_SAVE:
! 800: GetDlgItemText( hDlg, IDC_EDITNAME, cfgptr->Name, MAX_PATH );
! 801: if( cfgptr->Name[0] == '\0' )
! 802: {
! 803: char szMessage[ MAX_PATH ];
! 804: WIN32GUI_LoadUIString( IDS_MUSTENTERNAME, szMessage, MAX_PATH );
! 805: gui_message( szMessage );
! 806: }
! 807: else
! 808: {
! 809: if( !strchr( cfgptr->Name, '\\' ) && !strchr( cfgptr->Name, '/' ) )
! 810: {
! 811: if( start_path )
! 812: {
! 813: strncpy( init_path, start_path, MAX_PATH );
! 814: strncat( init_path, "\\Configurations\\", MAX_PATH );
! 815: }
! 816:
! 817: sprintf( full_path, "%s%s.UAE", init_path, cfgptr->Name );
! 818: }
! 819: else
! 820: {
! 821: strcpy( full_path, cfgptr->Name );
! 822: }
! 823: GetDlgItemText( hDlg, IDC_EDITDESCRIPTION, workprefs.description, 256 );
! 824: cfgfile_save( &workprefs, full_path );
! 825: }
! 826: break;
! 827:
! 828: case CONFIG_LOAD:
! 829: GetDlgItemText( hDlg, IDC_EDITNAME, cfgptr->Name, MAX_PATH );
! 830: if( cfgptr->Name[0] == '\0' )
! 831: {
! 832: char szMessage[ MAX_PATH ];
! 833: WIN32GUI_LoadUIString( IDS_MUSTSELECTCONFIG, szMessage, MAX_PATH );
! 834: gui_message( szMessage );
! 835: }
! 836: else
! 837: {
! 838: if( start_path )
! 839: {
! 840: strncpy( init_path, start_path, MAX_PATH );
! 841: strncat( init_path, "\\Configurations\\", MAX_PATH );
! 842: }
! 843:
! 844: sprintf( full_path, "%s%s.UAE", init_path, cfgptr->Name );
! 845: strcpy( config_filename, cfgptr->Name );
! 846:
! 847: if( cfgfile_load( &workprefs, full_path ) == 0 )
! 848: {
! 849: char szMessage[ MAX_PATH ];
! 850: WIN32GUI_LoadUIString( IDS_COULDNOTLOADCONFIG, szMessage, MAX_PATH );
! 851: gui_message( szMessage );
! 852: }
! 853:
! 854: for( i = 0; i < C_PAGES; i++ )
! 855: {
! 856: if( pages[i] )
! 857: SendMessage( pages[i], WM_USER, 0, 0 );
! 858: }
! 859: EnableWindow( GetDlgItem( hDlg, IDC_VIEWINFO ), workprefs.info[0] );
! 860: }
! 861: break;
! 862:
! 863: case CONFIG_DELETE:
! 864: GetDlgItemText( hDlg, IDC_EDITNAME, cfgptr->Name, MAX_PATH );
! 865: if( cfgptr->Name[0] == '\0' )
! 866: {
! 867: char szMessage[ MAX_PATH ];
! 868: WIN32GUI_LoadUIString( IDS_MUSTSELECTCONFIGFORDELETE, szMessage, MAX_PATH );
! 869: gui_message( szMessage );
! 870: }
! 871: else
! 872: {
! 873: char szMessage[ MAX_PATH ];
! 874: char szTitle[ MAX_PATH ];
! 875: WIN32GUI_LoadUIString( IDS_DELETECONFIGCONFIRMATION, szMessage, MAX_PATH );
! 876: WIN32GUI_LoadUIString( IDS_DELETECONFIGTITLE, szTitle, MAX_PATH );
! 877: if( MessageBox( hDlg, szMessage, szTitle,
! 878: MB_YESNO | MB_ICONWARNING | MB_APPLMODAL | MB_SETFOREGROUND ) == IDYES )
! 879: {
! 880: if( start_path )
! 881: {
! 882: strncpy( init_path, start_path, MAX_PATH );
! 883: strncat( init_path, "\\Configurations\\", MAX_PATH );
! 884: }
! 885:
! 886: sprintf( full_path, "%s%s.UAE", init_path, cfgptr->Name );
! 887: DeleteFile( full_path );
! 888: }
! 889: }
! 890: break;
! 891: }
! 892: FreeConfigStruct( cfgptr );
! 893: }
! 894: }
! 895:
! 896: static int clicked_entry = -1;
! 897:
! 898: #define LOADSAVE_COLUMNS 2
! 899: #define HARDDISK_COLUMNS 7
! 900: #define MAX_COLUMN_HEADING_WIDTH 20
! 901:
! 902: void InitializeListView( HWND hDlg )
! 903: {
! 904: HANDLE file_handle = NULL;
! 905: WIN32_FIND_DATA find_data;
! 906: BOOL rc = TRUE;
! 907: HWND list;
! 908: LV_ITEM lvstruct;
! 909: LV_COLUMN lvcolumn;
! 910: RECT rect;
! 911: int num_columns = ( hDlg == pages[ LOADSAVE_ID ] ) ? LOADSAVE_COLUMNS : HARDDISK_COLUMNS;
! 912: char column_heading[ HARDDISK_COLUMNS ][ MAX_COLUMN_HEADING_WIDTH ];
! 913: char sectors_str[6] = "";
! 914: char surfaces_str[6] = "";
! 915: char reserved_str[6] = "";
! 916: char blocksize_str[6] = "";
! 917: char readwrite_str[4] = "";
! 918: char volname_str[ MAX_PATH ] = "";
! 919: int width = 0, column_width[ HARDDISK_COLUMNS ];
! 920: int items = 0, result = 0, i, entry = 0, temp = 0;
! 921: ConfigStructPtr config = NULL;
! 922:
! 923: if( num_columns == LOADSAVE_COLUMNS )
! 924: {
! 925: WIN32GUI_LoadUIString( IDS_NAME, column_heading[0], MAX_COLUMN_HEADING_WIDTH );
! 926: WIN32GUI_LoadUIString( IDS_DESCRIPTION, column_heading[1], MAX_COLUMN_HEADING_WIDTH );
! 927:
! 928: list = GetDlgItem( hDlg, IDC_CONFIGLIST );
! 929: }
! 930: else
! 931: {
! 932: WIN32GUI_LoadUIString( IDS_VOLUME, column_heading[0], MAX_COLUMN_HEADING_WIDTH );
! 933: WIN32GUI_LoadUIString( IDS_PATH, column_heading[1], MAX_COLUMN_HEADING_WIDTH );
! 934: WIN32GUI_LoadUIString( IDS_RW, column_heading[2], MAX_COLUMN_HEADING_WIDTH );
! 935: WIN32GUI_LoadUIString( IDS_SECTORS, column_heading[3], MAX_COLUMN_HEADING_WIDTH );
! 936: WIN32GUI_LoadUIString( IDS_SURFACES, column_heading[4], MAX_COLUMN_HEADING_WIDTH );
! 937: WIN32GUI_LoadUIString( IDS_RESERVED, column_heading[5], MAX_COLUMN_HEADING_WIDTH );
! 938: WIN32GUI_LoadUIString( IDS_BLOCKSIZE, column_heading[6], MAX_COLUMN_HEADING_WIDTH );
! 939:
! 940: list = GetDlgItem( hDlg, IDC_VOLUMELIST );
! 941: }
! 942:
! 943: ListView_DeleteAllItems( list );
! 944:
! 945: for( i = 0; i < num_columns; i++ )
! 946: column_width[i] = ListView_GetStringWidth( list, column_heading[i] ) + 15;
! 947:
! 948: // If there are no columns, then insert some
! 949: lvcolumn.mask = LVCF_WIDTH;
! 950: if( ListView_GetColumn( list, 1, &lvcolumn ) == FALSE )
! 951: {
! 952: for( i = 0; i < num_columns; i++ )
! 953: {
! 954: lvcolumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
! 955: lvcolumn.iSubItem = i;
! 956: lvcolumn.fmt = LVCFMT_LEFT;
! 957: lvcolumn.pszText = column_heading[i];
! 958: lvcolumn.cx = column_width[i];
! 959: ListView_InsertColumn( list, i, &lvcolumn );
! 960: }
! 961: }
! 962: if( num_columns == LOADSAVE_COLUMNS )
! 963: {
! 964: if( ( config = GetFirstConfigEntry( &file_handle, &find_data ) ) != NULL )
! 965: {
! 966: while( config )
! 967: {
! 968: lvstruct.mask = LVIF_TEXT | LVIF_PARAM;
! 969: lvstruct.pszText = config->Name;
! 970: lvstruct.lParam = 0;
! 971: lvstruct.iItem = entry;
! 972: lvstruct.iSubItem = 0;
! 973: result = ListView_InsertItem( list, &lvstruct );
! 974: if( result != -1 )
! 975: {
! 976: width = ListView_GetStringWidth( list, lvstruct.pszText ) + 15;
! 977: if( width > column_width[ lvstruct.iSubItem ] )
! 978: column_width[ lvstruct.iSubItem ] = width;
! 979:
! 980: ListView_SetItemText( list, result, 1, config->Description );
! 981: width = ListView_GetStringWidth( list, config->Description ) + 15;
! 982: if( width > column_width[ 1 ] )
! 983: column_width[ 1 ] = width;
! 984:
! 985: entry++;
! 986: }
! 987: FreeConfigStruct( config );
! 988: config = GetNextConfigEntry( &file_handle, &find_data );
! 989: }
! 990: }
! 991: }
! 992: else
! 993: {
! 994: for( i = 0; i < nr_units( workprefs.mountinfo ); i++ )
! 995: {
! 996: int secspertrack, surfaces, reserved, blocksize, size;
! 997: int cylinders, readonly;
! 998: char *volname, *rootdir;
! 999: char *failure;
! 1000:
! 1001: failure = get_filesys_unit (workprefs.mountinfo, i,
! 1002: &volname, &rootdir, &readonly,
! 1003: &secspertrack, &surfaces, &reserved,
! 1004: &cylinders, &size, &blocksize);
! 1005:
! 1006: if( is_hardfile( workprefs.mountinfo, i ) )
! 1007: {
! 1008: sprintf( sectors_str, "%d", secspertrack );
! 1009: sprintf( surfaces_str, "%d", surfaces );
! 1010: sprintf( reserved_str, "%d", reserved );
! 1011: sprintf( blocksize_str, "%d", blocksize );
! 1012: sprintf( volname_str, "DH%d", i );
! 1013: }
! 1014: else
! 1015: {
! 1016: strcpy( sectors_str, "n/a" );
! 1017: strcpy( surfaces_str, "n/a" );
! 1018: strcpy( reserved_str, "n/a" );
! 1019: strcpy( blocksize_str, "n/a" );
! 1020: strcpy( volname_str, volname );
! 1021: }
! 1022:
! 1023: sprintf( readwrite_str, "%s", readonly ? "no" : "yes" );
! 1024: lvstruct.mask = LVIF_TEXT | LVIF_PARAM;
! 1025: lvstruct.pszText = volname_str;
! 1026: lvstruct.lParam = 0;
! 1027: lvstruct.iItem = i;
! 1028: lvstruct.iSubItem = 0;
! 1029: result = ListView_InsertItem (list, &lvstruct);
! 1030: if (result != -1) {
! 1031: width = ListView_GetStringWidth( list, lvstruct.pszText ) + 15;
! 1032: if( width > column_width[ lvstruct.iSubItem ] )
! 1033: column_width[ lvstruct.iSubItem ] = width;
! 1034:
! 1035: ListView_SetItemText( list, result, 1, rootdir );
! 1036: width = ListView_GetStringWidth( list, rootdir ) + 15;
! 1037: if( width > column_width[ 1 ] )
! 1038: column_width[ 1 ] = width;
! 1039:
! 1040: ListView_SetItemText( list, result, 2, readwrite_str );
! 1041: width = ListView_GetStringWidth( list, readwrite_str ) + 15;
! 1042: if( width > column_width[ 2 ] )
! 1043: column_width[ 2 ] = width;
! 1044:
! 1045: ListView_SetItemText( list, result, 3, sectors_str );
! 1046: width = ListView_GetStringWidth( list, sectors_str ) + 15;
! 1047: if( width > column_width[ 3 ] )
! 1048: column_width[ 3 ] = width;
! 1049:
! 1050: ListView_SetItemText( list, result, 4, surfaces_str );
! 1051: width = ListView_GetStringWidth( list, surfaces_str ) + 15;
! 1052: if( width > column_width[ 4 ] )
! 1053: column_width[ 4 ] = width;
! 1054:
! 1055: ListView_SetItemText( list, result, 5, reserved_str );
! 1056: width = ListView_GetStringWidth( list, reserved_str ) + 15;
! 1057: if( width > column_width[ 5 ] )
! 1058: column_width[ 5 ] = width;
! 1059:
! 1060: ListView_SetItemText( list, result, 6, blocksize_str );
! 1061: width = ListView_GetStringWidth( list, blocksize_str ) + 15;
! 1062: if( width > column_width[ 6 ] )
! 1063: column_width[ 6 ] = width;
! 1064: }
! 1065: }
! 1066: }
! 1067: if( rc == FALSE )
! 1068: {
! 1069: FreeConfigStruct( config );
! 1070: }
! 1071:
! 1072: if( result != -1 )
! 1073: {
! 1074: if( GetWindowRect( list, &rect ) )
! 1075: {
! 1076: ScreenToClient( hDlg, (LPPOINT)&rect );
! 1077: ScreenToClient( hDlg, (LPPOINT)&rect.right );
! 1078: if( num_columns == 2 )
! 1079: {
! 1080: if( ( temp = rect.right - rect.left - column_width[ 0 ] - 4 ) > column_width[1] )
! 1081: column_width[1] = temp;
! 1082: }
! 1083: }
! 1084:
! 1085: // Adjust our column widths so that we can see the contents...
! 1086: for( i = 0; i < num_columns; i++ )
! 1087: {
! 1088: ListView_SetColumnWidth( list, i, column_width[i] );
! 1089: }
! 1090:
! 1091: #if 0
! 1092: // Turn on full-row-select option
! 1093: ListView_SetExtendedListViewStyle( list, LVS_EX_FULLROWSELECT );
! 1094: #endif
! 1095:
! 1096: // Redraw the items in the list...
! 1097: items = ListView_GetItemCount( list );
! 1098: ListView_RedrawItems( list, 0, items );
! 1099: }
! 1100: }
1.1.1.2 root 1101:
1102: static int listview_find_selected (HWND list)
1103: {
1104: int i, items;
1105: items = ListView_GetItemCount (list);
1106: for (i = 0; i < items; i++) {
1107: if (ListView_GetItemState (list, i, LVIS_SELECTED) == LVIS_SELECTED)
1108: return i;
1109: }
1110: return -1;
1111: }
1112:
1113: static int listview_entry_from_click (HWND list)
1114: {
1115: POINT point;
1116: DWORD pos = GetMessagePos ();
1117: int items, entry;
1118:
1119: point.x = LOWORD (pos);
1120: point.y = HIWORD (pos);
1121: ScreenToClient (list, &point);
1122: entry = ListView_GetTopIndex (list);
1123: items = entry + ListView_GetCountPerPage (list);
1124: if (items > ListView_GetItemCount (list))
1125: items = ListView_GetItemCount (list);
1126:
1127: while (entry <= items) {
1128: RECT rect;
1129: /* Get the bounding rectangle of an item. If the mouse
1130: * location is within the bounding rectangle of the item,
1131: * you know you have found the item that was being clicked. */
1132: ListView_GetItemRect (list, entry, &rect, LVIR_BOUNDS);
1133: if (PtInRect (&rect, point)) {
1134: UINT flag = LVIS_SELECTED | LVIS_FOCUSED;
1135: ListView_SetItemState (list, entry, flag, flag);
1136: return entry;
1137: }
1138: entry++;
1139: }
1140: return -1;
1141: }
1142:
1.1.1.4 ! root 1143: static int CALLBACK InfoSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
! 1144: {
! 1145: static int recursive = 0;
! 1146:
! 1147: switch (msg)
! 1148: {
! 1149: case WM_INITDIALOG:
! 1150: recursive++;
! 1151: SetDlgItemText (hDlg, IDC_PATH_NAME, workprefs.info);
! 1152: recursive--;
! 1153: return TRUE;
! 1154:
! 1155: case WM_COMMAND:
! 1156: if (recursive)
! 1157: break;
! 1158: recursive++;
! 1159:
! 1160: switch( wParam )
! 1161: {
! 1162: case IDC_SELECTOR:
! 1163: DiskSelection (hDlg, IDC_PATH_NAME, 8, &workprefs );
! 1164: break;
! 1165: case IDOK:
! 1166: EndDialog (hDlg, 1);
! 1167: break;
! 1168: case IDCANCEL:
! 1169: EndDialog (hDlg, 0);
! 1170: break;
! 1171: }
! 1172:
! 1173: GetDlgItemText( hDlg, IDC_PATH_NAME, workprefs.info, sizeof workprefs.info );
! 1174: recursive--;
! 1175: break;
! 1176: }
! 1177: return FALSE;
! 1178: }
! 1179:
1.1.1.2 root 1180: static BOOL CALLBACK LoadSaveDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
1181: {
1182: char name_buf[MAX_PATH] = "", desc_buf[128] = "";
1.1.1.4 ! root 1183: char *posn = NULL;
1.1.1.2 root 1184: HWND list;
1185: int dblclick = 0;
1186: NM_LISTVIEW *nmlistview;
1187: int items = 0, entry = 0;
1.1.1.4 ! root 1188: LPHELPINFO lpHelpInfo;
! 1189:
1.1.1.2 root 1190: switch (msg) {
1.1.1.4 ! root 1191: case WM_INITDIALOG:
1.1.1.2 root 1192: pages[LOADSAVE_ID] = hDlg;
1.1.1.4 ! root 1193: InitializeListView(hDlg);
! 1194: if( !full_property_sheet )
! 1195: {
! 1196: EnableWindow( GetDlgItem( hDlg, IDC_SAVE ), FALSE );
1.1.1.2 root 1197: }
1.1.1.4 ! root 1198: EnableWindow( GetDlgItem( hDlg, IDC_VIEWINFO ), workprefs.info[0] );
! 1199: #if 0
! 1200: if( !config_filename[0] && configname[0] )
! 1201: {
! 1202: if( posn = strrchr( configname, '\\' ) )
! 1203: strcpy( configname, ++posn );
! 1204: if( posn = strrchr( configname, '.' ) )
! 1205: *posn = '\0';
! 1206: strcpy( config_filename, configname );
! 1207: }
! 1208: #endif
! 1209: SetDlgItemText( hDlg, IDC_EDITNAME, config_filename );
! 1210: SetDlgItemText( hDlg, IDC_EDITDESCRIPTION, workprefs.description );
1.1.1.2 root 1211: return TRUE;
1.1.1.4 ! root 1212:
! 1213: case WM_USER:
1.1.1.2 root 1214: break;
1.1.1.4 ! root 1215:
! 1216: case WM_HELP:
! 1217: lpHelpInfo = (LPHELPINFO)lParam;
! 1218: break;
! 1219:
! 1220: case WM_COMMAND:
! 1221: switch (wParam)
! 1222: {
! 1223: case IDC_SAVE:
! 1224: HandleConfiguration( hDlg, CONFIG_SAVE_FULL );
! 1225: InitializeListView( hDlg );
! 1226: break;
! 1227: case IDC_QUICKSAVE:
! 1228: HandleConfiguration( hDlg, CONFIG_SAVE );
! 1229: InitializeListView( hDlg );
! 1230: break;
! 1231: case IDC_QUICKLOAD:
! 1232: HandleConfiguration( hDlg, CONFIG_LOAD );
! 1233: break;
! 1234: case IDC_LOAD:
! 1235: HandleConfiguration( hDlg, CONFIG_LOAD_FULL );
! 1236: break;
! 1237: case IDC_DELETE:
! 1238: HandleConfiguration( hDlg, CONFIG_DELETE );
! 1239: InitializeListView( hDlg );
! 1240: break;
! 1241: case IDC_VIEWINFO:
! 1242: if( workprefs.info[0] )
! 1243: {
! 1244: if( strstr( workprefs.info, "Configurations\\" ) )
! 1245: sprintf( name_buf, "%s\\%s", start_path, workprefs.info );
! 1246: else
! 1247: strcpy( name_buf, workprefs.info );
! 1248: ShellExecute( NULL, NULL, name_buf, NULL, NULL, SW_SHOWNORMAL );
! 1249: }
1.1.1.2 root 1250: break;
1.1.1.4 ! root 1251: case IDC_SETINFO:
! 1252: if( DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_SETINFO), hDlg, InfoSettingsProc ) )
! 1253: {
! 1254: EnableWindow( GetDlgItem( hDlg, IDC_VIEWINFO ), workprefs.info[0] );
! 1255: }
1.1.1.2 root 1256: break;
1257: }
1258: break;
1.1.1.4 ! root 1259:
! 1260: case WM_NOTIFY:
! 1261: if (((LPNMHDR) lParam)->idFrom == IDC_CONFIGLIST)
! 1262: {
! 1263: nmlistview = (NM_LISTVIEW *) lParam;
! 1264: list = nmlistview->hdr.hwndFrom;
! 1265:
! 1266: switch (nmlistview->hdr.code)
! 1267: {
! 1268: case NM_DBLCLK:
! 1269: dblclick = 1;
! 1270: /* fall-through */
! 1271: case NM_CLICK:
! 1272: entry = listview_entry_from_click (list);
! 1273: /* Copy the item's name and description to the gadgets at the bottom... */
! 1274: if (entry >= 0)
! 1275: {
! 1276: ListView_GetItemText (list, entry, 0, name_buf, MAX_PATH);
! 1277: ListView_GetItemText (list, entry, 1, desc_buf, 128);
! 1278: SetDlgItemText (hDlg, IDC_EDITNAME, name_buf);
! 1279: SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, desc_buf);
! 1280: ListView_RedrawItems (list, 0, items);
! 1281:
! 1282: if( dblclick )
! 1283: {
! 1284: HandleConfiguration( hDlg, CONFIG_LOAD );
! 1285: /* Copy stuff from workprefs and config_xxx settings */
! 1286: gui_to_prefs ();
! 1287: PropSheet_PressButton( hPropertySheet, PSBTN_OK );
! 1288: }
1.1.1.2 root 1289: }
1.1.1.4 ! root 1290: break;
1.1.1.2 root 1291: }
1292: }
1.1.1.4 ! root 1293: else
! 1294: {
! 1295: switch (((NMHDR *) lParam)->code)
! 1296: {
! 1297: case PSN_HELP:
! 1298: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "configurations.htm" );
! 1299: break;
! 1300: case PSN_APPLY:
! 1301: /* Copy stuff from workprefs and config_xxx settings */
! 1302: gui_to_prefs ();
! 1303: break;
! 1304:
! 1305: case PSN_RESET:
! 1306: if (allow_quit)
! 1307: {
! 1308: quit_program = 1;
! 1309: regs.spcflags |= SPCFLAG_BRK;
! 1310: }
! 1311: break;
1.1.1.2 root 1312: }
1313: }
1.1.1.4 ! root 1314: break;
1.1.1.2 root 1315: }
1.1.1.4 ! root 1316:
1.1.1.2 root 1317: return FALSE;
1318: }
1319:
1.1.1.4 ! root 1320: #define MAX_CONTRIBUTORS_LENGTH 2048
! 1321:
1.1.1.2 root 1322: static int CALLBACK ContributorsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
1323: {
1324: CHARFORMAT CharFormat;
1.1.1.4 ! root 1325: char szContributors1[ MAX_CONTRIBUTORS_LENGTH ];
! 1326: char szContributors2[ MAX_CONTRIBUTORS_LENGTH ];
! 1327: char szContributors[ MAX_CONTRIBUTORS_LENGTH*2 ];
1.1.1.2 root 1328:
1329: switch (msg) {
1330: case WM_COMMAND:
1331: if (wParam == ID_OK) {
1332: EndDialog (hDlg, 1);
1333: return TRUE;
1334: }
1335: break;
1336: case WM_INITDIALOG:
1337: CharFormat.cbSize = sizeof (CharFormat);
1338:
1.1.1.4 ! root 1339: WIN32GUI_LoadUIString( IDS_CONTRIBUTORS1, szContributors1, MAX_CONTRIBUTORS_LENGTH );
! 1340: WIN32GUI_LoadUIString( IDS_CONTRIBUTORS2, szContributors2, MAX_CONTRIBUTORS_LENGTH );
! 1341: sprintf( szContributors, "%s%s", szContributors1, szContributors2 );
1.1.1.2 root 1342:
1.1.1.4 ! root 1343: SetDlgItemText (hDlg, IDC_CONTRIBUTORS, szContributors );
1.1.1.2 root 1344: SendDlgItemMessage (hDlg, IDC_CONTRIBUTORS, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat);
1345: CharFormat.dwMask |= CFM_SIZE | CFM_FACE;
1346: CharFormat.yHeight = 10 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */
1347:
1348: strcpy (CharFormat.szFaceName, "Times New Roman");
1349: SendDlgItemMessage (hDlg, IDC_CONTRIBUTORS, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
1350: /* SendDlgItemMessage(hDlg, IDC_CONTRIBUTORS, EM_SETBKGNDCOLOR,0,GetSysColor( COLOR_3DFACE ) ); */
1351:
1352: return TRUE;
1353: }
1354: return FALSE;
1355: }
1356:
1357: static void DisplayContributors (HWND hDlg)
1358: {
1.1.1.4 ! root 1359: DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_CONTRIBUTORS), hDlg, ContributorsProc);
1.1.1.2 root 1360: }
1361:
1.1.1.4 ! root 1362: #define NUM_URLS 7
! 1363: typedef struct url_info
1.1.1.2 root 1364: {
1.1.1.4 ! root 1365: int id;
! 1366: BOOL state;
! 1367: char *display;
! 1368: char *url;
! 1369: } urlinfo;
! 1370:
! 1371: static urlinfo urls[NUM_URLS] =
! 1372: {
! 1373: {IDC_CLOANTOHOME, FALSE, "Cloanto's Amiga Forever", "http://www.cloanto.com/amiga/forever/"},
! 1374: {IDC_AMIGAHOME, FALSE, "Amiga Inc.", "http://www.amiga.com"},
! 1375: {IDC_PICASSOHOME, FALSE, "Picasso96 Home Page", "http://www.picasso96.cogito.de/"},
! 1376: {IDC_UAEHOME, FALSE, "UAE Home Page", "http://www.freiburg.linux.de/~uae/"},
! 1377: {IDC_WINUAEHOME, FALSE, "WinUAE Home Page", "http://www.CodePoet.com/UAE/"},
! 1378: {IDC_AIABHOME, FALSE, "AIAB", "http://aiab.emuunlim.com/"},
! 1379: {IDC_THEROOTS, FALSE, "Back To The Roots", "http://back2roots.emuunlim.com/"}
! 1380: };
1.1.1.2 root 1381:
1.1.1.4 ! root 1382: static void SetupRichText( HWND hDlg, urlinfo *url )
1.1.1.3 root 1383: {
1384: CHARFORMAT CharFormat;
1385: CharFormat.cbSize = sizeof (CharFormat);
1386:
1.1.1.4 ! root 1387: SetDlgItemText( hDlg, url->id, url->display );
! 1388: SendDlgItemMessage( hDlg, url->id, EM_GETCHARFORMAT, 0, (LPARAM)&CharFormat );
! 1389: CharFormat.dwMask |= CFM_UNDERLINE | CFM_SIZE | CFM_FACE | CFM_COLOR;
! 1390: CharFormat.dwEffects = url->state ? CFE_UNDERLINE : 0;
! 1391: CharFormat.yHeight = 10 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */
1.1.1.3 root 1392:
1.1.1.4 ! root 1393: CharFormat.crTextColor = GetSysColor( COLOR_ACTIVECAPTION );
! 1394: strcpy( CharFormat.szFaceName, "Tahoma" );
! 1395: SendDlgItemMessage( hDlg, url->id, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CharFormat );
! 1396: SendDlgItemMessage( hDlg, url->id, EM_SETBKGNDCOLOR, 0, GetSysColor( COLOR_3DFACE ) );
! 1397: }
! 1398:
! 1399: static void url_handler(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
! 1400: {
! 1401: static int last_rectangle = -1;
! 1402: int i;
! 1403: BOOL found = FALSE;
! 1404: HCURSOR m_hCursor = NULL;
! 1405: POINT point;
! 1406: point.x = LOWORD (lParam);
! 1407: point.y = HIWORD (lParam);
! 1408:
! 1409: for (i = 0; i < NUM_URLS; i++)
! 1410: {
! 1411: RECT rect;
! 1412: GetWindowRect( GetDlgItem( hDlg, urls[i].id), &rect );
! 1413: ScreenToClient( hDlg, (POINT *) &rect );
! 1414: ScreenToClient( hDlg, (POINT *) &(rect.right) );
! 1415: if( PtInRect( &rect, point ) )
! 1416: {
! 1417: if( msg == WM_LBUTTONDOWN )
! 1418: {
! 1419: ShellExecute (NULL, NULL, urls[i].url , NULL, NULL, SW_SHOWNORMAL);
! 1420: SetCursor( LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ) );
! 1421: }
! 1422: else
! 1423: {
! 1424: if( ( i != last_rectangle ) )
! 1425: {
! 1426: // try and load the system hand (Win2000+)
! 1427: m_hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND) );
! 1428: if (!m_hCursor)
! 1429: {
! 1430: // retry with our fallback hand
! 1431: m_hCursor = LoadCursor(hInst, MAKEINTRESOURCE(IDC_MYHAND) );
! 1432: }
! 1433: SetCursor( m_hCursor );
! 1434: urls[i].state = TRUE;
! 1435: SetupRichText( hDlg, &urls[i] );
! 1436:
! 1437: if( last_rectangle != -1 )
! 1438: {
! 1439: urls[last_rectangle].state = FALSE;
! 1440: SetupRichText( hDlg, &urls[last_rectangle] );
! 1441: }
! 1442: }
! 1443: }
! 1444: last_rectangle = i;
! 1445: found = TRUE;
! 1446: break;
! 1447: }
! 1448: }
! 1449:
! 1450: if( !found && last_rectangle >= 0 )
! 1451: {
! 1452: SetCursor( LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ) );
! 1453: urls[last_rectangle].state = FALSE;
! 1454: SetupRichText( hDlg, &urls[last_rectangle] );
! 1455: last_rectangle = -1;
! 1456: }
1.1.1.3 root 1457: }
1458:
1.1.1.2 root 1459: static void init_aboutdlg (HWND hDlg)
1460: {
1461: CHARFORMAT CharFormat;
1.1.1.4 ! root 1462: int i;
! 1463:
1.1.1.2 root 1464: CharFormat.cbSize = sizeof (CharFormat);
1465:
1.1.1.4 ! root 1466: SetDlgItemText (hDlg, IDC_RICHEDIT1, "UAE/Win32");
1.1.1.2 root 1467: SendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat);
1468: CharFormat.dwMask |= CFM_BOLD | CFM_SIZE | CFM_FACE;
1469: CharFormat.dwEffects = CFE_BOLD;
1470: CharFormat.yHeight = 18 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */
1471:
1472: strcpy (CharFormat.szFaceName, "Times New Roman");
1473: SendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
1474: SendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_SETBKGNDCOLOR, 0, GetSysColor (COLOR_3DFACE));
1475:
1.1.1.4 ! root 1476: SetDlgItemText (hDlg, IDC_RICHEDIT2, VersionStr );
1.1.1.2 root 1477: SendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat);
1478: CharFormat.dwMask |= CFM_SIZE | CFM_FACE;
1479: CharFormat.yHeight = 10 * 20;
1480: strcpy (CharFormat.szFaceName, "Times New Roman");
1481: SendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
1482: SendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_SETBKGNDCOLOR, 0, GetSysColor (COLOR_3DFACE));
1483:
1.1.1.4 ! root 1484: for( i = 0; i < NUM_URLS; i++ )
! 1485: {
! 1486: SetupRichText( hDlg, &urls[i] );
! 1487: }
1.1.1.2 root 1488: }
1489:
1490: static BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
1491: {
1.1.1.4 ! root 1492: switch( msg )
! 1493: {
! 1494: case WM_INITDIALOG:
! 1495: pages[ABOUT_ID] = hDlg;
! 1496: init_aboutdlg (hDlg);
! 1497: break;
! 1498:
! 1499: case WM_COMMAND:
! 1500: if (wParam == IDC_CONTRIBUTORS)
! 1501: {
! 1502: DisplayContributors (hDlg);
! 1503: }
! 1504: break;
! 1505: case WM_SETCURSOR:
! 1506: return TRUE;
! 1507: break;
! 1508: case WM_LBUTTONDOWN:
! 1509: case WM_MOUSEMOVE:
! 1510: url_handler( hDlg, msg, wParam, lParam );
! 1511: break;
! 1512: case WM_NOTIFY:
! 1513: switch (((NMHDR *) lParam)->code)
! 1514: {
! 1515: case PSN_APPLY:
! 1516: /* Copy stuff from workprefs and config_xxx settings */
! 1517: gui_to_prefs ();
! 1518: break;
! 1519:
! 1520: case PSN_RESET:
! 1521: if (allow_quit)
! 1522: {
! 1523: quit_program = 1;
! 1524: regs.spcflags |= SPCFLAG_BRK;
! 1525: }
! 1526: break;
1.1.1.2 root 1527: }
1528: break;
1529: }
1.1.1.4 ! root 1530:
1.1.1.2 root 1531: return FALSE;
1532: }
1533:
1534: static struct win32_displaymode *GetDisplayMode (int logical_number)
1535: {
1536: struct win32_displaymode *dm = win32_displaymode_list;
1537: while (logical_number > 0 && dm != 0)
1538: dm = dm->next, logical_number--;
1539: return dm;
1540: }
1541:
1.1.1.4 ! root 1542: static void enable_for_displaydlg (HWND hDlg)
1.1.1.2 root 1543: {
1.1.1.4 ! root 1544: if (! full_property_sheet)
! 1545: {
1.1.1.2 root 1546: /* Disable certain controls which are only to be set once at start-up... */
1.1.1.4 ! root 1547: EnableWindow (GetDlgItem (hDlg, IDC_TEST16BIT), FALSE);
1.1.1.2 root 1548: EnableWindow (GetDlgItem (hDlg, IDC_LORES), FALSE);
1549: EnableWindow (GetDlgItem (hDlg, IDC_XCENTER), FALSE);
1550: EnableWindow (GetDlgItem (hDlg, IDC_YCENTER), FALSE);
1551: EnableWindow (GetDlgItem (hDlg, IDC_ASPECT), FALSE);
1.1.1.4 ! root 1552: EnableWindow (GetDlgItem (hDlg, IDC_LM_NORMAL), FALSE);
! 1553: EnableWindow (GetDlgItem (hDlg, IDC_LM_DOUBLED), FALSE);
! 1554: EnableWindow (GetDlgItem (hDlg, IDC_LM_SCANLINES), FALSE);
1.1.1.2 root 1555: EnableWindow (GetDlgItem (hDlg, IDC_RESOLUTION), FALSE);
1556: EnableWindow (GetDlgItem (hDlg, IDC_XSIZE), FALSE);
1557: EnableWindow (GetDlgItem (hDlg, IDC_YSIZE), FALSE);
1.1.1.4 ! root 1558: }
! 1559: else
! 1560: {
! 1561: EnableWindow( GetDlgItem( hDlg, IDC_PFULLSCREEN ), ! workprefs.address_space_24);
! 1562: EnableWindow( GetDlgItem( hDlg, IDC_XSIZE ), workprefs.gfx_afullscreen ? FALSE:TRUE );
! 1563: EnableWindow( GetDlgItem( hDlg, IDC_YSIZE ), workprefs.gfx_afullscreen ? FALSE:TRUE );
! 1564: EnableWindow( GetDlgItem( hDlg, IDC_RESOLUTION ), workprefs.gfx_afullscreen ? TRUE:FALSE );
! 1565: }
! 1566: }
! 1567:
! 1568: static void enable_for_chipsetdlg (HWND hDlg)
! 1569: {
! 1570: }
! 1571:
! 1572: static void LoadNthString( DWORD value, char *nth, DWORD dwNthMax )
! 1573: {
! 1574: switch( value )
! 1575: {
! 1576: case 1:
! 1577: WIN32GUI_LoadUIString( IDS_SECOND, nth, dwNthMax );
! 1578: break;
! 1579:
! 1580: case 2:
! 1581: WIN32GUI_LoadUIString( IDS_THIRD, nth, dwNthMax );
! 1582: break;
! 1583:
! 1584: case 3:
! 1585: WIN32GUI_LoadUIString( IDS_FOURTH, nth, dwNthMax );
! 1586: break;
! 1587:
! 1588: case 4:
! 1589: WIN32GUI_LoadUIString( IDS_FIFTH, nth, dwNthMax );
! 1590: break;
! 1591:
! 1592: case 5:
! 1593: WIN32GUI_LoadUIString( IDS_SIXTH, nth, dwNthMax );
! 1594: break;
! 1595:
! 1596: case 6:
! 1597: WIN32GUI_LoadUIString( IDS_SEVENTH, nth, dwNthMax );
! 1598: break;
! 1599:
! 1600: case 7:
! 1601: WIN32GUI_LoadUIString( IDS_EIGHTH, nth, dwNthMax );
! 1602: break;
! 1603:
! 1604: case 8:
! 1605: WIN32GUI_LoadUIString( IDS_NINTH, nth, dwNthMax );
! 1606: break;
! 1607:
! 1608: case 9:
! 1609: WIN32GUI_LoadUIString( IDS_TENTH, nth, dwNthMax );
! 1610: break;
! 1611:
! 1612: default:
! 1613: strcpy( nth, "" );
1.1.1.2 root 1614: }
1615: }
1616:
1.1.1.4 ! root 1617: #define MAX_FRAMERATE_LENGTH 40
! 1618: #define MAX_NTH_LENGTH 20
! 1619:
! 1620: static void values_to_displaydlg (HWND hDlg)
1.1.1.2 root 1621: {
1.1.1.4 ! root 1622: char buffer[ MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH ];
! 1623: char Nth[ MAX_NTH_LENGTH ];
! 1624: LPSTR blah[1] = { Nth };
! 1625: LPTSTR string = NULL;
! 1626: int d,d2,index;
! 1627:
! 1628: switch( workprefs.color_mode )
! 1629: {
! 1630: case 2:
! 1631: d = 16;
! 1632: break;
! 1633: case 5:
! 1634: d = 32;
! 1635: break;
! 1636: default:
! 1637: d = 8;
! 1638: break;
! 1639: }
! 1640:
! 1641: if( workprefs.gfx_afullscreen )
! 1642: {
! 1643: d2 = d;
! 1644: if( ( index = WIN32GFX_AdjustScreenmode( &workprefs.gfx_width, &workprefs.gfx_height, &d2 ) ) >= 0 )
! 1645: {
! 1646: switch( d2 )
! 1647: {
! 1648: case 15:
! 1649: workprefs.color_mode = 1;
! 1650: d = 2;
! 1651: break;
! 1652: case 16:
! 1653: workprefs.color_mode = 2;
! 1654: d = 2;
! 1655: break;
! 1656: case 32:
! 1657: workprefs.color_mode = 5;
! 1658: d = 4;
! 1659: break;
! 1660: default:
! 1661: workprefs.color_mode = 0;
! 1662: d = 1;
! 1663: break;
! 1664: }
! 1665: }
! 1666: }
! 1667: else
! 1668: {
! 1669: d = d/8;
! 1670: }
! 1671:
! 1672: if ((index = picasso_display_mode_index (workprefs.gfx_width, workprefs.gfx_height, d)) >= 0)
! 1673: SendDlgItemMessage( hDlg, IDC_RESOLUTION, CB_SETCURSEL, index, 0 );
! 1674:
! 1675: SetDlgItemInt( hDlg, IDC_XSIZE, workprefs.gfx_width, FALSE );
! 1676: SetDlgItemInt( hDlg, IDC_YSIZE, workprefs.gfx_height, FALSE );
1.1.1.2 root 1677:
1.1.1.4 ! root 1678: SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_SETPOS, TRUE, workprefs.gfx_framerate);
1.1.1.2 root 1679:
1.1.1.4 ! root 1680: WIN32GUI_LoadUIString( IDS_FRAMERATE, buffer, MAX_FRAMERATE_LENGTH );
! 1681: LoadNthString( workprefs.gfx_framerate - 1, Nth, MAX_NTH_LENGTH );
! 1682: if( FormatMessage( FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_ALLOCATE_BUFFER,
! 1683: buffer, 0, 0, (LPTSTR)&string, MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH, (va_list *)blah ) == 0 )
! 1684: {
! 1685: DWORD dwLastError = GetLastError();
! 1686: sprintf (buffer, "Every %s Frame", nth[workprefs.gfx_framerate - 1]);
! 1687: SetDlgItemText( hDlg, IDC_RATETEXT, buffer );
! 1688: }
! 1689: else
! 1690: {
! 1691: SetDlgItemText( hDlg, IDC_RATETEXT, string );
! 1692: LocalFree( string );
! 1693: }
1.1.1.2 root 1694:
1.1.1.4 ! root 1695: CheckRadioButton( hDlg, IDC_LM_NORMAL, IDC_LM_SCANLINES, IDC_LM_NORMAL+workprefs.gfx_linedbl );
1.1.1.2 root 1696: CheckDlgButton (hDlg, IDC_AFULLSCREEN, workprefs.gfx_afullscreen);
1.1.1.4 ! root 1697: CheckDlgButton (hDlg, IDC_PFULLSCREEN, workprefs.gfx_pfullscreen);
1.1.1.2 root 1698: CheckDlgButton (hDlg, IDC_ASPECT, workprefs.gfx_correct_aspect);
1699: CheckDlgButton (hDlg, IDC_LORES, workprefs.gfx_lores);
1700:
1.1.1.4 ! root 1701: CheckDlgButton (hDlg, IDC_XCENTER, workprefs.gfx_xcenter);
! 1702: CheckDlgButton (hDlg, IDC_YCENTER, workprefs.gfx_ycenter);
1.1.1.2 root 1703: }
1704:
1705: static void init_resolution_combo (HWND hDlg)
1706: {
1.1.1.4 ! root 1707: int i;
1.1.1.2 root 1708:
1.1.1.4 ! root 1709: for( i = 0; i < picasso_nr_resolutions (); i++ )
! 1710: {
! 1711: SendDlgItemMessage( hDlg, IDC_RESOLUTION, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)DisplayModes[i].name );
1.1.1.2 root 1712: }
1713: }
1714:
1.1.1.4 ! root 1715: static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
1.1.1.2 root 1716: {
1.1.1.4 ! root 1717: BOOL success = FALSE;
! 1718:
! 1719: workprefs.gfx_pfullscreen = IsDlgButtonChecked (hDlg, IDC_PFULLSCREEN);
! 1720: workprefs.gfx_afullscreen = IsDlgButtonChecked (hDlg, IDC_AFULLSCREEN);
! 1721: EnableWindow( GetDlgItem( hDlg, IDC_RESOLUTION ), workprefs.gfx_afullscreen ? TRUE:FALSE );
! 1722:
! 1723: workprefs.gfx_lores = IsDlgButtonChecked (hDlg, IDC_LORES);
1.1.1.2 root 1724: workprefs.gfx_correct_aspect = IsDlgButtonChecked (hDlg, IDC_ASPECT);
1.1.1.4 ! root 1725: workprefs.gfx_linedbl = ( IsDlgButtonChecked( hDlg, IDC_LM_SCANLINES ) ? 2 :
! 1726: IsDlgButtonChecked( hDlg, IDC_LM_DOUBLED ) ? 1 : 0 );
1.1.1.2 root 1727:
1.1.1.4 ! root 1728: workprefs.gfx_framerate = SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_GETPOS, 0, 0);
1.1.1.2 root 1729:
1730: {
1.1.1.4 ! root 1731: char buffer[ MAX_FRAMERATE_LENGTH ];
! 1732: char Nth[ MAX_NTH_LENGTH ];
! 1733: LPSTR blah[1] = { Nth };
! 1734: LPTSTR string = NULL;
! 1735:
! 1736: WIN32GUI_LoadUIString( IDS_FRAMERATE, buffer, MAX_FRAMERATE_LENGTH );
! 1737: LoadNthString( workprefs.gfx_framerate - 1, Nth, MAX_NTH_LENGTH );
! 1738: if( FormatMessage( FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_ALLOCATE_BUFFER,
! 1739: buffer, 0, 0, (LPTSTR)&string, MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH, (va_list *)blah ) == 0 )
! 1740: {
! 1741: DWORD dwLastError = GetLastError();
! 1742: sprintf (buffer, "Every %s Frame", nth[workprefs.gfx_framerate - 1]);
! 1743: SetDlgItemText( hDlg, IDC_RATETEXT, buffer );
! 1744: }
! 1745: else
! 1746: {
! 1747: SetDlgItemText( hDlg, IDC_RATETEXT, string );
! 1748: LocalFree( string );
! 1749: }
! 1750: workprefs.gfx_width = GetDlgItemInt( hDlg, IDC_XSIZE, &success, FALSE );
! 1751: if( !success )
! 1752: workprefs.gfx_width = 800;
! 1753: workprefs.gfx_height = GetDlgItemInt( hDlg, IDC_YSIZE, &success, FALSE );
! 1754: if( !success )
! 1755: workprefs.gfx_height = 600;
1.1.1.2 root 1756: }
1.1.1.4 ! root 1757: workprefs.gfx_xcenter = (IsDlgButtonChecked (hDlg, IDC_XCENTER) ? 2 : 0 ); /* Smart centering */
! 1758: workprefs.gfx_ycenter = (IsDlgButtonChecked (hDlg, IDC_YCENTER) ? 2 : 0 ); /* Smart centering */
1.1.1.2 root 1759:
1.1.1.4 ! root 1760: if (msg == WM_COMMAND && LOWORD (wParam) == IDC_RESOLUTION && HIWORD (wParam) == CBN_SELCHANGE)
! 1761: {
! 1762: LONG posn;
! 1763: posn = SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_GETCURSEL, 0, 0);
! 1764: if (posn == CB_ERR)
! 1765: return;
! 1766: workprefs.gfx_width = DisplayModes[posn].res.width;
! 1767: workprefs.gfx_height = DisplayModes[posn].res.height;
! 1768: switch( DisplayModes[posn].depth )
! 1769: {
! 1770: case 2:
! 1771: workprefs.color_mode = 2;
! 1772: break;
! 1773: case 3:
! 1774: case 4:
! 1775: workprefs.color_mode = 5;
! 1776: break;
! 1777: default:
! 1778: workprefs.color_mode = 0;
! 1779: break;
! 1780: }
! 1781: /* Set the Int boxes */
! 1782: SetDlgItemInt( hDlg, IDC_XSIZE, workprefs.gfx_width, FALSE );
! 1783: SetDlgItemInt( hDlg, IDC_YSIZE, workprefs.gfx_height, FALSE );
1.1.1.2 root 1784: }
1785: }
1786:
1.1.1.4 ! root 1787: static BOOL CALLBACK DisplayDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
1.1.1.2 root 1788: {
1789: static int recursive = 0;
1.1.1.4 ! root 1790: HKEY hPixelFormatKey;
! 1791: RGBFTYPE colortype = RGBFB_NONE;
! 1792: DWORD dwType = REG_DWORD;
! 1793: DWORD dwDisplayInfoSize = sizeof( colortype );
! 1794:
! 1795: switch (msg)
! 1796: {
! 1797: case WM_INITDIALOG:
! 1798: pages[DISPLAY_ID] = hDlg;
1.1.1.2 root 1799: SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_SETPAGESIZE, 0, 1);
1800: SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_SETRANGE, TRUE, MAKELONG (MIN_REFRESH_RATE, MAX_REFRESH_RATE));
1.1.1.4 ! root 1801: init_resolution_combo( hDlg );
1.1.1.2 root 1802:
1.1.1.4 ! root 1803: case WM_USER:
1.1.1.2 root 1804: recursive++;
1.1.1.4 ! root 1805: values_to_displaydlg (hDlg);
! 1806: enable_for_displaydlg (hDlg);
1.1.1.2 root 1807: recursive--;
1.1.1.4 ! root 1808: break;
1.1.1.2 root 1809:
1.1.1.4 ! root 1810: case WM_HSCROLL:
! 1811: case WM_COMMAND:
1.1.1.2 root 1812: if (recursive > 0)
1813: break;
1814: recursive++;
1.1.1.4 ! root 1815: if( ( wParam == IDC_TEST16BIT ) && DirectDraw_Start() )
! 1816: {
! 1817: if( RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\CodePoet Computing\\WinUAE", 0, KEY_ALL_ACCESS, &hPixelFormatKey ) == ERROR_SUCCESS )
! 1818: {
! 1819: char szMessage[ 4096 ];
! 1820: char szTitle[ MAX_PATH ];
! 1821: WIN32GUI_LoadUIString( IDS_GFXCARDCHECK, szMessage, 4096 );
! 1822: WIN32GUI_LoadUIString( IDS_GFXCARDTITLE, szTitle, MAX_PATH );
! 1823:
! 1824: if( MessageBox( NULL, szMessage, szTitle,
! 1825: MB_YESNO | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND ) == IDYES )
! 1826: {
! 1827: colortype = WIN32GFX_FigurePixelFormats(0);
! 1828: RegSetValueEx( hPixelFormatKey, "DisplayInfo", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof( colortype ) );
! 1829: }
! 1830: RegCloseKey( hPixelFormatKey );
! 1831: }
! 1832: else
! 1833: {
! 1834: write_log( "WinUAE is missing HKEY_LOCAL_MACHINE Registry keys! These can only be created by a valid Setup program.\n" );
! 1835: }
! 1836: DirectDraw_Release();
! 1837: }
! 1838: else
! 1839: {
! 1840: values_from_displaydlg (hDlg, msg, wParam, lParam);
! 1841: enable_for_displaydlg( hDlg );
! 1842: }
1.1.1.2 root 1843: recursive--;
1844: break;
1845:
1.1.1.4 ! root 1846: case WM_NOTIFY:
! 1847: switch (((NMHDR *) lParam)->code)
! 1848: {
! 1849: case PSN_HELP:
! 1850: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "display.htm" );
1.1.1.2 root 1851: break;
1852:
1.1.1.4 ! root 1853: case PSN_APPLY:
! 1854: /* Copy stuff from workprefs and config_xxx settings */
! 1855: gui_to_prefs ();
! 1856: break;
! 1857:
! 1858: case PSN_RESET:
! 1859: if (allow_quit)
! 1860: {
1.1.1.2 root 1861: quit_program = 1;
1862: regs.spcflags |= SPCFLAG_BRK;
1863: }
1864: break;
1865: }
1.1.1.4 ! root 1866: break;
1.1.1.2 root 1867: }
1868: return FALSE;
1869: }
1870:
1.1.1.4 ! root 1871: static void values_to_chipsetdlg (HWND hDlg)
1.1.1.2 root 1872: {
1.1.1.4 ! root 1873: char buffer[ MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH ];
! 1874: char Nth[ MAX_NTH_LENGTH ];
! 1875: LPSTR blah[1] = { Nth };
! 1876: LPTSTR string = NULL;
! 1877: int d,d2,index;
! 1878:
! 1879: switch( workprefs.chipset_mask )
! 1880: {
! 1881: case 0:
! 1882: CheckRadioButton( hDlg, IDC_OCS, IDC_AGA, IDC_OCS+0 );
! 1883: break;
! 1884: case CSMASK_ECS_AGNUS:
! 1885: CheckRadioButton( hDlg, IDC_OCS, IDC_AGA, IDC_OCS+1 );
! 1886: break;
! 1887: case CSMASK_ECS_DENISE:
! 1888: CheckRadioButton( hDlg, IDC_OCS, IDC_AGA, IDC_OCS+2 );
! 1889: break;
! 1890: case CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE:
! 1891: CheckRadioButton( hDlg, IDC_OCS, IDC_AGA, IDC_OCS+3 );
! 1892: break;
! 1893: case CSMASK_AGA:
! 1894: case CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA:
! 1895: CheckRadioButton( hDlg, IDC_OCS, IDC_AGA, IDC_OCS+4 );
! 1896: break;
! 1897: }
! 1898:
! 1899: CheckDlgButton (hDlg, IDC_BLITIMM, workprefs.immediate_blits);
! 1900: CheckDlgButton (hDlg, IDC_NTSC, workprefs.ntscmode);
! 1901:
! 1902: CheckRadioButton (hDlg, IDC_COLLISION0, IDC_COLLISION3, IDC_COLLISION0 + workprefs.collision_level);
! 1903: CheckDlgButton (hDlg, IDC_FASTCOPPER, workprefs.fast_copper );
1.1.1.2 root 1904: }
1905:
1.1.1.4 ! root 1906: static void values_from_chipsetdlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
1.1.1.2 root 1907: {
1.1.1.4 ! root 1908: BOOL success = FALSE;
1.1.1.2 root 1909:
1.1.1.4 ! root 1910: workprefs.fast_copper = IsDlgButtonChecked (hDlg, IDC_FASTCOPPER);
! 1911: workprefs.immediate_blits = IsDlgButtonChecked (hDlg, IDC_BLITIMM);
! 1912: workprefs.collision_level = (IsDlgButtonChecked (hDlg, IDC_COLLISION0) ? 0
! 1913: : IsDlgButtonChecked (hDlg, IDC_COLLISION1) ? 1
! 1914: : IsDlgButtonChecked (hDlg, IDC_COLLISION2) ? 2 : 3);
! 1915: workprefs.chipset_mask = (IsDlgButtonChecked( hDlg, IDC_OCS ) ? 0
! 1916: : IsDlgButtonChecked( hDlg, IDC_ECS_AGNUS ) ? CSMASK_ECS_AGNUS
! 1917: : IsDlgButtonChecked( hDlg, IDC_ECS_DENISE ) ? CSMASK_ECS_DENISE
! 1918: : IsDlgButtonChecked( hDlg, IDC_ECS ) ? CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE
! 1919: : CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE);
! 1920: workprefs.ntscmode = (IsDlgButtonChecked (hDlg, IDC_NTSC) ? 1 : 0);
1.1.1.2 root 1921: }
1922:
1.1.1.4 ! root 1923: static BOOL CALLBACK ChipsetDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
1.1.1.2 root 1924: {
1925: static int recursive = 0;
1.1.1.4 ! root 1926: HKEY hPixelFormatKey;
! 1927: RGBFTYPE colortype = RGBFB_NONE;
! 1928: DWORD dwType = REG_DWORD;
! 1929: DWORD dwDisplayInfoSize = sizeof( colortype );
! 1930:
1.1.1.2 root 1931: switch (msg) {
1.1.1.4 ! root 1932: case WM_INITDIALOG:
! 1933: pages[CHIPSET_ID] = hDlg;
1.1.1.2 root 1934:
1.1.1.4 ! root 1935: case WM_USER:
1.1.1.2 root 1936: recursive++;
1.1.1.4 ! root 1937: values_to_chipsetdlg (hDlg);
! 1938: enable_for_chipsetdlg (hDlg);
1.1.1.2 root 1939: recursive--;
1.1.1.4 ! root 1940: break;
1.1.1.2 root 1941:
1942: case WM_HSCROLL:
1943: case WM_COMMAND:
1944: if (recursive > 0)
1945: break;
1946: recursive++;
1.1.1.4 ! root 1947: values_from_chipsetdlg (hDlg, msg, wParam, lParam);
! 1948: enable_for_chipsetdlg( hDlg );
1.1.1.2 root 1949: recursive--;
1950: break;
1951:
1952: case WM_NOTIFY:
1953: switch (((NMHDR *) lParam)->code) {
1.1.1.4 ! root 1954: case PSN_HELP:
! 1955: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "chipset.htm" );
! 1956: break;
! 1957:
! 1958: case PSN_APPLY:
! 1959: /* Copy stuff from workprefs and config_xxx settings */
! 1960: gui_to_prefs ();
1.1.1.2 root 1961: break;
1962:
1963: case PSN_RESET:
1964: if (allow_quit) {
1965: quit_program = 1;
1966: regs.spcflags |= SPCFLAG_BRK;
1967: }
1968: break;
1969: }
1.1.1.4 ! root 1970: break;
1.1.1.2 root 1971: }
1972: return FALSE;
1973: }
1974:
1.1.1.4 ! root 1975: static void enable_for_memorydlg (HWND hDlg)
1.1.1.2 root 1976: {
1977: EnableWindow (GetDlgItem (hDlg, IDC_Z3TEXT), ! workprefs.address_space_24);
1978: EnableWindow (GetDlgItem (hDlg, IDC_Z3FASTRAM), ! workprefs.address_space_24);
1979: EnableWindow (GetDlgItem (hDlg, IDC_Z3FASTMEM), ! workprefs.address_space_24);
1980: EnableWindow (GetDlgItem (hDlg, IDC_FASTMEM), workprefs.chipmem_size <= 0x200000);
1981: EnableWindow (GetDlgItem (hDlg, IDC_FASTRAM), workprefs.chipmem_size <= 0x200000);
1982: EnableWindow (GetDlgItem (hDlg, IDC_FASTTEXT), workprefs.chipmem_size <= 0x200000);
1.1.1.4 ! root 1983: EnableWindow (GetDlgItem (hDlg, IDC_GFXCARDTEXT), ! workprefs.address_space_24);
! 1984: EnableWindow (GetDlgItem (hDlg, IDC_P96RAM), ! workprefs.address_space_24);
! 1985: EnableWindow (GetDlgItem (hDlg, IDC_P96MEM), ! workprefs.address_space_24);
1.1.1.2 root 1986: }
1987:
1.1.1.4 ! root 1988: static void values_to_memorydlg (HWND hDlg)
1.1.1.2 root 1989: {
1990: uae_u32 mem_size = 0;
1991:
1992: switch (workprefs.chipmem_size) {
1993: case 0x00080000: mem_size = 0; break;
1994: case 0x00100000: mem_size = 1; break;
1995: case 0x00200000: mem_size = 2; break;
1996: case 0x00400000: mem_size = 3; break;
1997: case 0x00800000: mem_size = 4; break;
1998: }
1999: SendDlgItemMessage (hDlg, IDC_CHIPMEM, TBM_SETPOS, TRUE, mem_size);
2000: SetDlgItemText (hDlg, IDC_CHIPRAM, memsize_names[msi_chip[mem_size]]);
2001:
1.1.1.4 ! root 2002: mem_size = 0;
1.1.1.2 root 2003: switch (workprefs.fastmem_size) {
2004: case 0x00000000: mem_size = 0; break;
2005: case 0x00100000: mem_size = 1; break;
2006: case 0x00200000: mem_size = 2; break;
2007: case 0x00400000: mem_size = 3; break;
2008: case 0x00800000: mem_size = 4; break;
2009: case 0x01000000: mem_size = 5; break;
2010: }
2011: SendDlgItemMessage (hDlg, IDC_FASTMEM, TBM_SETPOS, TRUE, mem_size);
2012: SetDlgItemText (hDlg, IDC_FASTRAM, memsize_names[msi_fast[mem_size]]);
2013:
1.1.1.4 ! root 2014: mem_size = 0;
1.1.1.2 root 2015: switch (workprefs.bogomem_size) {
2016: case 0x00000000: mem_size = 0; break;
2017: case 0x00080000: mem_size = 1; break;
2018: case 0x00100000: mem_size = 2; break;
2019: }
2020: SendDlgItemMessage (hDlg, IDC_SLOWMEM, TBM_SETPOS, TRUE, mem_size);
2021: SetDlgItemText (hDlg, IDC_SLOWRAM, memsize_names[msi_bogo[mem_size]]);
2022:
1.1.1.4 ! root 2023: mem_size = 0;
1.1.1.2 root 2024: switch (workprefs.z3fastmem_size) {
1.1.1.4 ! root 2025: case 0x00000000: mem_size = 0; break; /* 0-megs */
! 2026: case 0x00100000: mem_size = 1; break; /* 1-megs */
! 2027: case 0x00200000: mem_size = 2; break; /* 2-megs */
! 2028: case 0x00400000: mem_size = 3; break; /* 4-megs */
! 2029: case 0x00800000: mem_size = 4; break; /* 8-megs */
! 2030: case 0x01000000: mem_size = 5; break; /* 16-megs */
! 2031: case 0x02000000: mem_size = 6; break; /* 32-megs */
! 2032: case 0x04000000: mem_size = 7; break; /* 64-megs */
! 2033: case 0x08000000: mem_size = 8; break; /* 128-megs */
! 2034: case 0x10000000: mem_size = 9; break; /* 256-megs */
! 2035: case 0x20000000: mem_size = 10; break; /* 512-megs */
! 2036: case 0x40000000: mem_size = 11; break; /* 1 GB-megs */
! 2037:
! 2038: }
! 2039: SendDlgItemMessage (hDlg, IDC_Z3FASTMEM, TBM_SETPOS, TRUE, mem_size);
! 2040: SetDlgItemText (hDlg, IDC_Z3FASTRAM, memsize_names[msi_z3fast[mem_size]]);
! 2041:
! 2042: mem_size = 0;
! 2043: switch (workprefs.gfxmem_size) {
1.1.1.2 root 2044: case 0x00000000: mem_size = 0; break;
2045: case 0x00100000: mem_size = 1; break;
2046: case 0x00200000: mem_size = 2; break;
2047: case 0x00400000: mem_size = 3; break;
2048: case 0x00800000: mem_size = 4; break;
1.1.1.4 ! root 2049: case 0x01000000: mem_size = 5; break;
! 2050: case 0x02000000: mem_size = 6; break;
1.1.1.2 root 2051: }
1.1.1.4 ! root 2052: SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETPOS, TRUE, mem_size);
! 2053: SetDlgItemText (hDlg, IDC_P96RAM, memsize_names[msi_gfx[mem_size]]);
1.1.1.2 root 2054: }
2055:
1.1.1.4 ! root 2056: static void fix_values_memorydlg (void)
1.1.1.2 root 2057: {
2058: if (workprefs.chipmem_size > 0x200000)
2059: workprefs.fastmem_size = 0;
2060: }
2061:
1.1.1.4 ! root 2062: static BOOL CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
1.1.1.2 root 2063: {
1.1.1.4 ! root 2064: static int recursive = 0;
! 2065: unsigned int max_z3_mem = MAX_Z3_MEM;
! 2066: MEMORYSTATUS memstats;
! 2067:
! 2068: switch (msg)
! 2069: {
! 2070: case WM_INITDIALOG:
! 2071: pages[MEMORY_ID] = hDlg;
! 2072:
! 2073: memstats.dwLength = sizeof( memstats );
! 2074: GlobalMemoryStatus( &memstats );
! 2075: while( ( memstats.dwAvailPageFile + memstats.dwAvailPhys - 32000000) < (DWORD)( 1 << (max_z3_mem + 19) ) )
! 2076: max_z3_mem--;
! 2077:
1.1.1.2 root 2078: SendDlgItemMessage (hDlg, IDC_CHIPMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_CHIP_MEM, MAX_CHIP_MEM));
2079: SendDlgItemMessage (hDlg, IDC_FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_FAST_MEM, MAX_FAST_MEM));
2080: SendDlgItemMessage (hDlg, IDC_SLOWMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_SLOW_MEM, MAX_SLOW_MEM));
1.1.1.4 ! root 2081: SendDlgItemMessage (hDlg, IDC_Z3FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_Z3_MEM, max_z3_mem));
! 2082: SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_P96_MEM, MAX_P96_MEM));
1.1.1.2 root 2083:
1.1.1.4 ! root 2084: case WM_USER:
! 2085: recursive++;
! 2086: fix_values_memorydlg ();
! 2087: values_to_memorydlg (hDlg);
! 2088: enable_for_memorydlg (hDlg);
! 2089: recursive--;
! 2090: break;
1.1.1.2 root 2091:
2092: case WM_HSCROLL:
2093: workprefs.chipmem_size = memsizes[msi_chip[SendMessage (GetDlgItem (hDlg, IDC_CHIPMEM), TBM_GETPOS, 0, 0)]];
2094: workprefs.bogomem_size = memsizes[msi_bogo[SendMessage (GetDlgItem (hDlg, IDC_SLOWMEM), TBM_GETPOS, 0, 0)]];
2095: workprefs.fastmem_size = memsizes[msi_fast[SendMessage (GetDlgItem (hDlg, IDC_FASTMEM), TBM_GETPOS, 0, 0)]];
2096: workprefs.z3fastmem_size = memsizes[msi_z3fast[SendMessage (GetDlgItem (hDlg, IDC_Z3FASTMEM), TBM_GETPOS, 0, 0)]];
1.1.1.4 ! root 2097: workprefs.gfxmem_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_P96MEM), TBM_GETPOS, 0, 0)]];
! 2098: fix_values_memorydlg();
! 2099: values_to_memorydlg(hDlg);
! 2100: enable_for_memorydlg(hDlg);
! 2101: break;
! 2102:
! 2103: case WM_COMMAND:
! 2104: if (recursive > 0)
! 2105: break;
! 2106: recursive++;
! 2107: values_to_memorydlg (hDlg);
! 2108: recursive--;
1.1.1.2 root 2109: break;
2110:
2111: case WM_NOTIFY:
1.1.1.4 ! root 2112: switch (((NMHDR *) lParam)->code)
! 2113: {
! 2114: case PSN_HELP:
! 2115: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "ram.htm" );
! 2116: break;
! 2117:
! 2118: case PSN_APPLY:
! 2119: /* Copy stuff from workprefs and config_xxx settings */
! 2120: gui_to_prefs ();
1.1.1.2 root 2121: break;
1.1.1.4 ! root 2122:
! 2123: case PSN_RESET:
! 2124: if (allow_quit)
! 2125: {
1.1.1.2 root 2126: quit_program = 1;
2127: regs.spcflags |= SPCFLAG_BRK;
2128: }
2129: break;
2130: }
2131: }
2132: return FALSE;
2133: }
2134:
1.1.1.4 ! root 2135: static void values_to_kickstartdlg (HWND hDlg)
! 2136: {
! 2137: SetDlgItemText( hDlg, IDC_ROMFILE, workprefs.romfile );
! 2138: SetDlgItemText( hDlg, IDC_KEYFILE, workprefs.keyfile );
! 2139: // Disable Expansion ROM settings for now (CD32 related)
! 2140: ShowWindow( GetDlgItem( hDlg, IDC_ROMFILE2TEXT ), SW_HIDE );
! 2141: ShowWindow( GetDlgItem( hDlg, IDC_ROMFILE2 ), SW_HIDE );
! 2142: ShowWindow( GetDlgItem( hDlg, IDC_ROMCHOOSER2 ), SW_HIDE );
! 2143: }
! 2144:
! 2145: static BOOL CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
! 2146: {
! 2147: switch( msg )
! 2148: {
! 2149: case WM_INITDIALOG:
! 2150: pages[KICKSTART_ID] = hDlg;
! 2151:
! 2152: case WM_USER:
! 2153: values_to_kickstartdlg (hDlg);
! 2154: return TRUE;
! 2155:
! 2156: case WM_COMMAND:
! 2157: switch( wParam )
! 2158: {
! 2159: case IDC_KICKCHOOSER:
! 2160: DiskSelection( hDlg, IDC_ROMFILE, 6, &workprefs );
! 2161: break;
! 2162:
! 2163: case IDC_KEYCHOOSER:
! 2164: DiskSelection( hDlg, IDC_KEYFILE, 7, &workprefs );
! 2165: break;
! 2166:
! 2167: default:
! 2168: if( SendMessage( GetDlgItem( hDlg, IDC_ROMFILE ), EM_GETMODIFY, 0, 0 ) )
! 2169: {
! 2170: GetDlgItemText( hDlg, IDC_ROMFILE, workprefs.romfile, CFG_ROM_LENGTH);
! 2171: SendMessage( GetDlgItem( hDlg, IDC_ROMFILE ), EM_SETMODIFY, 0, 0 );
! 2172: }
! 2173: if( SendMessage( GetDlgItem( hDlg, IDC_KEYFILE ), EM_GETMODIFY, 0, 0 ) )
! 2174: {
! 2175: GetDlgItemText( hDlg, IDC_KEYFILE, workprefs.keyfile, CFG_KEY_LENGTH);
! 2176: SendMessage( GetDlgItem( hDlg, IDC_ROMFILE ), EM_SETMODIFY, 0, 0 );
! 2177: }
! 2178: break;
! 2179: }
! 2180: break;
! 2181:
! 2182: case WM_NOTIFY:
! 2183: switch( ((NMHDR *) lParam)->code )
! 2184: {
! 2185: case PSN_HELP:
! 2186: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "rom.htm" );
! 2187: break;
! 2188:
! 2189: case PSN_APPLY:
! 2190: /* Copy stuff from workprefs and config_xxx settings */
! 2191: gui_to_prefs ();
! 2192: break;
! 2193:
! 2194: case PSN_RESET:
! 2195: if (allow_quit)
! 2196: {
! 2197: quit_program = 1;
! 2198: regs.spcflags |= SPCFLAG_BRK;
! 2199: }
! 2200: break;
! 2201: }
! 2202: break;
! 2203: }
! 2204: return FALSE;
! 2205: }
1.1.1.2 root 2206:
1.1.1.4 ! root 2207: static void enable_for_miscdlg (HWND hDlg)
1.1.1.2 root 2208: {
1.1.1.4 ! root 2209: if( !full_property_sheet )
! 2210: {
! 2211: EnableWindow( GetDlgItem( hDlg, IDC_JULIAN), FALSE);
! 2212: EnableWindow( GetDlgItem( hDlg, IDC_SOCKETS), FALSE);
! 2213: EnableWindow( GetDlgItem( hDlg, IDC_SHOWGUI ), FALSE );
! 2214: EnableWindow( GetDlgItem( hDlg, IDC_AUTOCONFIG ), FALSE );
! 2215: EnableWindow( GetDlgItem( hDlg, IDC_CREATELOGFILE ), FALSE );
! 2216: EnableWindow( GetDlgItem( hDlg, IDC_ILLEGAL ), FALSE );
! 2217: EnableWindow( GetDlgItem( hDlg, IDC_NOSPEED ), FALSE );
! 2218: EnableWindow( GetDlgItem( hDlg, IDC_NOSOUND ), FALSE );
! 2219: EnableWindow( GetDlgItem( hDlg, IDC_NOOVERLAY ), FALSE );
! 2220: ShowWindow( GetDlgItem( hDlg, IDC_RESETAMIGA ), SW_SHOW );
! 2221: ShowWindow( GetDlgItem( hDlg, IDC_QUITEMU ), SW_SHOW );
1.1.1.2 root 2222: }
1.1.1.4 ! root 2223: // Turn off cd.device and c2p h/w (Akiko) check-boxes for now
! 2224: ShowWindow( GetDlgItem( hDlg, IDC_AKIKOC2P ), SW_HIDE );
! 2225: ShowWindow( GetDlgItem( hDlg, IDC_CDDEVICE ), SW_HIDE );
1.1.1.2 root 2226: }
2227:
1.1.1.4 ! root 2228: static void values_to_miscdlg (HWND hDlg)
1.1.1.2 root 2229: {
1.1.1.4 ! root 2230: CheckDlgButton( hDlg, IDC_SOCKETS, workprefs.socket_emu );
! 2231: CheckDlgButton( hDlg, IDC_ILLEGAL, workprefs.illegal_mem);
1.1.1.2 root 2232: }
2233:
1.1.1.4 ! root 2234: static BOOL CALLBACK MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
1.1.1.2 root 2235: {
1.1.1.4 ! root 2236: switch (msg)
! 2237: {
! 2238: case WM_INITDIALOG:
! 2239: pages[MISC_ID] = hDlg;
1.1.1.2 root 2240:
1.1.1.4 ! root 2241: case WM_USER:
! 2242: values_to_miscdlg (hDlg);
! 2243: enable_for_miscdlg (hDlg);
1.1.1.2 root 2244: return TRUE;
2245:
1.1.1.4 ! root 2246: case WM_COMMAND:
! 2247: switch( wParam )
! 2248: {
! 2249: case IDC_DOSAVESTATE:
! 2250: DiskSelection( hDlg, wParam, 9, &workprefs );
! 2251: if( strlen( savestate_filename ) )
! 2252: {
! 2253: savestate_state = STATE_DOSAVE;
! 2254: }
! 2255: break;
! 2256: case IDC_DOLOADSTATE:
! 2257: DiskSelection( hDlg, wParam, 10, &workprefs );
! 2258: if( strlen( savestate_filename ) )
! 2259: {
! 2260: savestate_state = STATE_DORESTORE;
! 2261: }
! 2262: break;
! 2263: case IDC_RESETAMIGA:
! 2264: uae_reset();
! 2265: break;
! 2266: case IDC_QUITEMU:
! 2267: uae_quit();
! 2268: PropSheet_PressButton( hPropertySheet, PSBTN_CANCEL );
! 2269: break;
! 2270: case IDC_SOCKETS:
! 2271: workprefs.socket_emu = IsDlgButtonChecked( hDlg, IDC_SOCKETS );
! 2272: break;
! 2273: case IDC_ILLEGAL:
! 2274: workprefs.illegal_mem = IsDlgButtonChecked (hDlg, IDC_ILLEGAL);
! 2275: break;
! 2276: }
1.1.1.2 root 2277: break;
2278:
1.1.1.4 ! root 2279: case WM_NOTIFY:
! 2280: switch (((NMHDR *) lParam)->code)
! 2281: {
! 2282: case PSN_HELP:
! 2283: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "misc.htm" );
1.1.1.2 root 2284: break;
2285:
1.1.1.4 ! root 2286: case PSN_APPLY:
! 2287: /* Copy stuff from workprefs and config_xxx settings */
! 2288: gui_to_prefs ();
! 2289: break;
! 2290:
! 2291: case PSN_RESET:
! 2292: if (allow_quit)
! 2293: {
1.1.1.2 root 2294: quit_program = 1;
2295: regs.spcflags |= SPCFLAG_BRK;
2296: }
2297: break;
2298: }
1.1.1.4 ! root 2299: break;
1.1.1.2 root 2300: }
2301: return FALSE;
2302: }
2303:
1.1.1.4 ! root 2304: static int cpu_ids[] = { IDC_CPU0, IDC_CPU0, IDC_CPU1, IDC_CPU1, IDC_CPU2, IDC_CPU4, IDC_CPU3, IDC_CPU5, IDC_CPU6, IDC_CPU6 };
! 2305: static int trust_ids[] = { IDC_TRUST0, IDC_TRUST1, IDC_TRUST1, IDC_TRUST2 };
1.1.1.2 root 2306:
2307: static void enable_for_cpudlg (HWND hDlg)
2308: {
1.1.1.4 ! root 2309: /* The "compatible" checkbox is only available when CPU type is 68000 */
! 2310: EnableWindow (GetDlgItem (hDlg, IDC_COMPATIBLE), workprefs.cpu_level == 0);
! 2311:
! 2312: /* These four items only get enabled when adjustable CPU style is enabled */
1.1.1.2 root 2313: EnableWindow (GetDlgItem (hDlg, IDC_SPEED), workprefs.m68k_speed > 0);
2314: EnableWindow (GetDlgItem (hDlg, IDC_CS_CPU_TEXT), workprefs.m68k_speed > 0);
2315: EnableWindow (GetDlgItem (hDlg, IDC_CS_CHIPSET_TEXT), workprefs.m68k_speed > 0);
1.1.1.4 ! root 2316: EnableWindow (GetDlgItem (hDlg, IDC_CPUTEXT), workprefs.m68k_speed > 0 );
! 2317:
1.1.1.2 root 2318: }
2319:
2320: static void values_to_cpudlg (HWND hDlg)
2321: {
1.1.1.4 ! root 2322: SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETPOS, TRUE, workprefs.m68k_speed <= 0 ? 1 : workprefs.m68k_speed / CYCLE_UNIT );
! 2323: SetDlgItemInt( hDlg, IDC_CPUTEXT, workprefs.m68k_speed <= 0 ? 1 : workprefs.m68k_speed / CYCLE_UNIT, FALSE );
1.1.1.2 root 2324: CheckDlgButton (hDlg, IDC_COMPATIBLE, workprefs.cpu_compatible);
1.1.1.4 ! root 2325: CheckRadioButton (hDlg, IDC_CPU0, IDC_CPU6, cpu_ids[workprefs.cpu_level * 2 + !workprefs.address_space_24]);
1.1.1.2 root 2326:
2327: if (workprefs.m68k_speed == -1)
1.1.1.4 ! root 2328: CheckRadioButton( hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_HOST );
1.1.1.2 root 2329: else if (workprefs.m68k_speed == 0)
1.1.1.4 ! root 2330: CheckRadioButton( hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_68000 );
1.1.1.2 root 2331: else
1.1.1.4 ! root 2332: CheckRadioButton( hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_ADJUSTABLE );
1.1.1.2 root 2333: }
2334:
2335: static void values_from_cpudlg (HWND hDlg)
2336: {
2337: int newcpu;
1.1.1.4 ! root 2338: int newtrust;
! 2339:
1.1.1.2 root 2340: workprefs.cpu_compatible = IsDlgButtonChecked (hDlg, IDC_COMPATIBLE);
1.1.1.4 ! root 2341: workprefs.m68k_speed = IsDlgButtonChecked (hDlg, IDC_CS_HOST) ? -1
! 2342: : IsDlgButtonChecked (hDlg, IDC_CS_68000) ? 0
! 2343: : SendMessage (GetDlgItem (hDlg, IDC_SPEED), TBM_GETPOS, 0, 0) * CYCLE_UNIT;
! 2344:
1.1.1.2 root 2345: newcpu = (IsDlgButtonChecked (hDlg, IDC_CPU0) ? 0
1.1.1.4 ! root 2346: : IsDlgButtonChecked (hDlg, IDC_CPU1) ? 1
! 2347: : IsDlgButtonChecked (hDlg, IDC_CPU2) ? 2
! 2348: : IsDlgButtonChecked (hDlg, IDC_CPU3) ? 3
! 2349: : IsDlgButtonChecked (hDlg, IDC_CPU4) ? 4
! 2350: : IsDlgButtonChecked (hDlg, IDC_CPU5) ? 5 : 6);
! 2351: /* When switching away from 68000, disable 24 bit addressing. */
! 2352: switch( newcpu )
! 2353: {
! 2354: case 0: // 68000
! 2355: case 1: // 68010
! 2356: case 2: // 68EC020
! 2357: case 3: // 68EC020+FPU
1.1.1.2 root 2358: workprefs.address_space_24 = 1;
1.1.1.4 ! root 2359: workprefs.cpu_level = newcpu;
! 2360: break;
! 2361:
! 2362: case 4: // 68020
! 2363: case 5: // 68020+FPU
! 2364: case 6: // 68040
! 2365: workprefs.address_space_24 = 0;
! 2366: workprefs.cpu_level = newcpu - 2;
! 2367: break;
1.1.1.2 root 2368: }
1.1.1.4 ! root 2369: if (newcpu > 0)
! 2370: workprefs.cpu_compatible = 0;
! 2371:
! 2372: if( pages[ KICKSTART_ID ] )
! 2373: SendMessage( pages[ KICKSTART_ID ], WM_USER, 0, 0 );
! 2374: if( pages[ DISPLAY_ID ] )
! 2375: SendMessage( pages[ DISPLAY_ID ], WM_USER, 0, 0 );
! 2376: if( pages[ MEMORY_ID ] )
! 2377: SendMessage( pages[ MEMORY_ID ], WM_USER, 0, 0 );
1.1.1.2 root 2378: }
2379:
2380: static BOOL CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
2381: {
2382: static int recursive = 0;
1.1.1.4 ! root 2383:
1.1.1.2 root 2384: switch (msg) {
1.1.1.4 ! root 2385: case WM_INITDIALOG:
1.1.1.2 root 2386: pages[CPU_ID] = hDlg;
2387: SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETRANGE, TRUE, MAKELONG (MIN_M68K_PRIORITY, MAX_M68K_PRIORITY));
2388: SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETPAGESIZE, 0, 1);
2389:
1.1.1.4 ! root 2390: case WM_USER:
1.1.1.2 root 2391: recursive++;
2392: values_to_cpudlg (hDlg);
2393: enable_for_cpudlg (hDlg);
2394: recursive--;
2395: return TRUE;
2396:
1.1.1.4 ! root 2397: case WM_COMMAND:
1.1.1.2 root 2398: if (recursive > 0)
2399: break;
2400: recursive++;
2401: values_from_cpudlg (hDlg);
2402: values_to_cpudlg (hDlg);
2403: enable_for_cpudlg (hDlg);
2404: recursive--;
2405: break;
2406:
1.1.1.4 ! root 2407: case WM_HSCROLL:
! 2408: recursive++;
! 2409: values_from_cpudlg( hDlg );
! 2410: values_to_cpudlg( hDlg );
! 2411: enable_for_cpudlg( hDlg );
! 2412: recursive--;
! 2413: break;
! 2414:
! 2415: case WM_NOTIFY:
1.1.1.2 root 2416: switch (((NMHDR *) lParam)->code) {
1.1.1.4 ! root 2417: case PSN_HELP:
! 2418: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "cpu.htm" );
! 2419: break;
! 2420: case PSN_APPLY:
! 2421: /* Copy stuff from workprefs and config_xxx settings */
! 2422: gui_to_prefs ();
1.1.1.2 root 2423: break;
2424:
1.1.1.4 ! root 2425: case PSN_RESET:
1.1.1.2 root 2426: if (allow_quit) {
2427: quit_program = 1;
2428: regs.spcflags |= SPCFLAG_BRK;
2429: }
2430: break;
2431: }
2432: }
2433: return FALSE;
2434: }
2435:
1.1.1.4 ! root 2436: static BOOL sound_frequency_supported[ 4 ] = { 0, 0, 0, 0 };
! 2437:
! 2438: static void fill_sound_frequency_supported( void )
1.1.1.2 root 2439: {
1.1.1.4 ! root 2440: WAVEFORMATEX wavfmt;
! 2441: HWAVEOUT hWaveOut = NULL;
! 2442: int i = 0;
! 2443: MMRESULT result;
! 2444:
! 2445: wavfmt.cbSize = 0;
! 2446: wavfmt.wFormatTag = WAVE_FORMAT_PCM;
! 2447: wavfmt.nChannels = 2;
! 2448: wavfmt.nSamplesPerSec = 11025;
! 2449: wavfmt.wBitsPerSample = 16;
! 2450: wavfmt.nBlockAlign = 4;
! 2451: wavfmt.nAvgBytesPerSec = wavfmt.nBlockAlign * wavfmt.nSamplesPerSec;
! 2452:
! 2453: for( i = 0; i < 4; i++ )
! 2454: {
! 2455: if( i == 3 )
! 2456: wavfmt.nSamplesPerSec = 48000;
! 2457: else
! 2458: wavfmt.nSamplesPerSec = 11025 * (i+1);
! 2459: wavfmt.nAvgBytesPerSec = wavfmt.nBlockAlign * wavfmt.nSamplesPerSec;
! 2460: result = waveOutOpen( &hWaveOut, WAVE_MAPPER, &wavfmt, 0, 0, WAVE_FORMAT_QUERY );
! 2461: if( result == MMSYSERR_NOERROR )
! 2462: {
! 2463: sound_frequency_supported[i] = 1;
! 2464: }
! 2465: else
! 2466: {
! 2467: write_log( "WAVEOUT: Unsupported format of %d Hz\n", wavfmt.nSamplesPerSec );
! 2468: }
! 2469: }
! 2470: }
1.1.1.2 root 2471:
1.1.1.4 ! root 2472: static void enable_for_sounddlg (HWND hDlg)
! 2473: {
! 2474: EnableWindow( GetDlgItem( hDlg, IDC_FREQUENCY ), workprefs.produce_sound );
! 2475: EnableWindow( GetDlgItem( hDlg, IDC_11KHZ ), workprefs.produce_sound && sound_frequency_supported[0] );
! 2476: EnableWindow( GetDlgItem( hDlg, IDC_22KHZ ), workprefs.produce_sound && sound_frequency_supported[1] );
! 2477: EnableWindow( GetDlgItem( hDlg, IDC_44KHZ ), workprefs.produce_sound && sound_frequency_supported[2] );
! 2478: EnableWindow( GetDlgItem( hDlg, IDC_48KHZ ), workprefs.produce_sound && sound_frequency_supported[3] );
! 2479:
! 2480: EnableWindow( GetDlgItem( hDlg, IDC_SOUNDSIZE ), workprefs.produce_sound );
! 2481: EnableWindow( GetDlgItem( hDlg, IDC_8BIT ), workprefs.produce_sound );
! 2482: EnableWindow( GetDlgItem( hDlg, IDC_16BIT ), workprefs.produce_sound );
! 2483:
! 2484: EnableWindow( GetDlgItem( hDlg, IDC_STEREOMODE ), workprefs.produce_sound );
! 2485: EnableWindow( GetDlgItem( hDlg, IDC_STEREOMODE0 ), workprefs.produce_sound );
! 2486: EnableWindow( GetDlgItem( hDlg, IDC_STEREOMODE1 ), workprefs.produce_sound );
! 2487: EnableWindow( GetDlgItem( hDlg, IDC_STEREOMODE2 ), workprefs.produce_sound );
! 2488:
! 2489: EnableWindow( GetDlgItem( hDlg, IDC_SOUNDINTERPOLATION ), workprefs.produce_sound );
! 2490: EnableWindow( GetDlgItem( hDlg, IDC_INTERPOLATION0 ), workprefs.produce_sound );
! 2491: EnableWindow( GetDlgItem( hDlg, IDC_INTERPOLATION1 ), workprefs.produce_sound );
! 2492:
! 2493: EnableWindow( GetDlgItem( hDlg, IDC_SOUNDBUFFERMEM ), workprefs.produce_sound );
! 2494: EnableWindow( GetDlgItem( hDlg, IDC_SOUNDBUFFERRAM ), workprefs.produce_sound );
! 2495: EnableWindow( GetDlgItem( hDlg, IDC_SOUNDBUFFERTEXT ), workprefs.produce_sound );
! 2496:
! 2497: EnableWindow( GetDlgItem( hDlg, IDC_AUDIOSYNC ), workprefs.produce_sound );
! 2498: }
! 2499:
! 2500: static int exact_log2 (int v)
! 2501: {
! 2502: int l = 0;
! 2503: while ((v >>= 1) != 0)
! 2504: l++;
! 2505: return l;
1.1.1.2 root 2506: }
2507:
2508: static void values_to_sounddlg (HWND hDlg)
2509: {
2510: int which_button;
2511:
1.1.1.4 ! root 2512: if( (workprefs.sound_freq <= 11025) && sound_frequency_supported[0] )
1.1.1.2 root 2513: which_button = IDC_11KHZ;
1.1.1.4 ! root 2514: else if( (workprefs.sound_freq <= 22050) && sound_frequency_supported[1] )
1.1.1.2 root 2515: which_button = IDC_22KHZ;
1.1.1.4 ! root 2516: else if( (workprefs.sound_freq <= 44100) && sound_frequency_supported[2] )
1.1.1.2 root 2517: which_button = IDC_44KHZ;
1.1.1.4 ! root 2518: else if( sound_frequency_supported[3] )
1.1.1.2 root 2519: which_button = IDC_48KHZ;
1.1.1.4 ! root 2520: else
! 2521: which_button = IDC_22KHZ; /* default */
1.1.1.2 root 2522: CheckRadioButton (hDlg, IDC_11KHZ, IDC_48KHZ, which_button);
2523:
2524: CheckRadioButton (hDlg, IDC_8BIT, IDC_16BIT, workprefs.sound_bits == 16 ? IDC_16BIT : IDC_8BIT);
2525:
2526: switch (workprefs.produce_sound) {
2527: case 0: which_button = IDC_SOUND0; break;
2528: case 1: which_button = IDC_SOUND1; break;
2529: case 2: which_button = IDC_SOUND2; break;
2530: case 3: which_button = IDC_SOUND3; break;
2531: }
2532:
1.1.1.4 ! root 2533: CheckRadioButton( hDlg, IDC_SOUND0, IDC_SOUND3, which_button );
! 2534:
! 2535: switch (workprefs.stereo)
! 2536: {
! 2537: case 0:
! 2538: // mono
! 2539: which_button = IDC_STEREOMODE0;
! 2540: break;
! 2541: case 1:
! 2542: default:
! 2543: // stereo, but which type?
! 2544: if( workprefs.mixed_stereo )
! 2545: which_button = IDC_STEREOMODE2;
! 2546: else
! 2547: which_button = IDC_STEREOMODE1;
! 2548: break;
! 2549: }
! 2550: CheckRadioButton( hDlg, IDC_STEREOMODE0, IDC_STEREOMODE2, which_button );
1.1.1.2 root 2551:
1.1.1.4 ! root 2552: CheckRadioButton( hDlg, IDC_INTERPOLATION0, IDC_INTERPOLATION1, IDC_INTERPOLATION0 + workprefs.sound_interpol );
! 2553: SendDlgItemMessage( hDlg, IDC_SOUNDBUFFERRAM, TBM_SETPOS, TRUE, exact_log2 (currprefs.sound_maxbsiz / 256));
! 2554: SetDlgItemInt( hDlg, IDC_SOUNDBUFFERMEM, workprefs.sound_maxbsiz, FALSE );
1.1.1.2 root 2555: }
2556:
2557: static void values_from_sounddlg (HWND hDlg)
2558: {
2559: workprefs.sound_bits = IsDlgButtonChecked (hDlg, IDC_8BIT) ? 8 : 16;
2560: workprefs.sound_freq = (IsDlgButtonChecked (hDlg, IDC_11KHZ) ? 11025
2561: : IsDlgButtonChecked (hDlg, IDC_22KHZ) ? 22050
2562: : IsDlgButtonChecked (hDlg, IDC_44KHZ) ? 44100 : 48000);
2563: workprefs.produce_sound = (IsDlgButtonChecked (hDlg, IDC_SOUND0) ? 0
2564: : IsDlgButtonChecked (hDlg, IDC_SOUND1) ? 1
2565: : IsDlgButtonChecked (hDlg, IDC_SOUND2) ? 2 : 3);
1.1.1.4 ! root 2566: workprefs.mixed_stereo = 0;
! 2567: workprefs.stereo = IsDlgButtonChecked (hDlg, IDC_STEREOMODE0) ? 0 :
! 2568: IsDlgButtonChecked( hDlg, IDC_STEREOMODE1 ) ? 1 : (workprefs.mixed_stereo = 1);
! 2569:
! 2570: workprefs.sound_interpol = IsDlgButtonChecked( hDlg, IDC_INTERPOLATION0 ) ? 0 : 1;
! 2571: workprefs.sound_maxbsiz = GetDlgItemInt( hDlg, IDC_SOUNDBUFFERMEM, NULL, FALSE );
1.1.1.2 root 2572: }
2573:
2574: static BOOL CALLBACK SoundDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
2575: {
2576: static int recursive = 0;
1.1.1.4 ! root 2577:
1.1.1.2 root 2578: switch (msg) {
1.1.1.4 ! root 2579: case WM_INITDIALOG:
! 2580: fill_sound_frequency_supported();
! 2581: SendDlgItemMessage (hDlg, IDC_SOUNDBUFFERRAM, TBM_SETRANGE, TRUE, MAKELONG (MIN_SOUND_MEM, MAX_SOUND_MEM));
! 2582: SendDlgItemMessage (hDlg, IDC_SOUNDBUFFERRAM, TBM_SETPAGESIZE, 0, 1);
! 2583:
1.1.1.2 root 2584: pages[SOUND_ID] = hDlg;
2585:
1.1.1.4 ! root 2586: case WM_USER:
1.1.1.2 root 2587: recursive++;
2588: values_to_sounddlg (hDlg);
2589: enable_for_sounddlg (hDlg);
2590: recursive--;
2591: return TRUE;
2592:
1.1.1.4 ! root 2593: case WM_COMMAND:
1.1.1.2 root 2594: if (recursive > 0)
2595: break;
2596: recursive++;
2597: values_from_sounddlg (hDlg);
2598: enable_for_sounddlg (hDlg);
2599: recursive--;
2600: break;
2601:
1.1.1.4 ! root 2602: case WM_HSCROLL:
! 2603: workprefs.sound_maxbsiz = 512 << SendMessage( GetDlgItem( hDlg, IDC_SOUNDBUFFERRAM ), TBM_GETPOS, 0, 0 );
! 2604: SetDlgItemInt( hDlg, IDC_SOUNDBUFFERMEM, workprefs.sound_maxbsiz, FALSE );
! 2605: break;
! 2606:
! 2607: case WM_NOTIFY:
1.1.1.2 root 2608: switch (((NMHDR *) lParam)->code) {
1.1.1.4 ! root 2609: case PSN_HELP:
! 2610: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "sound.htm" );
1.1.1.2 root 2611: break;
1.1.1.4 ! root 2612: case PSN_APPLY:
! 2613: /* Copy stuff from workprefs and config_xxx settings */
! 2614: gui_to_prefs ();
! 2615: break;
! 2616: case PSN_RESET:
1.1.1.2 root 2617: if (allow_quit) {
2618: quit_program = 1;
2619: regs.spcflags |= SPCFLAG_BRK;
2620: }
2621: break;
2622: }
2623: break;
2624: }
2625: return FALSE;
2626: }
2627:
2628: struct fsvdlg_vals
2629: {
2630: char volume[4096];
2631: char rootdir[4096];
2632: int rw;
2633: };
2634:
2635: static struct fsvdlg_vals empty_fsvdlg = { "", "", 1 };
2636: static struct fsvdlg_vals current_fsvdlg;
2637:
2638: struct hfdlg_vals
2639: {
2640: char volumename[4096];
2641: char filename[4096];
1.1.1.4 ! root 2642: int sectors;
! 2643: int reserved;
! 2644: int surfaces;
! 2645: int cylinders;
! 2646: int blocksize;
1.1.1.2 root 2647: int rw;
2648: };
2649:
1.1.1.4 ! root 2650: static struct hfdlg_vals empty_hfdlg = { "", "", 32, 2, 1, 0, 512, 1 };
1.1.1.2 root 2651: static struct hfdlg_vals current_hfdlg;
2652:
2653: static int CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
2654: {
2655: static int recursive = 0;
2656: BROWSEINFO browse_info;
2657: char directory_path[MAX_PATH] = "";
2658: LPITEMIDLIST browse;
1.1.1.4 ! root 2659: char szTitle[ MAX_PATH ];
! 2660:
! 2661: WIN32GUI_LoadUIString( IDS_SELECTFILESYSROOT, szTitle, MAX_PATH );
1.1.1.2 root 2662:
2663: browse_info.hwndOwner = hDlg;
2664: browse_info.pidlRoot = NULL;
2665: browse_info.pszDisplayName = directory_path;
1.1.1.4 ! root 2666: browse_info.lpszTitle = "";
1.1.1.2 root 2667: browse_info.ulFlags = BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS;
2668: browse_info.lpfn = NULL;
2669: browse_info.iImage = 0;
2670:
2671: switch (msg) {
2672: case WM_INITDIALOG:
2673: recursive++;
2674: SetDlgItemText (hDlg, IDC_VOLUME_NAME, current_fsvdlg.volume);
2675: SetDlgItemText (hDlg, IDC_PATH_NAME, current_fsvdlg.rootdir);
2676: CheckDlgButton (hDlg, IDC_RW, current_fsvdlg.rw);
2677: recursive--;
2678: return TRUE;
2679:
2680: case WM_COMMAND:
2681: if (recursive)
2682: break;
2683: recursive++;
2684: if (HIWORD (wParam) == BN_CLICKED) {
2685: switch (LOWORD (wParam)) {
2686: case IDC_SELECTOR:
2687: if ((browse = SHBrowseForFolder (&browse_info)) != NULL) {
2688: SHGetPathFromIDList (browse, directory_path);
2689: SetDlgItemText (hDlg, IDC_PATH_NAME, directory_path);
2690: }
2691: break;
2692: case IDOK:
1.1.1.4 ! root 2693: if( strlen( current_fsvdlg.rootdir ) == 0 )
! 2694: {
! 2695: char szMessage[ MAX_PATH ];
! 2696: char szTitle[ MAX_PATH ];
! 2697: WIN32GUI_LoadUIString( IDS_MUSTSELECTPATH, szMessage, MAX_PATH );
! 2698: WIN32GUI_LoadUIString( IDS_SETTINGSERROR, szTitle, MAX_PATH );
! 2699:
! 2700: MessageBox( hDlg, szMessage, szTitle,
1.1.1.2 root 2701: MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
2702: break;
2703: }
1.1.1.4 ! root 2704: if( strlen( current_fsvdlg.volume ) == 0 )
! 2705: {
! 2706: char szMessage[ MAX_PATH ];
! 2707: char szTitle[ MAX_PATH ];
! 2708: WIN32GUI_LoadUIString( IDS_MUSTSELECTNAME, szMessage, MAX_PATH );
! 2709: WIN32GUI_LoadUIString( IDS_SETTINGSERROR, szTitle, MAX_PATH );
! 2710:
! 2711: MessageBox( hDlg, szMessage, szTitle,
1.1.1.2 root 2712: MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
2713: break;
2714: }
2715: EndDialog (hDlg, 1);
2716:
2717: break;
2718: case IDCANCEL:
2719: EndDialog (hDlg, 0);
2720: break;
2721: }
2722: }
2723: GetDlgItemText (hDlg, IDC_PATH_NAME, current_fsvdlg.rootdir, sizeof current_fsvdlg.rootdir);
2724: GetDlgItemText (hDlg, IDC_VOLUME_NAME, current_fsvdlg.volume, sizeof current_fsvdlg.volume);
2725: current_fsvdlg.rw = IsDlgButtonChecked (hDlg, IDC_RW);
2726: recursive--;
2727: break;
2728: }
2729: return FALSE;
2730: }
2731:
2732: static int CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
2733: {
2734: static int recursive = 0;
1.1.1.4 ! root 2735: UINT setting;
1.1.1.2 root 2736:
2737: switch (msg) {
1.1.1.4 ! root 2738: case WM_INITDIALOG:
1.1.1.2 root 2739: recursive++;
2740: SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename);
1.1.1.4 ! root 2741: SetDlgItemInt( hDlg, IDC_SECTORS, current_hfdlg.sectors, FALSE);
! 2742: SetDlgItemInt( hDlg, IDC_HEADS, current_hfdlg.surfaces, FALSE);
! 2743: SetDlgItemInt( hDlg, IDC_RESERVED, current_hfdlg.reserved, FALSE);
! 2744: SetDlgItemInt( hDlg, IDC_BLOCKSIZE, current_hfdlg.blocksize, FALSE);
1.1.1.2 root 2745: CheckDlgButton (hDlg, IDC_RW, current_hfdlg.rw);
2746: recursive--;
2747: return TRUE;
2748:
1.1.1.4 ! root 2749: case WM_COMMAND:
1.1.1.2 root 2750: if (recursive)
2751: break;
2752: recursive++;
2753:
2754: if (HIWORD (wParam) == BN_CLICKED) {
2755: switch (LOWORD (wParam)) {
1.1.1.4 ! root 2756: case IDC_CREATEHF:
1.1.1.2 root 2757: setting = CalculateHardfileSize (hDlg);
1.1.1.4 ! root 2758: if( !CreateHardFile(hDlg, setting) )
! 2759: {
! 2760: char szMessage[ MAX_PATH ];
! 2761: char szTitle[ MAX_PATH ];
! 2762: WIN32GUI_LoadUIString( IDS_FAILEDHARDFILECREATION, szMessage, MAX_PATH );
! 2763: WIN32GUI_LoadUIString( IDS_CREATIONERROR, szTitle, MAX_PATH );
! 2764:
! 2765: MessageBox( hDlg, szMessage, szTitle,
! 2766: MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
! 2767: }
1.1.1.2 root 2768: break;
1.1.1.4 ! root 2769: case IDC_SELECTOR:
! 2770: DiskSelection (hDlg, IDC_PATH_NAME, 2, &workprefs );
1.1.1.2 root 2771: break;
1.1.1.4 ! root 2772: case IDOK:
! 2773: if( strlen( current_hfdlg.filename ) == 0 )
! 2774: {
! 2775: char szMessage[ MAX_PATH ];
! 2776: char szTitle[ MAX_PATH ];
! 2777: WIN32GUI_LoadUIString( IDS_MUSTSELECTFILE, szMessage, MAX_PATH );
! 2778: WIN32GUI_LoadUIString( IDS_SETTINGSERROR, szTitle, MAX_PATH );
! 2779:
! 2780: MessageBox( hDlg, szMessage, szTitle,
1.1.1.2 root 2781: MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
2782: break;
2783: }
2784: EndDialog (hDlg, 1);
2785: break;
1.1.1.4 ! root 2786: case IDCANCEL:
1.1.1.2 root 2787: EndDialog (hDlg, 0);
2788: break;
2789: }
2790: }
2791:
2792: GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename, sizeof current_hfdlg.filename);
1.1.1.4 ! root 2793: current_hfdlg.sectors = GetDlgItemInt( hDlg, IDC_SECTORS, FALSE, FALSE );
! 2794: current_hfdlg.reserved = GetDlgItemInt( hDlg, IDC_RESERVED, FALSE, FALSE );
! 2795: current_hfdlg.surfaces = GetDlgItemInt( hDlg, IDC_HEADS, FALSE, FALSE );
! 2796: current_hfdlg.blocksize = GetDlgItemInt( hDlg, IDC_BLOCKSIZE, FALSE, FALSE );
1.1.1.2 root 2797: current_hfdlg.rw = IsDlgButtonChecked (hDlg, IDC_RW);
2798: recursive--;
2799:
2800: break;
2801: }
2802: return FALSE;
2803: }
2804:
2805: static void new_filesys (HWND hDlg)
2806: {
2807: const char *result;
2808:
1.1.1.4 ! root 2809: result = add_filesys_unit (workprefs.mountinfo, current_fsvdlg.volume,
! 2810: current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0);
1.1.1.2 root 2811: if (result)
2812: MessageBox (hDlg, result, "Bad directory",
2813: MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
2814: }
2815:
2816: static void new_hardfile (HWND hDlg)
2817: {
2818: const char *result;
2819:
1.1.1.4 ! root 2820: result = add_filesys_unit (workprefs.mountinfo, 0, current_hfdlg.filename,
! 2821: ! current_hfdlg.rw, current_hfdlg.sectors, current_hfdlg.surfaces,
! 2822: current_hfdlg.reserved, current_hfdlg.blocksize);
1.1.1.2 root 2823: if (result)
2824: MessageBox (hDlg, result, "Bad hardfile",
2825: MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
2826: }
2827:
2828: static void harddisk_remove (HWND hDlg)
2829: {
2830: int entry = listview_find_selected (GetDlgItem (hDlg, IDC_VOLUMELIST));
2831: if (entry < 0)
2832: return;
1.1.1.4 ! root 2833: kill_filesys_unit (workprefs.mountinfo, entry);
1.1.1.2 root 2834: }
2835:
2836: static void harddisk_move (HWND hDlg, int up)
2837: {
2838: int entry = listview_find_selected (GetDlgItem (hDlg, IDC_VOLUMELIST));
2839: if (entry < 0)
2840: return;
1.1.1.4 ! root 2841: move_filesys_unit (workprefs.mountinfo, entry, up ? entry - 1 : entry + 1);
1.1.1.2 root 2842: }
2843:
2844: static void harddisk_edit (HWND hDlg)
2845: {
2846: int entry = listview_find_selected (GetDlgItem (hDlg, IDC_VOLUMELIST));
1.1.1.4 ! root 2847: char *volname, *rootdir;
! 2848: int secspertrack, surfaces, cylinders, reserved, size, blocksize, readonly;
! 2849: const char *failure;
! 2850:
1.1.1.2 root 2851: if (entry < 0)
2852: return;
1.1.1.4 ! root 2853:
! 2854: failure = get_filesys_unit (workprefs.mountinfo, entry, &volname, &rootdir, &readonly,
! 2855: &secspertrack, &surfaces, &reserved, &cylinders, &size,
! 2856: &blocksize);
! 2857:
! 2858: if( is_hardfile( workprefs.mountinfo, entry ) )
! 2859: {
! 2860: current_hfdlg.sectors = secspertrack;
! 2861: current_hfdlg.surfaces = surfaces;
! 2862: current_hfdlg.reserved = reserved;
! 2863: current_hfdlg.cylinders = cylinders;
! 2864: current_hfdlg.blocksize = blocksize;
1.1.1.2 root 2865:
2866: strncpy (current_hfdlg.filename, rootdir, (sizeof current_hfdlg.filename) - 1);
2867: current_hfdlg.filename[(sizeof current_hfdlg.filename) - 1] = '\0';
1.1.1.4 ! root 2868: current_hfdlg.rw = !readonly;
! 2869: if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_HARDFILE), hDlg, HardfileSettingsProc))
! 2870: {
1.1.1.2 root 2871: const char *result;
1.1.1.4 ! root 2872: result = set_filesys_unit (workprefs.mountinfo, entry, 0, current_hfdlg.filename,
! 2873: ! current_hfdlg.rw, current_hfdlg.sectors, current_hfdlg.surfaces,
! 2874: current_hfdlg.reserved, current_hfdlg.blocksize);
1.1.1.2 root 2875: if (result)
2876: MessageBox (hDlg, result, "Bad hardfile",
1.1.1.4 ! root 2877: MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
1.1.1.2 root 2878: }
1.1.1.4 ! root 2879: }
! 2880: else /* Filesystem */
! 2881: {
1.1.1.2 root 2882: strncpy (current_fsvdlg.rootdir, rootdir, (sizeof current_fsvdlg.rootdir) - 1);
2883: current_fsvdlg.rootdir[(sizeof current_fsvdlg.rootdir) - 1] = '\0';
1.1.1.4 ! root 2884: strncpy (current_fsvdlg.volume, volname, (sizeof current_fsvdlg.volume) - 1);
1.1.1.2 root 2885: current_fsvdlg.volume[(sizeof current_fsvdlg.volume) - 1] = '\0';
1.1.1.4 ! root 2886: current_fsvdlg.rw = !readonly;
! 2887: if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_FILESYS), hDlg, VolumeSettingsProc)) {
1.1.1.2 root 2888: const char *result;
1.1.1.4 ! root 2889: result = set_filesys_unit (workprefs.mountinfo, entry, current_fsvdlg.volume,
! 2890: current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0);
1.1.1.2 root 2891: if (result)
2892: MessageBox (hDlg, result, "Bad hardfile",
1.1.1.4 ! root 2893: MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
1.1.1.2 root 2894: }
2895: }
2896: }
2897:
1.1.1.4 ! root 2898: static HWND cachedlist = NULL;
! 2899:
1.1.1.2 root 2900: static void harddiskdlg_button (HWND hDlg, int button)
2901: {
2902: switch (button) {
2903: case IDC_NEW_FS:
2904: current_fsvdlg = empty_fsvdlg;
1.1.1.4 ! root 2905: if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_FILESYS), hDlg, VolumeSettingsProc))
1.1.1.2 root 2906: new_filesys (hDlg);
2907: break;
2908:
2909: case IDC_NEW_HF:
2910: current_hfdlg = empty_hfdlg;
1.1.1.4 ! root 2911: if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_HARDFILE), hDlg, HardfileSettingsProc))
1.1.1.2 root 2912: new_hardfile (hDlg);
2913: break;
2914:
2915: case IDC_EDIT:
2916: harddisk_edit (hDlg);
2917: break;
2918:
2919: case IDC_REMOVE:
2920: harddisk_remove (hDlg);
2921: break;
2922:
2923: case IDC_UP:
2924: harddisk_move (hDlg, 1);
1.1.1.4 ! root 2925: clicked_entry--;
1.1.1.2 root 2926: break;
2927:
2928: case IDC_DOWN:
2929: harddisk_move (hDlg, 0);
1.1.1.4 ! root 2930: clicked_entry++;
1.1.1.2 root 2931: break;
1.1.1.4 ! root 2932:
! 2933: case IDC_MAPDRIVES:
! 2934: break;
1.1.1.2 root 2935: }
2936: }
2937:
2938: static void harddiskdlg_volume_notify (HWND hDlg, NM_LISTVIEW *nmlistview)
2939: {
2940: HWND list = nmlistview->hdr.hwndFrom;
2941: int dblclick = 0;
2942: int entry = 0;
2943:
2944: switch (nmlistview->hdr.code) {
2945: case NM_DBLCLK:
2946: dblclick = 1;
2947: /* fall through */
2948: case NM_CLICK:
2949: entry = listview_entry_from_click (list);
1.1.1.4 ! root 2950: if (entry >= 0)
! 2951: {
! 2952: if(dblclick)
! 2953: harddisk_edit (hDlg);
! 2954: InitializeListView( hDlg );
! 2955: clicked_entry = entry;
! 2956: cachedlist = list;
! 2957: // Hilite the current selected item
! 2958: ListView_SetItemState( cachedlist, clicked_entry, LVIS_SELECTED, LVIS_SELECTED );
1.1.1.2 root 2959: }
2960: break;
2961: }
2962: }
2963:
2964: static BOOL CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
2965: {
1.1.1.4 ! root 2966: static HICON hMoveUp = NULL, hMoveDown = NULL;
1.1.1.2 root 2967:
2968: switch (msg) {
1.1.1.4 ! root 2969: case WM_INITDIALOG:
! 2970: clicked_entry = 0;
1.1.1.2 root 2971: pages[HARDDISK_ID] = hDlg;
1.1.1.4 ! root 2972: if( !hMoveUp )
! 2973: hMoveUp = (HICON)LoadImage( hInst, MAKEINTRESOURCE( IDI_MOVE_UP ), IMAGE_ICON, 16, 16, LR_LOADMAP3DCOLORS );
! 2974: if( !hMoveDown )
! 2975: hMoveDown = (HICON)LoadImage( hInst, MAKEINTRESOURCE( IDI_MOVE_DOWN ), IMAGE_ICON, 16, 16, LR_LOADMAP3DCOLORS );
! 2976: SendMessage( GetDlgItem( hDlg, IDC_UP ), BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hMoveUp );
! 2977: SendMessage( GetDlgItem( hDlg, IDC_DOWN ), BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hMoveDown );
! 2978:
! 2979: case WM_USER:
! 2980: InitializeListView( hDlg );
1.1.1.2 root 2981: break;
1.1.1.4 ! root 2982:
! 2983: case WM_COMMAND:
1.1.1.2 root 2984: if (HIWORD (wParam) == BN_CLICKED)
1.1.1.4 ! root 2985: {
1.1.1.2 root 2986: harddiskdlg_button (hDlg, LOWORD (wParam));
1.1.1.4 ! root 2987: InitializeListView( hDlg );
1.1.1.2 root 2988:
1.1.1.4 ! root 2989: if( clicked_entry < 0 )
! 2990: clicked_entry = 0;
! 2991: if( clicked_entry >= ListView_GetItemCount( cachedlist ) )
! 2992: clicked_entry = ListView_GetItemCount( cachedlist ) - 1;
! 2993:
! 2994: if( cachedlist && clicked_entry >= 0 )
! 2995: {
! 2996: // Hilite the current selected item
! 2997: ListView_SetItemState( cachedlist, clicked_entry, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED );
! 2998: }
! 2999: }
! 3000: break;
! 3001:
! 3002: case WM_NOTIFY:
1.1.1.2 root 3003: if (((LPNMHDR) lParam)->idFrom == IDC_VOLUMELIST)
3004: harddiskdlg_volume_notify (hDlg, (NM_LISTVIEW *) lParam);
3005: else {
3006: switch (((NMHDR *) lParam)->code) {
1.1.1.4 ! root 3007: case PSN_HELP:
! 3008: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "hard-drives.htm" );
! 3009: break;
! 3010: case PSN_APPLY:
! 3011: /* Copy stuff from workprefs and config_xxx settings */
! 3012: gui_to_prefs ();
1.1.1.2 root 3013: break;
1.1.1.4 ! root 3014: case PSN_RESET:
1.1.1.2 root 3015: if (allow_quit) {
3016: quit_program = 1;
3017: regs.spcflags |= SPCFLAG_BRK;
3018: }
3019: break;
3020: }
3021: }
3022: return TRUE;
1.1.1.4 ! root 3023: default:
1.1.1.2 root 3024: return FALSE;
3025: }
1.1.1.4 ! root 3026:
1.1.1.2 root 3027: return FALSE;
3028: }
3029:
1.1.1.4 ! root 3030: static void EnableFloppyButtons( HWND hDlg, int floppies )
! 3031: {
! 3032: switch( floppies )
! 3033: {
! 3034: case 1:
! 3035: EnableWindow( GetDlgItem( hDlg, IDC_DISABLE1 ), TRUE );
! 3036: EnableWindow( GetDlgItem( hDlg, IDC_DF1TEXT ), FALSE );
! 3037: EnableWindow( GetDlgItem( hDlg, IDC_DF1 ), FALSE );
! 3038: EnableWindow( GetDlgItem( hDlg, IDC_EJECT1 ), FALSE );
! 3039:
! 3040: EnableWindow( GetDlgItem( hDlg, IDC_DISABLE2 ), FALSE );
! 3041: EnableWindow( GetDlgItem( hDlg, IDC_DF2TEXT ), FALSE );
! 3042: EnableWindow( GetDlgItem( hDlg, IDC_DF2 ), FALSE );
! 3043: EnableWindow( GetDlgItem( hDlg, IDC_EJECT2 ), FALSE );
! 3044:
! 3045: EnableWindow( GetDlgItem( hDlg, IDC_DISABLE3 ), FALSE );
! 3046: EnableWindow( GetDlgItem( hDlg, IDC_DF3TEXT ), FALSE );
! 3047: EnableWindow( GetDlgItem( hDlg, IDC_DF3 ), FALSE );
! 3048: EnableWindow( GetDlgItem( hDlg, IDC_EJECT3 ), FALSE );
! 3049:
! 3050: CheckDlgButton( hDlg, IDC_DISABLE1, BST_CHECKED );
! 3051: CheckDlgButton( hDlg, IDC_DISABLE2, BST_CHECKED );
! 3052: CheckDlgButton( hDlg, IDC_DISABLE3, BST_CHECKED );
! 3053: break;
! 3054: case 2:
! 3055: EnableWindow( GetDlgItem( hDlg, IDC_DISABLE1 ), TRUE );
! 3056: EnableWindow( GetDlgItem( hDlg, IDC_DF1TEXT ), TRUE );
! 3057: EnableWindow( GetDlgItem( hDlg, IDC_DF1 ), TRUE );
! 3058: EnableWindow( GetDlgItem( hDlg, IDC_EJECT1 ), TRUE );
! 3059:
! 3060: EnableWindow( GetDlgItem( hDlg, IDC_DISABLE2 ), TRUE );
! 3061: EnableWindow( GetDlgItem( hDlg, IDC_DF2TEXT ), FALSE );
! 3062: EnableWindow( GetDlgItem( hDlg, IDC_DF2 ), FALSE );
! 3063: EnableWindow( GetDlgItem( hDlg, IDC_EJECT2 ), FALSE );
! 3064:
! 3065: EnableWindow( GetDlgItem( hDlg, IDC_DISABLE3 ), FALSE );
! 3066: EnableWindow( GetDlgItem( hDlg, IDC_DF3TEXT ), FALSE );
! 3067: EnableWindow( GetDlgItem( hDlg, IDC_DF3 ), FALSE );
! 3068: EnableWindow( GetDlgItem( hDlg, IDC_EJECT3 ), FALSE );
! 3069:
! 3070: CheckDlgButton( hDlg, IDC_DISABLE2, BST_CHECKED );
! 3071: CheckDlgButton( hDlg, IDC_DISABLE3, BST_CHECKED );
! 3072: break;
! 3073: case 3:
! 3074: EnableWindow( GetDlgItem( hDlg, IDC_DISABLE2 ), TRUE );
! 3075: EnableWindow( GetDlgItem( hDlg, IDC_DF2TEXT ), TRUE );
! 3076: EnableWindow( GetDlgItem( hDlg, IDC_DF2 ), TRUE );
! 3077: EnableWindow( GetDlgItem( hDlg, IDC_EJECT2 ), TRUE );
! 3078:
! 3079: EnableWindow( GetDlgItem( hDlg, IDC_DISABLE3 ), TRUE );
! 3080: EnableWindow( GetDlgItem( hDlg, IDC_DF3TEXT ), FALSE );
! 3081: EnableWindow( GetDlgItem( hDlg, IDC_DF3 ), FALSE );
! 3082: EnableWindow( GetDlgItem( hDlg, IDC_EJECT3 ), FALSE );
! 3083:
! 3084: CheckDlgButton( hDlg, IDC_DISABLE3, BST_CHECKED );
! 3085: break;
! 3086: case 4:
! 3087: EnableWindow( GetDlgItem( hDlg, IDC_DISABLE3 ), TRUE );
! 3088: EnableWindow( GetDlgItem( hDlg, IDC_DF3TEXT ), TRUE );
! 3089: EnableWindow( GetDlgItem( hDlg, IDC_DF3 ), TRUE );
! 3090: EnableWindow( GetDlgItem( hDlg, IDC_EJECT3 ), TRUE );
! 3091: break;
! 3092: }
! 3093: }
! 3094:
1.1.1.2 root 3095: static BOOL CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
3096: {
3097: static int recursive = 0;
3098:
1.1.1.4 ! root 3099: switch (msg)
! 3100: {
! 3101: case WM_INITDIALOG:
1.1.1.2 root 3102: pages[FLOPPY_ID] = hDlg;
1.1.1.4 ! root 3103: EnableFloppyButtons( hDlg, workprefs.nr_floppies );
! 3104:
! 3105: case WM_USER:
1.1.1.2 root 3106: recursive++;
3107: SetDlgItemText (hDlg, IDC_DF0TEXT, workprefs.df[0]);
3108: SetDlgItemText (hDlg, IDC_DF1TEXT, workprefs.df[1]);
3109: SetDlgItemText (hDlg, IDC_DF2TEXT, workprefs.df[2]);
3110: SetDlgItemText (hDlg, IDC_DF3TEXT, workprefs.df[3]);
3111: recursive--;
3112: break;
1.1.1.4 ! root 3113:
! 3114: case WM_COMMAND:
1.1.1.2 root 3115: if (recursive > 0)
3116: break;
3117: recursive++;
1.1.1.4 ! root 3118: switch (wParam)
! 3119: {
! 3120: case IDC_DISABLE1:
! 3121: if( IsDlgButtonChecked( hDlg, IDC_DISABLE1 ) == BST_CHECKED )
! 3122: {
! 3123: EnableFloppyButtons( hDlg, 1 );
! 3124: workprefs.nr_floppies = 1;
! 3125: }
! 3126: else
! 3127: {
! 3128: EnableFloppyButtons( hDlg, 2 );
! 3129: workprefs.nr_floppies = 2;
! 3130: }
! 3131: break;
! 3132: case IDC_DISABLE2:
! 3133: if( IsDlgButtonChecked( hDlg, IDC_DISABLE2 ) == BST_CHECKED )
! 3134: {
! 3135: EnableWindow( GetDlgItem( hDlg, IDC_DISABLE3 ), FALSE );
! 3136: CheckDlgButton( hDlg, IDC_DISABLE3, BST_CHECKED );
! 3137: EnableFloppyButtons( hDlg, 2 );
! 3138: workprefs.nr_floppies = 2;
! 3139: }
! 3140: else
! 3141: {
! 3142: EnableFloppyButtons( hDlg, 3 );
! 3143: workprefs.nr_floppies = 3;
! 3144: }
! 3145: break;
! 3146: case IDC_DISABLE3:
! 3147: if( IsDlgButtonChecked( hDlg, IDC_DISABLE3 ) == BST_CHECKED )
! 3148: {
! 3149: EnableFloppyButtons( hDlg, 3 );
! 3150: workprefs.nr_floppies = 3;
! 3151: }
! 3152: else
! 3153: {
! 3154: EnableFloppyButtons( hDlg, 4 );
! 3155: workprefs.nr_floppies = 4;
! 3156: }
! 3157: break;
! 3158: case IDC_DF0:
! 3159: DiskSelection (hDlg, wParam, 0, &workprefs );
1.1.1.2 root 3160: break;
1.1.1.4 ! root 3161: case IDC_DF1:
! 3162: DiskSelection (hDlg, wParam, 0, &workprefs );
1.1.1.2 root 3163: break;
1.1.1.4 ! root 3164: case IDC_DF2:
! 3165: DiskSelection (hDlg, wParam, 0, &workprefs );
1.1.1.2 root 3166: break;
1.1.1.4 ! root 3167: case IDC_DF3:
! 3168: DiskSelection (hDlg, wParam, 0, &workprefs );
1.1.1.2 root 3169: break;
1.1.1.4 ! root 3170: case IDC_EJECT0:
! 3171: disk_eject(0);
1.1.1.2 root 3172: SetDlgItemText (hDlg, IDC_DF0TEXT, "");
1.1.1.4 ! root 3173: workprefs.df[0][0] = 0;
1.1.1.2 root 3174: break;
1.1.1.4 ! root 3175: case IDC_EJECT1:
! 3176: disk_eject(1);
1.1.1.2 root 3177: SetDlgItemText (hDlg, IDC_DF1TEXT, "");
1.1.1.4 ! root 3178: workprefs.df[1][0] = 0;
1.1.1.2 root 3179: break;
1.1.1.4 ! root 3180: case IDC_EJECT2:
! 3181: disk_eject(2);
1.1.1.2 root 3182: SetDlgItemText (hDlg, IDC_DF2TEXT, "");
1.1.1.4 ! root 3183: workprefs.df[2][0] = 0;
1.1.1.2 root 3184: break;
1.1.1.4 ! root 3185: case IDC_EJECT3:
! 3186: disk_eject(3);
1.1.1.2 root 3187: SetDlgItemText (hDlg, IDC_DF3TEXT, "");
1.1.1.4 ! root 3188: workprefs.df[3][0] = 0;
1.1.1.2 root 3189: break;
1.1.1.4 ! root 3190: case IDC_CREATE:
! 3191: DiskSelection (hDlg, wParam, 1, &workprefs );
1.1.1.2 root 3192: break;
1.1.1.4 ! root 3193: case IDC_CREATE_RAW:
! 3194: DiskSelection( hDlg, wParam, 1, &workprefs );
! 3195: break;
! 3196: }
! 3197: if( SendMessage( GetDlgItem( hDlg, IDC_DF0TEXT ), EM_GETMODIFY, 0, 0 ) )
! 3198: {
! 3199: GetDlgItemText (hDlg, IDC_DF0TEXT, workprefs.df[0], 255);
! 3200: SendMessage( GetDlgItem( hDlg, IDC_DF0TEXT ), EM_SETMODIFY, 0, 0 );
! 3201: }
! 3202:
! 3203: if( SendMessage( GetDlgItem( hDlg, IDC_DF1TEXT ), EM_GETMODIFY, 0, 0 ) )
! 3204: {
! 3205: GetDlgItemText (hDlg, IDC_DF1TEXT, workprefs.df[1], 255);
! 3206: SendMessage( GetDlgItem( hDlg, IDC_DF1TEXT ), EM_SETMODIFY, 0, 0 );
! 3207: }
! 3208:
! 3209: if( SendMessage( GetDlgItem( hDlg, IDC_DF2TEXT ), EM_GETMODIFY, 0, 0 ) )
! 3210: {
! 3211: GetDlgItemText (hDlg, IDC_DF2TEXT, workprefs.df[2], 255);
! 3212: SendMessage( GetDlgItem( hDlg, IDC_DF2TEXT ), EM_SETMODIFY, 0, 0 );
! 3213: }
! 3214:
! 3215: if( SendMessage( GetDlgItem( hDlg, IDC_DF3TEXT ), EM_GETMODIFY, 0, 0 ) )
! 3216: {
! 3217: GetDlgItemText (hDlg, IDC_DF3TEXT, workprefs.df[3], 255);
! 3218: SendMessage( GetDlgItem( hDlg, IDC_DF3TEXT ), EM_SETMODIFY, 0, 0 );
1.1.1.2 root 3219: }
3220: recursive--;
3221: break;
3222:
1.1.1.4 ! root 3223: case WM_NOTIFY:
! 3224: switch (((NMHDR *) lParam)->code)
! 3225: {
! 3226: case PSN_HELP:
! 3227: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "floppies.htm" );
! 3228: break;
! 3229: case PSN_APPLY:
! 3230: /* Copy stuff from workprefs and config_xxx settings */
! 3231: gui_to_prefs ();
1.1.1.2 root 3232: break;
1.1.1.4 ! root 3233: case PSN_RESET:
1.1.1.2 root 3234: if (allow_quit) {
3235: quit_program = 1;
3236: regs.spcflags |= SPCFLAG_BRK;
3237: }
3238: break;
3239: }
3240: return TRUE;
1.1.1.4 ! root 3241: default:
1.1.1.2 root 3242: return FALSE;
3243: }
3244:
3245: return FALSE;
3246: }
3247:
1.1.1.4 ! root 3248: PRINTER_INFO_1 *pInfo = NULL;
! 3249: DWORD dwEnumeratedPrinters = 0;
! 3250:
! 3251: static int joy0idc[] = {
! 3252: IDC_PORT0_JOY0, IDC_PORT0_JOY1, IDC_PORT0_MOUSE, IDC_PORT0_KBDA, IDC_PORT0_KBDB, IDC_PORT0_KBDC
! 3253: };
! 3254:
! 3255: static int joy1idc[] = {
! 3256: IDC_PORT1_JOY0, IDC_PORT1_JOY1, IDC_PORT1_MOUSE, IDC_PORT1_KBDA, IDC_PORT1_KBDB, IDC_PORT1_KBDC
! 3257: };
! 3258:
! 3259: static BOOL bNoMidiIn = FALSE;
! 3260:
! 3261: static void enable_for_portsdlg( HWND hDlg )
! 3262: {
! 3263: int i;
! 3264: if (! full_property_sheet)
! 3265: {
! 3266: /* Disable certain controls which are only to be set once at start-up... */
! 3267: EnableWindow( GetDlgItem( hDlg, IDC_SERIAL ), FALSE );
! 3268: EnableWindow( GetDlgItem( hDlg, IDC_PARALLEL ), FALSE );
! 3269: EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), FALSE );
! 3270: EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), FALSE );
! 3271: EnableWindow( GetDlgItem( hDlg, IDC_SHARED ), FALSE );
! 3272: }
! 3273: for( i = 0; i < 6; i++ )
! 3274: {
! 3275: EnableWindow( GetDlgItem( hDlg, joy0idc[i] ), TRUE );
! 3276: EnableWindow( GetDlgItem( hDlg, joy1idc[i] ), TRUE );
! 3277: }
! 3278: }
! 3279:
! 3280: static void UpdatePortRadioButtons( HWND hDlg )
! 3281: {
! 3282: int which_button1, which_button2;
! 3283:
! 3284: enable_for_portsdlg( hDlg );
! 3285: which_button1 = joy0idc[workprefs.jport0];
! 3286: if (CheckRadioButton (hDlg, IDC_PORT0_JOY0, IDC_PORT0_KBDC, which_button1) == 0)
! 3287: which_button1 = 0;
! 3288: else
! 3289: {
! 3290: EnableWindow( GetDlgItem( hDlg, joy1idc[workprefs.jport0] ), FALSE );
! 3291: }
! 3292: which_button2 = joy1idc[workprefs.jport1];
! 3293: if( workprefs.jport1 == workprefs.jport0 )
! 3294: {
! 3295: if( which_button2 == IDC_PORT1_KBDC )
! 3296: which_button2 = IDC_PORT1_KBDB;
! 3297: else
! 3298: which_button2++;
! 3299: }
! 3300: if (CheckRadioButton (hDlg, IDC_PORT1_JOY0, IDC_PORT1_KBDC, which_button2) == 0)
! 3301: which_button2 = 0;
! 3302: else
! 3303: {
! 3304: EnableWindow( GetDlgItem( hDlg, joy0idc[ workprefs.jport1 ] ), FALSE );
! 3305: }
! 3306: }
! 3307:
1.1.1.2 root 3308: static void values_from_portsdlg (HWND hDlg)
3309: {
3310: int item;
1.1.1.4 ! root 3311: /* 0 - joystick 0
! 3312: * 1 - joystick 1
! 3313: * 2 - mouse
! 3314: * 3 - numpad
! 3315: * 4 - cursor keys
! 3316: * 5 - elsewhere
! 3317: */
1.1.1.2 root 3318: if (IsDlgButtonChecked (hDlg, IDC_PORT0_JOY0)) {
1.1.1.4 ! root 3319: workprefs.jport0 = 0;
1.1.1.2 root 3320: }
3321: if (IsDlgButtonChecked (hDlg, IDC_PORT0_JOY1)) {
1.1.1.4 ! root 3322: workprefs.jport0 = 1;
1.1.1.2 root 3323: }
3324: if (IsDlgButtonChecked (hDlg, IDC_PORT0_MOUSE))
1.1.1.4 ! root 3325: workprefs.jport0 = 2;
1.1.1.2 root 3326: if (IsDlgButtonChecked (hDlg, IDC_PORT0_KBDA))
1.1.1.4 ! root 3327: workprefs.jport0 = 3;
1.1.1.2 root 3328: if (IsDlgButtonChecked (hDlg, IDC_PORT0_KBDB))
1.1.1.4 ! root 3329: workprefs.jport0 = 4;
1.1.1.2 root 3330: if (IsDlgButtonChecked (hDlg, IDC_PORT0_KBDC))
1.1.1.4 ! root 3331: workprefs.jport0 = 5;
1.1.1.2 root 3332:
3333: if (IsDlgButtonChecked (hDlg, IDC_PORT1_JOY0)) {
1.1.1.4 ! root 3334: workprefs.jport1 = 0;
1.1.1.2 root 3335: }
3336: if (IsDlgButtonChecked (hDlg, IDC_PORT1_JOY1)) {
1.1.1.4 ! root 3337: workprefs.jport1 = 1;
1.1.1.2 root 3338: }
3339: if (IsDlgButtonChecked (hDlg, IDC_PORT1_MOUSE))
1.1.1.4 ! root 3340: workprefs.jport1 = 2;
1.1.1.2 root 3341: if (IsDlgButtonChecked (hDlg, IDC_PORT1_KBDA))
1.1.1.4 ! root 3342: workprefs.jport1 = 3;
1.1.1.2 root 3343: if (IsDlgButtonChecked (hDlg, IDC_PORT1_KBDB))
1.1.1.4 ! root 3344: workprefs.jport1 = 4;
1.1.1.2 root 3345: if (IsDlgButtonChecked (hDlg, IDC_PORT1_KBDC))
1.1.1.4 ! root 3346: workprefs.jport1 = 5;
1.1.1.2 root 3347:
1.1.1.4 ! root 3348: item = SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_GETCURSEL, 0, 0L );
! 3349: if( item != CB_ERR )
! 3350: {
! 3351: if( item )
! 3352: strcpy( workprefs.prtname, pInfo[item-1].pName );
! 3353: else
! 3354: strcpy( workprefs.prtname, "" );
! 3355: }
1.1.1.2 root 3356:
3357: item = SendDlgItemMessage (hDlg, IDC_SERIAL, CB_GETCURSEL, 0, 0L);
1.1.1.4 ! root 3358: switch( item )
! 3359: {
! 3360: case 1:
! 3361: case 2:
! 3362: case 3:
! 3363: case 4:
! 3364: case 5:
! 3365: case 6:
! 3366: case 7:
! 3367: case 8:
! 3368: workprefs.use_serial = 1;
! 3369: sprintf( workprefs.sername, "COM%d", item );
! 3370: EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), TRUE );
! 3371: EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), TRUE );
! 3372: break;
! 3373:
! 3374: default:
! 3375: workprefs.use_serial = 0;
! 3376: strcpy( workprefs.sername, "none" );
! 3377: EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), FALSE );
! 3378: EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), FALSE );
1.1.1.2 root 3379: break;
3380: }
1.1.1.4 ! root 3381: if( IsDlgButtonChecked( hDlg, IDC_SHARED ) )
! 3382: workprefs.serial_demand = 1;
! 3383: else
! 3384: workprefs.serial_demand = 0;
1.1.1.2 root 3385: }
3386:
3387: static void values_to_portsdlg (HWND hDlg)
3388: {
1.1.1.4 ! root 3389: LONG item_height, result = 0;
1.1.1.2 root 3390: RECT rect;
3391:
1.1.1.4 ! root 3392: if( *workprefs.prtname )
! 3393: {
! 3394: result = SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_FINDSTRINGEXACT, -1, (LPARAM)workprefs.prtname );
! 3395: if( result < 0 )
! 3396: {
! 3397: // Warn the user that their printer-port selection is not valid on this machine
! 3398: char szMessage[ MAX_PATH ];
! 3399: WIN32GUI_LoadUIString( IDS_INVALIDPRTPORT, szMessage, MAX_PATH );
! 3400: gui_message( szMessage );
! 3401:
! 3402: // Disable the invalid parallel-port selection
! 3403: strcpy( workprefs.prtname, "none" );
! 3404:
! 3405: result = 0;
! 3406: }
! 3407: }
! 3408: SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_SETCURSEL, result, 0 );
! 3409:
! 3410: CheckDlgButton( hDlg, IDC_SHARED, workprefs.serial_demand );
! 3411:
! 3412: if( strcasecmp( workprefs.sername, szNone ) == 0 )
! 3413: {
1.1.1.2 root 3414: SendDlgItemMessage (hDlg, IDC_SERIAL, CB_SETCURSEL, 0, 0L);
1.1.1.4 ! root 3415: workprefs.use_serial = 0;
! 3416: }
! 3417: else
! 3418: {
! 3419: result = SendDlgItemMessage( hDlg, IDC_SERIAL, CB_SETCURSEL, workprefs.sername[3] - '0', 0L );
! 3420: if( result < 0 )
! 3421: {
! 3422: // Warn the user that their COM-port selection is not valid on this machine
! 3423: char szMessage[ MAX_PATH ];
! 3424: WIN32GUI_LoadUIString( IDS_INVALIDCOMPORT, szMessage, MAX_PATH );
! 3425: gui_message( szMessage );
! 3426:
! 3427: // Select "none" as the COM-port
! 3428: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_SETCURSEL, 0L, 0L );
! 3429:
! 3430: // Disable the chosen serial-port selection
! 3431: strcpy( workprefs.sername, "none" );
! 3432: workprefs.use_serial = 0;
! 3433: }
! 3434: else
! 3435: {
! 3436: workprefs.use_serial = 1;
1.1.1.2 root 3437: }
3438: }
3439:
1.1.1.4 ! root 3440: if( workprefs.use_serial )
! 3441: {
! 3442: EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), TRUE );
! 3443: if( !bNoMidiIn )
! 3444: EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), TRUE );
! 3445: }
! 3446: else
! 3447: {
! 3448: EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), FALSE );
! 3449: EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), FALSE );
! 3450: }
1.1.1.2 root 3451: /* Retrieve the height, in pixels, of a list item. */
3452: item_height = SendDlgItemMessage (hDlg, IDC_SERIAL, CB_GETITEMHEIGHT, 0, 0L);
3453: if (item_height != CB_ERR) {
3454: /* Get actual box position and size. */
3455: GetWindowRect (GetDlgItem (hDlg, IDC_SERIAL), &rect);
3456: rect.bottom = (rect.top + item_height * 5
1.1.1.4 ! root 3457: + SendDlgItemMessage (hDlg, IDC_SERIAL, CB_GETITEMHEIGHT, (WPARAM) - 1, 0L)
! 3458: + item_height);
1.1.1.2 root 3459: SetWindowPos (GetDlgItem (hDlg, IDC_SERIAL), 0, 0, 0, rect.right - rect.left,
1.1.1.4 ! root 3460: rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER);
! 3461: }
! 3462: }
! 3463:
! 3464: #define MAX_PRINTERS 10
! 3465:
! 3466: static void init_portsdlg( HWND hDlg )
! 3467: {
! 3468: int port, numdevs;
! 3469: char comport[5];
! 3470: COMMCONFIG cc;
! 3471: DWORD size = sizeof(COMMCONFIG);
! 3472:
! 3473: MIDIOUTCAPS midiOutCaps;
! 3474: MIDIINCAPS midiInCaps;
! 3475:
! 3476: DWORD cbNeeded = 0;
! 3477:
! 3478: SendDlgItemMessage (hDlg, IDC_SERIAL, CB_RESETCONTENT, 0, 0L);
! 3479: SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)szNone );
! 3480: for( port = 0; port < 8; port++ )
! 3481: {
! 3482: sprintf( comport, "COM%d", port );
! 3483: if( GetDefaultCommConfig( comport, &cc, &size ) )
! 3484: {
! 3485: SendDlgItemMessage( hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comport );
! 3486: }
! 3487: }
! 3488:
! 3489: SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_RESETCONTENT, 0, 0L);
! 3490: SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)szNone );
! 3491: if( !pInfo )
! 3492: {
! 3493: if( !EnumPrinters( PRINTER_ENUM_LOCAL, NULL, 1, (LPBYTE)pInfo, 0, &cbNeeded, &dwEnumeratedPrinters ) )
! 3494: {
! 3495: if( cbNeeded )
! 3496: {
! 3497: pInfo = calloc( 1, cbNeeded );
! 3498: if( EnumPrinters( PRINTER_ENUM_LOCAL, NULL, 1, (LPBYTE)pInfo, cbNeeded, &cbNeeded, &dwEnumeratedPrinters ) )
! 3499: {
! 3500: for( port = 0; port < dwEnumeratedPrinters; port++ )
! 3501: {
! 3502: SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)pInfo[port].pName );
! 3503: }
! 3504: }
! 3505: }
! 3506: else
! 3507: {
! 3508: EnableWindow( GetDlgItem( hDlg, IDC_PRINTERLIST ), FALSE );
! 3509: }
! 3510: }
! 3511: }
! 3512:
! 3513: if( ( numdevs = midiOutGetNumDevs() ) == 0 )
! 3514: {
! 3515: EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), FALSE );
! 3516: }
! 3517: else
! 3518: {
! 3519: char szMidiOut[ MAX_PATH ];
! 3520: WIN32GUI_LoadUIString( IDS_DEFAULTMIDIOUT, szMidiOut, MAX_PATH );
! 3521: SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_RESETCONTENT, 0, 0L );
! 3522: SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut );
! 3523:
! 3524: for( port = 0; port < numdevs; port++ )
! 3525: {
! 3526: if( midiOutGetDevCaps( port, &midiOutCaps, sizeof( midiOutCaps ) ) == MMSYSERR_NOERROR )
! 3527: {
! 3528: SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname );
! 3529: }
! 3530: }
! 3531: }
! 3532:
! 3533: if( ( numdevs = midiInGetNumDevs() ) == 0 )
! 3534: {
! 3535: EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), FALSE );
! 3536: bNoMidiIn = TRUE;
! 3537: }
! 3538: else
! 3539: {
! 3540: SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_RESETCONTENT, 0, 0L );
! 3541:
! 3542: for( port = 0; port < numdevs; port++ )
! 3543: {
! 3544: if( midiInGetDevCaps( port, &midiInCaps, sizeof( midiInCaps ) ) == MMSYSERR_NOERROR )
! 3545: {
! 3546: SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiInCaps.szPname );
! 3547: }
! 3548: }
1.1.1.2 root 3549: }
3550: }
3551:
3552: /* Handle messages for the Joystick Settings page of our property-sheet */
3553: static BOOL CALLBACK PortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
3554: {
3555: static int recursive = 0;
1.1.1.4 ! root 3556: int temp;
1.1.1.2 root 3557:
1.1.1.4 ! root 3558: switch (msg)
! 3559: {
! 3560: case WM_INITDIALOG:
1.1.1.2 root 3561: pages[PORTS_ID] = hDlg;
1.1.1.4 ! root 3562: init_portsdlg( hDlg );
! 3563:
! 3564: case WM_USER:
1.1.1.2 root 3565: recursive++;
1.1.1.4 ! root 3566: enable_for_portsdlg( hDlg );
1.1.1.2 root 3567: values_to_portsdlg (hDlg);
1.1.1.4 ! root 3568: UpdatePortRadioButtons( hDlg );
1.1.1.2 root 3569: recursive--;
3570: return TRUE;
3571:
1.1.1.4 ! root 3572: case WM_COMMAND:
! 3573: if( wParam == IDC_SWAP )
! 3574: {
! 3575: temp = workprefs.jport0;
! 3576: workprefs.jport0 = workprefs.jport1;
! 3577: workprefs.jport1 = temp;
! 3578: UpdatePortRadioButtons( hDlg );
! 3579: }
! 3580: else
! 3581: {
! 3582: if (recursive > 0)
! 3583: break;
! 3584: recursive++;
! 3585: values_from_portsdlg (hDlg);
! 3586: UpdatePortRadioButtons( hDlg );
! 3587: recursive--;
! 3588: }
1.1.1.2 root 3589: break;
3590:
1.1.1.4 ! root 3591: case WM_NOTIFY:
! 3592: switch (((NMHDR *) lParam)->code)
! 3593: {
! 3594: case PSN_HELP:
! 3595: HtmlHelp( NULL, help_file, HH_DISPLAY_TOPIC, "ports.htm" );
! 3596: break;
! 3597: case PSN_APPLY:
! 3598: /* Copy stuff from workprefs and config_xxx settings */
! 3599: gui_to_prefs ();
1.1.1.2 root 3600: break;
1.1.1.4 ! root 3601: case PSN_RESET:
1.1.1.2 root 3602: if (allow_quit) {
3603: quit_program = 1;
3604: regs.spcflags |= SPCFLAG_BRK;
3605: }
3606: break;
3607: }
3608: return FALSE;
3609: }
3610: return FALSE;
3611: }
3612:
3613: static void CALLBACK InitPropertySheet (HWND hDlg, UINT msg, LPARAM lParam)
3614: {
3615: int i;
1.1.1.4 ! root 3616: hPropertySheet = hDlg;
1.1.1.2 root 3617:
1.1.1.4 ! root 3618: switch (msg)
! 3619: {
! 3620: case PSCB_INITIALIZED:
! 3621: if (! full_property_sheet) {
! 3622: /* This shouldn't be necessary. */
! 3623: PropSheet_RemovePage( hDlg, 0, NULL ); /* Remove LoadSave */
! 3624: } else {
! 3625: for (i = 0; i < C_PAGES; i++)
! 3626: pages[i] = NULL;
! 3627: }
! 3628: break;
1.1.1.2 root 3629: }
3630: }
3631:
3632: static void init_page (PROPSHEETPAGE *ppage, int id, int tmpl, int icon, int title,
1.1.1.4 ! root 3633: BOOL (CALLBACK FAR *func) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam))
1.1.1.2 root 3634: {
3635: ppage[id].dwSize = sizeof (PROPSHEETPAGE);
1.1.1.4 ! root 3636: ppage[id].dwFlags = PSP_USETITLE | PSP_USEICONID | ((id != ABOUT_ID ) ? PSP_HASHELP : 0);
! 3637: ppage[id].pszTemplate = MAKEINTRESOURCE (tmpl);
! 3638: ppage[id].hInstance = hUIDLL ? hUIDLL : hInst;
! 3639: ppage[id].pszIcon = MAKEINTRESOURCE (icon);
! 3640:
! 3641: if( hUIDLL )
! 3642: {
! 3643: LPTSTR lpstrTitle = calloc( 1, MAX_PATH );
! 3644: LoadString( hUIDLL, title, lpstrTitle, MAX_PATH );
! 3645: ppage[id].pszTitle = lpstrTitle;
! 3646: }
! 3647: else
! 3648: {
! 3649: ppage[id].pszTitle = MAKEINTRESOURCE (title);
! 3650: }
! 3651: ppage[id].pfnDlgProc = func;
1.1.1.2 root 3652: ppage[id].lParam = 0;
3653: ppage[id].pfnCallback = NULL;
3654: ppage[id].pcRefParent = NULL;
3655: }
3656:
3657: int GetSettings (int all_options)
3658: {
1.1.1.4 ! root 3659: static int init_called = 0;
1.1.1.2 root 3660: int psresult;
1.1.1.4 ! root 3661: static PROPSHEETPAGE ppage[C_PAGES];
1.1.1.2 root 3662: PROPSHEETHEADER pHeader;
3663:
3664: full_property_sheet = all_options;
1.1.1.4 ! root 3665: allow_quit = all_options;
1.1.1.2 root 3666: pguiprefs = all_options ? &currprefs : &changed_prefs;
1.1.1.4 ! root 3667: default_prefs( &workprefs );
! 3668:
! 3669: WIN32GUI_LoadUIString( IDS_NONE, szNone, MAX_PATH );
! 3670:
! 3671: prefs_to_gui (&changed_prefs);
! 3672:
! 3673: if( !init_called )
! 3674: {
! 3675: init_page (ppage, LOADSAVE_ID, IDD_LOADSAVE, IDI_LOADSAVE, IDS_LOADSAVE, LoadSaveDlgProc);
! 3676: init_page (ppage, MEMORY_ID, IDD_MEMORY, IDI_MEMORY, IDS_MEMORY, MemoryDlgProc);
! 3677: init_page (ppage, KICKSTART_ID, IDD_KICKSTART, IDI_MEMORY, IDS_KICKSTART, KickstartDlgProc);
! 3678: init_page (ppage, CPU_ID, IDD_CPU, IDI_CPU, IDS_CPU, CPUDlgProc);
! 3679: init_page (ppage, DISPLAY_ID, IDD_DISPLAY, IDI_DISPLAY, IDS_DISPLAY, DisplayDlgProc);
! 3680: init_page (ppage, CHIPSET_ID, IDD_CHIPSET, IDI_DISPLAY, IDS_CHIPSET, ChipsetDlgProc);
! 3681: init_page (ppage, SOUND_ID, IDD_SOUND, IDI_SOUND, IDS_SOUND, SoundDlgProc);
! 3682: init_page (ppage, FLOPPY_ID, IDD_FLOPPY, IDI_FLOPPY, IDS_FLOPPY, FloppyDlgProc);
! 3683: init_page (ppage, HARDDISK_ID, IDD_HARDDISK, IDI_HARDDISK, IDS_HARDDISK, HarddiskDlgProc);
! 3684: init_page (ppage, PORTS_ID, IDD_PORTS, IDI_PORTS, IDS_PORTS, PortsDlgProc);
! 3685: init_page (ppage, MISC_ID, IDD_MISC, IDI_MISC, IDS_MISC, MiscDlgProc);
! 3686: init_page (ppage, ABOUT_ID, IDD_ABOUT, IDI_ABOUT, IDS_ABOUT, AboutDlgProc);
! 3687:
! 3688: init_called = 1;
! 3689: }
1.1.1.2 root 3690:
3691: pHeader.dwSize = sizeof (PROPSHEETHEADER);
1.1.1.4 ! root 3692: pHeader.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK | PSH_NOAPPLYNOW | PSH_HASHELP;
1.1.1.2 root 3693: if (! all_options && workprefs.gfx_afullscreen && workprefs.gfx_width < 640)
3694: pHeader.hwndParent = NULL;
3695: else
3696: pHeader.hwndParent = hAmigaWnd;
3697: pHeader.hInstance = hInst;
1.1.1.4 ! root 3698: pHeader.pszIcon = MAKEINTRESOURCE (IDI_APPICON);
! 3699: pHeader.pszCaption = "UAE/Win32";
1.1.1.2 root 3700: pHeader.nPages = C_PAGES;
1.1.1.4 ! root 3701: pHeader.nStartPage = 0;
! 3702: pHeader.ppsp = ppage;
1.1.1.2 root 3703: pHeader.pfnCallback = (PFNPROPSHEETCALLBACK) InitPropertySheet;
3704:
3705:
1.1.1.4 ! root 3706: psresult = PropertySheet (&pHeader);
1.1.1.2 root 3707:
1.1.1.4 ! root 3708: if (quit_program)
! 3709: psresult = -2;
1.1.1.2 root 3710:
1.1.1.4 ! root 3711: return psresult;
1.1.1.2 root 3712: }
3713:
3714: int gui_init (void)
3715: {
1.1.1.4 ! root 3716: return( GetSettings(1) );
1.1.1.2 root 3717: }
3718:
3719: int gui_update (void)
3720: {
3721: return 1;
3722: }
3723:
3724: void gui_exit (void)
3725: {
1.1.1.4 ! root 3726: #if 0
! 3727: free_prefs( &workprefs, 1 );
! 3728: #endif
! 3729: closeprinter(); // Bernd Roesch
1.1.1.2 root 3730: }
3731:
3732: extern HWND hStatusWnd;
1.1.1.4 ! root 3733: struct gui_info gui_data;
! 3734:
! 3735: void check_prefs_changed_gui( void )
! 3736: {
! 3737: }
1.1.1.2 root 3738:
3739: void gui_led (int led, int on)
3740: {
3741: WORD type;
1.1.1.4 ! root 3742: static char drive_text[5*6];
! 3743: char *ptr;
! 3744: extern int screen_is_picasso;
! 3745:
! 3746: if( hStatusWnd )
! 3747: {
! 3748: if( on )
! 3749: type = SBT_POPOUT;
! 3750: else
! 3751: type = 0;
! 3752:
! 3753: ptr = drive_text + led*6;
! 3754: if( led > 0 )
! 3755: {
! 3756: sprintf( ptr , "%02d", gui_data.drive_track[led-1]);
! 3757: }
! 3758: else
! 3759: {
! 3760: strcpy( ptr, "Power");
! 3761: }
! 3762: PostMessage (hStatusWnd, SB_SETTEXT, (WPARAM) ((led+2) | type), (LPARAM) ptr);
! 3763: }
! 3764: }
1.1.1.2 root 3765:
1.1.1.4 ! root 3766: void gui_fps( int fps )
! 3767: {
! 3768: static char fps_text[10];
1.1.1.2 root 3769:
1.1.1.4 ! root 3770: if( hStatusWnd )
! 3771: {
! 3772: sprintf( fps_text, "FPS: %2u", fps+1 );
! 3773: PostMessage( hStatusWnd, SB_SETTEXT, (WPARAM)( 1 ), (LPARAM)fps_text );
! 3774: }
! 3775: }
1.1.1.2 root 3776:
1.1.1.4 ! root 3777: void gui_filename (int num, const char *name)
! 3778: {
! 3779: }
! 3780:
! 3781: void gui_message(const char *format,...)
! 3782: {
! 3783: char msg[2048];
! 3784: char szTitle[ MAX_PATH ];
! 3785: va_list parms;
! 3786: int flipflop = 0;
! 3787: int fullscreen = 0;
! 3788: int reactivate_mouse = 0;
! 3789: HWND window = NULL;
! 3790:
! 3791: if( DirectDraw_GetCooperativeLevel( &window, &fullscreen ) && fullscreen )
! 3792: flipflop = 1;
! 3793:
! 3794: pause_sound(0);
! 3795: if( flipflop )
! 3796: ShowWindow( window, SW_MINIMIZE );
! 3797:
! 3798: va_start (parms, format);
! 3799: vsprintf( msg, format, parms );
! 3800: va_end (parms);
! 3801: write_log( msg );
1.1.1.2 root 3802:
1.1.1.4 ! root 3803: WIN32GUI_LoadUIString( IDS_ERRORTITLE, szTitle, MAX_PATH );
! 3804: if( mouseactive )
! 3805: {
! 3806: setmouseactive( 0 );
! 3807: reactivate_mouse = 1;
! 3808: }
1.1.1.2 root 3809:
1.1.1.4 ! root 3810: MessageBox( NULL, msg, szTitle, MB_OK | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND );
1.1.1.2 root 3811:
1.1.1.4 ! root 3812: if( reactivate_mouse )
! 3813: setmouseactive( 1 );
1.1.1.2 root 3814:
1.1.1.4 ! root 3815: if( flipflop )
! 3816: ShowWindow( window, SW_RESTORE );
! 3817:
! 3818: resume_sound();
1.1.1.2 root 3819: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.