Jump to content

Mac Weidu Launcher - easy mod installation on macOS


Recommended Posts

Want to start a thread here about my little Applescript utility, the Mac Weidu Launcher.  ("MWL" for short.)

You can find the latest version here.

What is this?

First and foremost. this is for Mac users.  Installing Weidu mods on a Mac is annoying - you have to download the right version of Weidu, put it in your game folder, open Terminal, navigate to your game folder (that part is always a pain in the neck), then type in the text command to run Weidu and start installing the mod.  Some mods come with .command scripts to make this easier... but a lot don't. 

This little app makes it much simpler, in a number of ways.

1) You don't need Weidu.  This app contains the latest version of Weidu within it, you don't need to find it yourself.  As of this writing, the latest version of Weidu is v246 v247 v249.  The current version of the MWL is v7.1.249.  See how that works? ;) So you can pretty easily see what you are getting or whether it needs to be updated.

If this app ever starts to lag behind the Weidu releases - if I am not around to update it, and nobody takes up the cause - you can do it the old-fashioned way: grab Weidu, drop it in your game folder.  This app will use whatever version it finds there, only copying it its own bundled version if there is none.

2) You don't need to type in any commands.  When you run the MWL from your game folder, it automatically finds all of the mods you have there, arranges them into what I think is a good installation order, and the presents you with the list.  Double-click the first one, and its installation will begin in a Terminal window.  When it is finished, the Terminal window will close.  Run the MWL again; it will show you the list again.  Double-click the next mod, and that one will be installed.  Rinse and repeat, until all of your mods are installed.  If you ever want to uninstall system, follow this same procedure, but when a mod's Terminal window opens, tell it to uninstall rather than install.

The MWL auto-sorts any mods it knows into a suggested install order. This should take some of the stress out of installing mods manually. Any mods it is not aware of appear at the end of the list, separated by dashed lines. These mods may have to be installed somewhere in the beginning  or middle of your install order; so these are mods you will need to pay more attention to, by reading their Readme files and maybe checking out their associated forum threads.

You can make duplicate copies of the MWL and put one in each game folder - one for BGEE, one for BG2EE, one for IWDEE, etc.  Each one will work with the mods in its respective game folder.

3) No cruft and bloat in your game folder.  You don't need to copy in multiple copies of Weidu.  You don't need any .command files.  You don't need anything except each mod's mod folder.  (This is the folder that contains the mod's .tp2 file.)  When you download a mod archive, after unzipping it you can ignore and throw away everything except the mod folder itself.  (Note: some older mods have their .tp2 file outside the mod folder... in these rare cases, you need both the folder and the .tp2 file.)  In most cases, you do not need a Mac-specific version of a mod; you can download the Windows version, throw away the "setup-[mod].exe" file, and just copy the mod folder to your game directory.  Then use the MWL.

The MWL thoughtfully tucks away all .debug logs into a /logs folder inside your game directory, instead of scattering them around chaotically.

This is not quite a mod manager, and it lacks some bells and whistles of stuff like the old BWS on Windows - it has no conflict detection, notably.  But I think it makes installing mods on a Mac, if anything, even easier and cleaner than it is on Windows. 

Here's a screenshot of the kind of thing you will see when you use the MWL:

Spoiler

1267982922_ScreenShot2020-10-01at11_36_13AM.jpg.6ce8de3f1c73340421fb979fd2efc515.jpg

 

An asterisk * indicates that some components of a mod have already been installed.  Two asterisks ** indicates that some components of a mod have recently been uninstalled. The mods found in your game folder will be presented in a suggested order that should minimize conflicts and install-order errors.  You can follow the suggested order, installing mods down the list and using the asterisks to keep track; or you can choose any mod from the list, and install them in whatever order you desire.  (And of course you can skip mods if you want to leave them out of your current install.)

Cheers!

Edited by subtledoctor
Link to comment
Guest LookToWindward

Hi,

I've been reading up on how Mods are installed on the Mac and looking at MacWeiduLauncher. Since I  have a lot of experience Programming in Cocoa/Objective-C and AppleScript, I was interested in the MacWeiduLauncher script which I've been studying to figure out how it works, with the idea of improving it.I think I've more or less got it now and I have some ideas to make it easier.

I'd ideally like to give it a proper GUI and I'm investigating in the best to do this in the longer term. In the short term I am extending it to work like this (without a GUI):

1. This will be one copy of MacWeiduLauncher, call it MWL8 (version) that lives in /Applications. 

2.  User selects a Game.

The Game Application itself is chosen, not the Resource folder) to install mods into (BG1, BG1:SOD, BG2, IWD, PST) for the EE products (I'm not sure about the other versions of the game). It then figures out where the game cam from (Apple,  BeamDog, etc. (only works for Apple and Beamdog at the moment)) and therefore where Mods should be installed. 

The idea is that the User can Drag and Drop the App onto MWL8 (or as alias to) and it would record an instance of a "Game" in persistent storage. The user can add as many "Game's" as they like, e.g BG1 from Beamdog and BG1 from Apple. 

You would typically do this operation ONCE when you first buy the game.

3. User Selects a Mod. 

The user Drags and Drops a Mod folder onto MWL8.

The idea is that MWL8 will keep a list of available Mods (and the virgin Mod Files themselves). Since most mods are downloaded in a zip file, it will alloc the zip file itself to be specified (and automatically expand it). It will check that the Mod is valid and if so record an instance of it. The zip file will be used (or one created for it) and this zip will be stored in persist storage).

