• Welcome to SC4 Devotion Forum Archives.

How to get DAMN to work on Mac

Started by Taikuh, May 12, 2016, 09:35:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Taikuh

I've gotten DAMN to work on my Mac but it's not a real, "consumer friendly" fix by far. Hopefully others will piggy back off my efforts and we could come up with something that's as easy to use as DAMN is for Windows. Things I need help with are in red at the bottom of this post.

First, my setup:
Mac Mini (mid 2011)
OS X 10.10.5
SimCity 4 Deluxe steam version, all updated

Mods that I have installed
NAM 34
CAM 2.1
Patched SimCity_1.dat
All of the CAM Starter Packs and their Dependencies. I wish all of those files were on LEX and tracked by the LEX Dependency Tracker.
Stoplight Replacement Mod
RTMT v3.60 and its dependencies. I have the RTMT's DAMN menus but I have not yet replaced the DAMN's original customMenu.dat with any of RTMT's.
DAMN

How I modified DAMN to get it to work

DAMN-Indexer.cmd --> DAMN-Indexer.command
Use this bash script instead of Daeley's Windows cmd script to index your DAMN Root directory and output the list to DAMN-index.txt: http://pastebin.com/KTCv07Ci
Or download the attachment if if you'd rather not mess with file extensions and the chmod thing.

customMenu.dat
Open customMenu.dat with a program like Ilives Reader or SC4Reader. Within the bigger Lua file:
  - change all instances of \\ to / (should be two instances to change only, both within DAMenu.interpret) And also
  - delete this block, found towards the bottom: (io.open() doesn't seem to work on SimCity for Mac)
local luainput = io.open([[Plugins/DAMN/Support/DAMN-index.txt]])
local line = 1
while (line) do
  line = luainput:read("*l")
  if (line) then
   DAMenu.interpret(line)
  end
end


Replace it with:
local luainput = [[BLAHBLAHBLAH]]
for line in string.gfind(luainput, "[^\n]+") do
  DAMenu.interpret(line)
end


Whenever you change your DAMN Root directory, run DAMN-Indexer.command, then copy the contents of DAMN-Index.txt and paste it over the BLAHBLAHBLAH within the [[ ]]. Make sure the [[ ]] still wrap around the pasted list.

I think these steps can be automated with a patched customMenu.dat that includes a LText file that local luainput = refers to. Then a modified DAMN-Indexer.command might be able to directly output the list into the LText portion of customMenu.dat.

One last thing(s) to change. The real problem with DAMN on Mac:
For some reason, the following line within DA.interpret() doesn't seem to be executing:
DAMenu.items[relpath] = menu
That means all of the name_of_mod.dat files in the DAMN Root directory are not able to add their building items to the DAMN menus. Up to now, you're able to open the DAMN news window and navigate through the different submenus. But once you hit the terminal submenus where the buildings should be listed and selectable, you get nothing.

The current workaround to this is to modify a line in each name_of_mod.dat file. We'll use DAMN/Root/Civic/Education/Jeronij's Modular Zoo/JRJ Modular Zoo.dat as an example because it comes with the full installation of DAMN. Open the Lua file within it and change Line 9 from
local menu = DAMenu.items["JRJ Modular Zoo.dat"]
to
local menu = DAMenu.items["civic"].items["education"].items["jeronij's modular zoo"]

And there you have it!

Things to do:
  - Get DAMenu.items[relpath] = menu to work. I don't know why it's not executing. It executes fine in Lua interactive mode outside the game. If we can get this to work, we won't have to modify each and every name_of_mod.dat file within the DAMN Root directory.
  - Alternatively, modify each name_of_mod.dat file that you have...
  - Automate transferring the contents of DAMN-Index.txt to customMenu.dat, preferably integrated within DAMN-Indexer.command


Attached is my DAMN/Support/ folder. It has the modified customMenu.dat and the DAMN-Indexer.command I mentioned above. You'll still have to change the name_of_mod.dat files.
If modifying other people's work or posting these files are against the rules, just let me know and I'll take this down.

Mero90

That's intresting! I'm not using the DAMN right now, but I tried it in the past on Windows and my SimCity Wine port.

However seems you succeeded into running the SC4Reader on Mac, right? Did you used Wine, any wine engine or winetricks in particular?

Taikuh

Quote from: Mero90 on May 12, 2016, 04:24:05 PM
That's intresting! I'm not using the DAMN right now, but I tried it in the past on Windows and my SimCity Wine port.

However seems you succeeded into running the SC4Reader on Mac, right? Did you used Wine, any wine engine or winetricks in particular?

I spent another whole day trying to get DAMenu.items[relpath] = menu to work. :bomb: My gf is beginning to think I'm crazy.

For SC4Reader, I used WineBottler 1.8
I unzipped the file and chose the EXE as the "installation file"
Installation mode: copy file (Program) and all files in the folder to the App Bundle
Include Mono
Winetricks: vcrun2013, iirc
I'm brain farting right now, so you'll have to remind me how I can check which wine engine version I'm using.

I've never used Ilives Reader so I don't know how it compares. What are some notable differences?

Mero90

I'm not a DAMN expert, but seems the windows version is based on the SC4 desktop shotcut, right?

Will this mac version work on non-Steam installations? (i.e. GOG and Origin that are not located in .../application support/steam/steamapps/common/SimCity 4 Deluxe)

QuoteFor SC4Reader, I used WineBottler 1.8
I unzipped the file and chose the EXE as the "installation file"
Installation mode: copy file (Program) and all files in the folder to the App Bundle
Include Mono
Winetricks: vcrun2013, iirc
I'm brain farting right now, so you'll have to remind me how I can check which wine engine version I'm using.

I know about WineBottler, you can use only one wine engine (WineBottler 1.8 means the engine 1.8).
I'll try to make it run on Wineskin.  ()testing()

Quote
I've never used Ilives Reader so I don't know how it compares. What are some notable differences?

That's just an elder SC4Reader version.

Taikuh

#4
Quote from: Mero90 on May 13, 2016, 04:44:58 AM
I'm not a DAMN expert, but seems the windows version is based on the SC4 desktop shotcut, right?

Will this mac version work on non-Steam installations? (i.e. GOG and Origin that are not located in .../application support/steam/steamapps/common/SimCity 4 Deluxe)

Keep us posted on getting a Mac friendly SC4Reader distributable :)

Because my modified customMenu.dat doesn't use Lua's io.open() function, my version of DAMN can be put in either Plugins folder and can even be put in a subfolder within Plugins.

I discovered something new today.
DAMenu.items[relpath] = menu actually applies to the last line of luainput. I don't know why but that's just how it is. I don't know how to fix it though. I tried separating the functions and writing new functions to do the different steps independently but for some reason, it only works for the last line.

So my guess is that the problem might not be with DAMenu.items[relpath] = menu but might be with one of my changes:
local luainput = [[BLAHBLAHBLAH]]
for line in string.gfind(luainput, "[^\n]+") do
  DAMenu.interpret(line)
end