Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005677Dwarf FortressTechnical -- Renderingpublic2012-03-18 14:332014-12-30 14:08
Reportercalrogman 
Assigned ToToady One 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformMacOSOS XOS Version10.7.3
Product Version0.34.05 
Target VersionFixed in Version0.40.24 
Summary0005677: PRINT_MODE:TEXT fails on OS X; Falls back to 2D
DescriptionA comment in data/init/init.txt reads:

  Linux/OS X users may also use PRINT_MODE:TEXT for primitive ncurses output.

However, on OS X, setting PRINT_MODE to TEXT and starting the game causes a message box to appear, reading "Text mode not supported on your platform, using 2D".
Steps To ReproduceSet [PRINT_MODE:TEXT]. Start the game.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0021597)
Footkerchief (manager)
2012-03-19 07:08

Reminder sent to: Baughn

Yo.
(0022383)
calrogman (reporter)
2012-04-26 13:47
edited on: 2012-04-26 13:49

Don't mean to pester but, any updates on this?

It looks to me like a very simple problem with the build chain (a missing DEFINE when compiling for OS X).

Lines 143-152 of g_src/init.cpp are seemingly relevant.

(0024236)
jinpoc (reporter)
2013-12-17 08:30

I'm seeing this bug on my os x 10.8.2 / df 0.34.11. Is this supposed to be fixed?
(0024237)
lethosor (manager)
2013-12-17 13:18
edited on: 2014-06-30 14:16

It is not fixed in 0.34.11.

(0025727)
VR3Cp79dA9 (reporter)
2014-07-11 04:05

Still not fixed in 0.40.02
(0031119)
lethosor (manager)
2014-11-22 07:30
edited on: 2014-11-22 07:46

This is an (untested) patch that may solve this problem:

diff -u -x '*~' g_src/curses.h g_src_patched/curses.h
--- g_src/curses.h	2014-11-22 10:26:32.000000000 -0500
+++ g_src_patched/curses.h	2014-11-22 10:28:10.000000000 -0500
@@ -3,26 +3,26 @@
 
 extern "C" {
 #include "GL/glew.h"
-#ifndef __APPLE__
-#ifdef unix
+#if defined(__unix__) || defined(__APPLE__)
+#ifdef __APPLE__
+# include <curses.h>
+#else
 # include <ncursesw/curses.h>
+#endif
 # undef COLOR_BLUE
 # undef COLOR_CYAN
 # undef COLOR_RED
 # undef COLOR_YELLOW
 # include <dlfcn.h>
 #endif
-#endif
 }
 
-#ifndef __APPLE__
-#ifdef unix
+#if defined(__unix__) || defined(__APPLE__)
 extern "C" {
   void init_curses();
   extern WINDOW **stdscr_p;
 };
 #endif
-#endif
 
 
 #endif
diff -u -x '*~' g_src/renderer_curses.cpp g_src_patched/renderer_curses.cpp
--- g_src/renderer_curses.cpp	2014-11-20 16:39:35.000000000 -0500
+++ g_src_patched/renderer_curses.cpp	2014-11-22 10:30:02.000000000 -0500
@@ -298,6 +298,8 @@
       if (handle) goto opened;
       handle = dlopen("libncursesw.so", RTLD_LAZY);
       if (handle) goto opened;
+      handle = dlopen("libncurses.dylib", RTLD_LAZY);
+      if (handle) goto opened;
       puts("Didn't find any flavor of libncursesw, attempting libncurses");
       sleep(5);
       handle = dlopen("libncurses.so.5", RTLD_LAZY);


Usage:
cd g_src && patch -p1 < [patch file]


