aboutsummaryrefslogtreecommitdiff
path: root/utils/winmm_drv/cpl
diff options
context:
space:
mode:
Diffstat (limited to 'utils/winmm_drv/cpl')
-rw-r--r--utils/winmm_drv/cpl/adlconfig-tool.c20
-rw-r--r--utils/winmm_drv/cpl/adlconfig-tool.exe.manifest36
-rw-r--r--utils/winmm_drv/cpl/adlconfig.c101
-rw-r--r--utils/winmm_drv/cpl/adlconfig.cpl.manifest36
-rw-r--r--utils/winmm_drv/cpl/adlconfig.def5
-rw-r--r--utils/winmm_drv/cpl/adlconfig.rc142
-rw-r--r--utils/winmm_drv/cpl/config_dialog.c383
-rw-r--r--utils/winmm_drv/cpl/config_dialog.h12
-rw-r--r--utils/winmm_drv/cpl/opl3icon.icobin0 -> 22486 bytes
-rw-r--r--utils/winmm_drv/cpl/resource.h50
-rw-r--r--utils/winmm_drv/cpl/targetver.h24
11 files changed, 809 insertions, 0 deletions
diff --git a/utils/winmm_drv/cpl/adlconfig-tool.c b/utils/winmm_drv/cpl/adlconfig-tool.c
new file mode 100644
index 0000000..513f5eb
--- /dev/null
+++ b/utils/winmm_drv/cpl/adlconfig-tool.c
@@ -0,0 +1,20 @@
+#include "targetver.h"
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <cpl.h>
+
+#include "resource.h"
+
+#include "config_dialog.h"
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int nCmdShow)
+{
+ initAdlSetupBox(hInstance, NULL);
+ runAdlSetupBox(hInstance, NULL);
+ return 0;
+
+ UNREFERENCED_PARAMETER(hPrevInstance);
+ UNREFERENCED_PARAMETER(pCmdLine);
+ UNREFERENCED_PARAMETER(nCmdShow);
+}
diff --git a/utils/winmm_drv/cpl/adlconfig-tool.exe.manifest b/utils/winmm_drv/cpl/adlconfig-tool.exe.manifest
new file mode 100644
index 0000000..1016f98
--- /dev/null
+++ b/utils/winmm_drv/cpl/adlconfig-tool.exe.manifest
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity
+ version="1.0.0.0"
+ processorArchitecture="*"
+ name="Wohlstand.libADLMIDI.WinMMDriver"
+ type="win32"
+ />
+ <description>libADLMIDI synth Driver settings tool</description>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="*"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+ </dependency>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!-- Windows 10 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!-- Windows 7 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <!-- Windows Vista -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ </application>
+ </compatibility>
+</assembly>
diff --git a/utils/winmm_drv/cpl/adlconfig.c b/utils/winmm_drv/cpl/adlconfig.c
new file mode 100644
index 0000000..744fc14
--- /dev/null
+++ b/utils/winmm_drv/cpl/adlconfig.c
@@ -0,0 +1,101 @@
+#include "targetver.h"
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <cpl.h>
+
+#include "resource.h"
+
+#include "config_dialog.h"
+
+static HANDLE hModule = NULL;
+
+BOOL WINAPI DllMain(
+ PVOID hmod,
+ ULONG ulReason,
+ PCONTEXT pctx OPTIONAL
+)
+{
+ if(ulReason != DLL_PROCESS_ATTACH)
+ {
+ return TRUE;
+ }
+ else
+ {
+ hModule = hmod;
+ }
+
+ return TRUE;
+
+ UNREFERENCED_PARAMETER(pctx);
+}
+
+LONG APIENTRY CPlApplet(
+ HWND hwndCPL, // handle of Control Panel window
+ UINT uMsg, // message
+ LONG_PTR lParam1, // first message parameter
+ LONG_PTR lParam2 // second message parameter
+)
+{
+ LPCPLINFO lpCPlInfo;
+ LPNEWCPLINFO lpNewCPlInfo;
+ LONG retCode = 0;
+
+ switch (uMsg)
+ {
+ // first message, sent once
+ case CPL_INIT:
+ initAdlSetupBox(hModule, hwndCPL);
+ return TRUE;
+
+ // second message, sent once
+ case CPL_GETCOUNT:
+ return 1L;
+
+ // third message, sent once per app
+ case CPL_INQUIRE:
+ lpCPlInfo = (LPCPLINFO)lParam2;
+ lpCPlInfo->idIcon = IDI_ICON1;
+ lpCPlInfo->idName = IDC_DRIVERNAME;
+ lpCPlInfo->idInfo = IDC_DRIVERDESC;
+ lpCPlInfo->lData = 0L;
+ break;
+
+ // third message, sent once per app
+ case CPL_NEWINQUIRE:
+ lpNewCPlInfo = (LPNEWCPLINFO)lParam2;
+ lpNewCPlInfo->dwSize = (DWORD) sizeof(NEWCPLINFO);
+ lpNewCPlInfo->dwFlags = 0;
+ lpNewCPlInfo->dwHelpContext = 0;
+ lpNewCPlInfo->lData = 0;
+ lpNewCPlInfo->hIcon = LoadIconW(hModule, (LPCTSTR)MAKEINTRESOURCEW(IDI_ICON1));
+ lpNewCPlInfo->szHelpFile[0] = '\0';
+
+ LoadStringW(hModule, IDC_DRIVERNAME, lpNewCPlInfo->szName, 32);
+ LoadStringW(hModule, IDC_DRIVERDESC, lpNewCPlInfo->szInfo, 64);
+ break;
+
+ // application icon selected
+ case CPL_SELECT:
+ break;
+
+ // application icon double-clicked
+ case CPL_DBLCLK:
+ runAdlSetupBox(hModule, hwndCPL);
+ break;
+
+ case CPL_STOP:
+ break;
+
+ case CPL_EXIT:
+ cleanUpAdlSetupBox(hModule, hwndCPL);
+ break;
+
+ default:
+ break;
+ }
+
+ return retCode;
+
+ UNREFERENCED_PARAMETER(lParam1);
+}
diff --git a/utils/winmm_drv/cpl/adlconfig.cpl.manifest b/utils/winmm_drv/cpl/adlconfig.cpl.manifest
new file mode 100644
index 0000000..1016f98
--- /dev/null
+++ b/utils/winmm_drv/cpl/adlconfig.cpl.manifest
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity
+ version="1.0.0.0"
+ processorArchitecture="*"
+ name="Wohlstand.libADLMIDI.WinMMDriver"
+ type="win32"
+ />
+ <description>libADLMIDI synth Driver settings tool</description>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="*"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+ </dependency>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!-- Windows 10 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!-- Windows 7 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <!-- Windows Vista -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ </application>
+ </compatibility>
+</assembly>
diff --git a/utils/winmm_drv/cpl/adlconfig.def b/utils/winmm_drv/cpl/adlconfig.def
new file mode 100644
index 0000000..97ed971
--- /dev/null
+++ b/utils/winmm_drv/cpl/adlconfig.def
@@ -0,0 +1,5 @@
+LIBRARY "libADLMIDIConfig"
+
+EXPORTS
+ CPlApplet
+ ToolDlgProc
diff --git a/utils/winmm_drv/cpl/adlconfig.rc b/utils/winmm_drv/cpl/adlconfig.rc
new file mode 100644
index 0000000..75551fd
--- /dev/null
+++ b/utils/winmm_drv/cpl/adlconfig.rc
@@ -0,0 +1,142 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+/////////////////////////////////////////////////////////////////////////////
+// Russian (Russia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// RT_MANIFEST
+//
+
+#ifdef ADL_IS_CPL_APPLET
+MANIFSEST_RES_CPL RT_MANIFEST "adlconfig.cpl.manifest"
+#else
+MANIFSEST_RES RT_MANIFEST "adlconfig-tool.exe.manifest"
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1 ICON "opl3icon.ico"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_CONFIG_BOX DIALOGEX 0, 0, 243, 242
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "libADLMIDI settings"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,81,210,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,135,210,50,14
+ PUSHBUTTON "Apply",IDC_APPLYBUTTON,191,210,50,14
+ COMBOBOX IDC_VOLUMEMODEL,79,95,155,200,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Volume model:",IDC_VM_LABEL,5,97,66,8
+ COMBOBOX IDC_BANK_ID,79,15,155,200,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ GROUPBOX "Instruments bank",IDC_INS_BANK,4,2,234,51
+ CONTROL "Internal bank",IDC_BANK_INTERNAL,"Button",BS_AUTORADIOBUTTON | WS_GROUP,9,16,63,10
+ CONTROL "External bank",IDC_BANK_EXTERNAL,"Button",BS_AUTORADIOBUTTON,9,33,67,10
+ EDITTEXT IDC_BANK_PATH,79,31,107,14,ES_AUTOHSCROLL | WS_DISABLED
+ PUSHBUTTON "Browse...",IDC_BROWSE_BANK,187,31,48,14
+ PUSHBUTTON "Restore defaults",IDC_RESTORE_DEFAULTS,153,193,88,14
+ CONTROL "Deep tremolo (Auto/Enable/Disable)",IDC_FLAG_TREMOLO,
+ "Button",BS_AUTO3STATE | WS_TABSTOP,5,124,227,10
+ CONTROL "Deep virbrato (Auto/Enable/Disable)",IDC_FLAG_VIBRATO,
+ "Button",BS_AUTO3STATE | WS_TABSTOP,5,141,227,10
+ CONTROL "Full-panning stereo",IDC_FLAG_SOFTPAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,108,227,10
+ COMBOBOX IDC_EMULATOR,79,56,155,200,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Chip emulator type:",IDC_CHIPEMU_LABEL,5,58,67,8
+ LTEXT "Number of chips",IDC_CHIPNUM_LABEL,5,75,69,8
+ COMBOBOX IDC_NUM_CHIPS,79,74,33,200,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_NUM_4OPVO,193,74,41,200,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Number of 4OP voices",IDC_4OPSNUM_LABEL,115,76,72,8
+ CONTROL "Scalable modulation",IDC_FLAG_SCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,157,228,10
+ CONTROL "Full-range brightness (CC74)",IDC_FLAG_FULLBRIGHT,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,173,228,10
+ PUSHBUTTON "About...",IDC_ABOUT,5,210,50,14
+ PUSHBUTTON "Reset synth now",IDC_RESET_SYNTH,69,193,80,14
+ RTEXT "Settings will be applied immediately",IDC_BOTTOMNOTE_LABEL,0,227,241,8
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_SETUP_BOX, DIALOG
+ BEGIN
+ RIGHTMARGIN, 241
+ BOTTOMMARGIN, 241
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDC_DRIVERNAME "libADLMIDI settings"
+ IDC_DRIVERDESC "Settings for libADLMIDI synthesizer"
+END
+
+#endif // Russian (Russia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/utils/winmm_drv/cpl/config_dialog.c b/utils/winmm_drv/cpl/config_dialog.c
new file mode 100644
index 0000000..8489273
--- /dev/null
+++ b/utils/winmm_drv/cpl/config_dialog.c
@@ -0,0 +1,383 @@
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <commctrl.h>
+#include <commdlg.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "config_dialog.h"
+#include "resource.h"
+
+#include "regconfig.h"
+
+#ifndef CBM_FIRST
+#define CBM_FIRST 0x1700
+#endif
+#ifndef CB_SETMINVISIBLE
+#define CB_SETMINVISIBLE (CBM_FIRST+1)
+#endif
+
+typedef int (*BankNamesCount)(void);
+typedef const char *const *(*BankNamesList)(void);
+
+static const char *const volume_models_descriptions[] =
+{
+ "Auto (defined by bank)",
+ "Generic",
+ "OPL3 Native",
+ "DMX",
+ "Apogee Sound System",
+ "Win9x SB16 driver",
+ "DMX (Fixed AM)",
+ "Apogee Sound System (Fixed AM)",
+ "Audio Interfaces Library (AIL)",
+ "Win9x Generic FM driver",
+ "HMI Sound Operating System",
+ "HMI Sound Operating System (Old)",
+ NULL
+};
+
+static const char * const emulator_type_descriptions[] =
+{
+ "Nuked OPL3 1.8",
+ "Nuked OPL3 1.7.4 (Optimized)",
+ "DOSBox",
+ "Opal",
+ "Java OPL3",
+ NULL
+};
+
+static DriverSettings g_setup;
+static HINSTANCE s_hModule;
+
+static void syncBankType(HWND hwnd, int type);
+static void sync4ops(HWND hwnd);
+static void syncWidget(HWND hwnd);
+static void buildLists(HWND hwnd);
+static void syncBankType(HWND hwnd, int type);
+static void openCustomBank(HWND hwnd);
+static void updateBankName(HWND hwnd, const WCHAR *filePath);
+
+static void sync4ops(HWND hwnd)
+{
+ char buff[10];
+ int i;
+
+ SendDlgItemMessageW(hwnd, IDC_NUM_4OPVO, CB_RESETCONTENT, 0, 0);
+ SendDlgItemMessageA(hwnd, IDC_NUM_4OPVO, CB_ADDSTRING, (LPARAM)-1, (LPARAM)"AUTO");
+ for(i = 0; i <= g_setup.numChips * 6; i++)
+ {
+ ZeroMemory(buff, 10);
+ snprintf(buff, 10, "%d", i);
+ SendDlgItemMessageA(hwnd, IDC_NUM_4OPVO, CB_ADDSTRING, (LPARAM)0, (LPARAM)buff);
+ }
+ SendDlgItemMessageA(hwnd, IDC_NUM_4OPVO, CB_SETCURSEL, (WPARAM)g_setup.num4ops + 1, (LPARAM)0);
+}
+
+static void syncWidget(HWND hwnd)
+{
+ char buff[10];
+ int i;
+
+ SendDlgItemMessage(hwnd, IDC_BANK_EXTERNAL, BM_SETCHECK, 0, 0);
+ SendDlgItemMessage(hwnd, IDC_BANK_INTERNAL, BM_SETCHECK, 0, 0);
+
+ if(g_setup.useExternalBank == 1)
+ SendDlgItemMessage(hwnd, IDC_BANK_EXTERNAL, BM_SETCHECK, 1, 0);
+ else
+ SendDlgItemMessage(hwnd, IDC_BANK_INTERNAL, BM_SETCHECK, 1, 0);
+
+ syncBankType(hwnd, g_setup.useExternalBank);
+
+ SendDlgItemMessage(hwnd, IDC_FLAG_TREMOLO, BM_SETCHECK, g_setup.flagDeepTremolo, 0);
+ SendDlgItemMessage(hwnd, IDC_FLAG_VIBRATO, BM_SETCHECK, g_setup.flagDeepVibrato, 0);
+ SendDlgItemMessage(hwnd, IDC_FLAG_SOFTPAN, BM_SETCHECK, g_setup.flagSoftPanning, 0);
+ SendDlgItemMessage(hwnd, IDC_FLAG_SCALE, BM_SETCHECK, g_setup.flagScaleModulators, 0);
+ SendDlgItemMessage(hwnd, IDC_FLAG_FULLBRIGHT, BM_SETCHECK, g_setup.flagFullBrightness, 0);
+
+ SendDlgItemMessageW(hwnd, IDC_NUM_CHIPS, CB_RESETCONTENT, 0, 0);
+ for(i = 1; i <= 100; i++)
+ {
+ ZeroMemory(buff, 10);
+ snprintf(buff, 10, "%d", i);
+ SendDlgItemMessageA(hwnd, IDC_NUM_CHIPS, CB_ADDSTRING, (LPARAM)0, (LPARAM)buff);
+ }
+
+ SendDlgItemMessageA(hwnd, IDC_NUM_CHIPS, CB_SETCURSEL, (WPARAM)g_setup.numChips - 1, (LPARAM)0);
+ SendDlgItemMessageA(hwnd, IDC_BANK_ID, CB_SETCURSEL, (WPARAM)g_setup.bankId, (LPARAM)0);
+ updateBankName(hwnd, g_setup.bankPath);
+ SendDlgItemMessageA(hwnd, IDC_EMULATOR, CB_SETCURSEL, (WPARAM)g_setup.emulatorId, (LPARAM)0);
+ SendDlgItemMessageA(hwnd, IDC_VOLUMEMODEL, CB_SETCURSEL, (WPARAM)g_setup.volumeModel, (LPARAM)0);
+
+ sync4ops(hwnd);
+}
+
+static void buildLists(HWND hwnd)
+{
+ int i, bMax;
+ HMODULE lib;
+ const char *const* list;
+ BankNamesCount adl_getBanksCount;
+ BankNamesList adl_getBankNames;
+
+ lib = LoadLibraryW(L"adlmididrv.dll");
+ if(lib)
+ {
+ adl_getBanksCount = (BankNamesCount)GetProcAddress(lib, "adl_getBanksCount");
+ adl_getBankNames = (BankNamesList)GetProcAddress(lib, "adl_getBankNames");
+ if(adl_getBanksCount && adl_getBankNames)
+ {
+ bMax = adl_getBanksCount();
+ list = adl_getBankNames();
+ for(i = 0; i < bMax; i++)
+ {
+ SendDlgItemMessageA(hwnd, IDC_BANK_ID, CB_ADDSTRING, (LPARAM)0, (LPARAM)list[i]);
+ }
+ }
+ else
+ {
+ SendDlgItemMessageA(hwnd, IDC_BANK_ID, CB_ADDSTRING, (LPARAM)0, (LPARAM)"<Can't get calls>");
+ }
+ FreeLibrary(lib);
+ }
+ else
+ {
+ SendDlgItemMessageA(hwnd, IDC_BANK_ID, CB_ADDSTRING, (LPARAM)0, (LPARAM)"<Can't load library>");
+ }
+
+ // Volume models
+ for(i = 0; volume_models_descriptions[i] != NULL; ++i)
+ {
+ SendDlgItemMessageA(hwnd, IDC_VOLUMEMODEL, CB_ADDSTRING, (LPARAM)0, (LPARAM)volume_models_descriptions[i]);
+ }
+
+ // Emulators list
+ for(i = 0; emulator_type_descriptions[i] != NULL; ++i)
+ {
+ SendDlgItemMessageA(hwnd, IDC_EMULATOR, CB_ADDSTRING, (LPARAM)0, (LPARAM)emulator_type_descriptions[i]);
+ }
+}
+
+static void syncBankType(HWND hwnd, int type)
+{
+ EnableWindow(GetDlgItem(hwnd, IDC_BANK_ID), !type);
+ EnableWindow(GetDlgItem(hwnd, IDC_BROWSE_BANK), type);
+}
+
+static void updateBankName(HWND hwnd, const WCHAR *filePath)
+{
+ int i, len = wcslen(filePath);
+ const WCHAR *p = NULL;
+
+ for(i = 0; i < len; i++)
+ {
+ if(filePath[i] == L'\\' || filePath[i] == L'/')
+ p = filePath + i + 1;
+ }
+
+ if(p == NULL)
+ SendDlgItemMessage(hwnd, IDC_BANK_PATH, WM_SETTEXT, (WPARAM)NULL, (LPARAM)L"<none>");
+ else
+ SendDlgItemMessage(hwnd, IDC_BANK_PATH, WM_SETTEXT, (WPARAM)NULL, (LPARAM)p);
+}
+
+static void openCustomBank(HWND hwnd)
+{
+ OPENFILENAMEW ofn;
+ WCHAR szFile[MAX_PATH];
+
+ ZeroMemory(&ofn, sizeof(ofn));
+ ZeroMemory(szFile, sizeof(szFile));
+
+ wcsncpy(szFile, g_setup.bankPath, MAX_PATH);
+
+ ofn.lStructSize = sizeof(ofn);
+ ofn.hInstance = s_hModule;
+ ofn.hwndOwner = hwnd;
+ ofn.lpstrFilter = L"WOPL bank file (*.wopl)\0*.WOPL\0All files (*.*)\0*.*\0";
+ ofn.lpstrFile = szFile;
+ ofn.nMaxFile = sizeof(szFile);
+ ofn.lpstrTitle = L"Open external bank file";
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_READONLY | OFN_HIDEREADONLY | OFN_EXPLORER;
+
+ if(GetOpenFileNameW(&ofn) == TRUE)
+ {
+ ZeroMemory(g_setup.bankPath, sizeof(g_setup.bankPath));
+ wcsncpy(g_setup.bankPath, szFile, MAX_PATH);
+ updateBankName(hwnd, g_setup.bankPath);
+ }
+}
+
+INT_PTR CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
+{
+ switch(Message)
+ {
+ case WM_INITDIALOG:
+ buildLists(hwnd);
+ syncWidget(hwnd);
+ return TRUE;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDC_ABOUT:
+ MessageBoxW(hwnd,
+ L"libADLMIDI - a software MIDI synthesizer with OPL3 FM synth,\n"
+ L"Made by Vitaly Novichkov \"Wohlstand\".\n\n"
+ L"Source code is here: https://github.com/Wohlstand/libADLMIDI",
+ L"About this driver",
+ MB_OK);
+ break;
+
+ case IDC_NUM_CHIPS:
+ if(HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ g_setup.numChips = 1 + SendMessageW((HWND)lParam, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0);
+ g_setup.num4ops = -1;
+ sync4ops(hwnd);
+ }
+ break;
+
+ case IDC_NUM_4OPVO:
+ if(HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ g_setup.num4ops = SendMessageW((HWND)lParam, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0) - 1;
+ }
+ break;
+
+ case IDC_EMULATOR:
+ if(HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ g_setup.emulatorId = SendMessageW((HWND)lParam, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0);
+ }
+ break;
+
+ case IDC_VOLUMEMODEL:
+ if(HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ g_setup.volumeModel = SendMessageW((HWND)lParam, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0);
+ }
+ break;
+
+ case IDC_BANK_INTERNAL:
+ g_setup.useExternalBank = 0;
+ syncBankType(hwnd, FALSE);
+ break;
+
+ case IDC_BANK_EXTERNAL:
+ g_setup.useExternalBank = 1;
+ syncBankType(hwnd, TRUE);
+ break;
+
+ case IDC_BANK_ID:
+ if(HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ g_setup.bankId = SendMessageW((HWND)lParam, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0);
+ }
+ break;
+
+ case IDC_BROWSE_BANK:
+ openCustomBank(hwnd);
+ break;
+
+ case IDC_FLAG_TREMOLO:
+ if(HIWORD(wParam) == BN_CLICKED)
+ {
+ g_setup.flagDeepTremolo = SendDlgItemMessage(hwnd, IDC_FLAG_TREMOLO, (UINT)BM_GETCHECK, 0, 0);
+ }
+ break;
+
+ case IDC_FLAG_VIBRATO:
+ if(HIWORD(wParam) == BN_CLICKED)
+ {
+ g_setup.flagDeepVibrato = SendDlgItemMessage(hwnd, IDC_FLAG_VIBRATO, (UINT)BM_GETCHECK, 0, 0);
+ }
+ break;
+
+ case IDC_FLAG_SOFTPAN:
+ if(HIWORD(wParam) == BN_CLICKED)
+ {
+ g_setup.flagSoftPanning = SendDlgItemMessage(hwnd, IDC_FLAG_SOFTPAN, (UINT)BM_GETCHECK, 0, 0);
+ }
+ break;
+
+ case IDC_FLAG_SCALE:
+ if(HIWORD(wParam) == BN_CLICKED)
+ {
+ g_setup.flagScaleModulators = SendDlgItemMessage(hwnd, IDC_FLAG_SCALE, (UINT)BM_GETCHECK, 0, 0);
+ }
+ break;
+
+ case IDC_FLAG_FULLBRIGHT:
+ if(HIWORD(wParam) == BN_CLICKED)
+ {
+ g_setup.flagFullBrightness = SendDlgItemMessage(hwnd, IDC_FLAG_FULLBRIGHT, (UINT)BM_GETCHECK, 0, 0);
+ }
+ break;
+
+
+ case IDC_RESTORE_DEFAULTS:
+ setupDefault(&g_setup);
+ syncWidget(hwnd);
+ break;
+
+ case IDC_RESET_SYNTH:
+ sendSignal(DRV_SIGNAL_RESET_SYNTH);
+ break;
+
+ case IDC_APPLYBUTTON:
+ saveSetup(&g_setup);
+ sendSignal(DRV_SIGNAL_RELOAD_SETUP);
+ break;
+
+ case IDOK:
+ saveSetup(&g_setup);
+ sendSignal(DRV_SIGNAL_RELOAD_SETUP);
+ EndDialog(hwnd, IDOK);
+ break;
+
+ case IDCANCEL:
+ EndDialog(hwnd, IDCANCEL);
+ break;
+ }
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+
+ UNREFERENCED_PARAMETER(lParam);
+}
+
+
+BOOL runAdlSetupBox(HINSTANCE hModule, HWND hwnd)
+{
+ s_hModule = hModule;
+
+ loadSetup(&g_setup);
+
+ DialogBoxW(hModule, MAKEINTRESOURCEW(IDD_CONFIG_BOX), hwnd, ToolDlgProc);
+
+ s_hModule = NULL;
+
+ return TRUE;
+}
+
+WINBOOL initAdlSetupBox(HINSTANCE hModule, HWND hwnd)
+{
+ InitCommonControls();
+ setupDefault(&g_setup);
+ UNREFERENCED_PARAMETER(hModule);
+ UNREFERENCED_PARAMETER(hwnd);
+ return TRUE;
+}
+
+WINBOOL cleanUpAdlSetupBox(HINSTANCE hModule, HWND hwnd)
+{
+ UNREFERENCED_PARAMETER(hModule);
+ UNREFERENCED_PARAMETER(hwnd);
+ return TRUE;
+}
diff --git a/utils/winmm_drv/cpl/config_dialog.h b/utils/winmm_drv/cpl/config_dialog.h
new file mode 100644
index 0000000..1cb45d6
--- /dev/null
+++ b/utils/winmm_drv/cpl/config_dialog.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#ifndef SETUP_DIALOG_HHHH
+#define SETUP_DIALOG_HHHH
+
+#include <windef.h>
+
+extern BOOL initAdlSetupBox(HINSTANCE hModule, HWND hwnd);
+extern BOOL runAdlSetupBox(HINSTANCE hModule, HWND hwnd);
+extern BOOL cleanUpAdlSetupBox(HINSTANCE hModule, HWND hwnd);
+
+#endif
diff --git a/utils/winmm_drv/cpl/opl3icon.ico b/utils/winmm_drv/cpl/opl3icon.ico
new file mode 100644
index 0000000..16c3d9a
--- /dev/null
+++ b/utils/winmm_drv/cpl/opl3icon.ico
Binary files differ
diff --git a/utils/winmm_drv/cpl/resource.h b/utils/winmm_drv/cpl/resource.h
new file mode 100644
index 0000000..bd6b662
--- /dev/null
+++ b/utils/winmm_drv/cpl/resource.h
@@ -0,0 +1,50 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by adlsetup.rc
+//
+#include <winresrc.h>
+
+#define MANIFSEST_RES 1
+#define MANIFSEST_RES_CPL 123
+#define IDD_CONFIG_BOX 101
+#define IDI_ICON1 102
+#define IDC_DRIVERNAME 103
+#define IDC_DRIVERDESC 104
+
+#define IDC_APPLYBUTTON 1000
+#define IDC_VOLUMEMODEL 1001
+#define IDC_VM_LABEL 1002
+#define IDC_BANK_ID 1003
+#define IDC_INS_BANK 1004
+#define IDC_BANK_INTERNAL 1005
+#define IDC_BANK_EXTERNAL 1006
+#define IDC_BANK_PATH 1007
+#define IDC_BROWSE_BANK 1008
+#define IDC_RESTORE_DEFAULTS 1010
+#define IDC_FLAG_TREMOLO 1011
+#define IDC_FLAG_VIBRATO 1012
+#define IDC_FLAG_SOFTPAN 1013
+#define IDC_EMULATOR 1014
+#define IDC_NUM_CHIPS 1018
+#define IDC_NUM_4OPVO 1019
+#define IDC_FLAG_SCALE 1020
+#define IDC_FLAG_FULLBRIGHT 1021
+#define IDC_ABOUT 1022
+#define IDC_CHIPEMU_LABEL 1023
+#define IDC_CHIPNUM_LABEL 1024
+#define IDC_4OPSNUM_LABEL 1025
+#define IDC_RESET_SYNTH 1026
+#define IDC_BOTTOMNOTE_LABEL 1027
+
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NO_MFC 1
+#define _APS_NEXT_RESOURCE_VALUE 105
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1028
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/utils/winmm_drv/cpl/targetver.h b/utils/winmm_drv/cpl/targetver.h
new file mode 100644
index 0000000..203dfbc
--- /dev/null
+++ b/utils/winmm_drv/cpl/targetver.h
@@ -0,0 +1,24 @@
+#pragma once
+
+// The following macros define the minimum required platform. The minimum required platform
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
+// your application. The macros work by enabling all features available on platform versions up to and
+// including the version specified.
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
+#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
+#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
+#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
+#endif