diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..77134db --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/build +*.exe +*.res +/asio diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..cc9b83d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "iup"] + path = iup + url = https://github.com/jprjr/iup-build.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..54a6ceb --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +all: +TARGET=x86_64-w64-mingw32 +IUP_VER=3.22 + +include iup/Makefile + +.PHONY: all asioconfig clean + +all: build/$(TARGET)/asioconfig.exe + +ASIO_INCDIRS = -Iasio/common -Iasio/host -Iasio/host/pc +ASIO_FILES = asio/common/asio.cpp asio/host/pc/asiolist.cpp asio/host/asiodrivers.cpp +WINDOWS_LIBS = -lgdi32 -lcomdlg32 -lcomctl32 -luuid -loleaut32 -lole32 + + + +build/$(TARGET)/asioconfig.exe: asioconfig.cpp $(LIBIUP) asioconfig.res + mkdir -p build/$(TARGET) + $(TARGET_CXX) -mwindows -static -I$(IUP_INCDIR) $(ASIO_INCDIRS) -o $@ asioconfig.cpp $(ASIO_FILES) -L$(IUP_LIBDIR) -liup $(WINDOWS_LIBS) asioconfig.res + $(TARGET_STRIP) $@ + upx $@ + + +asioconfig.res: asioconfig.rc + $(TARGET_WINDRES) -c 1252 asioconfig.rc -O coff -o asioconfig.res + +clean: + rm -f asioconfig.res asioconfig.exe diff --git a/asioconfig.cpp b/asioconfig.cpp new file mode 100644 index 0000000..71f64d4 --- /dev/null +++ b/asioconfig.cpp @@ -0,0 +1,69 @@ +#include +#include +#include +#include "asio.h" +#include "asiodrivers.h" + +AsioDrivers *drivers; +ASIODriverInfo my_info; + +static int doubleclick_handler(Ihandle *ih, int item, char *text) { + my_info.sysRef = GetForegroundWindow(); + strcpy(my_info.name,text); + ASIOInit(&my_info); + ASIOControlPanel(); + return 0; +} + +int main(int argc, char **argv) { + drivers = new AsioDrivers(); + char **names; + int i = 0; + long devices = 0; + names = (char **)malloc(sizeof(char *) * 32); + if(names == 0) { + return 1; + } + for(i=0; i<32; i++) { + names[i] = (char *)malloc(sizeof(char) * 32); + if(names[i] == 0) { + return 1; + } + } + + my_info.asioVersion = 2; + + Ihandle *dlg, *list; + IupOpen(&argc, &argv); + + list = IupList(0); + + devices = drivers->asioGetNumDev(); + if(devices == 0) { + IupSetAttribute(list,"1","No items found"); + /* return 1; */ + } + + char listIndexString[3]; + + for(i=0; iasioGetDriverName(i,names[i],32); + IupSetAttribute(list,listIndexString,names[i]); + } + } + IupSetCallback(list,"DBLCLICK_CB",(Icallback)doubleclick_handler); + + dlg = IupDialog(IupVbox(list,NULL)); + IupSetAttribute(dlg, "TITLE", "Hello world"); + + IupShowXY(dlg, IUP_CENTER, IUP_CENTER); + + IupMainLoop(); + + IupClose(); + + return EXIT_SUCCESS; +} + diff --git a/asioconfig.rc b/asioconfig.rc new file mode 100755 index 0000000..8f3f8bc --- /dev/null +++ b/asioconfig.rc @@ -0,0 +1,57 @@ +CURSOR_PEN CURSOR "iup/deps/iup-3.22/etc/pen.cur" + +1 VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "ASIO Config\0" + VALUE "CompanyName", "John Regan\0" + VALUE "FileDescription", "ASIO Config\0" + VALUE "FileVersion", "1.0.0\0" + VALUE "LegalCopyright", "Copyright 2017 John Regan.\0" + VALUE "OriginalFilename", "asioconfig.exe\0" + VALUE "ProductName", "ASIO Config\0" + VALUE "ProductVersion", "1.0.0\0" + END + END +END + +/****************************************************/ +/* Used by IupFileDlg when SHOWPREVIEW=Yes */ + +/* To avoid the inclusion of */ +#define WS_CHILD 0x40000000L +#define WS_VISIBLE 0x10000000L +#define WS_CLIPSIBLINGS 0x04000000L +#define DS_3DLOOK 0x0004L +#define DS_CONTROL 0x0400L +#define SS_OWNERDRAW 0x0000000DL +#define WS_EX_STATICEDGE 0x00020000L + +#define IUP_PREVIEWCANVAS 3000 /* 0x0BB8 */ + +iupPreviewDlg DIALOG DISCARDABLE 0, 0, 250, 95 +STYLE WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | DS_3DLOOK | DS_CONTROL +FONT 8, "MS Shell Dlg" +BEGIN + /* ..., SS_OWNERDRAW, x, y, width, height, ... */ + CONTROL "", IUP_PREVIEWCANVAS, "STATIC", SS_OWNERDRAW, 70, 0, 120, 90, WS_EX_STATICEDGE +END + +/****************************************************/ +/* The following lines will enable Windows XP/Vista Visual Styles */ + +/* don't add this if building the DLL */ +#ifndef IUP_DLL +#ifdef TEC_64 +1 24 "iup/deps/iup-3.22/etc/iup64.manifest" +#else +1 24 "iup/deps/iup-3.22/etc/iup.manifest" +#endif +#endif + +/****************************************************/ diff --git a/iup b/iup new file mode 160000 index 0000000..5186b1c --- /dev/null +++ b/iup @@ -0,0 +1 @@ +Subproject commit 5186b1c40c758ee3dba5d720524006333c73811c