{"id":2186,"date":"2015-04-28T00:35:12","date_gmt":"2015-04-28T05:35:12","guid":{"rendered":"https:\/\/justinparrtech.com\/JustinParr-Tech\/?p=2186"},"modified":"2015-04-28T01:33:22","modified_gmt":"2015-04-28T06:33:22","slug":"ularn-win32","status":"publish","type":"post","link":"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/","title":{"rendered":"ULarn Win32 &#8211; Runs on Windows 7"},"content":{"rendered":"<p>ULarn (Ultra-Larn) for Win32, built on Cygwin but runs natively<\/p>\n<p>Ularn that runs on Windows 7!<\/p>\n<p><!--more--><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\"><p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<\/div><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#background\" >Background<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#download\" >Download<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#movement\" >Movement:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#more-details\" >More Details<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#problem-1-mingw-isnt-going-to-work\" >Problem 1:\u00a0 MinGW isn&#8217;t going to work<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#configuring-for-cygwin\" >Configuring for Cygwin<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#problem-2-%e2%80%98configure-had-some-issues\" >Problem 2:\u00a0 &#8216;configure&#8217; Had Some Issues<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#problem-3-ncurses-termcap\" >Problem 3:\u00a0 ncurses \/ termcap<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#problem-4-issues-with-zlib\" >Problem 4:\u00a0 Issues with ZLib<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#clean-compile-build\" >Clean Compile \/ Build!<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#problem-5-hard-coded-location\" >Problem 5:\u00a0 Hard Coded Location<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#now-what\" >Now What?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#problem-6-suss-out-dll-dependencies\" >Problem 6:\u00a0 Suss out DLL Dependencies<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#problem-7-determine-user-name\" >Problem 7:\u00a0 Determine User Name<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#problem-8-path-assumptions\" >Problem 8:\u00a0 Path Assumptions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#sources\" >Sources<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#screen-shots-running-on-windows-7\" >Screen Shots Running on Windows 7<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#isnt-that-kind-of-small\" >Isn&#8217;t that kind of small?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/ularn-win32\/#next-steps\" >Next Steps<\/a><\/li><\/ul><\/nav><\/div>\n\n<h2><span class=\"ez-toc-section\" id=\"background\"><\/span>Background<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Larn is one of the many &#8220;Roguelike&#8221; games, using ASCII (letters and symbols), before graphical computer games were common.<\/p>\n<p>Unlike Rogue and Hack, Larn was one of the first Roguelike games to employ a top-level &#8220;town&#8221;, with a bank, a store, trading post, and other buildings.<\/p>\n<p>Rather than a food-based timer, where you have to eat periodically, your character is on a quest, where a special potion must be acquired, to cure your character&#8217;s daughter&#8217;s illness, which if not cured within a specified time period, will result in failure (her death).\u00a0 This gives the game a global timer, where the player must accumulate wealth, special items, explore, and kill monsters, all within the time limit.<\/p>\n<p>I wasted many of my prime teen hours playing Larn, and it has a special place in my heart to this day.<\/p>\n<p>A newer version, called &#8220;Ultra-Larn&#8221;, or &#8220;Ularn&#8221; for short, emerged in 1992, offering more dungeon levels, more monsters, more items, better game play, etc&#8230;<\/p>\n<p>YEARS LATER, maybe 2006-ish, I downloaded a bunch of classic games, including the original Larn and Ularn, but these only run in *nix or DOS &#8211; there really isn&#8217;t (wasn&#8217;t) a good Win32 version available.<\/p>\n<p>Although you could run the DOS versions in DosBox (A DOS emulator), it wasn&#8217;t an easy, clean, or pure experience.<\/p>\n<p>After scouring the Internet, I finally found a distribution called Ularn Win TTY (1.6.3).\u00a0 This version had been updated with color, directional walls, and a few other enhancements.<\/p>\n<p>Since then, Ularn Win TTY has ceased to exist, or at least, I can&#8217;t find a valid link to it.<\/p>\n<p>Moreover, there doesn&#8217;t appear to be a stable Windows release of Ularn, <strong>so I decided to download the latest official version, 1.5pt4, and compile one<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"download\"><\/span>Download<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>This is a Cygwin build of Ularn 1.5pt4, modified to run &#8220;as is&#8221; <span style=\"text-decoration: underline;\"><em><strong>without<\/strong><\/em><\/span> having to install Cygwin.\u00a0 The included cygwin1.dll is all that&#8217;s required.<\/p>\n<p>Simply extract all the files from the zip file, in the folder CygUlarn_1_5_pt4\\Binaries, to an empty folder, and launch &#8220;Ularn.exe&#8221;.<\/p>\n<p>You can download the zip file here:<\/p>\n<p><a href=\"\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_1_5_pt4.zip\">CygUlarn_1_5_pt4.zip<\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"movement\"><\/span>Movement:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre>y  k  u\r\n \\ | \/\r\nh - - l\r\n \/ | \\\r\nb  j  n\r\n\r\nKeyboard layout:\r\nul  ur\r\n<strong>y  u<\/strong>\r\n<strong> h  j  k  l<\/strong> \r\n lf dn up rt\r\n<strong>b  n<\/strong>\r\ndl  dr\r\n\r\n? - Help file - this is your friend!<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"more-details\"><\/span>More Details<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In case you are interested in the process, and my thoughts at the time, here is some additional info.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"problem-1-mingw-isnt-going-to-work\"><\/span>Problem 1:\u00a0 MinGW isn&#8217;t going to work<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>My first thought was to build this using Eclipse and MinGW.\u00a0 I found out very quickly that MinGW doesn&#8217;t support &#8220;curses&#8221;, and there are a bunch of other &#8220;GNU&#8221; dependencies, that were simply impractical to re-write to use the WinAPI, or compile and cobble together all of the pieces I needed.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"configuring-for-cygwin\"><\/span>Configuring for Cygwin<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Looking to Cygwin, all of the parts were there, but Ularn is REALLY OLD CODE!\u00a0 The last time it was &#8220;built&#8221; in Cygwin was apparently in 2002!<\/p>\n<p>I set up a Cygwin environment, got everything up to date, installed automake and autoconfig, gcc, and make, and went to town.<\/p>\n<p>Within a shell, I ran the &#8216;autogen.sh&#8217; script, which ran just fine, and created the &#8216;configure&#8217; script.<\/p>\n<p>I ran &#8216;configure&#8217;, which completed successfully, but there were a few hidden problems that I was about to discover.<\/p>\n<p>The main purpose of configure is to create the Makefile and config.h &#8212; a collection of constants that defines various compile options for various platforms.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"problem-2-%e2%80%98configure-had-some-issues\"><\/span>Problem 2:\u00a0 &#8216;configure&#8217; Had Some Issues<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The configure script failed to detect Cygwin, so I had to dig around in the source code, and figure out that a bunch of the compile errors were related to a &#8220;CYGWIN&#8221; constant that should have been created during the configure process, but wasn&#8217;t.\u00a0 I added the following line at the top of <strong>config.h<\/strong>:<\/p>\n<pre>#define CYGWIN 1<\/pre>\n<p>That fixed many of the signal errors I was getting during compile time.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"problem-3-ncurses-termcap\"><\/span>Problem 3:\u00a0 ncurses \/ termcap<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Next, I fought with ncurses, which I didn&#8217;t know at the time was related to termcap.\u00a0 Not sure if this is part of the &#8220;official&#8221; GNU distribution, or specific to Cygwin, but termcap has been swallowed by ncurses.<\/p>\n<p>Everything I read said, &#8220;Eh, download ncurses, compile with -lncurses, and you should be fine!&#8221;, or the typical internet response, &#8220;RTFM you n00b!&#8221;\u00a0 &lt;&#8211; <em>I love these people.\u00a0 I learned so much from some jerk posting, &#8220;RTFM&#8221;<\/em>.<\/p>\n<p>Whenever I&#8217;m trying to google for something obscure, I always end up on a message board which feels like that scene from MST3K:<\/p>\n<blockquote><p>Tom Servo: No, wait! We&#8217;re trapped in space! Can we use this thing to get back to Earth?<\/p>\n<p><em>[or, maybe compile this application that uses termcap???]<\/em><\/p>\n<p>Benkitnorf: I don&#8217;t know. Geez&#8230; let&#8217;s see, maybe this does something&#8230;<br \/>\n[pushes button, zapping Servo]<\/p>\n<p>Benkitnorf: Crap. That&#8217;s not it. Hang on&#8230;<br \/>\n[gets manual]<\/p>\n<p>Benkitnorf: Okay. Did you use the Intensifier Disc?<\/p>\n<p>All: Yes.<\/p>\n<p>Benkitnorf: Turn the controls 18 degrees to the left?<\/p>\n<p>All: Did that.<\/p>\n<p>Benkitnorf: Are you in Europe? Do you need an adapter?<\/p>\n<p>All: No.<\/p>\n<p>Benkitnorf: Well, look. I don&#8217;t know anything about this thing. Maybe this does something&#8230;<br \/>\n[pushes button, zapping Servo again]<\/p>\n<p>Benkitnorf: Oops. That didn&#8217;t work. Okay, well I&#8217;ll be sure to tell Exeter to give you a call! Bye!<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p><strong>I finally found a really old distribution of Cygwin with its own termcap, and I just blatantly statically included the termcap sources\u00a0 :-)<\/strong><\/p>\n<p>Everything I read said, &#8220;keep your code the same, just compile with -lncurses&#8221;.\u00a0 Yeah&#8230;. that doesn&#8217;t work.<\/p>\n<p>Everything else I read said, &#8220;You should bring the code up to date to use a newer library.&#8221;\u00a0 OK, <em>someone<\/em> can do that, but <em>someone<\/em> isn&#8217;t me.\u00a0 Have fun with that.\u00a0 If I have to &#8220;bring the code up to date&#8221;, I&#8217;d rather just write my own, like the <a href=\"http:\/\/nlarn.sourceforge.net\/\" target=\"_blank\">Nlarn<\/a> guy did, rather than waste the time having to learn someone else&#8217;s code.<\/p>\n<p>I copied *.c and *.h from the termcap sources to the Ularn\/src folder.\u00a0 I had to make a couple of modifications to extern.h, and I had to modify the Makefile to include the new .c, .h, and object (*.o) files.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"problem-4-issues-with-zlib\"><\/span>Problem 4:\u00a0 Issues with ZLib<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Can&#8217;t find &#8216;compress&#8217; and &#8216;uncompress&#8217;.<\/p>\n<p>A little googling (and much more name-calling) later, and I determined that these symbols were tied to zlib, as I&#8217;d expected.<\/p>\n<p><span style=\"color: #00ff00;\"><em>&#8220;Benkitnorf: Did you compile with -lz?&#8221; <\/em><\/span><\/p>\n<p><span style=\"color: #00ff00;\"><em>&#8220;All: yes, we compiled with -lz&#8221;.<\/em><\/span><\/p>\n<p>After some more digging, I found a constant in config.h to turn off zlib support, so I just did that, instead.\u00a0 Again, if someone <em>else<\/em> wants to mess with this, go right ahead!<\/p>\n<p>I remmed out the following line in config.h:<\/p>\n<pre>#define HAVE_LIBZ 1<\/pre>\n<p>This is referred to as &#8220;libz&#8221; rather than &#8220;zlib&#8221;, so there is probably some rare, obscure, outdated reference that I&#8217;m missing somewhere.\u00a0 The easier answer is just to turn it off &#8212; so we have a slightly larger save file?\u00a0 WHO CARES.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"clean-compile-build\"><\/span>Clean Compile \/ Build!<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>So at this point, I had a compiled, working version of Ularn.exe, built on Cygwin!<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2191 size-full\" src=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Terminal.png\" alt=\"CygUlarn_Terminal\" width=\"586\" height=\"317\" srcset=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Terminal.png 586w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Terminal-300x162.png 300w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/p>\n<p>Still a few more bugs to work out&#8230;<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"problem-5-hard-coded-location\"><\/span>Problem 5:\u00a0 Hard Coded Location<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>I launched Ularn from a Cygwin shell, only to get the following message:<\/p>\n<blockquote><p>Can&#8217;t create scoreboard file in \/usr\/local\/shared\/Ularn<\/p>\n<p>Check permissions and try again<\/p><\/blockquote>\n<p>The shared files, including the scoreboard, were assumed to be in \/usr\/local\/shared\/Ularn, which simply doesn&#8217;t exist in my local Cyg environment.<\/p>\n<p>I think this was being read from a macro in the Makefile, assigned to LIBDIR.<\/p>\n<pre>:DEFS= -DLIBDIR='\"${datarootdir}\/Ularn\"'<\/pre>\n<p>Then, in data.c, &#8220;libdir&#8221; is assigned:<\/p>\n<pre>char *libdir = LIBDIR;<\/pre>\n<p>The easier thing to do is hard code the &#8220;libdir&#8221; path to the current folder from the environment:<\/p>\n<pre>char *libdir = \".\";<\/pre>\n<p><strong>NOW, I had a Ularn.exe that actually <em>runs<\/em>.<\/strong><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"now-what\"><\/span>Now What?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>My next goal was to liberate &#8220;CygUlarn&#8221; from the Cygwin environment.<\/p>\n<p>There are many so-called Win32 apps that were really ported, compiled, and built on Cygwin, and similarly liberated.\u00a0 For example, if you download RSync for Windows, it has the same cygwin1.dll within the package&#8230;.<\/p>\n<p>Step 1:\u00a0 I copied everything to an isolated folder<\/p>\n<p>Step 2:\u00a0 I launched a command prompt, and wiped out the path<\/p>\n<h3><span class=\"ez-toc-section\" id=\"problem-6-suss-out-dll-dependencies\"><\/span>Problem 6:\u00a0 Suss out DLL Dependencies<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The first thing to do was to figure out the DLL dependencies.\u00a0 The only one was cygwin1.dll &#8211; this is because everything else is statically-compiled in to the quite-chunky 500K executable!\u00a0 The original Ularn was probably 50K!\u00a0 But the original Ularn won&#8217;t run in Windows 7, and doesn&#8217;t have to contend with the Windows API.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"problem-7-determine-user-name\"><\/span>Problem 7:\u00a0 Determine User Name<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Once I got the DLL dependency resolved, the next issue was to correctly capture the user name.\u00a0 Ularn is intended for a multi-user environment, just like its Larn predecessor, so it tries to go scrape the system&#8217;s user info to figure out who is logged in.\u00a0 In a Cygwin shell, this works just fine, but in a Windows shell, there is no such construct.<\/p>\n<p>My solution was to make a couple of modifications in main.c, to just simply <em>prompt<\/em> for the user name at startup.\u00a0 I remmed out all the code dealing with finding the user name or UID, ending in a fatal error if you can&#8217;t find the user name.<\/p>\n<p>Old Code:<\/p>\n<pre>\/*\r\n\u00a0*\u00a0\u00a0 \u00a0first task is to identify the player\r\n\u00a0*\/\r\n\u00a0\u00a0 \u00a0if ((ptr = getlogin()) == (char *)NULL) {\r\n\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0if (pwe=getpwuid(geteuid()))\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0   \u00a0\u00a0\u00a0 \u00a0ptr = pwe-&gt;pw_name;\r\n\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0else if ((ptr = getenv(\"LOGNAME\")) == (char *)NULL)\r\n\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0if ((ptr = getenv(\"USER\")) == (char *)NULL) { \u00a0\r\nnoone:\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0fprintf(stderr,\"Who *are* you?\\n\");\r\n\u00a0\u00a0   \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0exit(1);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 }\r\n\u00a0\u00a0 \u00a0}<\/pre>\n<p>I added the following:<\/p>\n<pre>noone:\r\n\u00a0\u00a0 \u00a0fprintf(stdout,\"Who are you? \");\r\n\u00a0\u00a0 \u00a0fgets(defaultplayer,sizeof(defaultplayer),stdin);\r\n\u00a0\u00a0 \u00a0defaultplayer[strlen(defaultplayer)-1]=0;\r\n\u00a0\u00a0 \u00a0ptr=defaultplayer;<\/pre>\n<p>&#8220;fgets&#8221; is a better method, since it protects against the buffer length, but it has the quirky behavior of including the carriage return.\u00a0\u00a0 ???\u00a0 Stupid behavior.\u00a0 Thus assigning &#8220;0&#8221; (end of string) to the position at the string length minus one, effectively wiping out the carriage return.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"problem-8-path-assumptions\"><\/span>Problem 8:\u00a0 Path Assumptions<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>One more run, and everything seemed OK, until&#8230;.<\/p>\n<blockquote><p>Can&#8217;t write to save file \/home\/Justin\/Ularn.sav<\/p><\/blockquote>\n<p>Some files, like help and scoreboard, are &#8220;global&#8221;, and I had addressed that by fixing &#8216;libdir&#8217; (see above), but others were tied to the user profile.<\/p>\n<p>In the DOS version, it just saves everything to the Larn folder, so I opted for that solution instead.<\/p>\n<p>Old code:<\/p>\n<pre>\u00a0\u00a0 \u00a0\/* this will be overwritten with the players name *\/\r\n\u00a0\u00a0 \u00a0if ((ptr = getenv(\"HOME\")) == (char *)NULL)\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0if ((ptr = pwe-&gt;pw_dir) == (char *)NULL)\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0ptr = \".\";\r\n\r\n\u00a0\u00a0  \/* save file name in home directory *\/\r\n\u00a0\u00a0 \u00a0sprintf(savefilename, \"%s\/Ularn.sav\", ptr);\r\n\r\n\u00a0\u00a0 \u00a0sprintf(buf, \"%s\/%s\",ptr, optsfile); \u00a0\u00a0 \u00a0 \/* the .Ularnopts filename *\/\r\n\u00a0\u00a0 \u00a0strcpy(optsfile, buf);\r\n\r\n\u00a0\u00a0 \u00a0sprintf(buf, \"%s\/%s\", ptr, ckpfile);\u00a0\u00a0 \u00a0  \/* the checkpoint file *\/\r\n\u00a0\u00a0 \u00a0strcpy(ckpfile, buf);<\/pre>\n<p>New code:<\/p>\n<pre>\u00a0\u00a0\u00a0 sprintf(savefilename, \"%s.sav\", ptr);\r\n\r\n\u00a0\u00a0 \u00a0sprintf(buf, \"%s%s\",ptr, optsfile); \u00a0\u00a0 \u00a0\/* the .Ularnopts filename *\/\r\n\u00a0\u00a0 \u00a0strcpy(optsfile, buf);\r\n\r\n\u00a0\u00a0 \u00a0sprintf(buf, \"%s.chk\", ptr);\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/* the checkpoint file *\/\r\n\u00a0\u00a0 \u00a0strcpy(ckpfile, buf);<\/pre>\n<p>Assuming you type &#8220;NewGuy&#8221; as your name, this will create or use the three following &#8220;local&#8221; user files in the Ularn folder:<\/p>\n<ul>\n<li>NewGuy.sav &#8212; Save file<\/li>\n<li>NewGuy.Ularnopts &#8212; Optional options file<\/li>\n<li>NewGuy.chk &#8212; If Ularn or the whole system crashes, this restores your game from a &#8220;checkpoint&#8221; taken every 400 moves<\/li>\n<\/ul>\n<p>Again &#8211; my goal is to <em>play it<\/em>, not support a highly-multi-user environment.\u00a0 If there are two &#8220;Bob&#8217;s&#8221;, you know what?\u00a0 Bob1 and Bob2 are just going to have to work it out.<\/p>\n<p>Aaannd&#8230;. It works!<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"sources\"><\/span>Sources<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>All of the modified sources, including Makefiles, termcap files, and modified source files are included in the &#8220;Sources&#8221; folder of the zip file in the &#8216;Download&#8217; section above.<\/p>\n<p>If you want the<em><strong> original<\/strong><\/em>, go download it, here:<\/p>\n<p><a href=\"https:\/\/github.com\/joshbressers\/ularn\" target=\"_blank\">2002 Unmodified Ularn Source<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"screen-shots-running-on-windows-7\"><\/span>Screen Shots Running on Windows 7<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Launch, showing Firefox browser, Win7 desktop.\u00a0 The window is a Windows shell not a Cygwin shell (note the icon)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2205 size-large\" src=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_1-1024x576.png\" alt=\"CygUlarn_1\" width=\"627\" height=\"353\" srcset=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_1-1024x576.png 1024w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_1-300x169.png 300w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_1.png 1366w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/p>\n<p>Choose your class:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2206\" src=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_2-1024x576.png\" alt=\"CygUlarn_2\" width=\"627\" height=\"353\" srcset=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_2-1024x576.png 1024w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_2-300x169.png 300w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_2.png 1366w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/p>\n<p>The town:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2207\" src=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_3-1024x576.png\" alt=\"CygUlarn_3\" width=\"627\" height=\"353\" srcset=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_3-1024x576.png 1024w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_3-300x169.png 300w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_3.png 1366w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/p>\n<p>Dungeon crawling &#8212; being attacked by Gnomes!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2208\" src=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_4-1024x576.png\" alt=\"CygUlarn_4\" width=\"627\" height=\"353\" srcset=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_4-1024x576.png 1024w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_4-300x169.png 300w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_4.png 1366w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"isnt-that-kind-of-small\"><\/span>Isn&#8217;t that kind of small?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Glad you asked!<\/p>\n<p>In 32-bit Windows, &#8220;ALT+ENTER&#8221;, holding ALT and pressing ENTER, brings you to a full-screen command prompt.<\/p>\n<p>In 64-bit versions of Windows, including most machines running Windows 7, &#8220;full screen command prompt&#8221; is not available.<\/p>\n<p><strong>Here is what you can do instead:<\/strong><\/p>\n<ol>\n<li>Right-click on &#8220;Ularn.exe&#8221; (or simply &#8220;Ularn&#8221; if you have file extensions turned off)<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2210\" src=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Shortcut_1.png\" alt=\"CygUlarn_Shortcut_1\" width=\"291\" height=\"128\" \/><\/li>\n<li>Right-click on &#8220;Ularn.exe &#8211; Shortcut&#8221; or &#8220;Ularn &#8211; Shortcut&#8221;, then select &#8220;Properties&#8221;, which will allow you to modify the shortcut.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2211\" src=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Shortcut_2.png\" alt=\"CygUlarn_Shortcut_2\" width=\"328\" height=\"73\" srcset=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Shortcut_2.png 328w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Shortcut_2-300x67.png 300w\" sizes=\"auto, (max-width: 328px) 100vw, 328px\" \/><\/li>\n<li>Click the &#8220;Font&#8221; tab, at the top.\u00a0 Here are the default settings:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2212\" src=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Shortcut_3.png\" alt=\"CygUlarn_Shortcut_3\" width=\"386\" height=\"533\" srcset=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Shortcut_3.png 386w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Shortcut_3-217x300.png 217w\" sizes=\"auto, (max-width: 386px) 100vw, 386px\" \/><\/li>\n<li>Select <span style=\"text-decoration: underline;\"><strong>these<\/strong><\/span> settings instead, &#8220;Lucida Console&#8221; for the Font, and &#8220;24&#8221; for the size:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2213\" src=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Shortcut_4.png\" alt=\"CygUlarn_Shortcut_4\" width=\"386\" height=\"533\" srcset=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Shortcut_4.png 386w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Shortcut_4-217x300.png 217w\" sizes=\"auto, (max-width: 386px) 100vw, 386px\" \/><\/li>\n<\/ol>\n<p><strong>From now on, launch &#8220;Ularn.exe &#8211; Shortcut&#8221; or &#8220;Ularn &#8211; Shortcut&#8221;<\/strong><\/p>\n<p>Here is what the screen looks like:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2214\" src=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Large-1024x576.png\" alt=\"CygUlarn_Large\" width=\"627\" height=\"353\" srcset=\"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Large-1024x576.png 1024w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Large-300x169.png 300w, https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-content\/uploads\/CygUlarn_Large.png 1366w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/p>\n<p>Much easier to read!<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"next-steps\"><\/span>Next Steps<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>I&#8217;m kind of a purist, so I want to maintain the Ularn version &#8220;as-is&#8221;, meaning, as close to the original source as possible.\u00a0 I think people should have access to the original experience, either for nostalgia or just to maintain an historical record.<\/p>\n<p>However, there are some things I&#8217;d like to do, and <span style=\"text-decoration: underline;\"><em><strong>if<\/strong><\/em><\/span> I end up doing them, I will bundle that as a separate version:<\/p>\n<ul>\n<li><strong>Ularn Win TTY, bless it, added color<\/strong>.\u00a0 This is one of the biggest drawbacks to Larn and Ularn &#8212; NO COLOR!\u00a0 I think there&#8217;s room to add an option to conditionally enable color.\u00a0 If you&#8217;re a purist, disable it, if you want something easier on the eyes, enable it.<\/li>\n<li><strong>Get rid of 80 x 25.<\/strong>\u00a0 There is plenty of room for larger dungeons by going to 80 x 40 or 80 x 50.\u00a0 In the source code, it alludes to all of the maximum game board dimensions, so it may be as simple as expanding the defaults.\u00a0 In theory, &#8220;ncurses&#8221; or &#8220;termcap&#8221; or whatever should handle the back end.<\/li>\n<li><strong>Bring back the dots!<\/strong>\u00a0 Original Larn had &#8220;dots&#8221; like Rogue and Hack, indicating areas that you have explored.\u00a0 Ularn can get quite confusing, because your awareness is a 3 x 3 grid &#8212; sometimes you don&#8217;t know if you&#8217;ve explored something or not, because a dark hallway in the center of two other dark hallways looks exactly the same as the ones you <span style=\"text-decoration: underline;\"><em><strong> have<\/strong><\/em><\/span> explored.\u00a0 If you love something, let it go.\u00a0 If you&#8217;ve explored something, put a dot on it!<\/li>\n<li><strong>Branch Trading Post and DND Store.<\/strong>\u00a0 Ularn adds a &#8220;branch bank of Larn&#8221; several levels in to the dungeon.\u00a0 This is convenient, since the dungeon is 15 levels deep, and you quickly find yourself loaded down with a bunch of belts, rings, and unique items, leaving only a few inventory slots available for gems and other items.\u00a0 Easy access to a &#8220;Branch trading post&#8221; or &#8220;Branch DND store&#8221; would allow you to liquidate uneeded assets, or procure much-needed supplies without having to constantly run back and forth to the town.<\/li>\n<li><strong>True ANSI terminal support<\/strong>.\u00a0 I WANT TO USE THE DARN ARROW KEYS.<\/li>\n<\/ul>\n<p>I&#8217;m not trying to reinvent the wheel, with yet another Roguelike&#8230; my intent is to bring back a classic, so that people on modern operating systems can run it and enjoy it.<\/p>\n<p>If you want a modern take on Larn, check out <a href=\"http:\/\/nlarn.sourceforge.net\/\" target=\"_blank\">Nlarn<\/a>.\u00a0 I think the guy who wrote this did a spectacular job!\u00a0 However, his take on it is the same as mine &#8212; rather than hack around with 30-year-old code, he wrote a simulacrum from the ground up.\u00a0 It&#8217;s far superior to Larn or Ularn, but it&#8217;s not &#8220;pure Larn&#8221;.\u00a0 For folks who want Ularn, here it is.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ULarn (Ultra-Larn) for Win32, built on Cygwin but runs natively Ularn that runs on Windows 7!<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2186","post","type-post","status-publish","format-standard","hentry","category-other-stuff"],"_links":{"self":[{"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/posts\/2186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/comments?post=2186"}],"version-history":[{"count":10,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/posts\/2186\/revisions"}],"predecessor-version":[{"id":2217,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/posts\/2186\/revisions\/2217"}],"wp:attachment":[{"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/media?parent=2186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/categories?post=2186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/justinparrtech.com\/JustinParr-Tech\/wp-json\/wp\/v2\/tags?post=2186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}