MCPcopy Create free account
hub / github.com/NetHack/NetHack / assign_video

Function assign_video

sys/msdos/video.c:1006–1069  ·  view source on GitHub ↗

* Process defaults.nh OPTIONS=video:xxxx * * where (current) legitimate values are: * * autodetect (attempt to determine the adapter type) * default (force use of the default video method for environment) * vga (use vga adapter code) */

Source from the content-addressed store, hash-verified

1004 * vga (use vga adapter code)
1005 */
1006int
1007assign_video(char *sopt)
1008{
1009 /*
1010 * debug
1011 *
1012 * printf("video is %s",sopt);
1013 * getch();
1014 */
1015 iflags.grmode = 0;
1016 iflags.hasvesa = 0;
1017 iflags.hasvga = 0;
1018 iflags.usevesa = 0;
1019 iflags.usevga = 0;
1020
1021 if (strncmpi(sopt, "def", 3) == 0) { /* default */
1022 /* do nothing - default */
1023#ifdef SCREEN_VGA
1024 } else if (strncmpi(sopt, "vga", 3) == 0) { /* vga */
1025 iflags.usevga = 1;
1026 iflags.hasvga = 1;
1027#endif
1028#ifdef SCREEN_VESA
1029 } else if (strncmpi(sopt, "vesa", 4) == 0) { /* vesa */
1030 iflags.hasvesa = 1;
1031 iflags.usevesa = 1;
1032#endif
1033#ifdef SCREEN_8514
1034 } else if (strncmpi(sopt, "8514", 4) == 0) { /* 8514/A */
1035 iflags.use8514 = 1;
1036 iflags.has8514 = 1;
1037#endif
1038 } else if (strncmpi(sopt, "auto", 4) == 0) { /* autodetect */
1039#ifdef SCREEN_VESA
1040 if (vesa_detect()) {
1041 iflags.hasvesa = 1;
1042 }
1043#endif
1044#ifdef SCREEN_8514
1045 if (v8514_detect()) {
1046 iflags.has8514 = 1;
1047 }
1048#endif
1049#ifdef SCREEN_VGA
1050 if (vga_detect()) {
1051 iflags.hasvga = 1;
1052 }
1053#endif
1054 /*
1055 * Auto-detect Priorities (arbitrary for now):
1056 * VESA, VGA
1057 */
1058 if (iflags.hasvesa) iflags.usevesa = 1;
1059 else if (iflags.hasvga) {
1060 iflags.usevga = 1;
1061 /* VGA depends on BIOS to enable function keys*/
1062 iflags.BIOS = 1;
1063 iflags.rawio = 1;

Callers 1

optfn_videoFunction · 0.85

Calls 3

vesa_detectFunction · 0.85
vga_detectFunction · 0.85
strncmpiFunction · 0.50

Tested by

no test coverage detected