From e719ef2a95f4be040bf0d88590d9825276d0bb21 Mon Sep 17 00:00:00 2001 From: soules Date: Fri, 28 Jul 2006 03:26:59 +0000 Subject: [PATCH] - everything in src/drivers/pc compiles under c++... now back to linker errors --- drivers/pc/input.cpp | 22 ++++++++++----------- drivers/pc/main.cpp | 4 ++-- drivers/pc/sdl-sound.cpp | 4 ++-- drivers/pc/sdl-video.cpp | 42 +++++++++++++++++++++++----------------- drivers/pc/sdl.cpp | 14 +++++++------- 5 files changed, 46 insertions(+), 40 deletions(-) diff --git a/drivers/pc/input.cpp b/drivers/pc/input.cpp index 14f7841d..1743b535 100644 --- a/drivers/pc/input.cpp +++ b/drivers/pc/input.cpp @@ -247,7 +247,7 @@ static void KeyboardCommands(void) { if(InputType[2] == SIFC_BWORLD) { - strcpy(&BWorldData[1],bbuf); + strcpy((char *)&BWorldData[1],(char *)bbuf); BWorldData[0]=1; } else @@ -359,7 +359,7 @@ static uint32 powerpadbuf[2]={0,0}; static uint32 UpdatePPadData(int w) { if(FCEUI_IsMovieActive()<0) - return; + return 0; uint32 r=0; ButtConfig *ppadtsc=powerpadsc[w]; @@ -590,7 +590,7 @@ static void subcon(char *text, ButtConfig *bc) for(wc=0;wcButtType[wc]==bc->ButtType[wc-1] && bc->DeviceNum[wc]==bc->DeviceNum[wc-1] && @@ -611,22 +611,22 @@ void ConfigDevice(int which, int arg) case FCFGD_QUIZKING: for(x=0;x<6;x++) { - sprintf(buf,"Quiz King Buzzer #%d", x+1); - subcon(buf,&QuizKingButtons[x]); + sprintf((char *)buf,"Quiz King Buzzer #%d", x+1); + subcon((char *)buf,&QuizKingButtons[x]); } break; case FCFGD_HYPERSHOT: for(x=0;x<4;x++) { - sprintf(buf,"Hyper Shot %d: %s",((x&2)>>1)+1,(x&1)?"JUMP":"RUN"); - subcon(buf,&HyperShotButtons[x]); + sprintf((char *)buf,"Hyper Shot %d: %s",((x&2)>>1)+1,(x&1)?"JUMP":"RUN"); + subcon((char *)buf,&HyperShotButtons[x]); } break; case FCFGD_POWERPAD: for(x=0;x<12;x++) { - sprintf(buf,"PowerPad %d: %d", (arg&1)+1,x+11); - subcon(buf,&powerpadsc[arg&1][x]); + sprintf((char *)buf,"PowerPad %d: %d", (arg&1)+1,x+11); + subcon((char *)buf,&powerpadsc[arg&1][x]); } break; @@ -635,8 +635,8 @@ void ConfigDevice(int which, int arg) char *str[10]={"A","B","SELECT","START","UP","DOWN","LEFT","RIGHT","Rapid A","Rapid B"}; for(x=0;x<10;x++) { - sprintf(buf,"GamePad #%d: %s",arg+1,str[x]); - subcon(buf,&GamePadConfig[arg][x]); + sprintf((char *)buf,"GamePad #%d: %s",arg+1,str[x]); + subcon((char *)buf,&GamePadConfig[arg][x]); } } break; diff --git a/drivers/pc/main.cpp b/drivers/pc/main.cpp index 6bdd7ce7..4be0d222 100644 --- a/drivers/pc/main.cpp +++ b/drivers/pc/main.cpp @@ -163,7 +163,7 @@ static void CreateDirs(void) mkdir(tdir); } #else - mkdir(DrBaseDirectory,S_IRWXU); + mkdir((char *)DrBaseDirectory,S_IRWXU); for(x=0;x<6;x++) { sprintf(tdir,"%s"PSS"%s",DrBaseDirectory,subs[x]); @@ -357,7 +357,7 @@ int CLImain(int argc, char *argv[]) return(0); DrBaseDirectory=GetBaseDirectory(); - FCEUI_SetBaseDirectory(DrBaseDirectory); + FCEUI_SetBaseDirectory((char *)DrBaseDirectory); CreateDirs(); diff --git a/drivers/pc/sdl-sound.cpp b/drivers/pc/sdl-sound.cpp index f0b522c1..3db57e40 100644 --- a/drivers/pc/sdl-sound.cpp +++ b/drivers/pc/sdl-sound.cpp @@ -280,7 +280,7 @@ int InitSound(FCEUGI *gi) if(BufferSize < spec.samples) BufferSize = spec.samples; - Buffer = malloc(sizeof(int) * BufferSize); + Buffer = (int *)malloc(sizeof(int) * BufferSize); BufferRead = BufferWrite = BufferIn = 0; //printf("SDL Size: %d, Internal size: %d\n",spec.samples,BufferSize); @@ -332,7 +332,7 @@ int KillSound(void) SDL_QuitSubSystem(SDL_INIT_AUDIO); if(Buffer) { - free(Buffer); + free((void *)Buffer); Buffer = 0; } return(0); diff --git a/drivers/pc/sdl-video.cpp b/drivers/pc/sdl-video.cpp index 5886f0fb..6eb305fc 100644 --- a/drivers/pc/sdl-video.cpp +++ b/drivers/pc/sdl-video.cpp @@ -43,7 +43,7 @@ extern int sdlhaveogl; static int usingogl; static double exs,eys; #else -static int exs,eys; +static double exs,eys; #endif static int eefx; @@ -232,7 +232,8 @@ int InitVideo(FCEUGI *gi) GUI_SetVideo(_fullscreen, (NWIDTH*exs), tlines*eys); #endif - screen = SDL_SetVideoMode((NWIDTH*exs), tlines*eys, desbpp, flags); + screen = SDL_SetVideoMode((int)(NWIDTH*exs), (int)(tlines*eys), + desbpp, flags); } curbpp=screen->format->BitsPerPixel; if(!screen) @@ -254,7 +255,7 @@ int InitVideo(FCEUGI *gi) } if(gi->name) - SDL_WM_SetCaption(gi->name,gi->name); + SDL_WM_SetCaption((const char *)gi->name, (const char *)gi->name); else SDL_WM_SetCaption("FCE Ultra","FCE Ultra"); @@ -371,28 +372,33 @@ void BlitScreen(uint8 *XBuf) if(_fullscreen) { - xo=(((TmpScreen->w-NWIDTH*exs))/2); + xo=(int)(((TmpScreen->w-NWIDTH*exs))/2); dest+=xo*(curbpp>>3); if(TmpScreen->h>(tlines*eys)) { - yo=((TmpScreen->h-tlines*eys)/2); + yo=(int)((TmpScreen->h-tlines*eys)/2); dest+=yo*TmpScreen->pitch; } } if(curbpp>8) { - if(BlitBuf) - Blit8ToHigh(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,1,1); - else - Blit8ToHigh(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,exs,eys); + if(BlitBuf) { + Blit8ToHigh(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,1,1); + } else { + Blit8ToHigh(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch, + (int)exs,(int)eys); + } } else { - if(BlitBuf) - Blit8To8(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,1,1,0,sponge); - else - Blit8To8(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,exs,eys,eefx,sponge); + if(BlitBuf) { + Blit8To8(XBuf+NOFFSET,dest, NWIDTH, tlines, + TmpScreen->pitch, 1, 1, 0, sponge); + } else { + Blit8To8(XBuf+NOFFSET, dest, NWIDTH, tlines, + TmpScreen->pitch, (int)exs, (int)eys, eefx, sponge); + } } if(SDL_MUSTLOCK(TmpScreen)) SDL_UnlockSurface(TmpScreen); @@ -409,13 +415,13 @@ void BlitScreen(uint8 *XBuf) drect.x=0; drect.y=0; - drect.w=exs*NWIDTH; - drect.h=eys*tlines; + drect.w=(Uint16)(exs*NWIDTH); + drect.h=(Uint16)(eys*tlines); SDL_BlitSurface(BlitBuf, &srect,screen,&drect); } - SDL_UpdateRect(screen, xo, yo, NWIDTH*exs, tlines*eys); + SDL_UpdateRect(screen, xo, yo, (Uint32)(NWIDTH*exs), (Uint32)(tlines*eys)); if(screen->flags&SDL_DOUBLEBUF) SDL_Flip(screen); @@ -423,8 +429,8 @@ void BlitScreen(uint8 *XBuf) uint32 PtoV(uint16 x, uint16 y) { - y=(double)y/eys; - x=(double)x/exs; + y=(uint16)((double)y/eys); + x=(uint16)((double)x/exs); if(eoptions&EO_CLIPSIDES) x+=8; y+=srendline; diff --git a/drivers/pc/sdl.cpp b/drivers/pc/sdl.cpp index b263bf59..5fb26188 100644 --- a/drivers/pc/sdl.cpp +++ b/drivers/pc/sdl.cpp @@ -219,13 +219,13 @@ uint8 *GetBaseDirectory(void) uint8 *ol; uint8 *ret; - ol=getenv("HOME"); + ol=(uint8 *)getenv("HOME"); if(ol) { - ret=malloc(strlen(ol)+1+strlen("./fceultra")); - strcpy(ret,ol); - strcat(ret,"/.fceultra"); + ret=(uint8 *)malloc(strlen((char *)ol)+1+strlen("./fceultra")); + strcpy((char *)ret,(char *)ol); + strcat((char *)ret,"/.fceultra"); } else { @@ -239,7 +239,7 @@ uint8 *GetBaseDirectory(void) if(sa) *sa = 0; #else - ret=malloc(1); + ret=(uint8 *)malloc(sizeof(uint8)); ret[0]=0; #endif printf("%s\n",ret); @@ -311,9 +311,9 @@ int DWaitButton(const uint8 *text, ButtConfig *bc, int wb) static int32 LastAx[64][64]; int x,y; - SDL_WM_SetCaption(text,0); + SDL_WM_SetCaption((const char *)text,0); #ifndef EXTGUI - puts(text); + puts((const char *)text); #endif for(x=0;x<64;x++) for(y=0;y<64;y++)