The Mod may be packaged in two ways (it will accept both):

Style 1 (Like SCS)

Style1:

osx-stratagems-v32    	(outer folder)
      stratagems   		(main mod folder)
          Mod Files/Folders
          setup-stratagems.tp2
        
Style2:
osx-ntotsc-v3-2-0		(outer folder)
	ntotsc              (Mod files)
	setup-ntotsc.tp2

Whenever the real files of the Mod are needed, the Mod is "Prepared" (the Zip file expanded into temp storage).

Typically this operation will be performed when a User wishes to try out a new Mod.

 

3.  Installing Mods.

If the user launches MWL8 by double clicking then it function like a normal app in that it has a Menu Bar and "Actions" Item with the following Actions:

	Actions   (Menu)
	---------------------
	Game Application Info
	Game Mod info
	---------------------
	Add Game
	Add Mod
	Remove App
	Remove Mod
	---------------------
	Install Mod
	Uninstall Mod
	Install All Mods
	Uninstall All Mods


 

Game App Info displays a dialog with a list of registered Games, if the User selects one, it shows mod centric details of the App.

App Mod Info displays a dialog with a list of registered Mods, if the User selects one, it shows details of the mod.

Add Game and Add Mod are the same actions as if Drag and Drop were used.

Remove App, this uninstalls all mods that are installed in the selected game and then removes the Game from persistent storage.

Remove Mod, this uninstalls the chosen mod from all Games in which it is currently installed and them removes the mod from persistent storage, putting the zip file into the Trash.

Install Mod, this installs the Mod into one or more games (see below).

Uninstall Mod, this uninstalls the Mod from one or more games (see below).

Install All Mods, this installs All Mods into one or more games (see below).

Uninstall All Mods, this uninstalls All Mod from one or more games (see below).

When installing a Mod, it will only install into the Game if it Game qualifies, e.g if a Mod is for IWD, then the user will only be able to select the IWD Apps (but they may be Multiple IWDs installed (from different sources, Apple, Beamdog, etc.). If a mod is compatible with with a number of games, then it can be installed all games at the same time.

-----------------

I'll break for now as it is a lot to digest and it was a bit of a brain dump for me. I'm part way through writing the Script now, at the moment I have:

Add App works with BG1, BG2, IWD, PST from Apple and Beamdog and records the app.

I also most of the Add Mod done and I'm working on that now. 

One question I would like to ask is, how does the Mod Order work. I see you read it from a URL and then do some processing based on this list?

Anyway, all the Best

Dave 

 

 

 

 

 

 

Link to comment

Heh, you are thinking about things that I have had planned for a long time.  Choosing a game, recording game (and thus resource folder) locations in persistent storage, use a proper GUI, etc.  The difference is, I have basically zero experience doing anything with Cocoa/Objective-C (I made one app, way back in ~2003, with XCode and Interface Builder), whereas you have a lot.  :)

Happy to help, and to contribute wisdom from what I've learned.  Three features that are closest to my front burner, and that I think would be great in such an app:

