Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
807 stars 65 forks source link

Re the comments in src/stubs/Carbon/{Carbon.h,carbon_stubs.c} #158

Closed Kristine1975 closed 5 years ago

Kristine1975 commented 6 years ago

Not really an issue, just some notes on the comments in the above files:

Carbon.h:

// pascal is used for some functions from Carbon/MacOS that use Pascal linkage or sth // whatever, this define makes the compiler shut up for now :-P

The original MacOS was written in Pascal which has different calling conventions than C, so this was needed for C to interface with the OS. Definitely not needed anymore.

typedef void* CGrafPtr; // whatever this is?

A pointer to a CGrafPort, part of the original MacOS's drawing framework.

typedef Handle PixMapHandle; // whatever this is..

A handle (movable pointer, used to avoid memory fragmentation) to a PixMap, a pixel image.

typedef Handle CTabHandle; // ...

A handle to a ColorTable, a color table (d'uh) used with indexed images.

struct FSSpec

A file path in the original MacOS: By storing the volume number, the ID of the directory, and the file name, files could be moved without a path to it becoming invalid.

// TODO: just eliminate all calls to this?

This returns e.g. why the last memory allocation failed. It should be ok to just remove it.

carbon_stubs.c:

GetResource

Loaded a resource (structured data) from a resource file (essentially a database of structured data). For some reason the MacOS port of System Shock didn't use the original data files, but converted them to MacOS resource files and then used the OS to load textures etc. So it's not needed anymore when using the original System Shock data files.

SetPort

Sets the CGrafPort (see above) that is used by drawing functions. Indeed not needed anymore after switching to SDL.

Interrupt commented 6 years ago

Thanks for the background on all of this! Now that things are running reliably, we could start going through and removing all of the Mac specific references.