#ifndef WIN32GUI_H
#define WIN32GUI_H

#define MAX_BUFFER_SIZE    256
#define NUM_DRIVES         4

typedef struct
{
    char volume[3]; // null terminated drive-letter
    char path[256];
    char name[256];
    uae_u16 rw;
    uae_u16 removable;
    HANDLE notification;
} drive_specs;

extern drive_specs drives[NUM_DRIVES];

#define CFG_DESCRIPTION_LENGTH 128
#define CFG_SER_LENGTH 256
#define CFG_ROM_LENGTH 256
#define CFG_PAR_LENGTH 256
#define CFG_KEY_LENGTH 256

#define CONFIG_VERSION_MAJOR 1
#define CONFIG_VERSION_MINOR 1

typedef struct
{
    // Configuration Version Information
    DWORD Size;
    WORD VersionMajor;
    WORD VersionMinor;

    // Configuration Description
    char  Name[ MAX_PATH ];
    char  Description[ CFG_DESCRIPTION_LENGTH ];

    // Actual configuration information
    char  DebuggerEnabled;      // allow debugging
    char  InvalidAddresses;     // log invalid-address stuff
    char  NoAutoConfig;         // do not add uae-devices and memory if set
    char  AddressingIs24Bit;    // 24-bit addressing
    
    int   FakeJoystick;         // Joystick settings

    char  VSyncTime;            // related to QueryPerformanceCounter or RTSC register
    char  GfxLibReplacement;    // use the EXPERIMENTAL gfx-lib replacement stuff
    char  CenterX;              // center the image horizontally
    char  CenterY;              // center the image vertically

    char  Blit32;               // 32-bit blits
    char  BlitImmediate;        // blit immediately
    char  FullScreen;           // full-screen display mode
    char  LineDouble;           // double lines

    char  CorrectAspect;        // dunno
    char  Lores;                // lores pixels
    char  TestDrawingSpeed;     // forces frame refreshes
    char  NoCursor;             // no_xhair option

    char  Accuracy;             // emulator accuracy
    char  ColorMode;            // dunno
    char  M68KSpeed;            // -w option, for tuning CPU vs. custom-chip performance
    char  FloppySpeed;          // floppy-speed setting

    char  MonitorEmulation;     // emulate the 1084
    char  DesiredPriority;      // Win32 priority
    char  DebugLogging;
    char  SerialPort;           // serial-port flag

    char  SerialName[CFG_SER_LENGTH];      // name of port to use

    char  res1;
    char  res2;
    char  res3;
    char  res4;

    char  KickstartName[CFG_ROM_LENGTH];   // Name of ROM file
    char  KeyFileName[CFG_KEY_LENGTH];     // Name of Key-File
    char  PrinterName[CFG_PAR_LENGTH];     // Name of printer
    int   CopperHack;
    int   res5;
    int   res6;
    char  res7;
    char  res8;           // user has selected to use a custom-size for their window-mode display
    char  res9;
    char  CustomSize;             // flag that the user has a brain-dead cpu
    int   Z3Mem;                // Zorro-III memory

    int   FrameRate;            // refresh-rate for Amiga screens
    int   KeyboardLanguage;     // keyboard layout

    // Memory sizes
    int  ChipMem;
    int  FastMem;
    int  P96Mem;

    int   ScreenWidth;          // width of display for Amiga screens
    int   ScreenHeight;         // height of display for Amiga screens

    char  HardFileBootPri;
    char  Emulate1084;
    // Sound settings
    char  SoundSupport;
    char  SoundStereo;
    int   SoundBits;
    int   SoundFreq;

    // Hard-Drive Settings
    drive_specs drives[ NUM_DRIVES ];

    // Floppy Settings
    char  df[4][256];

} ConfigStruct, *ConfigStructPtr;

ConfigStructPtr AllocateConfigStruct( void );
void FreeConfigStruct( ConfigStructPtr cfgptr );
ConfigStructPtr GetFirstConfigEntry( HANDLE *file_handle, LPWIN32_FIND_DATA find_data );
ConfigStructPtr GetNextConfigEntry( HANDLE *file_handle, LPWIN32_FIND_DATA find_data );
void GetDefaultsForPage( ConfigStructPtr cfgptr, int page );
void ConfigurationFile( HWND hDlg, ConfigStructPtr cfgptr, int flag );
void GetSetDriveValues( HWND hDlg, DWORD drive_id, BOOL set );
void DiskSelection(HWND hDlg, WPARAM wParam, int flag);
void InitializeListView( HWND hDlg );
void TransferConfiguration( HWND hDlg, int flag );
void SetupVolumes( void );
void CalculateFPS( DWORD setting, char *buffer );
void CalculateSpeed( DWORD setting, char *buffer );
void UpdateRadioButtons( HWND hDlg, HWND lParam );
void UpdateScroller(HWND hDlg, HWND lParam);
BOOL CALLBACK LoadSaveDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK AboutDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK StartupDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK SoundDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK DisplayDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK HarddiskDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK FloppiesDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK PortsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK AdvancedDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK DebuggerDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void CALLBACK InitPropertySheet( HWND hDlg, UINT msg, LPARAM lParam );
void CalculateRealMem(DWORD setting, int *size, char *buffer, int chipmem_flag);
void SetStatusText(char *text, int part);
HWND AddStatusWindow(void);
void KickStuffSelection( HWND hDlg, int which );
void CreateDiskFile( char *name );

BOOL GetSettings( void );

// Number of pages in the settings dialog
#define C_PAGES 9
enum { LOADSAVE_ID, STARTUP_ID, SOUND_ID, FLOPPY_ID, DISPLAY_ID, HARDDISK_ID, PORTS_ID, ADVANCED_ID, ABOUT_ID };

#define MIN_CHIP_MEM 0
#define MAX_CHIP_MEM 4
#define MIN_FAST_MEM 0
#define MAX_FAST_MEM 4
#define MIN_Z3_MEM 0
#define MAX_Z3_MEM 5
#define MIN_P96_MEM 0
#define MAX_P96_MEM 4
#define MIN_M68K_PRIORITY 1
#define MAX_M68K_PRIORITY 16
#define MIN_REFRESH_RATE 1
#define MAX_REFRESH_RATE 10

#define MAX_LINES 580
#endif
