• Welcome to SC4 Devotion Forum Archives.

Running SC4-PIM X on Linux

Started by Themistokles, December 28, 2016, 04:58:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Themistokles

Hi everyone!

Preamble: (As avid readers of my MD will have noticed) I've recently moved entirely to Linux Ubuntu, and with entirely I mean that finally also SC4 has made the move. With the help of PlayOnLinux and WINE, the game itself runs more or less without problems (have some load-order issues but not too much). The problem is lot editing. I can't play SC4 live without editing lots. Really can't.

Problem: Maxis LE does not install. So I ditched it and moved to SC4 PIM-X, which installs fine, but upon launch gives me errors. Installing the script to make SC4 PIM-X run on Windows 7 and newer made the list about half as long as it was before, but obviously something still remains to be fixed. This is what it gives me:

Traceback (most recent call last):
  File "SC4PIMApp.pyo", line 3454, in OnClose
  File "SC4PIMApp.pyo", line 3457, in ShowMain
  File "SC4PIMApp.pyo", line 2883, in __init__
  File "SC4PIMApp.pyo", line 3213, in LoadDatas
pywintypes.error: (2, 'RegOpenKeyEx', 'File not found.')


In my eyes this looks like there's a missing file. But which? Where could I get it? Is there something else fishy going on? %confuso

Any ideas?

Thanks in advance. :)
Come join me on a hike to St Edmea!

Latest update: 7

"In the end, our society will be defined not only by what we create, but by what we refuse to destroy." - John Sawhill

mgb204

I can think of a few things that would cause problems. For example if the application under Windows needs to access the registry. I don't know how Linux would handle such calls frankly. But whatever you are using to emulate Windows would need to cater to that. The application might be looking for the SC4 install location / plugins locations.

Of course, before getting into that, you should ensure all the libraries (.dlls) are installed that are required by the application. Under Windows you need to place such files into the installation folder of PIM-X. Again, I can't vouch for how Linux handles such libraries, which once again are pretty much designed for Windows.

If all else fails, running a virtualised Windows install would allow you to freely run most applications.

Themistokles

.dll is a good point. Is there any list of dlls that the PIM would need, and is there a way to figure out which of them might be missing?

I'm running the PIM through WINE with PlayOnLinux, so I guess there already is some kind of compatibility layer.

I do have a dual boot with Windows 10 so I could reinstall SC4 over there and use PIM on Windows, but for various reasons I would prefer having all of it on Linux.
Come join me on a hike to St Edmea!

Latest update: 7

"In the end, our society will be defined not only by what we create, but by what we refuse to destroy." - John Sawhill

mgb204

The list of files is linked on the download page, otherwise they should be on the support thread which is also linked from the download.

Themistokles

