OSX 1.14d code edits

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
AntiRush
Posts: 1
Joined: Wed Jun 03, 2015 3:09 am

OSX 1.14d code edits

Post by AntiRush » Sun Mar 03, 2019 12:38 pm

I've been working on replacing the graphics subsystem in the OSX version of D2 and figured I could start sharing
information in case anybody is interested. There is an unfortunate amount of old Carbon code still sticking around, so I've started replacing some of that too.

This is from OSX version 1.14d

Code: Select all

int __attribute__((cdecl)) EnsureDirectory(char* path);
Diablo II.0x226f8
This function is called for various filesystem paths and creates the directories if they don't exist.
Paths will be in the form '\{MacPath01}\Save'.

MacPath01 corresponds to the base directory of the game (by default '/Applications/Diablo II'
MacPath02 is the current user's Application Support directory '$HOME/Library/Application Support'

The default version of this uses some gross old Carbon APIs and, among other things makes startup scale linearly with
the number of directories (and subdirectories!) in your Application Support directory.
It is also prone to crashing if there are 'uncommon' characters in filenames inside of Application Support.

This is pretty easy to replace; just make sure the directories are created when asked and everything will be great.
The MacPath01 stuff is also a good place if you want to change where savegames or logs go.

Code: Select all

int __attribute__((cdecl)) ErrorReporter(char *dump_path, int code);
Diablo II.0x2E90
This is the handler that gets called when D2 crashes. By default it will spawn the Blizzard error reporter which is not
very useful and quite annoying if you happen to be crashing the game a lot. A bunch of debug information gets written to the
file in `dump_path` which can sometimes be nice to look at.

Post Reply

Return to “Code Editing”