Commit Graph

1055 Commits

Author SHA1 Message Date
nhmall
dc1e2da359 Windows startup modifications
Changes to be committed:
	modified:   include/winprocs.h
	modified:   src/options.c
	modified:   sys/share/pcmain.c
	new file:   sys/share/safeproc.c
	modified:   sys/winnt/Makefile.msc
	modified:   sys/winnt/stubs.c
	new file:   sys/winnt/windmain.c
	modified:   sys/winnt/winnt.c
	modified:   win/win32/vs2017/NetHack.vcxproj
	modified:   win/win32/vs2017/NetHackW.vcxproj
	modified:   win/win32/winhack.c

Because multiple window ports are supported on Windows
now, even in the same executable and selectable via
config file in some cases, some adjustments became
necessary. There will likely be some further refining
of this over the next day or two.

List of changes:

Move Windows startup from sys/share/pcmain.c and
into its own sys/winnt/windmain.c so that it can
be modified to fix some current breakage, and
allow altering the order of some things.

There is startup processing code that is common to
all of the Windows WindowPorts, but that startup
processing code needs to have no dependency on
any one of those WindowPorts.

Yet, during startup processing, some of the initialization
routines can end up calling NetHack functions that
expect an active Window port underneath, and if there
isn't one, routines like pline, impossible, panic can
end up invoking null function pointers.

Place a new file sys/share/safeproc.c, in which a complete
window port is available for early startup processing
purposes. It's WindowPort name field is set to
"safe-startup" just for reference.  The prototypes in
include/winprocs.h require that SAFEPROCS be

Usage:

 windowprocs = get_safe_procs(0);
initializes a set of winprocs function pointers that ensure
none of the function pointers are left null, but that's all it does.

 windowprocs = get_safe_procs(1);
initializes a set of winprocs functions pointers that ensure
none of the function pointers are left null, but also
provides some basic output and input functionality using nothing
other than C stdio routines (no platform or OS specific code).

The conditional code related to WIN32 has been removed from
sys/share/pcmain.c

The code common to all of the Windows WindowPorts calls
get_safe_procs() almost immediately to ensure that
there is a set of WindowPort winprocs available.
2018-12-08 17:56:20 -05:00
Pasi Kallinen
8319227b55 Clear the getlin buffer
Recent change to this bit of code didn't clear the buffer,
which causes garbage in the string if compiled with EDIT_GETLIN
2018-12-07 22:18:53 +02:00
nhmall
1baa20dfc5 header update on cursstat.c 2018-12-05 23:43:59 -05:00
nhmall
c4930c6782 update header on curswins 2018-12-05 17:45:40 -05:00
nhmall
9c873712b6 update header on cursstat 2018-12-05 17:45:15 -05:00
nhmall
2458281d42 update header on cursmisc 2018-12-05 17:44:08 -05:00
nhmall
c260911f38 update header on cursmesg 2018-12-05 17:43:33 -05:00
nhmall
661ffb0133 update header on cursmain 2018-12-05 17:42:49 -05:00
nhmall
86281c5555 update header on cursinvt 2018-12-05 17:42:11 -05:00
nhmall
14335ea90c update header on cursinit 2018-12-05 17:41:30 -05:00
nhmall
c258f9c3f8 update header on cursdial 2018-12-05 17:40:33 -05:00
PatR
f2195c1212 more !SHELL, !SUSPEND
Update tty command completion to ignore #shell and #suspend when
they're disabled.  (Since they aren't flagged for command completion,
this should be unnoticeable.)

Update X11 extended command selection to not show shell and suspend
in the menu when they're disabled.  (Trickier than I expected.)

X11 currently rejects #suspend (at run time, not compile time) but
allows #shell.  If it was launched syncronously from a terminal
window, shell escape behaves sanely.  Otherwise, that seems like
asking for trouble.
2018-12-03 01:46:01 -08:00
Bart House
06fba14091 Merge branch 'win-minor' of https://rodney.nethack.org:20040/git/NHsource into win-minor 2018-12-02 20:23:03 -08:00
Bart House
f081e53876 Fix for NetHackW.exe menu icon rendering. 2018-12-02 20:22:47 -08:00
nhmall
5d9c172497 Merge branch 'win-minor' into NetHack-3.6.2-beta01 2018-12-02 21:26:54 -05:00
Bart House
92612b8f0c Added some missing header files to VS2017 NetHackW project. 2018-12-02 18:15:02 -08:00
Bart House
f3dcdc7fda Splash dialog and main window handle dpi change notifications. 2018-12-02 18:09:34 -08:00
nhmall
7e9bc20c3a Merge branch 'win-minor' into NetHack-3.6.2-beta01 2018-12-02 19:42:12 -05:00
nhmall
6fe706f274 'curses_display_nhmenu' should return a value
Caught by automated build test

../win/curses/cursdial.c:598:9: error: non-void function 'curses_display_nhmenu' should return a value [-Wreturn-type]
        return;
        ^
../win/curses/cursdial.c:605:9: error: non-void function 'curses_display_nhmenu' should return a value [-Wreturn-type]
        return;
2018-12-02 18:47:23 -05:00
Bart House
796bdce828 Update comment within mswin_status_string. 2018-12-02 13:35:48 -08:00
Bart House
6ee48481b1 Respect BL_FLUSH and BL_RESET indications to mswin_status_update. 2018-12-02 13:33:07 -08:00
Bart House
0f679b3109 NetHackW status hilite support improved to include support for attributes. 2018-12-02 13:25:03 -08:00
nhmall
a9ff2a296a remove slipped-in partial bits from another feature
Some bits from another feature by Tangles had
slipped into our merge of curses a while back.