1) Currently it polls all subfolders within the game directory to find .tp2 files, and uses the result as the list of available mods.  This can result in false positives, as some few mods (unfortunately) have other random .tp2 files buried in their folder structure.  I would like to restrict the search for .tp2 files to the resource directory itself, or one level lower, i.e. in folders within the resource directory, but not in folders within those folders.  (I hope that's clear.)  I just don't know how to do (yet) this because I suck at have no experience with shell scripts.  EDIT - this is fixed as of v7.5... yay!

2) After installing a mod, the app should poll weidu.log and if any components from that mod are installed, then the next time it displays the list of mods to the user that mod should be visually differentiated.  Like, with a * before it (which is something I could do with the existing version, theoretically), or in a different color (which would need a GUI app like you're discussing).  EDIT - this is implemented as of v7.5... yay!

3) I would like to refine the way the mod list currently works.  Right now it displays something like

  • item_rev
  • IWDification
  • might_and_guile
  • item_rev

Because you are supposed to install only component 0 of item_rev in the first instance, and then later you can install any other components.  I would like to display the list like this:

  • item_rev:0
  • IWDification
  • might_and_guile
  • item_rev

...and the behavior should be, if it sees a colon followed by an integer and you choose that entry, it should install that component only from that mod, and then close the Terminal window, with no user interaction in the Terminal.  (This can be done with the way it calls Weidu, using --force-install and similar options.)  It should only run Weidu in the normal way and give the user the normal Weidu interaction if a mod is listed with no such integers, as in the second instance of item_rev above.  This again is something that could be done with v7 of the MWL, it would only take a certain amount of Applescript-fu that I haven't currently mastered.  The same was true of pretty much everything in the MWL at some point - I learned it as I went - but it would take me time I don't have right now.

One caveat as you go forward: Apple's OS is craaazy locked-down these days.  I had a LOT of trouble with recent versions being able to run on any given user's computer without demands for admin passwords, etc.  That's why you see the current app resorting to shell scripts so much with a lot of it could be done quite simply with Applescript itself.  What you're talking about - a full-fledged app that lives in /Applications, and can be fed an arbitrary location on the computer and call an script there - is deemed a big security risk by Apple.  This is silly - it's no more than any user can do in the OS GUI - but it caused me a LOT of hiccups in developing v7.

Otherwise, you're talking about making what I always dreamed this app could become, so I support the idea 100%.

Edited by subtledoctor
Link to comment

I have updated the MWL to version 7.5

I am currently installing ~100 mods onto BG2EE, and I have to step away at various points in the middle.  (Quarantining with kids is... challenging.)  So I have added a small feature which simply adds a star - '*' - to the mod name if some or all of it has already been installed (if the .tp2 file name is in weidu.log).  Additionally, if some or all of a mod has been uninstalled (specifically, if weidu.log lists it as being uninstalled, meaning it was the last thing you uninstalled), then the mod will be listed with two stars - '**' - in front of it.

Mods that aren't recognized by the auto-sorter are now a bit more visually distinct, cordoned off at the bottom of the list.

Cheers.

Edited by subtledoctor
Link to comment

Hi, I'm brand new to this Infinity engine modding thing, and I joined this forum to contact you. I just got BG2EE for my Mac and after reading the GOG.com forums I decided I don't want the new characters, so I'm trying to use your MWL to install the mod I found in the GOG forums that removes them. It's a clean BG2EE, latest version, never played, installed in my Documents folder so MacOS doesn't have a fit when I try to mod it. I only want the one mod so it seems simple. When I run it it seems to complete, but then when I run it again just to check, there is no * on the mod I just selected and installed. How can I tell if it is really done, since I have never played BG2EE and don't know where/how the new characters would show up in the game if the mod install didn't work?

I took a screenshot of the log file.

888898823_Logfile2020-05-3112_45.thumb.jpg.83a72dc41e7932064907bfca1f6add26.jpg

 

Link to comment

Oh, huh.  That's not good.  Sounds like when I added the checks for the content of weidu.log, I didn't anticipate the initial situation when no such file exists. 

@Larryh Easiest thing to try is to simply create a blank text file, call it "weidu.log," and put it in your game folder.  See if it works then.

I'll update the app, but it might take a bit.

Link to comment

