Another load of cleanups.
Also, all filename handling is now Unicode. Fixes for many items on the bugs list. New logo and main icon for the project.
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Application resource script for Windows.
|
||||
*
|
||||
* Version: @(#)VARCem.rc 1.0.9 2018/03/28
|
||||
* Version: @(#)VARCem.rc 1.0.11 2018/03/31
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -66,8 +66,6 @@ MainMenu MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&Action"
|
||||
BEGIN
|
||||
MENUITEM "&Right CTRL is left ALT", IDM_ACTION_RCTRL_IS_LALT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Hard Reset", IDM_ACTION_HRESET
|
||||
MENUITEM "&Ctrl+Alt+Del\tCtrl+F12", IDM_ACTION_RESET_CAD
|
||||
MENUITEM SEPARATOR
|
||||
@@ -133,6 +131,8 @@ BEGIN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "F&orce 4:3 display ratio", IDM_VID_FORCE43
|
||||
MENUITEM "Change contrast for &monochrome display", IDM_VID_CGACON
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "R&ight CTRL is left ALT", IDM_KBD_RCTRL_IS_LALT
|
||||
END
|
||||
POPUP "&Tools"
|
||||
BEGIN
|
||||
@@ -631,13 +631,7 @@ END
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
#ifdef RELEASE_BUILD
|
||||
/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC_256x256.png */
|
||||
100 ICON DISCARDABLE "win/icons/emu-rb.ico"
|
||||
#else
|
||||
/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC2_256x256.png */
|
||||
100 ICON DISCARDABLE "win/icons/emu.ico"
|
||||
#endif
|
||||
100 ICON DISCARDABLE "win/icons/varcem.ico"
|
||||
128 ICON DISCARDABLE "win/icons/floppy_525.ico"
|
||||
129 ICON DISCARDABLE "win/icons/floppy_525_active.ico"
|
||||
144 ICON DISCARDABLE "win/icons/floppy_35.ico"
|
||||
@@ -966,7 +960,7 @@ BEGIN
|
||||
IDS_2154 "Unable to register Raw Input!"
|
||||
IDS_2155 "IRQ %i"
|
||||
IDS_2156 "%" PRIu64
|
||||
IDS_2157 "%" PRIu64 " MB (CHS: %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")"
|
||||
IDS_2157 "%" PRIu64 " MB (CHS: %u, %u, %u)"
|
||||
IDS_2158 "Floppy %i (%s): %ls"
|
||||
IDS_2159 "All images (*.0??;*.1??;*.360;*.720;*.86F;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF)\0*.0??;*.1??;*.360;*.720;*.86F;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.360;*.720;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.360;*.720;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"
|
||||
IDS_2160 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0"
|
||||
@@ -1077,8 +1071,13 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
#ifdef EMU_VER_PATCH
|
||||
FILEVERSION EMU_VER_MAJOR,EMU_VER_MINOR,EMU_VER_REV,EMU_VER_PATCH
|
||||
PRODUCTVERSION EMU_VER_MAJOR,EMU_VER_MINOR,EMU_VER_REV,EMU_VER_PATCH
|
||||
#else
|
||||
FILEVERSION EMU_VER_MAJOR,EMU_VER_MINOR,EMU_VER_REV,0
|
||||
PRODUCTVERSION EMU_VER_MAJOR,EMU_VER_MINOR,EMU_VER_REV,0
|
||||
#endif
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
||||
BIN
src/win/icons/.attic/amu_2.ico
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
src/win/icons/.attic/chip-32x32.ico
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
src/win/icons/.attic/chip2-32x32.ico
Normal file
|
After Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 385 KiB After Width: | Height: | Size: 385 KiB |
|
Before Width: | Height: | Size: 385 KiB After Width: | Height: | Size: 385 KiB |
BIN
src/win/icons/varcem.ico
Normal file
|
After Width: | Height: | Size: 36 KiB |
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Makefile for Windows systems using the MinGW32 environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.17 2018/03/27
|
||||
# Version: @(#)Makefile.mingw 1.0.18 2018/03/31
|
||||
#
|
||||
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
#
|
||||
@@ -240,6 +240,9 @@ else
|
||||
endif
|
||||
PREPROC := cpp
|
||||
WINDRES := windres
|
||||
ifndef CAT
|
||||
CAT := cat
|
||||
endif
|
||||
|
||||
SYSINC := -Iwin/mingw/include
|
||||
SYSLIB :=
|
||||
@@ -688,6 +691,9 @@ ifneq ($(DEBUG), y)
|
||||
@strip hello.exe
|
||||
endif
|
||||
|
||||
foo.exe: foo.o
|
||||
@$(CC) $(LDFLAGS) -o foo.exe \
|
||||
foo.o $(LIBS)
|
||||
|
||||
clean:
|
||||
@echo Cleaning objects..
|
||||
@@ -712,8 +718,8 @@ depclean:
|
||||
|
||||
depends: DEPOBJ=$(OBJ:%.o=%.d)
|
||||
depends: depclean $(OBJ:%.o=%.d)
|
||||
@-cat $(DEPOBJ) >>$(DEPFILE)
|
||||
@-rm -f $(DEPOBJ)
|
||||
@$(CAT) $(DEPOBJ) >>$(DEPFILE)
|
||||
# @-rm -f $(DEPOBJ)
|
||||
|
||||
$(DEPFILE):
|
||||
endif
|
||||
|
||||
@@ -659,25 +659,21 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(ProjectDir)\..\Include;$(ProjectDir)\..\..\mingw\include;$(ProjectDir)\..\..\mingw\include\pcap;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86</LibraryPath>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IncludePath>$(ProjectDir)\..\Include;$(ProjectDir)\..\..\mingw\include;$(ProjectDir)\..\..\mingw\include\pcap;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64</LibraryPath>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(ProjectDir)\..\Include;$(ProjectDir)\..\..\mingw\include;$(ProjectDir)\..\..\mingw\include\pcap;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86</LibraryPath>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IncludePath>$(ProjectDir)\..\Include;$(ProjectDir)\..\..\mingw\include;$(ProjectDir)\..\..\mingw\include\pcap;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64</LibraryPath>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<IncludePath>$(ProjectDir)\..\..\mingw\include;$(ProjectDir)\..\..\mingw\include\pcap;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(ProjectDir)\..\Include;$(ProjectDir)\..\..\mingw\include;$(ProjectDir)\..\..\mingw\include\pcap;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
|
||||
@@ -659,16 +659,20 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<LibraryPath>$(ProjectDir)\..\Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
@@ -756,4 +760,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<IncludePath>$(ProjectDir)\..\..\mingw\include;$(ProjectDir)\..\..\mingw\include\pcap;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(ProjectDir)\..\Include;$(ProjectDir)\..\..\mingw\include;$(ProjectDir)\..\..\mingw\include\pcap;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* NOTE: Will be moved to the tools/ folder soon.
|
||||
*
|
||||
* Version: @(#)pcap_if.rc 1.0.1 2018/02/14
|
||||
* Version: @(#)pcap_if.rc 1.0.3 2018/03/30
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -53,20 +53,12 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#endif //_WIN32
|
||||
|
||||
|
||||
/*
|
||||
* Icons by Devcore
|
||||
* - https://commons.wikimedia.org/wiki/File:Icon_PC_256x256.png
|
||||
*/
|
||||
#ifdef RELEASE_BUILD
|
||||
100 ICON DISCARDABLE "win/icons/emu-rb.ico"
|
||||
#else
|
||||
100 ICON DISCARDABLE "win/icons/emu.ico"
|
||||
#endif
|
||||
100 ICON DISCARDABLE "win/icons/varcem.ico"
|
||||
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,2,0
|
||||
PRODUCTVERSION 1,0,2,0
|
||||
FILEVERSION 1,0,3,0
|
||||
PRODUCTVERSION 1,0,3,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -81,18 +73,14 @@ BEGIN
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "IRC #VARCem on FreeNode\0"
|
||||
VALUE "FileDescription", "PCap_IF - test tool for WinPcap\0"
|
||||
VALUE "FileVersion", "1.0.2\0"
|
||||
VALUE "InternalName", "pcap_if\0"
|
||||
VALUE "LegalCopyright", "Copyright 2017,2018 Fred N. van Kempen\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "pcap_if.exe\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "WinPcap Test Tool\0"
|
||||
VALUE "ProductVersion", "1.0.2\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
VALUE "CompanyName", "IRC #VARCem on FreeNode"
|
||||
VALUE "FileDescription", "PCap_IF - test tool for WinPcap"
|
||||
VALUE "FileVersion", "1.0.3"
|
||||
VALUE "InternalName", "pcap_if"
|
||||
VALUE "LegalCopyright", "Copyright 2017,2018 Fred N. van Kempen"
|
||||
VALUE "OriginalFilename", "pcap_if.exe"
|
||||
VALUE "ProductName", "WinPcap Test Tool"
|
||||
VALUE "ProductVersion", "1.0.3"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows resource defines.
|
||||
*
|
||||
* Version: @(#)resource.h 1.0.6 2018/03/25
|
||||
* Version: @(#)resource.h 1.0.7 2018/03/31
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -249,7 +249,6 @@
|
||||
|
||||
#define IDM_ABOUT 40001
|
||||
#define IDC_ABOUT_ICON 65535
|
||||
#define IDM_ACTION_RCTRL_IS_LALT 40010
|
||||
#define IDM_ACTION_SCREENSHOT 40011
|
||||
#define IDM_ACTION_HRESET 40012
|
||||
#define IDM_ACTION_RESET_CAD 40013
|
||||
@@ -289,6 +288,7 @@
|
||||
#define IDM_VID_GRAY_AMBER 40092
|
||||
#define IDM_VID_GRAY_GREEN 40093
|
||||
#define IDM_VID_GRAY_WHITE 40094
|
||||
#define IDM_KBD_RCTRL_IS_LALT 40101
|
||||
|
||||
#define IDM_LOG_BREAKPOINT 51201
|
||||
#define IDM_DUMP_VRAM 51202 // should be an Action
|
||||
|
||||
143
src/win/win.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform main support module for Windows.
|
||||
*
|
||||
* Version: @(#)win.c 1.0.9 2018/03/20
|
||||
* Version: @(#)win.c 1.0.10 2018/03/31
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -249,10 +249,75 @@ plat_get_string(int i)
|
||||
}
|
||||
|
||||
|
||||
/* Process the commandline, and create standard argc/argv array. */
|
||||
static int
|
||||
ProcessCommandLine(wchar_t ***argw)
|
||||
{
|
||||
WCHAR *cmdline;
|
||||
wchar_t *argbuf;
|
||||
wchar_t **args;
|
||||
int argc_max;
|
||||
int i, q, argc;
|
||||
|
||||
cmdline = GetCommandLine();
|
||||
i = wcslen(cmdline) + 1;
|
||||
argbuf = (wchar_t *)malloc(sizeof(wchar_t)*i);
|
||||
wcscpy(argbuf, cmdline);
|
||||
|
||||
argc = 0;
|
||||
argc_max = 64;
|
||||
args = (wchar_t **)malloc(sizeof(wchar_t *) * argc_max);
|
||||
if (args == NULL) {
|
||||
free(argbuf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* parse commandline into argc/argv format */
|
||||
i = 0;
|
||||
while (argbuf[i]) {
|
||||
while (argbuf[i] == L' ')
|
||||
i++;
|
||||
|
||||
if (argbuf[i]) {
|
||||
if ((argbuf[i] == L'\'') || (argbuf[i] == L'"')) {
|
||||
q = argbuf[i++];
|
||||
if (!argbuf[i])
|
||||
break;
|
||||
} else
|
||||
q = 0;
|
||||
|
||||
args[argc++] = &argbuf[i];
|
||||
|
||||
if (argc >= argc_max) {
|
||||
argc_max += 64;
|
||||
args = realloc(args, sizeof(wchar_t *)*argc_max);
|
||||
if (args == NULL) {
|
||||
free(argbuf);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
while ((argbuf[i]) && ((q)
|
||||
? (argbuf[i]!=q) : (argbuf[i]!=L' '))) i++;
|
||||
|
||||
if (argbuf[i]) {
|
||||
argbuf[i] = 0;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
args[argc] = NULL;
|
||||
*argw = args;
|
||||
|
||||
return(argc);
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_WX
|
||||
/* Create a console if we don't already have one. */
|
||||
static void
|
||||
CreateConsole(int init)
|
||||
void
|
||||
plat_console(int init)
|
||||
{
|
||||
HANDLE h;
|
||||
FILE *fp;
|
||||
@@ -334,71 +399,6 @@ CreateConsole(int init)
|
||||
}
|
||||
|
||||
|
||||
/* Process the commandline, and create standard argc/argv array. */
|
||||
static int
|
||||
ProcessCommandLine(wchar_t ***argw)
|
||||
{
|
||||
WCHAR *cmdline;
|
||||
wchar_t *argbuf;
|
||||
wchar_t **args;
|
||||
int argc_max;
|
||||
int i, q, argc;
|
||||
|
||||
cmdline = GetCommandLine();
|
||||
i = wcslen(cmdline) + 1;
|
||||
argbuf = (wchar_t *)malloc(sizeof(wchar_t)*i);
|
||||
wcscpy(argbuf, cmdline);
|
||||
|
||||
argc = 0;
|
||||
argc_max = 64;
|
||||
args = (wchar_t **)malloc(sizeof(wchar_t *) * argc_max);
|
||||
if (args == NULL) {
|
||||
free(argbuf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* parse commandline into argc/argv format */
|
||||
i = 0;
|
||||
while (argbuf[i]) {
|
||||
while (argbuf[i] == L' ')
|
||||
i++;
|
||||
|
||||
if (argbuf[i]) {
|
||||
if ((argbuf[i] == L'\'') || (argbuf[i] == L'"')) {
|
||||
q = argbuf[i++];
|
||||
if (!argbuf[i])
|
||||
break;
|
||||
} else
|
||||
q = 0;
|
||||
|
||||
args[argc++] = &argbuf[i];
|
||||
|
||||
if (argc >= argc_max) {
|
||||
argc_max += 64;
|
||||
args = realloc(args, sizeof(wchar_t *)*argc_max);
|
||||
if (args == NULL) {
|
||||
free(argbuf);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
while ((argbuf[i]) && ((q)
|
||||
? (argbuf[i]!=q) : (argbuf[i]!=L' '))) i++;
|
||||
|
||||
if (argbuf[i]) {
|
||||
argbuf[i] = 0;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
args[argc] = NULL;
|
||||
*argw = args;
|
||||
|
||||
return(argc);
|
||||
}
|
||||
|
||||
|
||||
/* For the Windows platform, this is the start of the application. */
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
|
||||
@@ -424,7 +424,8 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
|
||||
set_language(0x0409);
|
||||
|
||||
/* Create console window. */
|
||||
CreateConsole(1);
|
||||
if (force_debug)
|
||||
plat_console(1);
|
||||
|
||||
/* Process the command line for options. */
|
||||
argc = ProcessCommandLine(&argw);
|
||||
@@ -432,13 +433,13 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
|
||||
/* Pre-initialize the system, this loads the config file. */
|
||||
if (! pc_init(argc, argw)) {
|
||||
/* Detach from console. */
|
||||
CreateConsole(0);
|
||||
plat_console(0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Cleanup: we may no longer need the console. */
|
||||
if (! force_debug)
|
||||
CreateConsole(0);
|
||||
plat_console(0);
|
||||
|
||||
/* Handle our GUI. */
|
||||
i = ui_init(nCmdShow);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform support defintions for Win32.
|
||||
*
|
||||
* Version: @(#)win.h 1.0.5 2018/03/08
|
||||
* Version: @(#)win.h 1.0.6 2018/03/31
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -72,9 +72,8 @@ extern HICON hIcon[512];
|
||||
|
||||
extern int status_is_open;
|
||||
|
||||
extern char openfilestring[260];
|
||||
extern WCHAR wopenfilestring[260];
|
||||
|
||||
extern char openfilestring[];
|
||||
extern WCHAR wopenfilestring[];
|
||||
extern DWORD filterindex;
|
||||
|
||||
|
||||
@@ -144,14 +143,8 @@ extern void StatusBarCreate(HWND hwndParent, uintptr_t idStatus,
|
||||
|
||||
/* Functions in win_dialog.c: */
|
||||
extern void dialog_center(HWND hdlg);
|
||||
|
||||
extern wchar_t *BrowseFolder(wchar_t *saved_path, wchar_t *title);
|
||||
|
||||
extern int file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, int save);
|
||||
extern int file_dlg(HWND hwnd, WCHAR *f, char *fn, int save);
|
||||
extern int file_dlg_mb(HWND hwnd, char *f, char *fn, int save);
|
||||
extern int file_dlg_w_st(HWND hwnd, int i, WCHAR *fn, int save);
|
||||
extern int file_dlg_st(HWND hwnd, int i, char *fn, int save);
|
||||
extern int file_dlg(HWND hwnd, WCHAR *filt, WCHAR *ifn, int save);
|
||||
extern int file_dlg_st(HWND hwnd, int i, WCHAR *fn, int save);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
*
|
||||
* Imlementation of the Device Configuration dialog.
|
||||
*
|
||||
* Version: @(#)win_devconf.c 1.0.6 2018/03/20
|
||||
* This module takes a standard 'device_config_t' structure,
|
||||
* and builds a complete Win32 DIALOG resource block in a
|
||||
* buffer in memory, and then passes that to the API handler.
|
||||
*
|
||||
* Version: @(#)win_devconf.c 1.0.7 2018/03/31
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -52,9 +56,8 @@
|
||||
#include "win.h"
|
||||
|
||||
|
||||
static device_t *config_device;
|
||||
|
||||
static uint8_t deviceconfig_changed = 0;
|
||||
static device_t *config_device;
|
||||
static uint8_t deviceconfig_changed = 0;
|
||||
|
||||
|
||||
#ifdef __amd64__
|
||||
@@ -62,10 +65,11 @@ static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
wchar_t ws[512];
|
||||
char s[512];
|
||||
HWND h;
|
||||
|
||||
int val_int;
|
||||
int id;
|
||||
int c;
|
||||
@@ -73,26 +77,20 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
int changed;
|
||||
int cid;
|
||||
const device_config_t *config;
|
||||
char s[80];
|
||||
wchar_t ws[512];
|
||||
LPTSTR lptsTemp;
|
||||
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
id = IDC_CONFIG_BASE;
|
||||
config = config_device->config;
|
||||
case WM_INITDIALOG:
|
||||
id = IDC_CONFIG_BASE;
|
||||
config = config_device->config;
|
||||
lptsTemp = (LPTSTR)malloc(512);
|
||||
|
||||
lptsTemp = (LPTSTR) malloc(512);
|
||||
while (config->type != -1) {
|
||||
const device_config_selection_t *selection = config->selection;
|
||||
h = GetDlgItem(hdlg, id);
|
||||
|
||||
while (config->type != -1)
|
||||
{
|
||||
const device_config_selection_t *selection = config->selection;
|
||||
h = GetDlgItem(hdlg, id);
|
||||
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
switch (config->type) {
|
||||
case CONFIG_BINARY:
|
||||
val_int = config_get_int((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
SendMessage(h, BM_SETCHECK, val_int, 0);
|
||||
@@ -100,12 +98,11 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
id++;
|
||||
break;
|
||||
|
||||
case CONFIG_SELECTION:
|
||||
case CONFIG_SELECTION:
|
||||
val_int = config_get_int((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
c = 0;
|
||||
while (selection->description && selection->description[0])
|
||||
{
|
||||
while (selection->description && selection->description[0]) {
|
||||
mbstowcs(lptsTemp, selection->description, strlen(selection->description) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
|
||||
if (val_int == selection->value)
|
||||
@@ -113,50 +110,45 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
selection++;
|
||||
c++;
|
||||
}
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_MIDI:
|
||||
case CONFIG_MIDI:
|
||||
val_int = config_get_int((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
num = plat_midi_get_num_devs();
|
||||
for (c = 0; c < num; c++)
|
||||
{
|
||||
for (c = 0; c < num; c++) {
|
||||
plat_midi_get_dev_name(c, s);
|
||||
mbstowcs(lptsTemp, s, strlen(s) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
|
||||
if (val_int == c)
|
||||
SendMessage(h, CB_SETCURSEL, c, 0);
|
||||
}
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_SPINNER:
|
||||
case CONFIG_SPINNER:
|
||||
val_int = config_get_int((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
_swprintf(ws, L"%i", val_int);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)ws);
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_FNAME:
|
||||
case CONFIG_FNAME:
|
||||
{
|
||||
wchar_t* str = config_get_wstring((char *)config_device->name, (char *)config->name, 0);
|
||||
if (str)
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)str);
|
||||
id += 3;
|
||||
wchar_t* str = config_get_wstring((char *)config_device->name, (char *)config->name, 0);
|
||||
if (str)
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)str);
|
||||
id += 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case CONFIG_HEX16:
|
||||
case CONFIG_HEX16:
|
||||
val_int = config_get_hex16((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
c = 0;
|
||||
while (selection->description && selection->description[0])
|
||||
{
|
||||
while (selection->description && selection->description[0]) {
|
||||
mbstowcs(lptsTemp, selection->description, strlen(selection->description) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
|
||||
if (val_int == selection->value)
|
||||
@@ -164,16 +156,14 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
selection++;
|
||||
c++;
|
||||
}
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_HEX20:
|
||||
case CONFIG_HEX20:
|
||||
val_int = config_get_hex20((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
c = 0;
|
||||
while (selection->description && selection->description[0])
|
||||
{
|
||||
while (selection->description && selection->description[0]) {
|
||||
mbstowcs(lptsTemp, selection->description, strlen(selection->description) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
|
||||
if (val_int == selection->value)
|
||||
@@ -181,44 +171,36 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
selection++;
|
||||
c++;
|
||||
}
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
}
|
||||
config++;
|
||||
}
|
||||
|
||||
free(lptsTemp);
|
||||
config++;
|
||||
}
|
||||
|
||||
free(lptsTemp);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
cid = LOWORD(wParam);
|
||||
if (cid == IDOK)
|
||||
{
|
||||
id = IDC_CONFIG_BASE;
|
||||
config = config_device->config;
|
||||
changed = 0;
|
||||
char s[512];
|
||||
case WM_COMMAND:
|
||||
cid = LOWORD(wParam);
|
||||
if (cid == IDOK) {
|
||||
id = IDC_CONFIG_BASE;
|
||||
config = config_device->config;
|
||||
changed = 0;
|
||||
|
||||
while (config->type != -1)
|
||||
{
|
||||
const device_config_selection_t *selection = config->selection;
|
||||
h = GetDlgItem(hdlg, id);
|
||||
while (config->type != -1) {
|
||||
const device_config_selection_t *selection = config->selection;
|
||||
h = GetDlgItem(hdlg, id);
|
||||
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
switch (config->type) {
|
||||
case CONFIG_BINARY:
|
||||
val_int = config_get_int((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
if (val_int != SendMessage(h, BM_GETCHECK, 0, 0))
|
||||
changed = 1;
|
||||
|
||||
id++;
|
||||
break;
|
||||
|
||||
case CONFIG_SELECTION:
|
||||
case CONFIG_SELECTION:
|
||||
val_int = config_get_int((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
@@ -228,33 +210,30 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (val_int != selection->value)
|
||||
changed = 1;
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_MIDI:
|
||||
case CONFIG_MIDI:
|
||||
val_int = config_get_int((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
|
||||
if (val_int != c)
|
||||
changed = 1;
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_FNAME:
|
||||
case CONFIG_FNAME:
|
||||
{
|
||||
char* str = config_get_string((char *)config_device->name, (char *)config->name, (char*)"");
|
||||
SendMessage(h, WM_GETTEXT, 511, (LPARAM)s);
|
||||
if (strcmp(str, s))
|
||||
char* str = config_get_string((char *)config_device->name, (char *)config->name, (char*)"");
|
||||
SendMessage(h, WM_GETTEXT, 511, (LPARAM)s);
|
||||
if (strcmp(str, s))
|
||||
changed = 1;
|
||||
|
||||
id += 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case CONFIG_SPINNER:
|
||||
case CONFIG_SPINNER:
|
||||
val_int = config_get_int((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
if (val_int > config->spinner.max)
|
||||
val_int = config->spinner.max;
|
||||
@@ -267,11 +246,10 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (val_int != c)
|
||||
changed = 1;
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_HEX16:
|
||||
case CONFIG_HEX16:
|
||||
val_int = config_get_hex16((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
@@ -281,11 +259,10 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (val_int != selection->value)
|
||||
changed = 1;
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_HEX20:
|
||||
case CONFIG_HEX20:
|
||||
val_int = config_get_hex20((char *)config_device->name, (char *)config->name, config->default_int);
|
||||
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
@@ -295,39 +272,35 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (val_int != selection->value)
|
||||
changed = 1;
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
}
|
||||
config++;
|
||||
}
|
||||
config++;
|
||||
}
|
||||
|
||||
if (!changed)
|
||||
{
|
||||
deviceconfig_changed = 0;
|
||||
EndDialog(hdlg, 0);
|
||||
return TRUE;
|
||||
}
|
||||
if (! changed) {
|
||||
deviceconfig_changed = 0;
|
||||
EndDialog(hdlg, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
deviceconfig_changed = 1;
|
||||
deviceconfig_changed = 1;
|
||||
|
||||
id = IDC_CONFIG_BASE;
|
||||
config = config_device->config;
|
||||
id = IDC_CONFIG_BASE;
|
||||
config = config_device->config;
|
||||
|
||||
while (config->type != -1)
|
||||
{
|
||||
const device_config_selection_t *selection = config->selection;
|
||||
h = GetDlgItem(hdlg, id);
|
||||
while (config->type != -1) {
|
||||
const device_config_selection_t *selection = config->selection;
|
||||
h = GetDlgItem(hdlg, id);
|
||||
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
switch (config->type) {
|
||||
case CONFIG_BINARY:
|
||||
config_set_int((char *)config_device->name, (char *)config->name, SendMessage(h, BM_GETCHECK, 0, 0));
|
||||
|
||||
id++;
|
||||
break;
|
||||
|
||||
case CONFIG_SELECTION:
|
||||
case CONFIG_SELECTION:
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
for (; c > 0; c--)
|
||||
selection++;
|
||||
@@ -336,21 +309,21 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_MIDI:
|
||||
case CONFIG_MIDI:
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
config_set_int((char *)config_device->name, (char *)config->name, c);
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_FNAME:
|
||||
case CONFIG_FNAME:
|
||||
SendMessage(h, WM_GETTEXT, 511, (LPARAM)ws);
|
||||
config_set_wstring((char *)config_device->name, (char *)config->name, ws);
|
||||
|
||||
id += 3;
|
||||
break;
|
||||
|
||||
case CONFIG_SPINNER:
|
||||
case CONFIG_SPINNER:
|
||||
SendMessage(h, WM_GETTEXT, 79, (LPARAM)ws);
|
||||
wcstombs(s, ws, 79);
|
||||
sscanf(s, "%i", &c);
|
||||
@@ -364,7 +337,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_HEX16:
|
||||
case CONFIG_HEX16:
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
for (; c > 0; c--)
|
||||
selection++;
|
||||
@@ -373,7 +346,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_HEX20:
|
||||
case CONFIG_HEX20:
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
for (; c > 0; c--)
|
||||
selection++;
|
||||
@@ -381,139 +354,127 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
}
|
||||
config++;
|
||||
}
|
||||
config++;
|
||||
}
|
||||
|
||||
EndDialog(hdlg, 0);
|
||||
return TRUE;
|
||||
}
|
||||
else if (cid == IDCANCEL)
|
||||
{
|
||||
deviceconfig_changed = 0;
|
||||
EndDialog(hdlg, 0);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
int id = IDC_CONFIG_BASE;
|
||||
const device_config_t *config = config_device->config;
|
||||
EndDialog(hdlg, 0);
|
||||
return TRUE;
|
||||
} else if (cid == IDCANCEL) {
|
||||
deviceconfig_changed = 0;
|
||||
EndDialog(hdlg, 0);
|
||||
return TRUE;
|
||||
} else {
|
||||
int id = IDC_CONFIG_BASE;
|
||||
const device_config_t *config = config_device->config;
|
||||
|
||||
while (config->type != -1)
|
||||
{
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
while (config->type != -1) {
|
||||
switch (config->type) {
|
||||
case CONFIG_BINARY:
|
||||
id++;
|
||||
break;
|
||||
|
||||
case CONFIG_SELECTION:
|
||||
case CONFIG_MIDI:
|
||||
case CONFIG_SPINNER:
|
||||
case CONFIG_SELECTION:
|
||||
case CONFIG_MIDI:
|
||||
case CONFIG_SPINNER:
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
case CONFIG_FNAME:
|
||||
{
|
||||
if (cid == id+1)
|
||||
{
|
||||
char s[512];
|
||||
s[0] = 0;
|
||||
int c, d;
|
||||
HWND h = GetDlgItem(hdlg, id);
|
||||
SendMessage(h, WM_GETTEXT, 511, (LPARAM)s);
|
||||
char file_filter[512];
|
||||
file_filter[0] = 0;
|
||||
case CONFIG_FNAME:
|
||||
if (cid == id+1) {
|
||||
int c, d;
|
||||
HWND h = GetDlgItem(hdlg, id);
|
||||
SendMessage(h, WM_GETTEXT, 511, (LPARAM)s);
|
||||
char file_filter[512];
|
||||
file_filter[0] = 0;
|
||||
|
||||
c = 0;
|
||||
while (config->file_filter[c].description && config->file_filter[c].description[0])
|
||||
{
|
||||
if (c > 0)
|
||||
strcat(file_filter, "|");
|
||||
strcat(file_filter, config->file_filter[c].description);
|
||||
strcat(file_filter, " (");
|
||||
d = 0;
|
||||
while (config->file_filter[c].extensions[d] && config->file_filter[c].extensions[d][0])
|
||||
{
|
||||
c = 0;
|
||||
while (config->file_filter[c].description && config->file_filter[c].description[0]) {
|
||||
if (c > 0)
|
||||
strcat(file_filter, "|");
|
||||
strcat(file_filter, config->file_filter[c].description);
|
||||
strcat(file_filter, " (");
|
||||
d = 0;
|
||||
while (config->file_filter[c].extensions[d] && config->file_filter[c].extensions[d][0]) {
|
||||
if (d > 0)
|
||||
strcat(file_filter, ";");
|
||||
strcat(file_filter, "*.");
|
||||
strcat(file_filter, config->file_filter[c].extensions[d]);
|
||||
d++;
|
||||
}
|
||||
strcat(file_filter, ")|");
|
||||
d = 0;
|
||||
while (config->file_filter[c].extensions[d] && config->file_filter[c].extensions[d][0])
|
||||
{
|
||||
if (d > 0)
|
||||
strcat(file_filter, ";");
|
||||
strcat(file_filter, "*.");
|
||||
strcat(file_filter, config->file_filter[c].extensions[d]);
|
||||
d++;
|
||||
}
|
||||
c++;
|
||||
strcat(file_filter, ";");
|
||||
strcat(file_filter, "*.");
|
||||
strcat(file_filter, config->file_filter[c].extensions[d]);
|
||||
d++;
|
||||
}
|
||||
strcat(file_filter, "|All files (*.*)|*.*|");
|
||||
mbstowcs(ws, file_filter, strlen(file_filter) + 1);
|
||||
d = strlen(file_filter);
|
||||
|
||||
/* replace | with \0 */
|
||||
for (c = 0; c < d; ++c)
|
||||
if (ws[c] == L'|')
|
||||
ws[c] = 0;
|
||||
|
||||
if (!file_dlg(hdlg, ws, s, 0))
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)wopenfilestring);
|
||||
strcat(file_filter, ")|");
|
||||
d = 0;
|
||||
while (config->file_filter[c].extensions[d] && config->file_filter[c].extensions[d][0]) {
|
||||
if (d > 0)
|
||||
strcat(file_filter, ";");
|
||||
strcat(file_filter, "*.");
|
||||
strcat(file_filter, config->file_filter[c].extensions[d]);
|
||||
d++;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
config++;
|
||||
strcat(file_filter, "|All files (*.*)|*.*|");
|
||||
mbstowcs(ws, file_filter, strlen(file_filter) + 1);
|
||||
d = strlen(file_filter);
|
||||
|
||||
/* replace | with \0 */
|
||||
for (c = 0; c < d; ++c)
|
||||
if (ws[c] == L'|')
|
||||
ws[c] = 0;
|
||||
|
||||
if (! file_dlg(hdlg, ws, L"", 0))
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)wopenfilestring);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
config++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
|
||||
uint8_t
|
||||
deviceconfig_open(HWND hwnd, device_t *device)
|
||||
{
|
||||
const device_config_t *config = device->config;
|
||||
uint16_t *data_block = malloc(16384);
|
||||
uint16_t *data;
|
||||
DLGTEMPLATE *dlg = (DLGTEMPLATE *)data_block;
|
||||
DLGITEMTEMPLATE *item;
|
||||
int y = 10;
|
||||
int id = IDC_CONFIG_BASE;
|
||||
const device_config_t *config = device->config;
|
||||
uint16_t *data_block = malloc(16384);
|
||||
uint16_t *data;
|
||||
DLGTEMPLATE *dlg = (DLGTEMPLATE *)data_block;
|
||||
DLGITEMTEMPLATE *item;
|
||||
int y = 10;
|
||||
int id = IDC_CONFIG_BASE;
|
||||
|
||||
deviceconfig_changed = 0;
|
||||
deviceconfig_changed = 0;
|
||||
|
||||
memset(data_block, 0, 4096);
|
||||
memset(data_block, 0x00, sizeof(16384));
|
||||
|
||||
dlg->style = DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU;
|
||||
dlg->x = 10;
|
||||
dlg->y = 10;
|
||||
dlg->cx = 220;
|
||||
dlg->cy = 70;
|
||||
dlg->style = DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | \
|
||||
WS_POPUP | WS_CAPTION | WS_SYSMENU;
|
||||
dlg->x = 10;
|
||||
dlg->y = 10;
|
||||
dlg->cx = 220;
|
||||
dlg->cy = 70;
|
||||
|
||||
data = (uint16_t *)(dlg + 1);
|
||||
data = (uint16_t *)(dlg + 1);
|
||||
|
||||
*data++ = 0; /*no menu*/
|
||||
*data++ = 0; /*predefined dialog box class*/
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Device Configuration", -1, data, 50);
|
||||
*data++ = 0; /*no menu*/
|
||||
*data++ = 0; /*predefined dialog box class*/
|
||||
data += MultiByteToWideChar(CP_ACP, 0,
|
||||
"Device Configuration", -1, data, 50);
|
||||
|
||||
*data++ = 9; /*Point*/
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Segoe UI", -1, data, 50);
|
||||
*data++ = 9; /*Point*/
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Segoe UI", -1, data, 50);
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
while (config->type != -1)
|
||||
{
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
while (config->type != -1) {
|
||||
switch (config->type) {
|
||||
case CONFIG_BINARY:
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 10;
|
||||
item->y = y;
|
||||
@@ -528,16 +489,17 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0080; /* button class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
|
||||
data += MultiByteToWideChar(CP_ACP, 0,
|
||||
config->description, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
y += 20;
|
||||
break;
|
||||
|
||||
case CONFIG_SELECTION:
|
||||
case CONFIG_MIDI:
|
||||
case CONFIG_HEX16:
|
||||
case CONFIG_HEX20:
|
||||
case CONFIG_SELECTION:
|
||||
case CONFIG_MIDI:
|
||||
case CONFIG_HEX16:
|
||||
case CONFIG_HEX20:
|
||||
/*Combo box*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 70;
|
||||
@@ -547,13 +509,15 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
item->cx = 140;
|
||||
item->cy = 150;
|
||||
|
||||
item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL;
|
||||
item->style = WS_CHILD | WS_VISIBLE | \
|
||||
CBS_DROPDOWN | WS_VSCROLL;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0085; /* combo box class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
|
||||
data += MultiByteToWideChar(CP_ACP, 0,
|
||||
config->description, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
@@ -574,7 +538,8 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0082; /* static class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
|
||||
data += MultiByteToWideChar(CP_ACP, 0,
|
||||
config->description, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
@@ -583,7 +548,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
y += 20;
|
||||
break;
|
||||
|
||||
case CONFIG_SPINNER:
|
||||
case CONFIG_SPINNER:
|
||||
/*Spinner*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 70;
|
||||
@@ -593,14 +558,16 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
item->cx = 140;
|
||||
item->cy = 14;
|
||||
|
||||
item->style = WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_NUMBER;
|
||||
item->style = WS_CHILD | WS_VISIBLE | \
|
||||
ES_AUTOHSCROLL | ES_NUMBER;
|
||||
item->dwExtendedStyle = WS_EX_CLIENTEDGE;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0081; /* edit text class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "", -1, data, 256);
|
||||
data += MultiByteToWideChar(CP_ACP, 0,
|
||||
"", -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
@@ -622,7 +589,8 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0082; /* static class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
|
||||
data += MultiByteToWideChar(CP_ACP, 0,
|
||||
config->description, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
@@ -631,7 +599,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
y += 20;
|
||||
break;
|
||||
|
||||
case CONFIG_FNAME:
|
||||
case CONFIG_FNAME:
|
||||
/*File*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 70;
|
||||
@@ -648,7 +616,8 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0081; /* edit text class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "", -1, data, 256);
|
||||
data += MultiByteToWideChar(CP_ACP, 0,
|
||||
"", -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
@@ -669,7 +638,8 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0080; /* button class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Browse", -1, data, 256);
|
||||
data += MultiByteToWideChar(CP_ACP, 0,
|
||||
"Browse", -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
@@ -690,7 +660,8 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0082; /* static class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
|
||||
data += MultiByteToWideChar(CP_ACP, 0,
|
||||
config->description, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
@@ -698,56 +669,56 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
|
||||
y += 20;
|
||||
break;
|
||||
}
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
config++;
|
||||
}
|
||||
|
||||
dlg->cdit = (id - IDC_CONFIG_BASE) + 2;
|
||||
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 20;
|
||||
item->y = y;
|
||||
item->cx = 50;
|
||||
item->cy = 14;
|
||||
item->id = IDOK; /* OK button identifier */
|
||||
item->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0080; /* button class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "OK", -1, data, 50);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 80;
|
||||
item->y = y;
|
||||
item->cx = 50;
|
||||
item->cy = 14;
|
||||
item->id = IDCANCEL; /* OK button identifier */
|
||||
item->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON;
|
||||
config++;
|
||||
}
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0080; /* button class */
|
||||
dlg->cdit = (id - IDC_CONFIG_BASE) + 2;
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Cancel", -1, data, 50);
|
||||
*data++ = 0; /* no creation data */
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 20;
|
||||
item->y = y;
|
||||
item->cx = 50;
|
||||
item->cy = 14;
|
||||
item->id = IDOK; /* OK button identifier */
|
||||
item->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON;
|
||||
|
||||
dlg->cy = y + 20;
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0080; /* button class */
|
||||
|
||||
config_device = device;
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "OK", -1, data, 50);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
DialogBoxIndirect(hinstance, dlg, hwnd, deviceconfig_dlgproc);
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
free(data_block);
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 80;
|
||||
item->y = y;
|
||||
item->cx = 50;
|
||||
item->cy = 14;
|
||||
item->id = IDCANCEL; /* OK button identifier */
|
||||
item->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON;
|
||||
|
||||
return deviceconfig_changed;
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0080; /* button class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Cancel", -1, data, 50);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
dlg->cy = y + 20;
|
||||
|
||||
config_device = device;
|
||||
|
||||
DialogBoxIndirect(hinstance, dlg, hwnd, dlg_proc);
|
||||
|
||||
free(data_block);
|
||||
|
||||
return deviceconfig_changed;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of server several dialogs.
|
||||
*
|
||||
* Version: @(#)win_dialog.c 1.0.4 2018/03/08
|
||||
* Version: @(#)win_dialog.c 1.0.5 2018/03/31
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -53,22 +53,12 @@
|
||||
#include "win.h"
|
||||
|
||||
|
||||
WCHAR path[MAX_PATH];
|
||||
WCHAR wopenfilestring[260];
|
||||
char openfilestring[260];
|
||||
WCHAR wopenfilestring[1024];
|
||||
char openfilestring[1024];
|
||||
DWORD filterindex = 0;
|
||||
|
||||
|
||||
static int CALLBACK
|
||||
BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
||||
{
|
||||
if (uMsg == BFFM_INITIALIZED)
|
||||
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* Center a dialog window with respect to the main window. */
|
||||
void
|
||||
dialog_center(HWND hdlg)
|
||||
{
|
||||
@@ -96,37 +86,6 @@ dialog_center(HWND hdlg)
|
||||
}
|
||||
|
||||
|
||||
wchar_t *
|
||||
BrowseFolder(wchar_t *saved_path, wchar_t *title)
|
||||
{
|
||||
BROWSEINFO bi = { 0 };
|
||||
LPITEMIDLIST pidl;
|
||||
IMalloc *imalloc;
|
||||
|
||||
bi.lpszTitle = title;
|
||||
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
|
||||
bi.lpfn = BrowseCallbackProc;
|
||||
bi.lParam = (LPARAM) saved_path;
|
||||
|
||||
pidl = SHBrowseForFolder(&bi);
|
||||
if (pidl != 0) {
|
||||
/* Get the name of the folder and put it in path. */
|
||||
SHGetPathFromIDList(pidl, path);
|
||||
|
||||
/* Free memory used. */
|
||||
imalloc = 0;
|
||||
if (SUCCEEDED(SHGetMalloc(&imalloc))) {
|
||||
imalloc->lpVtbl->Free(imalloc, pidl);
|
||||
imalloc->lpVtbl->Release(imalloc);
|
||||
}
|
||||
|
||||
return(path);
|
||||
}
|
||||
|
||||
return(L"");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ui_msgbox(int flags, void *arg)
|
||||
{
|
||||
@@ -209,101 +168,78 @@ ui_msgbox(int flags, void *arg)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
int
|
||||
msgbox_reset_yn(HWND hwnd)
|
||||
{
|
||||
return(MessageBox(hwnd, plat_get_string(IDS_2051),
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, int save)
|
||||
file_dlg(HWND hwnd, WCHAR *filt, WCHAR *ifn, int save)
|
||||
{
|
||||
OPENFILENAME ofn;
|
||||
wchar_t fn[1024];
|
||||
char temp[1024];
|
||||
BOOL r;
|
||||
/* DWORD err; */
|
||||
DWORD err;
|
||||
|
||||
/* Initialize OPENFILENAME */
|
||||
ZeroMemory(&ofn, sizeof(ofn));
|
||||
/* Clear out the ("initial") pathname. */
|
||||
memset(fn, 0x00, sizeof(fn));
|
||||
|
||||
/* Initialize OPENFILENAME. */
|
||||
memset(&ofn, 0x00, sizeof(OPENFILENAME));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hwndOwner = hwnd;
|
||||
ofn.lpstrFile = wopenfilestring;
|
||||
|
||||
/*
|
||||
* Set lpstrFile[0] to '\0' so that GetOpenFileName does
|
||||
* not use the contents of szFile to initialize itself.
|
||||
*/
|
||||
memcpy(ofn.lpstrFile, fn, (wcslen(fn) << 1) + 2);
|
||||
ofn.nMaxFile = 259;
|
||||
ofn.lpstrFilter = f;
|
||||
/* This is the buffer in which to place the resulting filename. */
|
||||
ofn.lpstrFile = fn;
|
||||
ofn.nMaxFile = sizeof_w(fn);
|
||||
|
||||
/* Set up the "file types" filter. */
|
||||
ofn.lpstrFilter = filt;
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.lpstrFileTitle = NULL;
|
||||
ofn.nMaxFileTitle = 0;
|
||||
ofn.lpstrInitialDir = NULL;
|
||||
|
||||
/* Tell the dialog where to go initially. */
|
||||
ofn.lpstrInitialDir = usr_path;
|
||||
|
||||
/* Set up the flags for this dialog. */
|
||||
ofn.Flags = OFN_PATHMUSTEXIST;
|
||||
if (! save)
|
||||
ofn.Flags |= OFN_FILEMUSTEXIST;
|
||||
|
||||
/* Display the Open dialog box. */
|
||||
if (save) {
|
||||
// pclog("GetSaveFileName - lpstrFile = %s\n", ofn.lpstrFile);
|
||||
if (save)
|
||||
r = GetSaveFileName(&ofn);
|
||||
} else {
|
||||
// pclog("GetOpenFileName - lpstrFile = %s\n", ofn.lpstrFile);
|
||||
else
|
||||
r = GetOpenFileName(&ofn);
|
||||
}
|
||||
|
||||
/* OK, just to make sure the dialog did not change our CWD. */
|
||||
plat_chdir(usr_path);
|
||||
|
||||
if (r) {
|
||||
/* All good, see if we can make this a relative path. */
|
||||
pc_path(wopenfilestring, sizeof_w(wopenfilestring), fn);
|
||||
|
||||
/* All good, create an ASCII copy of the string as well. */
|
||||
wcstombs(openfilestring, wopenfilestring, sizeof(openfilestring));
|
||||
|
||||
/* Remember the file type for next time. */
|
||||
filterindex = ofn.nFilterIndex;
|
||||
// pclog("File dialog return true\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* pclog("File dialog return false\n"); */
|
||||
/* err = CommDlgExtendedError();
|
||||
pclog("CommDlgExtendedError return %04X\n", err); */
|
||||
/* If an error occurred, log this. */
|
||||
err = CommDlgExtendedError();
|
||||
if (err != NO_ERROR) {
|
||||
sprintf(temp, "OpenFile(%ls, %d):\n\n error 0x%08lx",
|
||||
usr_path, save, err);
|
||||
pclog("%s\n", temp);
|
||||
(void)ui_msgbox(MBX_ERROR|MBX_ANSI, temp);
|
||||
}
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
file_dlg(HWND hwnd, WCHAR *f, char *fn, int save)
|
||||
{
|
||||
WCHAR ufn[512];
|
||||
|
||||
mbstowcs(ufn, fn, strlen(fn) + 1);
|
||||
|
||||
return(file_dlg_w(hwnd, f, ufn, save));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
file_dlg_mb(HWND hwnd, char *f, char *fn, int save)
|
||||
{
|
||||
WCHAR uf[512], ufn[512];
|
||||
|
||||
mbstowcs(uf, f, strlen(fn) + 1);
|
||||
mbstowcs(ufn, fn, strlen(fn) + 1);
|
||||
|
||||
return(file_dlg_w(hwnd, uf, ufn, save));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
file_dlg_w_st(HWND hwnd, int id, WCHAR *fn, int save)
|
||||
{
|
||||
return(file_dlg_w(hwnd, plat_get_string(id), fn, save));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
file_dlg_st(HWND hwnd, int id, char *fn, int save)
|
||||
file_dlg_st(HWND hwnd, int id, WCHAR *fn, int save)
|
||||
{
|
||||
return(file_dlg(hwnd, plat_get_string(id), fn, save));
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the New Floppy Image dialog.
|
||||
*
|
||||
* Version: @(#)win_new_floppy.c 1.0.8 2018/03/18
|
||||
* Version: @(#)win_new_floppy.c 1.0.9 2018/03/31
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -643,7 +643,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return TRUE;
|
||||
|
||||
case IDC_CFILE:
|
||||
if (!file_dlg_w(hdlg, plat_get_string(is_zip ? IDS_2176 : IDS_2174), L"", 1)) {
|
||||
if (!file_dlg(hdlg, plat_get_string(is_zip ? IDS_2176 : IDS_2174), L"", 1)) {
|
||||
if (!wcschr(wopenfilestring, L'.')) {
|
||||
if (wcslen(wopenfilestring) && (wcslen(wopenfilestring) <= 256)) {
|
||||
twcs = &wopenfilestring[wcslen(wopenfilestring)];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Settings dialog.
|
||||
*
|
||||
* Version: @(#)win_settings.c 1.0.15 2018/03/28
|
||||
* Version: @(#)win_settings.c 1.0.17 2018/03/31
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -2122,11 +2122,11 @@ static uint8_t next_free_ide_channel(void)
|
||||
|
||||
static void next_free_scsi_id_and_lun(uint8_t *id, uint8_t *lun)
|
||||
{
|
||||
uint8_t i, j;
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (!(scsi_tracking[i] & (0xffLL << (j << 3LL)))) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
for (j = 0; j < 8; j++) {
|
||||
if (! (scsi_tracking[i] & (0xffULL << (j << 3LL)))) {
|
||||
*id = i;
|
||||
*lun = j;
|
||||
return;
|
||||
@@ -2697,11 +2697,12 @@ static uint64_t hdconf_initialize_hdt_combo(HWND hdlg)
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE);
|
||||
for (i = 0; i < 127; i++)
|
||||
{
|
||||
temp_size = hdd_table[i][0] * hdd_table[i][1] * hdd_table[i][2];
|
||||
temp_size = hdd_table[i].cyls * hdd_table[i].head * hdd_table[i].sect;
|
||||
size_mb = temp_size >> 11;
|
||||
swprintf(szText, 255, plat_get_string(IDS_2157), size_mb, hdd_table[i][0], hdd_table[i][1], hdd_table[i][2]);
|
||||
swprintf(szText, 255, plat_get_string(IDS_2157), size_mb,
|
||||
hdd_table[i].cyls, hdd_table[i].head, hdd_table[i].sect);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText);
|
||||
if ((tracks == hdd_table[i][0]) && (hpc == hdd_table[i][1]) && (spt == hdd_table[i][2]))
|
||||
if ((tracks == hdd_table[i].cyls) && (hpc == hdd_table[i].head) && (spt == hdd_table[i].sect))
|
||||
{
|
||||
selection = i;
|
||||
}
|
||||
@@ -2721,7 +2722,7 @@ static void recalc_selection(HWND hdlg)
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE);
|
||||
for (i = 0; i < 127; i++)
|
||||
{
|
||||
if ((tracks == hdd_table[i][0]) && (hpc == hdd_table[i][1]) && (spt == hdd_table[i][2]))
|
||||
if ((tracks == hdd_table[i].cyls) && (hpc == hdd_table[i].head) && (spt == hdd_table[i].sect))
|
||||
{
|
||||
selection = i;
|
||||
}
|
||||
@@ -2742,6 +2743,7 @@ static BOOL CALLBACK
|
||||
#endif
|
||||
hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
char buf[512], *big_buf;
|
||||
HWND h = INVALID_HANDLE_VALUE;
|
||||
uint64_t i = 0;
|
||||
uint64_t temp;
|
||||
@@ -2750,8 +2752,6 @@ hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
uint32_t zero = 0;
|
||||
uint32_t base = 0x1000;
|
||||
uint64_t signature = 0xD778A82044445459ll;
|
||||
char buf[512];
|
||||
char *big_buf;
|
||||
int b = 0;
|
||||
uint64_t r = 0;
|
||||
uint8_t channel = 0;
|
||||
@@ -2784,6 +2784,7 @@ hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
set_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, tracks);
|
||||
size = (tracks * hpc * spt) << 9;
|
||||
set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, size >> 20);
|
||||
|
||||
hdconf_initialize_hdt_combo(hdlg);
|
||||
if (existing & 1)
|
||||
{
|
||||
@@ -2803,7 +2804,9 @@ hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
chs_enabled = 1;
|
||||
}
|
||||
|
||||
add_locations(hdlg);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS);
|
||||
if (existing & 2)
|
||||
{
|
||||
@@ -2820,6 +2823,7 @@ hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
SendMessage(h, CB_SETCURSEL, hdd_ptr->bus, 0);
|
||||
max_tracks = 266305;
|
||||
recalc_location_controls(hdlg, 1, 0);
|
||||
|
||||
if (existing & 2)
|
||||
{
|
||||
/* We're functioning as a load image dialog for a removable SCSI hard disk,
|
||||
@@ -2898,15 +2902,19 @@ hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
else if ((wcslen(hd_file_name) == 0) && (hdd_ptr->bus == HDD_BUS_SCSI_REMOVABLE))
|
||||
{
|
||||
/* Mark hard disk added but return empty - it will signify the disk was ejected. */
|
||||
hdd_ptr->spt = hdd_ptr->hpc = hdd_ptr->tracks = 0;
|
||||
hdd_ptr->tracks = 0;
|
||||
hdd_ptr->spt = hdd_ptr->hpc = 0;
|
||||
memset(hdd_ptr->fn, 0, sizeof(hdd_ptr->fn));
|
||||
|
||||
goto hd_add_ok_common;
|
||||
}
|
||||
|
||||
get_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, &(hdd_ptr->spt));
|
||||
get_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, &(hdd_ptr->hpc));
|
||||
get_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, &(hdd_ptr->tracks));
|
||||
get_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, &i);
|
||||
hdd_ptr->spt = (uint8_t)i;
|
||||
get_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, &i);
|
||||
hdd_ptr->hpc = (uint8_t)i;
|
||||
get_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, &i);
|
||||
hdd_ptr->tracks = (uint16_t)i;
|
||||
spt = hdd_ptr->spt;
|
||||
hpc = hdd_ptr->hpc;
|
||||
tracks = hdd_ptr->tracks;
|
||||
@@ -3071,7 +3079,7 @@ hd_add_ok_common:
|
||||
return TRUE;
|
||||
|
||||
case IDC_CFILE:
|
||||
if (!file_dlg_w(hdlg, plat_get_string(IDS_4106), L"", !(existing & 1)))
|
||||
if (!file_dlg(hdlg, plat_get_string(IDS_4106), L"", !(existing & 1)))
|
||||
{
|
||||
if (!wcschr(wopenfilestring, L'.')) {
|
||||
if (wcslen(wopenfilestring) && (wcslen(wopenfilestring) <= 256)) {
|
||||
@@ -3324,9 +3332,9 @@ hdd_add_file_open_error:
|
||||
if ((temp != selection) && (temp != 127) && (temp != 128))
|
||||
{
|
||||
selection = temp;
|
||||
tracks = hdd_table[selection][0];
|
||||
hpc = hdd_table[selection][1];
|
||||
spt = hdd_table[selection][2];
|
||||
tracks = hdd_table[selection].cyls;
|
||||
hpc = hdd_table[selection].head;
|
||||
spt = hdd_table[selection].sect;
|
||||
size = (tracks * hpc * spt) << 9;
|
||||
set_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, tracks);
|
||||
set_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, hpc);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Status Bar module.
|
||||
*
|
||||
* Version: @(#)win_stbar.c 1.0.4 2018/03/18
|
||||
* Version: @(#)win_stbar.c 1.0.5 2018/03/31
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -1023,7 +1023,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if ((part == -1) || (sb_menu_handles == NULL))
|
||||
break;
|
||||
|
||||
ret = file_dlg_w_st(hwnd, IDS_2159, floppyfns[id], 0);
|
||||
ret = file_dlg_st(hwnd, IDS_2159, floppyfns[id], 0);
|
||||
if (! ret)
|
||||
ui_sb_mount_floppy_img(id, part, (item_id == IDM_FLOPPY_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring);
|
||||
break;
|
||||
@@ -1048,7 +1048,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if ((part == -1) || (sb_menu_handles == NULL))
|
||||
break;
|
||||
|
||||
ret = file_dlg_w_st(hwnd, IDS_2173, floppyfns[id], 1);
|
||||
ret = file_dlg_st(hwnd, IDS_2173, floppyfns[id], 1);
|
||||
if (! ret) {
|
||||
plat_pause(1);
|
||||
ret = d86f_export(id, wopenfilestring);
|
||||
@@ -1086,7 +1086,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if ((part == -1) || (sb_menu_handles == NULL))
|
||||
break;
|
||||
|
||||
if (!file_dlg_w_st(hwnd, IDS_2075, cdrom_image[id].image_path, 0)) {
|
||||
if (!file_dlg_st(hwnd, IDS_2075, cdrom_image[id].image_path, 0)) {
|
||||
cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive;
|
||||
wcscpy(temp_path, wopenfilestring);
|
||||
if (!cdrom_image[id].prev_image_path)
|
||||
@@ -1164,7 +1164,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if ((part == -1) || (sb_menu_handles == NULL))
|
||||
break;
|
||||
|
||||
ret = file_dlg_w_st(hwnd, IDS_2175, zip_drives[id].image_path, 0);
|
||||
ret = file_dlg_st(hwnd, IDS_2175, zip_drives[id].image_path, 0);
|
||||
if (! ret)
|
||||
ui_sb_mount_zip_img(id, part, (item_id == IDM_ZIP_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring);
|
||||
break;
|
||||
@@ -1197,7 +1197,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_RDISK_IMAGE:
|
||||
case IDM_RDISK_IMAGE_WP:
|
||||
id = item_params & 0x001f;
|
||||
ret = file_dlg_w_st(hwnd, IDS_4106, hdd[id].fn, id);
|
||||
ret = file_dlg_st(hwnd, IDS_4106, hdd[id].fn, id);
|
||||
if (!ret) {
|
||||
removable_disk_unload(id);
|
||||
memset(hdd[id].fn, 0, sizeof(hdd[id].fn));
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implement the user Interface module.
|
||||
*
|
||||
* Version: @(#)win_ui.c 1.0.7 2018/03/20
|
||||
* Version: @(#)win_ui.c 1.0.8 2018/03/31
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -151,7 +151,7 @@ ResetAllMenus(void)
|
||||
EnableMenuItem(menuMain, IDM_CONFIG_SAVE, MF_DISABLED);
|
||||
#endif
|
||||
|
||||
CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, MF_UNCHECKED);
|
||||
CheckMenuItem(menuMain, IDM_KBD_RCTRL_IS_LALT, MF_UNCHECKED);
|
||||
|
||||
CheckMenuItem(menuMain, IDM_UPDATE_ICONS, MF_UNCHECKED);
|
||||
|
||||
@@ -213,7 +213,7 @@ ResetAllMenus(void)
|
||||
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+3, MF_UNCHECKED);
|
||||
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+4, MF_UNCHECKED);
|
||||
|
||||
CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, rctrl_is_lalt ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(menuMain, IDM_KBD_RCTRL_IS_LALT, rctrl_is_lalt ? MF_CHECKED : MF_UNCHECKED);
|
||||
|
||||
CheckMenuItem(menuMain, IDM_UPDATE_ICONS, update_icons ? MF_CHECKED : MF_UNCHECKED);
|
||||
|
||||
@@ -331,12 +331,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
keyboard_send_cae();
|
||||
break;
|
||||
|
||||
case IDM_ACTION_RCTRL_IS_LALT:
|
||||
rctrl_is_lalt ^= 1;
|
||||
CheckMenuItem(hmenu, IDM_ACTION_RCTRL_IS_LALT, rctrl_is_lalt ? MF_CHECKED : MF_UNCHECKED);
|
||||
config_save();
|
||||
break;
|
||||
|
||||
case IDM_ACTION_PAUSE:
|
||||
plat_pause(dopause ^ 1);
|
||||
CheckMenuItem(menuMain, IDM_ACTION_PAUSE, dopause ? MF_CHECKED : MF_UNCHECKED);
|
||||
@@ -510,6 +504,12 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
config_save();
|
||||
break;
|
||||
|
||||
case IDM_KBD_RCTRL_IS_LALT:
|
||||
rctrl_is_lalt ^= 1;
|
||||
CheckMenuItem(hmenu, IDM_KBD_RCTRL_IS_LALT, rctrl_is_lalt ? MF_CHECKED : MF_UNCHECKED);
|
||||
config_save();
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
# ifdef ENABLE_BUSLOGIC_LOG
|
||||
case IDM_LOG_BUSLOGIC:
|
||||
@@ -575,7 +575,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case IDM_CONFIG_LOAD:
|
||||
plat_pause(1);
|
||||
if (!file_dlg_st(hwnd, IDS_2160, "", 0) &&
|
||||
if (! file_dlg_st(hwnd, IDS_2160, L"", 0) &&
|
||||
(ui_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051) == IDYES)) {
|
||||
pc_reload(wopenfilestring);
|
||||
ResetAllMenus();
|
||||
@@ -585,7 +585,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case IDM_CONFIG_SAVE:
|
||||
plat_pause(1);
|
||||
if (! file_dlg_st(hwnd, IDS_2160, "", 1)) {
|
||||
if (! file_dlg_st(hwnd, IDS_2160, L"", 1)) {
|
||||
config_write(wopenfilestring);
|
||||
}
|
||||
plat_pause(0);
|
||||
@@ -891,7 +891,6 @@ ui_init(int nCmdShow)
|
||||
/* Create the Machine Rendering window. */
|
||||
hwndRender = CreateWindow(L"STATIC", NULL, WS_CHILD|SS_BITMAP,
|
||||
0, 0, 1, 1, hwnd, NULL, hinstance, NULL);
|
||||
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
|
||||
|
||||
/* That looks good, now continue setting up the machine. */
|
||||
switch (pc_init_modules()) {
|
||||
@@ -928,8 +927,13 @@ ui_init(int nCmdShow)
|
||||
if (start_in_fullscreen)
|
||||
plat_setfullscreen(1);
|
||||
|
||||
/* Activate the render window, this will also set the screen size. */
|
||||
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
|
||||
|
||||
#if 0
|
||||
/* Set up the current window size. */
|
||||
plat_resize(scrnsz_x, scrnsz_y);
|
||||
#endif
|
||||
|
||||
/* Fire up the machine. */
|
||||
pc_reset_hard();
|
||||
@@ -937,13 +941,6 @@ ui_init(int nCmdShow)
|
||||
/* Set the PAUSE mode depending on the renderer. */
|
||||
plat_pause(0);
|
||||
|
||||
/* If so requested via the command line, inform the
|
||||
* application that started us of our HWND, using the
|
||||
* the hWnd and unique ID the application has given
|
||||
* us. */
|
||||
if (source_hwnd)
|
||||
SendMessage((HWND) (uintptr_t) source_hwnd, WM_SENDHWND, (WPARAM) unique_id, (LPARAM) hwndMain);
|
||||
|
||||
/*
|
||||
* Everything has been configured, and all seems to work,
|
||||
* so now it is time to start the main thread to do some
|
||||
|
||||