Unfortunately the dlls weren't the problem. ()sad() I now have glut32, glu32, msvcp71 and gdiplus and the problem remains.
As you said, I found the dlls at the top of the support thread (should've looked there :facepalm:). Anyways, thanks for pointing them out! :)

I tried deselecting the main game folders on launching the PIM (which are nameless) and for what it is worth this gives me different set of errors:

Traceback (most recent call last):
  File "SC4PIMApp.pyo", line 3454, in OnClose
  File "SC4PIMApp.pyo", line 3457, in ShowMain
  File "SC4PIMApp.pyo", line 2883, in __init__
  File "SC4PIMApp.pyo", line 3247, in LoadDatas
  File "SC4Data.pyo", line 573, in __init__
  File "ImageFont.pyo", line 214, in truetype
  File "ImageFont.pyo", line 121, in __init__
IOError: cannot open resource
Come join me on a hike to St Edmea!

Latest update: 7

"In the end, our society will be defined not only by what we create, but by what we refuse to destroy." - John Sawhill

mgb204

Without familiarisation with either the code of the application or the inner workings of the emulators in Linux, it's hard for me to pin point an exact cause.

A brief search for the error message within the Python language comes up with this. It's plausible that the font the application uses is simply not installed, causing a problem with it initialising properly. Especially since the log before the error seems to relate to such resources. That said, I've no idea which font PIM-X uses, but once you know that, tracking down/installing a copy would be simple enough. I don't know about you, but I can rarely name a font just by seeing some text. Perhaps there is a brute-force solution to that problem. I'm assuming it'll be something typically installed on a Windows machine by default. So on your Windows machine, find all the fonts (usually in a folder, C:\Windows\Fonts), perhaps you can copy them to the Linux machine? Again, I don't know if you can use the same files for fonts in both Linux/Windows, but I've a feeling it should work.

Andreas

#6
I wonder if copying the Maxis Lot Editor files from a Windows installation to the Linux installation might work better than trying to run a copy of PIM-X, which apparently relies on a Python framework that obviously doesn't seem to run "out of the box", as it is using Windows DLLs which call all kinds of Windows resources. Alas, I know nothing about Linux either, but if WINE is the primary tool to get Windows applications running under Linux, it might be feasible to check if there's some "Python enabler" (no idea how it is called, but you get the idea) that makes Python-based programs executable in Linux. If not, copying the Lot Editor files might do the trick after all, since they use probably the same language as SimCity 4, so you can use the same WINE setup as for the game.
Andreas

Handyman

#7
Have you tried downloading and installing Python into your wine prefix. There is a Python for windows and Linux.
Here is the link     https://www.python.org/downloads/
:thumbsdown:

I went ahead and tried this, with or without python it installs but it fails to initialize when I start it, and I get the same errors reported as in the first post.
I will keep trying.

CasperVg

#8
SC4PIM does indeed look for the font Arial (arial.ttf). It is used, I believe to add R$/R$$/R$$$ onto wealth-dependent base textures in the PIM-X lot editor.

And a list of Registry entries that it tries to read from and/or write to:
"User Group ID" in HKEY_LOCAL_MACHINE\Software\Maxis\SimCity 4\Tools (read and write)
"Install Dir" in HKEY_LOCAL_MACHINE\Software\Maxis\SimCity 4\ (read)
"Language" in HKEY_LOCAL_MACHINE\Software\Maxis\SimCity 4\1.0 (read)
Follow my SimCity 4 Let's play on YouTube

compdude787

Quote from: CasperVg on December 29, 2016, 06:23:12 AM
SC4PIM does indeed look for the font Arial (arial.ttf). It is used, I believe to add R$/R$$/R$$$ onto wealth-dependent base textures in the PIM-X lot editor.

And a list of Registry entries that it tries to read from and/or write to:
"User Group ID" in HKEY_LOCAL_MACHINE\Software\Maxis\SimCity 4\Tools (read and write)
"Install Dir" in HKEY_LOCAL_MACHINE\Software\Maxis\SimCity 4\ (read)
"Language" in HKEY_LOCAL_MACHINE\Software\Maxis\SimCity 4\1.0 (read)

He's on Linux though. Giving him registry entries to change won't do much good.
Check out my MD, United States of Simerica!
Last updated: March 5, 2017

My YouTube Channel

CasperVg

True, but at least they can be added manually in Wine should it be required.
Follow my SimCity 4 Let's play on YouTube

Handyman

You can access the registry in wine with the following command

wine regedit

It looks and functions the same as in windows

Handyman

#12
It took some work but I finally got SC4-PIM X to run in Wine on my Ubuntu/Gnome 14.04 box. I installed wine1.8:i386 and Winetricks from the Ubuntu Wine ppa. Then a reboot. I installed SC4Deluxe and the updates. Next was SC4-PIM X. Then a reboot. I used Winetricks to install Python26 (Python interpreter, version 2.6.2) and also from Winetricks I installed corefonts (microsoft). Then a reboot.

It seems to run fine, although I currently know very little about it. It took a long time to open the first time because it was cataloging all my files, but after that it open very quickly.

I don't know what your experience level is, but if you need some more details, reply back and I will try to help.

Themistokles

Thanks for your replies Handyman and everyone else! I thought I followed your explanation, but still get the same list of errors.

I'm rather new to Ubuntu (experience level: intermediate beginner ;D ), so I couldn't replicate your description entirely. I already have winetricks installed. Trough the terminal I installed Python 26 and corefonts (winetricks python26 and winetricks corefonts). Then using PlayOnLinux I made a new virtual drive with (what I believe to be) the latest stable wine version (2.0-rc3; didn't find 1.8:i386, what does "i386" mean? :) ) into which I installed SC4-PIM. Rebooted, but still the same problem. :(
Come join me on a hike to St Edmea!

Latest update: 7

"In the end, our society will be defined not only by what we create, but by what we refuse to destroy." - John Sawhill

Handyman

#14
Quote from: Themistokles on December 31, 2016, 02:21:57 AM
Thanks for your replies Handyman and everyone else! I thought I followed your explanation, but still get the same list of errors.

I'm rather new to Ubuntu (experience level: intermediate beginner ;D ), so I couldn't replicate your description entirely. I already have winetricks installed. Trough the terminal I installed Python 26 and corefonts (winetricks python26 and winetricks corefonts). Then using PlayOnLinux I made a new virtual drive with (what I believe to be) the latest stable wine version (2.0-rc3; didn't find 1.8:i386, what does "i386" mean? :) ) into which I installed SC4-PIM. Rebooted, but still the same problem. :(

First I should point out that "Wine with Winetricks" and "PlayOnLinux" store there prefixes in different places. You can have both installed on the same computer and they will work fine, however as separate processes. If you open Nautilis (file browser) and click the drop down list to enable Show Hidden Files ( or Ctrl+H) you will find a ".PlayOnLinux folder" and a ".wine" folder.
While they both rely on the current install of wine they don't interact with each other.  I had success installing SC4-PIM X into a .wine prefix using Winetricks, however when I tried to install it in PlayOnLinux it failed.

I should also mention that you can have more than one .wine prefix (ie - .wine-PIMx). Using a separate prefix for each install can save a lot of time because if you trash the install you can simply remove that prefix and start over without affecting any other .wine installs.

Since your objective is to run SC4-PIM x I will concentrate on that end result.

To make sure we are on the correct path I will need to know the following:
- Your version of Ubuntu and Is it 32 or 64 bit (If you don't know then open your Settings and choose Details)
- Your version of Wine (in a terminal type   wine --version
- Is it 32 or 64 bit (open your  .wine  folder, open  drive_c  folder, if there is no  ProgramFiles(x86)  folder then it is 32 bit)

This will help to make sure I'm not giving the wrong instructions since it may entail completely removing Wine and starting fresh.

**UPDATE - I did a little more research on 32/64bit Wine and I don't think it will be necessary to re-install Wine. I have attached a pdf file that I think will work for your situation.
***UPDATE - Revised pdf attached to my next reply.

Themistokles

A big thank you, Handyman. That pdf was extremely clear and helpful. I followed it and PIM-X now works (at least the last time I was able to check...). The problem I now face corresponds exactly to the error that you wrote would be the result if SC4 were not installed, except that it is (both through PlayonLinux and through winetricks actually). Maybe winetricks-PIM doesn't recognise the Steam version of the game? ()what()

And also, sorry for the long delay - RL intervened and during that time Microsoft found an opportunity for revenge. As I said I have a dual boot and occasionally use Windows 10, but then one day Microsoft decided it was time for a smallish update of 3 hours and after those hours it not only ignores the load order I have chosen, placing itself firmly on top, but also scrapped the entire boot menu, so I can't even force it to boot on Linux. :bomb:
Come join me on a hike to St Edmea!

Latest update: 7

"In the end, our society will be defined not only by what we create, but by what we refuse to destroy." - John Sawhill

compdude787

Quote from: Themistokles on January 07, 2017, 09:19:31 AM
And also, sorry for the long delay - RL intervened and during that time Microsoft found an opportunity for revenge. As I said I have a dual boot and occasionally use Windows 10, but then one day Microsoft decided it was time for a smallish update of 3 hours and after those hours it not only ignores the load order I have chosen, placing itself firmly on top, but also scrapped the entire boot menu, so I can't even force it to boot on Linux. :bomb:

Seriously, Microsoft?! Seriously?
Check out my MD, United States of Simerica!
Last updated: March 5, 2017

My YouTube Channel

Handyman

Glad I could help, sorry to hear you're still having issues. In regards to that, I did a little more testing after your last post and as a result, I have revised the pdf. I added the following to the caveat at the end  "or if you do have SC4 installed you must uncheck the boxes that have a blank path entry". I'm not sure what is still happening, but if you are getting the same errors this might help. It appears that the path entries must be valid or it hangs. Obviously a blank path is invalid as is the path to my plugins folder if it does not exist yet.

As for any problems with Steam I can offer nada. I use the cd version of SC4D. Sorry!

I do have some info regarding your boot problem.
• You may be able to access your Boot Menu (BBS Popup) during a reboot. On mine if I press F8 during boot up I will get the Boot Menu. I do have to wait in the bios for a few seconds before the F8 selection will work. If you can select the drive that has Linux on it, you may be able to boot directly into your Linux install. Making this selection may also take you into Grub, if it still exists. If you can get in this way you can re-install Grub.
   
• You always have the option of booting up your live cd and re-installing Grub from there.

Run the following command from a terminal.

    X is the drive (letter) on which you want GRUB to write the boot information.

    sudo grub-install /dev/sdX       # Example: sudo grub-install /dev/sda

This will rewrite the MBR information to point to the current installation and rewrite some GRUB 2 files.

Now use the next command to update the Grub menu.

   sudo update-grub

Hopefully something here helps.

PS; I have attached the revised pdf