Thanks for looking! Makes perfect sense. So, just to be clear, that means the mod wasn't applied, right? I'll try creating an empty weidu.log and running again, but I already started the game so it might be a few days.  Played original BG2 for Mac alongside my son when it was new and I'm having great fun in Irenicus dungeon. I can live with the new characters showing up, how annoying can they be ...

Thanks for doing the MWL to help out "all 4 of us" Mac BG afficianados :D

Link to comment

OK, making the empty weidu.log file before running MWL fixed it. This time I was installing the Alternatives mod into a fresh install of BG2EE and it worked fine.

One minor suggestion: in your description on the project you use the term "game folder" which might mislead a Mac user new to modding. A few words about how you have to right-click on the Baldur's Gate II Enhanced Edition.app (or whatever your game app is called), select Show Package Contents, then open the Contents folder that appears, and then the Resources folder inside there is where you drop MWL and the mod folders.

THANKS for the workaround. Great utility!

Link to comment

Now that I have installed 3 mods I want to show you the "make your selection" screen that comes up when I start MWL. See screenshot.

Why does 'alternatives' appear twice, once with * and once without, and why no * on the other two?

Here is my weidu.log showing what is installed.

// Log of Currently Installed WeiDU Mods
// The top of the file is the 'oldest' mod
// ~TP2_File~ #language_number #component_number // [Subcomponent Name -> ] Component Name [ : Version]
~ALTERNATIVES/SETUP-ALTERNATIVES.TP2~ #0 #0 // Alternatives: v14
~PICKS_OF_THE_LITTER/PICKS_OF_THE_LITTER.TP2~ #0 #0 // Plasmocat's Picks of the Litter Portrait Pack: v3
~JPSPP/SETUP-JPSPP.TP2~ #0 #1001 // Alternate Aerie Portrait by JPS: v4
~JPSPP/SETUP-JPSPP.TP2~ #0 #1002 // Alternate Imoen Portrait by JPS: v4
~JPSPP/SETUP-JPSPP.TP2~ #0 #1004 // Alternate Jaheira Portrait -> Option 2 by JPS: v4
~JPSPP/SETUP-JPSPP.TP2~ #0 #1005 // Alternate Nalia Portrait by JPS: v4
~JPSPP/SETUP-JPSPP.TP2~ #0 #1006 // Alternate Viconia Portrait by JPS: v4

 

Screenshot 2020-06-09 18.12.10.png

Link to comment
1 hour ago, Larryh said:

Why does 'alternatives' appear twice, once with * and once without

Good question.  That's... kind of weird. Maybe the mod has an extra .tp2 file in it?  (Most mods don't, and they generally should not, but sometimes you see that.) 

Also it's weird that the 'jpspp' and 'picks_of_the_litter' mods are not in my install order document, so they should appear differently, with lines around them...

Anyway though, the stars for installed mods and lines between unknown mods are just little visual bonuses, I wouldn't sweat it that much.  As long as it is properly triggering installation of each mod, it is doing the job it is designed for.

Link to comment

I agree, the script is working fine for actually installing the mods, and I appreciate the convenience. But the status indicators showing are weird -- something to think about, because for what it's worth I looked at every file within all 3 mods (they are not very big) and there is exactly one .tp2 file in each.

 

Link to comment
Guest jw1234

In Mac OS Catalina, I get this error when I try to run the launcher:

cp: /private/var/folders/41/tt294pks0sqdy76tfs0wdplm0000gn/T/AppTranslocation/4CC43582-AC37-404E-9DA1-AB37932E9B69/d/weidu: Read-only file system

Link to comment

I thought we had evaded the app translocation crap...? 

I don't know what, if anything to do about that. (Not for nothing, I have so far refused to "upgrade" to Catalina.)  But I did find this very old advice on the interweb:

Quote

In macOS Sierra, Apple added a strange security feature called App Translocation (sometimes known as Gatekeeper Path Randomization) which means that after downloading an application, if you do not move the resulting application somewhere (anywhere!), with the Finder (you must use the Finder!), the application will be run as if it is located at a randomly chosen path by the system.

So, after downloading and unzipping the app, try manually moving the app around in the Finder and finally depositing it in your game folder.  Then see if it works.  That's a real shot in the dark, but it's all I have at the moment.

Edited by subtledoctor
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...