port: fix linux-build link error in optionsoverlay (_SHIFTL)

gbi.h's gDP* DL macros use _SHIFTL/_SHIFTR without defining them; game TUs
pull them in via <ultra64.h>. This is the first port/src TU to build a
display list, and on GCC/ld the missing macro became an undefined symbol
(MinGW's include chain happens to provide it). Define the two pure macros
locally, verbatim from PR/mbi.h -- including mbi.h itself drags in N64 OS
headers that shadow libc.
This commit is contained in:
James Dansereau committed 2026-09-03 09:59:50 -04:00
1 parent 76fb7b7a25
commit 203ceaf717
1 file changed
+9
+9
View File
@@ -22,6 +22,15 @@
#include <SDL.h>
#include <PR/ultratypes.h>
/* gbi.h's gDP* DL macros use _SHIFTL/_SHIFTR but do not define them -- game TUs
* get them from <ultra64.h>/<PR/mbi.h>, which also drags in N64 OS headers that
* shadow libc here. Define the two pure macros locally (verbatim from mbi.h) so
* this stays a plain port TU. Without them GCC/ld fails "undefined reference to
* _SHIFTL" (MinGW's chain happens to provide it). */
#ifndef _SHIFTL
#define _SHIFTL(v, s, w) ((u32)(((u32)(v) & ((0x01 << (w)) - 1)) << (s)))
#define _SHIFTR(v, s, w) ((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1)))
#endif
#include <PR/gbi.h>
#include "platform.h"