Skip to content
Snippets Groups Projects
Commit b05a6517 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Use GDI mode for Windows builds of SCFG, making this a Windows/GUI app now

In Windows 11, "Windows Terminal" is now the default console (though the
Windows user can change that to the old conhost.exe).  Running UIFC
apps (e.g. SCFG) in Windows console mode from within a Windows Terminal
console doesn't always display correctly (depending on the width of the
console). And even if if the app displays correctly at first in console
mode, it's very easy for the user to resize the console window and just
totally foobar the display of the app.

Windows console mode (previously, the default interface mode) is still
available ("-iw" option) if one wants to use it instead.

However, stdio/door mode ("-id") and ANSI mode ("-ia") can't be used directly
from a console.

The help/usage output is sent in Windows console mode (not stdout or GDI mode)
so it creates a new window, disables mouse support (so you can copy text from
it). stdout doesn't work from GUI apps. Fun times.
parent cf611198
No related branches found
No related tags found
No related merge requests found
......@@ -381,6 +381,21 @@ void set_cfg_filename(const char* hostname)
snprintf(cfg.filename, sizeof cfg.filename, "%ssbbs%s%s.ini", cfg.ctrl_dir, *hostname ? ".":"", hostname);
}
#ifdef _WIN32
#define printf cprintf
#endif
void banner()
{
char compiler[32];
DESCRIBE_COMPILER(compiler);
printf("\nSynchronet Configuration Utility (%s) v%s%c " COPYRIGHT_NOTICE
"\n",PLATFORM_DESC, VERSION, REVISION);
printf("\nCompiled %s/%s %s %s with %s\n", GIT_BRANCH, GIT_HASH, __DATE__, __TIME__, compiler);
}
int main(int argc, char **argv)
{
char* p;
......@@ -390,14 +405,12 @@ int main(int argc, char **argv)
BOOL door_mode=FALSE;
BOOL alt_chars = FALSE;
int ciolib_mode=CIOLIB_MODE_AUTO;
char compiler[32];
DESCRIBE_COMPILER(compiler);
printf("\nSynchronet Configuration Utility (%s) v%s%c " COPYRIGHT_NOTICE
"\n",PLATFORM_DESC, VERSION, REVISION);
printf("\nCompiled %s/%s %s %s with %s\n", GIT_BRANCH, GIT_HASH, __DATE__, __TIME__, compiler);
#if defined(_WIN32)
cio_api.options |= CONIO_OPT_DISABLE_CLOSE;
#else
banner();
#endif
xp_randomize();
cfg.size=sizeof(cfg);
......@@ -493,10 +506,22 @@ int main(int argc, char **argv)
case 'I':
ciolib_mode=CIOLIB_MODE_CURSES_ASCII;
break;
#endif
#elif defined _WIN32
case 'W':
ciolib_mode=CIOLIB_MODE_CONIO;
break;
case 'G':
switch (toupper(argv[i][3])) {
case 0:
case 'W':
ciolib_mode = CIOLIB_MODE_GDI;
break;
case 'F':
ciolib_mode = CIOLIB_MODE_GDI_FULLSCREEN;
break;
}
break;
#endif
case 'D':
door_mode=TRUE;
break;
......@@ -514,7 +539,16 @@ int main(int argc, char **argv)
auto_save=TRUE;
break;
default:
USAGE:
USAGE:
#ifdef _WIN32
uifc.size=sizeof(uifc);
uifc.mode |= UIFC_NOMOUSE;
uifc.scrn_len = 40;
initciolib(CIOLIB_MODE_CONIO);
uifcini32(&uifc);
banner();
#endif
printf("\nusage: scfg [ctrl_dir] [options]"
"\n\noptions:\n\n"
"-w run initial setup wizard\n"
......@@ -534,20 +568,28 @@ int main(int argc, char **argv)
"-host=<name> set hostname to use for alternate sbbs.ini file\n"
"-iX set interface mode to X (default=auto) where X is one of:\n"
#ifdef __unix__
" X = X11 mode\n"
" C = Curses mode\n"
" F = Curses mode with forced IBM charset\n"
" I = Curses mode with forced ASCII charset\n"
#else
" W = Win32 console mode\n"
#endif
" A = ANSI mode\n"
" D = standard input/output/door mode\n"
" X = X11 mode\n"
" C = Curses mode\n"
" F = Curses mode with forced IBM charset\n"
" I = Curses mode with forced ASCII charset\n"
#elif defined(_WIN32)
" W = Win32 console mode\n"
#if defined(WITH_GDI)
" G = Win32 graphics mode\n"
" GF = Win32 graphics mode, full screen\n"
#endif // WITH_GDI
#endif // _WIN32
" A = ANSI mode\n"
" D = standard input/output/door mode\n"
"-A use alternate (ASCII) characters for arrow symbols\n"
"-v# set video mode to # (default=auto)\n"
"-l# set screen lines to # (default=auto-detect)\n"
"-y automatically save changes (don't ask)\n"
);
#ifdef _WIN32
printf("\nHit a key to close...");
getch();
#endif
exit(0);
}
}
......
......@@ -34,7 +34,6 @@
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
<Import Project="..\..\xpdev\xpdev.props" />
<Import Project="..\..\smblib\smblib.props" />
<Import Project="..\..\conio\conio.props" />
<Import Project="..\..\uifc\uifc.props" />
<Import Project="..\..\build\undeprecate.props" />
<Import Project="..\..\build\target_ia32.props" />
......@@ -42,13 +41,13 @@
<Import Project="..\..\encode\encode.props" />
<Import Project="..\..\..\3rdp\win32.release\cryptlib\cryptlib.props" />
<Import Project="..\..\..\3rdp\win32.release\libarchive\libarchive.props" />
<Import Project="..\..\conio\conio_gdi.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
<Import Project="..\..\xpdev\xpdev.props" />
<Import Project="..\..\smblib\smblib.props" />
<Import Project="..\..\conio\conio.props" />
<Import Project="..\..\uifc\uifc.props" />
<Import Project="..\..\build\undeprecate.props" />
<Import Project="..\..\build\target_ia32.props" />
......@@ -56,6 +55,7 @@
<Import Project="..\..\encode\encode.props" />
<Import Project="..\..\..\3rdp\win32.release\cryptlib\cryptlib.props" />
<Import Project="..\..\..\3rdp\win32.release\libarchive\libarchive.props" />
<Import Project="..\..\conio\conio_gdi.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
......@@ -97,7 +97,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\msvc.win32.exe.debug/scfg.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
......@@ -139,7 +139,7 @@
<OutputFile>.\msvc.win32.exe.release/scfg.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<ProgramDatabaseFile>.\msvc.win32.exe.release/scfg.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
......@@ -238,8 +238,8 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\conio\conio.vcxproj">
<Project>{84592e48-27ca-48a6-b9c6-243d2347a578}</Project>
<ProjectReference Include="..\..\conio\conio_gdi.vcxproj">
<Project>{fbcce03b-65ee-44a1-bbe1-b1f789d223a1}</Project>
</ProjectReference>
<ProjectReference Include="..\..\smblib\smblib.vcxproj">
<Project>{d674842b-2f41-42cb-9426-b3c4b0682574}</Project>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment