From 8771614f87ad055f7813cc985e6009d924aeef92 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sun, 19 Oct 2014 00:44:23 +0000 Subject: [PATCH] Fix the Wii build and clean up remaining warnings. DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@4647 1a8010ca-5511-0410-912e-c29ae57300e0 --- .gitignore | 2 + polymer/eduke32/Makefile.common | 17 +++-- polymer/eduke32/build/src/kplib.c | 84 ++++++++++----------- polymer/eduke32/build/src/pragmas.c | 6 +- polymer/eduke32/build/src/startosx.editor.m | 10 +-- polymer/eduke32/source/menus.c | 4 +- polymer/eduke32/source/startosx.game.m | 14 ++-- 7 files changed, 73 insertions(+), 64 deletions(-) diff --git a/.gitignore b/.gitignore index 817e7fd0a..1a69d9408 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ /polymer/eduke32/source/jaudiolib/obj /polymer/eduke32/source/enet/obj /polymer/eduke32/source/testgame/obj +xcuserdata +project.xcworkspace diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index 61aa3fb1a..1f7a5ee55 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -16,14 +16,14 @@ ifneq ($(CROSS),) undefine STRIP endif -CC?=$(CROSS)gcc -CXX?=$(CROSS)g++ -AR?=$(CROSS)ar -RC?=$(CROSS)windres -RANLIB?=$(CROSS)ranlib -STRIP?=$(CROSS)strip -AS?=nasm -PKG_CONFIG?=pkg-config +CC=$(CROSS)gcc +CXX=$(CROSS)g++ +AR=$(CROSS)ar +RC=$(CROSS)windres +RANLIB=$(CROSS)ranlib +STRIP=$(CROSS)strip +AS=nasm +PKG_CONFIG=pkg-config # Override defaults that absolutely will not work. ifeq ($(CC),cc) @@ -48,6 +48,7 @@ ifeq ($(PLATFORM),WII) CCFULLPATH=$(DEVKITPPC)/bin/$(CC) + CROSS=powerpc-eabi- RANLIB=powerpc-eabi-ranlib STRIP=powerpc-eabi-strip endif diff --git a/polymer/eduke32/build/src/kplib.c b/polymer/eduke32/build/src/kplib.c index 4728fb443..813a36c34 100644 --- a/polymer/eduke32/build/src/kplib.c +++ b/polymer/eduke32/build/src/kplib.c @@ -284,7 +284,7 @@ static void suckbitsnextblock() nbitpos = LSWAPIL(*(int32_t *)&filptr[8]); nfilptr = (uint8_t *)&filptr[nbitpos+12]; *(int32_t *)&fakebuf[0] = *(int32_t *)&filptr[0]; //Copy last dword of IDAT chunk - if (*(int32_t *)&filptr[12] == LSWAPIB(0x54414449)) //Copy 1st dword of next IDAT chunk + if (*(int32_t *)&filptr[12] == (int32_t)LSWAPIB(0x54414449)) //Copy 1st dword of next IDAT chunk *(int32_t *)&fakebuf[4] = *(int32_t *)&filptr[16]; filptr = &fakebuf[4]; bitpos -= 32; } @@ -795,7 +795,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength, if (!pnginited) { pnginited = 1; initpngtables(); } - if ((*(int32_t *)&kfilebuf[0] != LSWAPIB(0x474e5089)) || (*(int32_t *)&kfilebuf[4] != LSWAPIB(0x0a1a0a0d))) + if ((*(int32_t *)&kfilebuf[0] != (int32_t)LSWAPIB(0x474e5089)) || (*(int32_t *)&kfilebuf[4] != (int32_t)LSWAPIB(0x0a1a0a0d))) return(-1); //"Invalid PNG file signature" filptr = (uint8_t *)&kfilebuf[8]; @@ -806,7 +806,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength, leng = LSWAPIL(*(int32_t *)&filptr[0]); i = *(int32_t *)&filptr[4]; filptr = &filptr[8]; - if (i == LSWAPIB(0x52444849)) //IHDR (must be first) + if (i == (int32_t)LSWAPIB(0x52444849)) //IHDR (must be first) { xsiz = LSWAPIL(*(int32_t *)&filptr[0]); if (xsiz <= 0) return(-1); ysiz = LSWAPIL(*(int32_t *)&filptr[4]); if (ysiz <= 0) return(-1); @@ -825,12 +825,12 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength, for (i=0; i=0; i--) palcol[i] = LSWAPIB((LSWAPIL(*(int32_t *)&filptr[i*3])>>8)|0xff000000); } - else if (i == LSWAPIB(0x44474b62)) //bKGD (must be after PLTE and before IDAT) + else if (i == (int32_t)LSWAPIB(0x44474b62)) //bKGD (must be after PLTE and before IDAT) { switch (kcoltype) { @@ -854,7 +854,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength, bakb = (bakcol&255); bakcol = LSWAPIB(bakcol); } - else if (i == LSWAPIB(0x534e5274)) //tRNS (must be after PLTE and before IDAT) + else if (i == (int32_t)LSWAPIB(0x534e5274)) //tRNS (must be after PLTE and before IDAT) { switch (kcoltype) { @@ -875,7 +875,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength, default:; } } - else if (i == LSWAPIB(0x54414449)) { break; } //IDAT + else if (i == (int32_t)LSWAPIB(0x54414449)) { break; } //IDAT filptr = &filptr[leng+4]; //crc = LSWAPIL(*(int32_t *)&filptr[-4]); } @@ -1948,23 +1948,23 @@ static int32_t ktgarend(const char *header, int32_t fleng, //============================== TARGA ends ================================= //============================== BMP begins ================================= //TODO: handle BI_RLE8 and BI_RLE4 (compression types 1&2 respectively) -// ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -// ³ 0(2): "BM" ³ -// ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿³ 10(4): rastoff³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -// ³headsiz=12 (OS/2 1.x)³³ 14(4): headsiz³ ³ All new formats: ³ -//ÚÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÁÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÁÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -//³ 18(2): xsiz ³ 18(4): xsiz ³ -//³ 20(2): ysiz ³ 22(4): ysiz ³ -//³ 22(2): planes (always 1) ³ 26(2): planes (always 1) ³ -//³ 24(2): cdim (1,4,8,24) ³ 28(2): cdim (1,4,8,16,24,32) ³ -//³ if (cdim < 16) ³ 30(4): compression (0,1,2,3!?,4) ³ -//³ 26(rastoff-14-headsiz): pal(bgr) ³ 34(4): (bitmap data size+3)&3 ³ -//³ ³ 46(4): N colors (0=2^cdim) ³ -//³ ³ if (cdim < 16) ³ -//³ ³ 14+headsiz(rastoff-14-headsiz): pal(bgr0) ³ -//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -// ³ rastoff(?): bitmap data ³ -// ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ +// +---------------+ +// | 0(2): "BM" | +// +---------------------+| 10(4): rastoff| +------------------+ +// |headsiz=12 (OS/2 1.x)|| 14(4): headsiz| | All new formats: | +//++---------------------++-------------+-+-+------------------+-----------------------+ +//| 18(2): xsiz | 18(4): xsiz | +//| 20(2): ysiz | 22(4): ysiz | +//| 22(2): planes (always 1) | 26(2): planes (always 1) | +//| 24(2): cdim (1,4,8,24) | 28(2): cdim (1,4,8,16,24,32) | +//| if (cdim < 16) | 30(4): compression (0,1,2,3!?,4) | +//| 26(rastoff-14-headsiz): pal(bgr) | 34(4): (bitmap data size+3)&3 | +//| | 46(4): N colors (0=2^cdim) | +//| | if (cdim < 16) | +//| | 14+headsiz(rastoff-14-headsiz): pal(bgr0) | +//+---------------------+---------------+---------+------------------------------------+ +// | rastoff(?): bitmap data | +// +-------------------------+ static int32_t kbmprend(const char *buf, int32_t fleng, intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres) { @@ -1974,7 +1974,7 @@ static int32_t kbmprend(const char *buf, int32_t fleng, UNREFERENCED_PARAMETER(fleng); headsiz = *(int32_t *)&buf[14]; - if (headsiz == LSWAPIB(12)) //OS/2 1.x (old format) + if (headsiz == (int32_t)LSWAPIB(12)) //OS/2 1.x (old format) { if (*(int16_t *)(&buf[22]) != SSWAPIB(1)) return(-1); xsiz = (int32_t)SSWAPIB(*(uint16_t *)&buf[18]); @@ -2000,7 +2000,7 @@ static int32_t kbmprend(const char *buf, int32_t fleng, if (cdim < 16) { if (cdim == 2) { palcol[0] = 0xffffffff; palcol[1] = LSWAPIB(0xff000000); } - if (headsiz == LSWAPIB(12)) j = 3; else j = 4; + if (headsiz == (int32_t)LSWAPIB(12)) j = 3; else j = 4; for (i=0,cptr=&buf[headsiz+14]; cptr<&buf[rastoff]; i++,cptr+=j) palcol[i] = ((*(int32_t *)&cptr[0])|LSWAPIB(0xff000000)); kcoltype = 3; bitdepth = (int8_t)cdim; paleng = i; //For PNGOUT @@ -2086,7 +2086,7 @@ static int32_t kpcxrend(const char *buf, int32_t fleng, intptr_t p,i; uint8_t c, *cptr; - if (*(int32_t *)buf != LSWAPIB(0x0801050a)) return(-1); + if (*(int32_t *)buf != (int32_t)LSWAPIB(0x0801050a)) return(-1); xsiz = SSWAPIB(*(int16_t *)&buf[ 8])-SSWAPIB(*(int16_t *)&buf[4])+1; if (xsiz <= 0) return(-1); ysiz = SSWAPIB(*(int16_t *)&buf[10])-SSWAPIB(*(int16_t *)&buf[6])+1; if (ysiz <= 0) return(-1); //buf[3]: bpp/plane:{1,2,4,8} @@ -2303,11 +2303,11 @@ void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz) if (*(uint16_t *)&ubuf[0] == SSWAPIB(0x5089)) //.PNG { lptr = (int32_t *)buf; - if ((lptr[0] != LSWAPIB(0x474e5089)) || (lptr[1] != LSWAPIB(0x0a1a0a0d))) return; + if ((lptr[0] != (int32_t)LSWAPIB(0x474e5089)) || (lptr[1] != (int32_t)LSWAPIB(0x0a1a0a0d))) return; lptr = &lptr[2]; while (((uintptr_t)lptr-(uintptr_t)buf) < (uintptr_t)(leng-16)) { - if (lptr[1] == LSWAPIB(0x52444849)) //IHDR + if (lptr[1] == (int32_t)LSWAPIB(0x52444849)) //IHDR {(*xsiz) = LSWAPIL(lptr[2]); (*ysiz) = LSWAPIL(lptr[3]); break; } lptr = (int32_t *)((intptr_t)lptr + LSWAPIL(lptr[0]) + 12); } @@ -2336,7 +2336,7 @@ void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz) } else if ((ubuf[0] == 'B') && (ubuf[1] == 'M')) //.BMP { - if (*(int32_t *) (&buf[14]) == LSWAPIB(12)) //OS/2 1.x (old format) + if (*(int32_t *) (&buf[14]) == (int32_t)LSWAPIB(12)) //OS/2 1.x (old format) { if (*(int16_t *) (&buf[22]) != SSWAPIB(1)) return; (*xsiz) = (int32_t) SSWAPIB(*(uint16_t *) &buf[18]); @@ -2349,7 +2349,7 @@ void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz) (*ysiz) = LSWAPIB(*(int32_t *) &buf[22]); } } - else if (*(int32_t *) ubuf == LSWAPIB(0x0801050a)) //.PCX + else if (*(int32_t *) ubuf == (int32_t)LSWAPIB(0x0801050a)) //.PCX { (*xsiz) = SSWAPIB(*(int16_t *) &buf[8])-SSWAPIB(*(int16_t *) &buf[4])+1; (*ysiz) = SSWAPIB(*(int16_t *) &buf[10])-SSWAPIB(*(int16_t *) &buf[6])+1; @@ -2394,7 +2394,7 @@ int32_t kprender(const char *buf, int32_t leng, intptr_t frameptr, int32_t bpl, return(kgifrend(buf, leng, frameptr, bpl, xdim, ydim)); else if ((ubuf[0] == 'B') && (ubuf[1] == 'M')) //.BMP return(kbmprend(buf, leng, frameptr, bpl, xdim, ydim)); - else if (*(int32_t *) ubuf == LSWAPIB(0x0801050a)) //.PCX + else if (*(int32_t *) ubuf == (int32_t)LSWAPIB(0x0801050a)) //.PCX return(kpcxrend(buf, leng, frameptr, bpl, xdim, ydim)); #ifdef KPCEL else if ((ubuf[0] == 0x19) && (ubuf[1] == 0x91) && (ubuf[10] == 8) && (ubuf[11] == 0)) //old .CEL/.PIC @@ -2538,11 +2538,11 @@ int32_t kzaddstack(const char *filnam) zipnamoffs = kzhashpos; kzhashpos += i; fread(&i,4,1,fil); - if (i == LSWAPIB(0x04034b50)) //'PK\3\4' is ZIP file id + if (i == (int32_t)LSWAPIB(0x04034b50)) //'PK\3\4' is ZIP file id { fseek(fil,-22,SEEK_END); fread(tempbuf,22,1,fil); - if (*(int32_t *)&tempbuf[0] == LSWAPIB(0x06054b50)) //Fast way of finding dir info + if (*(int32_t *)&tempbuf[0] == (int32_t)LSWAPIB(0x06054b50)) //Fast way of finding dir info { numfiles = SSWAPIB(*(int16_t *)&tempbuf[10]); fseek(fil,LSWAPIB(*(int32_t *)&tempbuf[16]),SEEK_SET); @@ -2553,8 +2553,8 @@ int32_t kzaddstack(const char *filnam) while (1) { if (!fread(&j,4,1,fil)) { numfiles = -1; break; } - if (j == LSWAPIB(0x02014b50)) break; //Found central file header :) - if (j != LSWAPIB(0x04034b50)) { numfiles = -1; break; } + if (j == (int32_t)LSWAPIB(0x02014b50)) break; //Found central file header :) + if (j != (int32_t)LSWAPIB(0x04034b50)) { numfiles = -1; break; } fread(tempbuf,26,1,fil); fseek(fil,LSWAPIB(*(int32_t *)&tempbuf[14]) + SSWAPIB(*(int16_t *)&tempbuf[24]) + SSWAPIB(*(int16_t *)&tempbuf[22]),SEEK_CUR); numfiles++; @@ -2565,7 +2565,7 @@ int32_t kzaddstack(const char *filnam) for (i=0; i 2GB-32K bytes gslidew = 0x7fffffff; //Force reload at beginning diff --git a/polymer/eduke32/build/src/pragmas.c b/polymer/eduke32/build/src/pragmas.c index db26f7212..c14a1ed2d 100644 --- a/polymer/eduke32/build/src/pragmas.c +++ b/polymer/eduke32/build/src/pragmas.c @@ -15,7 +15,10 @@ int32_t dmval; #if defined(__GNUC__) && defined(GEKKO) // naked function (no prolog/epilog) -// FIXME: this function produces unused parameter warnings and a missing return warning +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wreturn-type" +int32_t scale(int32_t a, int32_t d, int32_t c) ATTRIBUTE((naked)); int32_t scale(int32_t a, int32_t d, int32_t c) { // return ((int64_t)a * d) / c; @@ -95,6 +98,7 @@ int32_t scale(int32_t a, int32_t d, int32_t c) " blr\n" ); } +#pragma GCC diagnostic pop void clearbufbyte(void *d, int32_t c, int32_t a) { diff --git a/polymer/eduke32/build/src/startosx.editor.m b/polymer/eduke32/build/src/startosx.editor.m index 3822ced06..aace88346 100644 --- a/polymer/eduke32/build/src/startosx.editor.m +++ b/polymer/eduke32/build/src/startosx.editor.m @@ -32,26 +32,26 @@ static id nsapp; - (IBAction)alwaysShowClicked:(id)sender { - UNREFERENCED_PARAMETER(sender); + UNREFERENCED_PARAMETER(sender); } - (IBAction)fullscreenClicked:(id)sender { - UNREFERENCED_PARAMETER(sender); + UNREFERENCED_PARAMETER(sender); // XXX: recalculate the video modes list to take into account the fullscreen status } - (IBAction)cancel:(id)sender { - UNREFERENCED_PARAMETER(sender); + UNREFERENCED_PARAMETER(sender); [nsapp abortModal]; } - (IBAction)start:(id)sender { - UNREFERENCED_PARAMETER(sender); + UNREFERENCED_PARAMETER(sender); // XXX: write the states of the form controls to their respective homes [nsapp stopModal]; @@ -176,7 +176,7 @@ int startwin_settitle(const char *s) int startwin_idle(void *v) { - UNREFERENCED_PARAMETER(v); + UNREFERENCED_PARAMETER(v); if (startwin) [[startwin window] displayIfNeeded]; return 0; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 5c3694599..fb252c99d 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -137,7 +137,9 @@ static MenuPos_t MP_TOP_OPTIONS = { { MENU_MARGIN_CENTER<<16, 38< static MenuPos_t MP_TOP_JOYSTICK_NETWORK = { { MENU_MARGIN_CENTER<<16, 70<<16, }, 0, 7<<16, 0, -190<<16, 110<<16, 65536, }; static MenuPos_t MP_BIGOPTIONS = { { MENU_MARGIN_WIDE<<16, 38<<16, }, 2<<16, 4<<16, 190<<16, -190<<16, 20<<16, 65536, }; static MenuPos_t MP_BIGOPTIONSRT = { { MENU_MARGIN_WIDE<<16, 38<<16, }, 2<<16, 4<<16, 260<<16, -190<<16, 20<<16, 65536, }; +#ifdef USE_OPENGL static MenuPos_t MP_OPTIONS = { { MENU_MARGIN_WIDE<<16, 37<<16, }, 4<<16, 1<<16, 216<<16, 160<<16, 10<<16, 32768, }; +#endif static MenuPos_t MP_PLAYER_1 = { { MENU_MARGIN_WIDE<<16, 37<<16, }, 4<<16, 1<<16, 90<<16, 160<<16, 10<<16, 32768, }; static MenuPos_t MP_PLAYER_3 = { { MENU_MARGIN_WIDE<<16, 37<<16, }, 8<<16, 1<<16, 190<<16, 160<<16, 10<<16, 32768, }; static MenuPos_t MP_MACROS = { { 26<<16, 40<<16, }, 4<<16, 2<<16, 1<<16, 160<<16, 10<<16, 32768, }; @@ -149,7 +151,7 @@ static MenuPos_t MP_GAMEFUNCLIST = { { 100<<16, 51< static MenuPos_t MP_COLCORR = { { MENU_MARGIN_REGULAR<<16, 86<<16, }, 8<<16, 2<<16, -240<<16, 190<<16, 20<<16, 65536, }; static MenuPos_t MP_REDSLIDE = { { MENU_MARGIN_WIDE<<16, 37<<16, }, 8<<16, 2<<16, 170<<16, 190<<16, 20<<16, 65536, }; static MenuPos_t MP_LOADSAVE = { { 223<<16, 48<<16, }, 4<<16, 7<<16, 1<<16, 320<<16, 20<<16, 65536, }; -static MenuPos_t MP_NETSETUP = { { (MENU_MARGIN_REGULAR-4)<<16, 38<<16, }, 4<<16, 2<<16, 114<<16, 190<<16, 20<<16, 65536, };; +static MenuPos_t MP_NETSETUP = { { (MENU_MARGIN_REGULAR-4)<<16, 38<<16, }, 4<<16, 2<<16, 114<<16, 190<<16, 20<<16, 65536, }; // common menu option sets diff --git a/polymer/eduke32/source/startosx.game.m b/polymer/eduke32/source/startosx.game.m index ec50103fe..4c3a300db 100644 --- a/polymer/eduke32/source/startosx.game.m +++ b/polymer/eduke32/source/startosx.game.m @@ -180,26 +180,26 @@ static struct soundQuality_t { - (IBAction)alwaysShowClicked:(id)sender { - UNREFERENCED_PARAMETER(sender); + UNREFERENCED_PARAMETER(sender); } - (IBAction)fullscreenClicked:(id)sender { - UNREFERENCED_PARAMETER(sender); + UNREFERENCED_PARAMETER(sender); [self populateVideoModes:NO]; } - (IBAction)cancel:(id)sender { - UNREFERENCED_PARAMETER(sender); + UNREFERENCED_PARAMETER(sender); [nsapp abortModal]; } - (IBAction)start:(id)sender { - UNREFERENCED_PARAMETER(sender); + UNREFERENCED_PARAMETER(sender); int mode = [[modeslist3d objectAtIndex:[videoMode3DPUButton indexOfSelectedItem]] intValue]; if (mode >= 0) { @@ -262,7 +262,7 @@ static struct soundQuality_t { [startButton setEnabled:true]; [tabView selectTabViewItemAtIndex:0]; - [NSCursor unhide]; // Why should I need to do this? + [NSCursor unhide]; // Why should I need to do this? } - (void)setupMessagesMode @@ -401,8 +401,8 @@ int startwin_settitle(const char *s) int startwin_idle(void *v) { - UNREFERENCED_PARAMETER(v); - + UNREFERENCED_PARAMETER(v); + if (startwin) [[startwin window] displayIfNeeded]; return 0; }