Remove the partial bits as feature bits should
be complete or not at all, unless foundational
for something to come.
2018-12-02 11:54:42 -05:00
Tangles
7c025fc344 curses - reinstate guicolors 2018-12-02 11:22:54 -05:00
Tangles
c3ecb5c43d curses - don't use popup for count selection.
There are issues with dismissing the popup afterwards.  These
were not really investigated as a count-selection doesn't really
warrant a popup anyway.
2018-12-02 11:20:46 -05:00
Tangles
2af7a74b7d curses - fix hero turning into # when selecting a count of items.
Why was that line in there anyway?
2018-12-02 11:20:21 -05:00
Tangles
69d9a7a51b curses - don't autocomplete wiz cmds except in wizmode 2018-12-02 11:19:56 -05:00
Tangles
1f94456e46 curses - change some panics to impossibles. 2018-12-02 11:19:35 -05:00
PatR
028efc7342 X11 text popup fix
Text popups on OSX could be dismissed with <space> or <return> or
<esc> if user's X resources had 'NetHack*autofocus' set to True, but
for the default of False they ignored all keystrokes even if you
clicked inside the popup window to set focus explicitly.  Clicking
on the Close Window button of the popup's title bar was the only way
to get the popup to go away.  Fix suggested by Pasi.
2018-11-30 16:02:55 -08:00
nhmall
8a9f98f179 curses follow-up bits
Move the curses global variable defininitions to cursmain.c.

Make the references to those global variables extern in
include/wincurs.h

Get rid of a warning:
../win/curses/cursmesg.c:379:9: warning: declaration shadows a
variable in the global scope [-Wshadow] int orig_cursor = curs_set(0);

Kludge for Visual Studio compiler: Add a stub- file for use
in Windows curses port builds to ensure that a needed #pragma
is invoked prior to compiling the file pdcscrn.c in the
PDCurses source distribution. All command line options and
compile of the file. It is unreasonable to expect a NetHack
builder to have to tinker with the PDCurses source files in
order to build NetHack. This kludge means the NetHack builder
doesn't have to.
The file stub-pdcscrn.c contains only two lines:
	#pragma warning(disable : 4996)
	#include "pdcscrn.c"
Some day, if the PDCurses sources corrects the issue, this
can go away.
2018-11-30 16:00:24 -05:00
Pasi Kallinen
75bf7c1975 X11: Disable menucolors when showing text files 2018-11-30 15:26:38 +02:00
nhmall
5049d23ce0 make some progress on mingw build
Still not quite there yet though.
Focusing on tty (maybe curses) right now.

The gui has had significant code deviation from
prior gcc builds for windows and will take more
work.
2018-11-29 20:59:03 -05:00
Bart House
22af9a3bbf Adding manifest to NetHackW.exe in nmake build. 2018-11-28 21:06:39 -08:00
nhmall
bf4bb47518 Update header at the top of the curses files
Place the copyright notice within the win/curses files as confirmed
by the original curses port author on November 28, 2018.
2018-11-28 20:00:20 -05:00
PatR
091941c6c2 X11 bit prior to 'make depend' 2018-11-28 15:22:14 -08:00
Bart House
c44c0d3e01 Added support for color condition hilites to tile mode.
Code is complete but might take another pass over the code to simplify
where we can.
2018-11-25 21:04:30 -08:00
Bart House
95e701cd01 Fix map clearing when in tile mode and tile is set to NO_GLYPH. 2018-11-25 20:31:50 -08:00
nhmall
57a02d05bf build fix when STATUS_HILITES is not defined 2018-11-24 21:41:22 -05:00
nhmall
a1a51463c6 Revert "Added nhassert() support to tile2bmp."
This reverts commit a27fd2d83d.
2018-11-23 22:17:29 -05:00
nhmall
c5b283a839 Revert "Added decl_early_init() which is called when PLAYAGAIN is supported."
This reverts commit acbe4d9242.
2018-11-23 22:17:24 -05:00
nhmall
162018060a Revert "Initial check in of icontext."
This reverts commit 5bbe3cd6bb.
2018-11-23 22:17:18 -05:00
nhmall
4590c9c0dd Revert "Instance variable work check-point."
This reverts commit 8e316df117.
2018-11-23 22:17:12 -05:00
nhmall
7ad3f32e16 Revert "Renamed instance_variables to global_variables and iv to g."
This reverts commit f9a0db6c44.
2018-11-23 22:17:07 -05:00
nhmall
053baa8274 Revert "restore.c globals moved to instance_globals."
This reverts commit 865c4d5a7d.
2018-11-23 22:16:59 -05:00
nhmall
44af1c78f3 Revert "topl.c globals moved to instance_globals."
This reverts commit b384223e1b.
2018-11-23 22:16:45 -05:00
nhmall
3cbc6d4cf5 Revert "Modified objects initialization to support re-entry."
This reverts commit c3eefefc99.
2018-11-23 22:16:24 -05:00
Bart House
c3eefefc99 Modified objects initialization to support re-entry. 2018-11-23 15:22:55 -08:00
Bart House
b384223e1b topl.c globals moved to instance_globals. 2018-11-23 15:22:54 -08:00
Bart House
865c4d5a7d restore.c globals moved to instance_globals. 2018-11-23 15:22:54 -08:00
Bart House
f9a0db6c44 Renamed instance_variables to global_variables and iv to g. 2018-11-23 15:22:53 -08:00