(Note that this isn't actually possible to test on OS X, since libgraphics is statically linked).

(0031192)
Toady One (administrator)
2014-11-26 13:24

I'm getting 'mvwaddwstr' was not declared when it tries to compile renderer_curses.cpp. I don't appear to have a ncursesw directory with includes to try. Just a curses.h and a ncurses.h in usr/include, and neither of those have what is needed.
(0031193)
lethosor (manager)
2014-11-26 13:49
edited on: 2014-11-26 14:40

What's the value of NCURSES_VERSION?
Edit: Try defining _XOPEN_SOURCE_EXTENDED before including curses.h
Edit 2: You may have to update ncurses if that doesn't work; I'm not sure how best to do this without installing Homebrew or Macports (which should be manageable if Xcode is already installed).
This patch might allow it to compile on 10.6 and work on platforms where addwstr is available:

diff -u -x '*~' g_src/renderer_curses.cpp g_src_patched/renderer_curses.cpp
--- g_src/renderer_curses.cpp	2014-11-22 10:40:25.000000000 -0500
+++ g_src_patched/renderer_curses.cpp	2014-11-26 17:39:58.000000000 -0500
@@ -221,6 +221,7 @@
   static int (*_start_color)(void);
   static int (*_init_pair)(short p, short fg, short bg);
   static int (*_getmouse)(MEVENT *m);
+  static int (*_waddwstr)(WINDOW *w, const wchar_t *s);
   static int (*_waddnwstr)(WINDOW *w, const wchar_t *s, int i);
 
   static void *dlsym_orexit(const char *symbol, bool actually_exit = true) {
@@ -284,6 +285,9 @@
   int getmouse(MEVENT *m) {
     return _getmouse(m);
   }
+  int waddwstr(WINDOW *w, const wchar_t *s) {
+    return _waddwstr(w, s);
+  }
   int waddnwstr(WINDOW *w, const wchar_t *s, int n) {
     return _waddnwstr(w, s, n);
   }
@@ -332,6 +336,7 @@
       _start_color = (int (*)(void))dlsym_orexit("start_color");
       _init_pair = (int (*)(short p, short fg, short bg))dlsym_orexit("init_pair");
       _getmouse = (int (*)(MEVENT *m))dlsym_orexit("getmouse");
+      _waddwstr = (int (*)(WINDOW *w, const wchar_t *s))dlsym_orexit("waddwstr");
       _waddnwstr = (int (*)(WINDOW *w, const wchar_t *s, int i))dlsym_orexit("waddnwstr");
     
}
     


(0031565)
Toady One (administrator)
2014-12-30 14:08

Marking this off since it seems to work, at least on 10.7+ (with one additional try on 10.6).

- Issue History
Date Modified Username Field Change
2012-03-18 14:33 calrogman New Issue
2012-03-19 07:08 Footkerchief Status new => assigned
2012-03-19 07:08 Footkerchief Assigned To => Baughn
2012-03-19 07:08 Footkerchief Note Added: 0021597
2012-04-26 13:47 calrogman Note Added: 0022383
2012-04-26 13:48 calrogman Note Edited: 0022383 View Revisions
2012-04-26 13:49 calrogman Note Edited: 0022383 View Revisions
2012-04-26 14:39 danaris Issue Monitored: danaris
2012-05-17 18:04 ixtenebrae Issue Monitored: ixtenebrae
2013-01-20 04:07 lethosor Note Added: 0023837
2013-01-20 04:07 lethosor Issue Monitored: lethosor
2013-03-12 13:39 lethosor Note View State: 0023837: private
2013-10-17 17:16 lethosor Note Deleted: 0023837
2013-12-17 08:30 jinpoc Note Added: 0024236
2013-12-17 13:18 lethosor Note Added: 0024237
2014-06-30 14:16 lethosor Note Edited: 0024237 View Revisions
2014-07-11 04:05 VR3Cp79dA9 Note Added: 0025727
2014-07-26 21:18 jinpoc Issue Monitored: jinpoc
2014-11-22 07:30 lethosor Note Added: 0031119
2014-11-22 07:43 lethosor Note Edited: 0031119 View Revisions
2014-11-22 07:46 lethosor Note Edited: 0031119 View Revisions
2014-11-22 07:46 lethosor Note Edited: 0031119 View Revisions
2014-11-26 13:24 Toady One Note Added: 0031192
2014-11-26 13:49 lethosor Note Added: 0031193
2014-11-26 14:02 lethosor Note Edited: 0031193 View Revisions
2014-11-26 14:38 lethosor Note Edited: 0031193 View Revisions
2014-11-26 14:40 lethosor Note Edited: 0031193 View Revisions
2014-12-25 18:21 lethosor Assigned To Baughn => lethosor
2014-12-30 14:08 Toady One Note Added: 0031565
2014-12-30 14:08 Toady One Status assigned => resolved
2014-12-30 14:08 Toady One Fixed in Version => Next Version
2014-12-30 14:08 Toady One Resolution open => fixed
2014-12-30 14:08 Toady One Assigned To lethosor => Toady One


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker