diff options
| author | Max Horn | 2007-09-18 20:16:33 +0000 | 
|---|---|---|
| committer | Max Horn | 2007-09-18 20:16:33 +0000 | 
| commit | 3abc11611e1d1d93f1cf794df28879de3571bd01 (patch) | |
| tree | e1ac8a925d1388f8df010a114d7bed471fc9fe3b /backends/platform/dc | |
| parent | c3d3aebe87d16d4fc3b7ac8581b99fb97241c9ac (diff) | |
| download | scummvm-rg350-3abc11611e1d1d93f1cf794df28879de3571bd01.tar.gz scummvm-rg350-3abc11611e1d1d93f1cf794df28879de3571bd01.tar.bz2 scummvm-rg350-3abc11611e1d1d93f1cf794df28879de3571bd01.zip  | |
Code formatting fixes
svn-id: r28945
Diffstat (limited to 'backends/platform/dc')
| -rw-r--r-- | backends/platform/dc/audio.cpp | 12 | ||||
| -rw-r--r-- | backends/platform/dc/dcloader.cpp | 80 | ||||
| -rw-r--r-- | backends/platform/dc/dcmain.cpp | 26 | ||||
| -rw-r--r-- | backends/platform/dc/display.cpp | 84 | ||||
| -rw-r--r-- | backends/platform/dc/icon.cpp | 60 | ||||
| -rw-r--r-- | backends/platform/dc/input.cpp | 118 | ||||
| -rw-r--r-- | backends/platform/dc/label.cpp | 22 | ||||
| -rw-r--r-- | backends/platform/dc/selector.cpp | 80 | ||||
| -rw-r--r-- | backends/platform/dc/softkbd.cpp | 42 | ||||
| -rw-r--r-- | backends/platform/dc/time.cpp | 4 | ||||
| -rw-r--r-- | backends/platform/dc/vmsave.cpp | 66 | 
11 files changed, 297 insertions, 297 deletions
diff --git a/backends/platform/dc/audio.cpp b/backends/platform/dc/audio.cpp index 42201d2dd3..7364b170e6 100644 --- a/backends/platform/dc/audio.cpp +++ b/backends/platform/dc/audio.cpp @@ -44,28 +44,28 @@ void OSystem_Dreamcast::checkSound()    int n;    int curr_ring_buffer_samples; -  if(!_mixer) +  if (!_mixer)      return; -  if(read_sound_int(&SOUNDSTATUS->mode) != MODE_PLAY) +  if (read_sound_int(&SOUNDSTATUS->mode) != MODE_PLAY)      start_sound();    curr_ring_buffer_samples = read_sound_int(&SOUNDSTATUS->ring_length);    n = read_sound_int(&SOUNDSTATUS->samplepos); -  if((n-=fillpos)<0) +  if ((n-=fillpos)<0)      n += curr_ring_buffer_samples;    n = ADJUST_BUFFER_SIZE(n-10); -  if(n<100) +  if (n<100)      return;    Audio::Mixer::mixCallback(_mixer, (byte*)temp_sound_buffer,  			    2*SAMPLES_TO_BYTES(n)); -  if(fillpos+n > curr_ring_buffer_samples) { +  if (fillpos+n > curr_ring_buffer_samples) {      int r = curr_ring_buffer_samples - fillpos;      memcpy4s(RING_BUF+fillpos, temp_sound_buffer, SAMPLES_TO_BYTES(r));      fillpos = 0; @@ -74,7 +74,7 @@ void OSystem_Dreamcast::checkSound()    } else {      memcpy4s(RING_BUF+fillpos, temp_sound_buffer, SAMPLES_TO_BYTES(n));    } -  if((fillpos += n) >= curr_ring_buffer_samples) +  if ((fillpos += n) >= curr_ring_buffer_samples)      fillpos = 0;  } diff --git a/backends/platform/dc/dcloader.cpp b/backends/platform/dc/dcloader.cpp index 7254d48415..7e5a068780 100644 --- a/backends/platform/dc/dcloader.cpp +++ b/backends/platform/dc/dcloader.cpp @@ -116,14 +116,14 @@ extern "C" void flush_instruction_cache();  static void purge_copyback()  {    int i; -  for(i=0; i!=(1<<14); i+=(1<<5)) +  for (i=0; i!=(1<<14); i+=(1<<5))      *(volatile unsigned int *)(0xf4000000+i) &= ~3;  }  void DLObject::seterror(const char *fmt, ...)  { -  if(errbuf) { +  if (errbuf) {      va_list va;      va_start(va, fmt);      vsnprintf(errbuf, MAXDLERRLEN, fmt, va); @@ -151,12 +151,12 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size)  {    Elf32_Rela *rela; -  if(!(rela = (Elf32_Rela *)malloc(size))) { +  if (!(rela = (Elf32_Rela *)malloc(size))) {      seterror("Out of memory.");      return false;    } -  if(lseek(fd, offset, SEEK_SET)<0 || +  if (lseek(fd, offset, SEEK_SET)<0 ||       read(fd, rela, size) != size) {      seterror("Relocation table load failed.");      free(rela); @@ -164,7 +164,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size)    }    int cnt = size / sizeof(*rela); -  for(int i=0; i<cnt; i++) { +  for (int i=0; i<cnt; i++) {      Elf32_Sym *sym = (Elf32_Sym *)(((char *)symtab)+(rela[i].r_info>>4)); @@ -172,7 +172,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size)      switch(rela[i].r_info & 0xf) {      case 1: /* DIR32 */ -      if(sym->st_shndx < 0xff00) +      if (sym->st_shndx < 0xff00)  	*(unsigned long *)target += (unsigned long)segment;        break;      default: @@ -195,7 +195,7 @@ bool DLObject::load(int fd)    Elf32_Shdr *shdr;    int symtab_sect = -1; -  if(read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr) || +  if (read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr) ||       memcmp(ehdr.e_ident, ELFMAG, SELFMAG) ||       ehdr.e_type != 2 ||  ehdr.e_machine != 42 ||       ehdr.e_phentsize < sizeof(phdr) || ehdr.e_shentsize != sizeof(*shdr) || @@ -207,13 +207,13 @@ bool DLObject::load(int fd)    DBG("phoff = %d, phentsz = %d, phnum = %d\n",        ehdr.e_phoff, ehdr.e_phentsize, ehdr.e_phnum); -  if(lseek(fd, ehdr.e_phoff, SEEK_SET)<0 || +  if (lseek(fd, ehdr.e_phoff, SEEK_SET)<0 ||       read(fd, &phdr, sizeof(phdr)) != sizeof(phdr)) {      seterror("Program header load failed.");      return false;    } -  if(phdr.p_type != 1 || phdr.p_vaddr != 0 || phdr.p_paddr != 0 || +  if (phdr.p_type != 1 || phdr.p_vaddr != 0 || phdr.p_paddr != 0 ||       phdr.p_filesz > phdr.p_memsz) {      seterror("Invalid program header.");      return false; @@ -222,17 +222,17 @@ bool DLObject::load(int fd)    DBG("offs = %d, filesz = %d, memsz = %d, align = %d\n",        phdr.p_offset, phdr.p_filesz, phdr.p_memsz, phdr.p_align); -  if(!(segment = memalign(phdr.p_align, phdr.p_memsz))) { +  if (!(segment = memalign(phdr.p_align, phdr.p_memsz))) {      seterror("Out of memory.");      return false;    }    DBG("segment @ %p\n", segment); -  if(phdr.p_memsz > phdr.p_filesz) +  if (phdr.p_memsz > phdr.p_filesz)      memset(((char *)segment) + phdr.p_filesz, 0, phdr.p_memsz - phdr.p_filesz); -  if(lseek(fd, phdr.p_offset, SEEK_SET)<0 || +  if (lseek(fd, phdr.p_offset, SEEK_SET)<0 ||       read(fd, segment, phdr.p_filesz) != phdr.p_filesz) {      seterror("Segment load failed.");      return false; @@ -241,12 +241,12 @@ bool DLObject::load(int fd)    DBG("shoff = %d, shentsz = %d, shnum = %d\n",        ehdr.e_shoff, ehdr.e_shentsize, ehdr.e_shnum); -  if(!(shdr = (Elf32_Shdr *)malloc(ehdr.e_shnum * sizeof(*shdr)))) { +  if (!(shdr = (Elf32_Shdr *)malloc(ehdr.e_shnum * sizeof(*shdr)))) {      seterror("Out of memory.");      return false;    } -  if(lseek(fd, ehdr.e_shoff, SEEK_SET)<0 || +  if (lseek(fd, ehdr.e_shoff, SEEK_SET)<0 ||       read(fd, shdr, ehdr.e_shnum * sizeof(*shdr)) !=       ehdr.e_shnum * sizeof(*shdr)) {      seterror("Section headers load failed."); @@ -254,41 +254,41 @@ bool DLObject::load(int fd)      return false;    } -  for(int i=0; i<ehdr.e_shnum; i++) { +  for (int i=0; i<ehdr.e_shnum; i++) {      DBG("Section %d: type = %d, size = %d, entsize = %d, link = %d\n",  	i, shdr[i].sh_type, shdr[i].sh_size, shdr[i].sh_entsize, shdr[i].sh_link); -    if(shdr[i].sh_type == 2 && shdr[i].sh_entsize == sizeof(Elf32_Sym) && +    if (shdr[i].sh_type == 2 && shdr[i].sh_entsize == sizeof(Elf32_Sym) &&         shdr[i].sh_link < ehdr.e_shnum && shdr[shdr[i].sh_link].sh_type == 3 &&         symtab_sect < 0)        symtab_sect = i;    } -  if(symtab_sect < 0) { +  if (symtab_sect < 0) {      seterror("No symbol table.");      free(shdr);      return false;    } -  if(!(symtab = malloc(shdr[symtab_sect].sh_size))) { +  if (!(symtab = malloc(shdr[symtab_sect].sh_size))) {      seterror("Out of memory.");      free(shdr);      return false;    } -  if(lseek(fd, shdr[symtab_sect].sh_offset, SEEK_SET)<0 || +  if (lseek(fd, shdr[symtab_sect].sh_offset, SEEK_SET)<0 ||       read(fd, symtab, shdr[symtab_sect].sh_size) != shdr[symtab_sect].sh_size){      seterror("Symbol table load failed.");      free(shdr);      return false;    } -  if(!(strtab = (char *)malloc(shdr[shdr[symtab_sect].sh_link].sh_size))) { +  if (!(strtab = (char *)malloc(shdr[shdr[symtab_sect].sh_link].sh_size))) {      seterror("Out of memory.");      free(shdr);      return false;    } -  if(lseek(fd, shdr[shdr[symtab_sect].sh_link].sh_offset, SEEK_SET)<0 || +  if (lseek(fd, shdr[shdr[symtab_sect].sh_link].sh_offset, SEEK_SET)<0 ||       read(fd, strtab, shdr[shdr[symtab_sect].sh_link].sh_size) !=       shdr[shdr[symtab_sect].sh_link].sh_size){      seterror("Symbol table strings load failed."); @@ -300,15 +300,15 @@ bool DLObject::load(int fd)    DBG("Loaded %d symbols.\n", symbol_cnt);    Elf32_Sym *s = (Elf32_Sym *)symtab; -  for(int c = symbol_cnt; c--; s++) -    if(s->st_shndx < 0xff00) +  for (int c = symbol_cnt; c--; s++) +    if (s->st_shndx < 0xff00)        s->st_value += (Elf32_Addr)segment; -  for(int i=0; i<ehdr.e_shnum; i++) -    if(shdr[i].sh_type == 4 && shdr[i].sh_entsize == sizeof(Elf32_Rela) && +  for (int i=0; i<ehdr.e_shnum; i++) +    if (shdr[i].sh_type == 4 && shdr[i].sh_entsize == sizeof(Elf32_Rela) &&         shdr[i].sh_link == symtab_sect && shdr[i].sh_info < ehdr.e_shnum &&         (shdr[shdr[i].sh_info].sh_flags & 2)) -      if(!relocate(fd, shdr[i].sh_offset, shdr[i].sh_size)) { +      if (!relocate(fd, shdr[i].sh_offset, shdr[i].sh_size)) {  	free(shdr);  	return false;        } @@ -325,12 +325,12 @@ bool DLObject::open(const char *path)    DBG("open(\"%s\")\n", path); -  if((fd = ::open(path, O_RDONLY))<0) { +  if ((fd = ::open(path, O_RDONLY))<0) {      seterror("%s not found.", path);      return false;    } -  if(!load(fd)) { +  if (!load(fd)) {      ::close(fd);      unload();      return false; @@ -349,7 +349,7 @@ bool DLObject::open(const char *path)    dtors_start = symbol("__plugin_dtors");    dtors_end = symbol("__plugin_dtors_end"); -  if(ctors_start == NULL || ctors_end == NULL || dtors_start == NULL || +  if (ctors_start == NULL || ctors_end == NULL || dtors_start == NULL ||       dtors_end == NULL) {      seterror("Missing ctors/dtors.");      dtors_start = dtors_end = NULL; @@ -358,7 +358,7 @@ bool DLObject::open(const char *path)    }    DBG("Calling constructors.\n"); -  for(void (**f)(void) = (void (**)(void))ctors_start; f != ctors_end; f++) +  for (void (**f)(void) = (void (**)(void))ctors_start; f != ctors_end; f++)      (**f)();    DBG("%s opened ok.\n", path); @@ -367,8 +367,8 @@ bool DLObject::open(const char *path)  bool DLObject::close()  { -  if(dtors_start != NULL && dtors_end != NULL) -    for(void (**f)(void) = (void (**)(void))dtors_start; f != dtors_end; f++) +  if (dtors_start != NULL && dtors_end != NULL) +    for (void (**f)(void) = (void (**)(void))dtors_start; f != dtors_end; f++)        (**f)();    dtors_start = dtors_end = NULL;    unload(); @@ -379,14 +379,14 @@ void *DLObject::symbol(const char *name)  {    DBG("symbol(\"%s\")\n", name); -  if(symtab == NULL || strtab == NULL || symbol_cnt < 1) { +  if (symtab == NULL || strtab == NULL || symbol_cnt < 1) {      seterror("No symbol table loaded.");      return NULL;    }    Elf32_Sym *s = (Elf32_Sym *)symtab; -  for(int c = symbol_cnt; c--; s++) -    if((s->st_info>>4 == 1 || s->st_info>>4 == 2) && +  for (int c = symbol_cnt; c--; s++) +    if ((s->st_info>>4 == 1 || s->st_info>>4 == 2) &&         strtab[s->st_name] == '_' && !strcmp(name, strtab+s->st_name+1)) {        DBG("=> %p\n", (void*)s->st_value);        return (void*)s->st_value; @@ -402,7 +402,7 @@ static char dlerr[MAXDLERRLEN];  void *dlopen(const char *filename, int flags)  {    DLObject *obj = new DLObject(dlerr); -  if(obj->open(filename)) +  if (obj->open(filename))      return (void *)obj;    delete obj;    return NULL; @@ -411,11 +411,11 @@ void *dlopen(const char *filename, int flags)  int dlclose(void *handle)  {    DLObject *obj = (DLObject *)handle; -  if(obj == NULL) { +  if (obj == NULL) {      strcpy(dlerr, "Handle is NULL.");      return -1;    } -  if(obj->close()) { +  if (obj->close()) {      delete obj;      return 0;    } @@ -424,7 +424,7 @@ int dlclose(void *handle)  void *dlsym(void *handle, const char *symbol)  { -  if(handle == NULL) { +  if (handle == NULL) {      strcpy(dlerr, "Handle is NULL.");      return NULL;    } @@ -438,6 +438,6 @@ const char *dlerror()  void dlforgetsyms(void *handle)  { -  if(handle != NULL) +  if (handle != NULL)      ((DLObject *)handle)->discard_symtab();  } diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index df729f85f8..9c11d0f9da 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -64,16 +64,16 @@ void OSystem_Dreamcast::initBackend()  static bool find_track(int track, int &first_sec, int &last_sec)  {    struct TOC *toc = cdfs_gettoc(); -  if(!toc) +  if (!toc)      return false;    int i, first, last;    first = TOC_TRACK(toc->first);    last = TOC_TRACK(toc->last); -  if(first < 1 || last > 99 || first > last) +  if (first < 1 || last > 99 || first > last)      return false; -  for(i=first; i<=last; i++) -    if(!(TOC_CTRL(toc->entry[i-1])&4)) -      if(track==1) { +  for (i=first; i<=last; i++) +    if (!(TOC_CTRL(toc->entry[i-1])&4)) +      if (track==1) {  	first_sec = TOC_LBA(toc->entry[i-1]);  	last_sec = TOC_LBA(toc->entry[i]);  	return true; @@ -86,14 +86,14 @@ void OSystem_Dreamcast::playCD(int track, int num_loops, int start_frame, int du  {    int first_sec, last_sec;  #if 1 -  if(num_loops) +  if (num_loops)      --num_loops;  #endif -  if(num_loops>14) num_loops=14; -  else if(num_loops<0) num_loops=15; // infinity -  if(!find_track(track, first_sec, last_sec)) +  if (num_loops>14) num_loops=14; +  else if (num_loops<0) num_loops=15; // infinity +  if (!find_track(track, first_sec, last_sec))      return; -  if(duration) +  if (duration)      last_sec = first_sec + start_frame + duration;    first_sec += start_frame;    play_cdda_sectors(first_sec, last_sec, num_loops); @@ -168,7 +168,7 @@ void OSystem_Dreamcast::setFeatureState(Feature f, bool enable)    switch(f) {    case kFeatureAspectRatioCorrection:      _aspect_stretch = enable; -    if(screen) +    if (screen)        setScaling();      break;    case kFeatureVirtualKeyboard: @@ -230,12 +230,12 @@ int DCLauncherDialog::runModal()  {    char *base = NULL, *dir = NULL; -  if(!selectGame(base, dir, icon)) +  if (!selectGame(base, dir, icon))      exit(0);    // Set the game path.    ConfMan.addGameDomain(base); -  if(dir != NULL) +  if (dir != NULL)      ConfMan.set("path", dir, base);    // Set the target. diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index 1790785b67..9d095e389d 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -49,7 +49,7 @@  #define COPYPIXEL(n) do {			\    unsigned short _tmp = pal[*s++];		\    d[n] = _tmp|(pal[*s++]<<16);			\ -} while(0) +} while (0)  static void texture_memcpy64_pal(void *dest, void *src, int cnt, unsigned short *pal)  { @@ -58,7 +58,7 @@ static void texture_memcpy64_pal(void *dest, void *src, int cnt, unsigned short      (0xe0000000 | (((unsigned long)dest) & 0x03ffffc0));    QACR0 = ((0xa4000000>>26)<<2)&0x1c;    QACR1 = ((0xa4000000>>26)<<2)&0x1c; -  while(cnt--) { +  while (cnt--) {      COPYPIXEL(0);      COPYPIXEL(1);      COPYPIXEL(2); @@ -91,7 +91,7 @@ static void texture_memcpy64(void *dest, void *src, int cnt)      (0xe0000000 | (((unsigned long)dest) & 0x03ffffc0));    QACR0 = ((0xa4000000>>26)<<2)&0x1c;    QACR1 = ((0xa4000000>>26)<<2)&0x1c; -  while(cnt--) { +  while (cnt--) {      d[0] = *s++;      d[1] = *s++;      d[2] = *s++; @@ -137,8 +137,8 @@ void commit_dummy_transpoly()  void OSystem_Dreamcast::setPalette(const byte *colors, uint start, uint num)  {    unsigned short *dst = palette + start; -  if(num>0) -    while( num-- ) { +  if (num>0) +    while ( num-- ) {        *dst++ = ((colors[0]<<7)&0x7c00)|  	((colors[1]<<2)&0x03e0)|  	((colors[2]>>3)&0x001f); @@ -150,8 +150,8 @@ void OSystem_Dreamcast::setPalette(const byte *colors, uint start, uint num)  void OSystem_Dreamcast::setCursorPalette(const byte *colors, uint start, uint num)  {    unsigned short *dst = cursor_palette + start; -  if(num>0) -    while( num-- ) { +  if (num>0) +    while ( num-- ) {        *dst++ = ((colors[0]<<7)&0x7c00)|  	((colors[1]<<2)&0x03e0)|  	((colors[2]>>3)&0x001f); @@ -168,8 +168,8 @@ void OSystem_Dreamcast::disableCursorPalette(bool disable)  void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num)  {    const unsigned short *src = palette + start; -  if(num>0) -    while( num-- ) { +  if (num>0) +    while ( num-- ) {        unsigned short p = *src++;        colors[0] = ((p&0x7c00)>>7)|((p&0x7000)>>12);        colors[1] = ((p&0x03e0)>>2)|((p&0x0380)>>7); @@ -181,10 +181,10 @@ void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num)  void OSystem_Dreamcast::setScaling()  { -  if(_screen_w > 400) { +  if (_screen_w > 400) {      _xscale = _yscale = 1.0;      _top_offset = (SCREEN_H-_screen_h)>>1; -  } else if(_aspect_stretch && _screen_w == 320 && _screen_h == 200) { +  } else if (_aspect_stretch && _screen_w == 320 && _screen_h == 200) {      _xscale = SCREEN_W/320.0;      _yscale = SCREEN_H/200.0;      _top_offset = 0; @@ -206,22 +206,22 @@ void OSystem_Dreamcast::initSize(uint w, uint h)    _screen_h = h;    _overlay_x = (w-OVL_W)/2;    _overlay_y = (h-OVL_H)/2; -  if(_overlay_x<0) _overlay_x = 0; -  if(_overlay_y<0) _overlay_y = 0; +  if (_overlay_x<0) _overlay_x = 0; +  if (_overlay_y<0) _overlay_y = 0;    setScaling();    ta_sync(); -  if(!screen) +  if (!screen)      screen = new unsigned char[SCREEN_W*SCREEN_H]; -  if(!overlay) +  if (!overlay)      overlay = new unsigned short[OVL_W*OVL_H]; -  for(int i=0; i<NUM_BUFFERS; i++) -    if(!screen_tx[i]) +  for (int i=0; i<NUM_BUFFERS; i++) +    if (!screen_tx[i])        screen_tx[i] = ta_txalloc(SCREEN_W*SCREEN_H*2); -  for(int i=0; i<NUM_BUFFERS; i++) -    if(!mouse_tx[i]) +  for (int i=0; i<NUM_BUFFERS; i++) +    if (!mouse_tx[i])        mouse_tx[i] = ta_txalloc(MOUSE_W*MOUSE_H*2); -  for(int i=0; i<NUM_BUFFERS; i++) -    if(!ovl_tx[i]) +  for (int i=0; i<NUM_BUFFERS; i++) +    if (!ovl_tx[i])        ovl_tx[i] = ta_txalloc(OVL_TXSTRIDE*OVL_H*2);    _screen_buffer = 0;    _mouse_buffer = 0; @@ -239,7 +239,7 @@ void OSystem_Dreamcast::initSize(uint w, uint h)  void OSystem_Dreamcast::copyRectToScreen(const byte *buf, int pitch, int x, int y,  				  int w, int h)  { -  if(w<1 || h<1) +  if (w<1 || h<1)      return;    unsigned char *dst = screen + y*SCREEN_W + x;    do { @@ -293,7 +293,7 @@ void OSystem_Dreamcast::updateScreen(void)    struct polygon_list mypoly;    struct packed_colour_vertex_list myvertex; -  if(_screen_dirty) { +  if (_screen_dirty) {      _screen_buffer++;      _screen_buffer &= NUM_BUFFERS-1; @@ -301,10 +301,10 @@ void OSystem_Dreamcast::updateScreen(void)      unsigned short *dst = (unsigned short *)screen_tx[_screen_buffer];      unsigned char *src = screen; -    // while((*((volatile unsigned int *)(void*)0xa05f810c) & 0x3ff) != 200); +    // while ((*((volatile unsigned int *)(void*)0xa05f810c) & 0x3ff) != 200);      // *((volatile unsigned int *)(void*)0xa05f8040) = 0xff0000; -    for( int y = 0; y<_screen_h; y++ ) +    for ( int y = 0; y<_screen_h; y++ )      {        texture_memcpy64_pal( dst, src, _screen_w>>5, palette );        src += SCREEN_W; @@ -314,7 +314,7 @@ void OSystem_Dreamcast::updateScreen(void)      _screen_dirty = false;    } -  if( _overlay_visible && _overlay_dirty ) { +  if ( _overlay_visible && _overlay_dirty ) {      _overlay_buffer++;      _overlay_buffer &= NUM_BUFFERS-1; @@ -322,7 +322,7 @@ void OSystem_Dreamcast::updateScreen(void)      unsigned short *dst = (unsigned short *)ovl_tx[_overlay_buffer];      unsigned short *src = overlay; -    for( int y = 0; y<OVL_H; y++ ) +    for ( int y = 0; y<OVL_H; y++ )      {        texture_memcpy64( dst, src, OVL_W>>5 );        src += OVL_W; @@ -378,15 +378,15 @@ void OSystem_Dreamcast::updateScreen(void)    ta_commit_end(); -  if(_overlay_visible) { -    if(_overlay_fade < 1.0) +  if (_overlay_visible) { +    if (_overlay_fade < 1.0)        _overlay_fade += 0.125;    } else { -    if(_overlay_fade > 0) +    if (_overlay_fade > 0)        _overlay_fade -= 0.125;    } -  if(_overlay_fade > 0.0) { +  if (_overlay_fade > 0.0) {      mypoly.cmd =        TA_CMD_POLYGON|TA_CMD_POLYGON_TYPE_TRANSPARENT|TA_CMD_POLYGON_SUBLIST| @@ -432,16 +432,16 @@ void OSystem_Dreamcast::updateScreen(void)      ta_commit_list(&myvertex);    } -  if(_softkbd_on) -    if(_softkbd_motion < 120) +  if (_softkbd_on) +    if (_softkbd_motion < 120)        _softkbd_motion += 10;      else        ;    else -    if(_softkbd_motion > 0) +    if (_softkbd_motion > 0)        _softkbd_motion -= 10; -  if(_softkbd_motion) +  if (_softkbd_motion)      _softkbd.draw(330.0*sin(0.013*_softkbd_motion) - 320.0, 200.0,  		  120-_softkbd_motion); @@ -467,11 +467,11 @@ void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h,    unsigned short *dst = (unsigned short *)mouse_tx[_mouse_buffer];    int y=0; -  if(visible && w && h && w<=MOUSE_W && h<=MOUSE_H) -    for(int y=0; y<h; y++) { +  if (visible && w && h && w<=MOUSE_W && h<=MOUSE_H) +    for (int y=0; y<h; y++) {        int x; -      for(x=0; x<w; x++) -	if(*buf == _ms_keycolor) { +      for (x=0; x<w; x++) +	if (*buf == _ms_keycolor) {  	  *dst++ = 0;  	  buf++;  	} else @@ -527,7 +527,7 @@ void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h,  void OSystem_Dreamcast::mouseToSoftKbd(int x, int y, int &rx, int &ry) const  { -  if(_softkbd_motion) { +  if (_softkbd_motion) {      rx = (int)(x*_xscale - (330.0*sin(0.013*_softkbd_motion) - 320.0));      ry = (int)(y*_yscale + TOP_OFFSET - 200.0);    } else { @@ -550,7 +550,7 @@ void OSystem_Dreamcast::hideOverlay()  void OSystem_Dreamcast::clearOverlay()  { -  if(!_overlay_visible) +  if (!_overlay_visible)      return;    memset(overlay, 0, OVL_W*OVL_H*sizeof(unsigned short)); @@ -572,7 +572,7 @@ void OSystem_Dreamcast::grabOverlay(int16 *buf, int pitch)  void OSystem_Dreamcast::copyRectToOverlay(const int16 *buf, int pitch,  					  int x, int y, int w, int h)  { -  if(w<1 || h<1) +  if (w<1 || h<1)      return;    unsigned short *dst = overlay + y*OVL_W + x;    do { diff --git a/backends/platform/dc/icon.cpp b/backends/platform/dc/icon.cpp index 38c68c880c..fa1366d37a 100644 --- a/backends/platform/dc/icon.cpp +++ b/backends/platform/dc/icon.cpp @@ -33,7 +33,7 @@ void Icon::create_vmicon(void *buffer)    unsigned short *pal = (unsigned short *)buffer;    unsigned char *pix = ((unsigned char *)buffer)+32; -  for(int n = 0; n<16; n++) { +  for (int n = 0; n<16; n++) {      int p = palette[n];      pal[n] =        ((p>>16)&0xf000)| @@ -42,7 +42,7 @@ void Icon::create_vmicon(void *buffer)        ((p>> 4)&0x000f);    } -  for(int line = 0; line < 32; line++) { +  for (int line = 0; line < 32; line++) {      memcpy(pix, &bitmap[32/2*(31-line)], 32/2);      pix += 32/2;    } @@ -55,9 +55,9 @@ void Icon::create_texture()    unsigned short *tex = (unsigned short *)ta_txalloc(512);    unsigned short *linebase;    unsigned char *src = bitmap+sizeof(bitmap)-17; -  for(int y=0; y<16; y++) { +  for (int y=0; y<16; y++) {      linebase = tex + (tt[y]<<1); -    for(int x=0; x<16; x++, --src) +    for (int x=0; x<16; x++, --src)        linebase[tt[x]] = src[16]|(src[0]<<8);      src -= 16;    } @@ -67,7 +67,7 @@ void Icon::create_texture()  void Icon::setPalette(int pal)  {    unsigned int (*hwpal)[64][16] = (unsigned int (*)[64][16])0xa05f9000; -  for(int n = 0; n<16; n++) +  for (int n = 0; n<16; n++)      (*hwpal)[pal][n] = palette[n];  } @@ -124,13 +124,13 @@ int Icon::find_unused_pixel()  {    int use[16];    memset(use, 0, sizeof(use)); -  for(int n=0; n<32*32/2; n++) { +  for (int n=0; n<32*32/2; n++) {      unsigned char pix = bitmap[n];      use[pix&0xf]++;      use[pix>>4]++;    } -  for(int i=0; i<16; i++) -    if(!use[i]) +  for (int i=0; i<16; i++) +    if (!use[i])        return i;    return -1;  } @@ -142,41 +142,41 @@ bool Icon::load_image2(const void *data, int len)      short pla, bitcnt;      int comp, sizeimg, xres, yres, used, imp;    } hdr; -  if(len < 40) +  if (len < 40)      return false;    memcpy(&hdr, data, 40); -  if(hdr.size != 40 || /* hdr.sizeimg<=0 || */ hdr.w<0 || hdr.h<0 || +  if (hdr.size != 40 || /* hdr.sizeimg<=0 || */ hdr.w<0 || hdr.h<0 ||       hdr.bitcnt<0 || hdr.used<0)      return false; -  if(!hdr.used) +  if (!hdr.used)      hdr.used = 1<<hdr.bitcnt;    hdr.h >>= 1;    /* Fix incorrect sizeimg (The Dig) */ -  if(hdr.sizeimg < ((hdr.w*hdr.h*(1+hdr.bitcnt)+7)>>3)) +  if (hdr.sizeimg < ((hdr.w*hdr.h*(1+hdr.bitcnt)+7)>>3))      hdr.sizeimg = ((hdr.w*hdr.h*(1+hdr.bitcnt)+7)>>3); -  if(hdr.size + (hdr.used<<2) + hdr.sizeimg > len /* || +  if (hdr.size + (hdr.used<<2) + hdr.sizeimg > len /* ||       hdr.sizeimg < ((hdr.w*hdr.h*(1+hdr.bitcnt)+7)>>3) */)      return false; -  if(hdr.w != 32 || hdr.h != 32 || hdr.bitcnt != 4 || hdr.used > 16) +  if (hdr.w != 32 || hdr.h != 32 || hdr.bitcnt != 4 || hdr.used > 16)      return false;    memcpy(palette, ((const char *)data)+hdr.size, hdr.used<<2);    memcpy(bitmap, ((const char *)data)+hdr.size+(hdr.used<<2), 32*32/2); -  for(int i=0; i<16; i++) +  for (int i=0; i<16; i++)      palette[i] |= 0xff000000; -  for(int i=hdr.used; i<16; i++) +  for (int i=hdr.used; i<16; i++)      palette[i] = 0;    int unused = find_unused_pixel(); -  if(unused >= 0) { +  if (unused >= 0) {      const unsigned char *mask =        ((const unsigned char *)data)+hdr.size+(hdr.used<<2)+32*32/2;      unsigned char *pix = bitmap; -    for(int y=0; y<32; y++) -      for(int x=0; x<32/8; x++) { +    for (int y=0; y<32; y++) +      for (int x=0; x<32/8; x++) {  	unsigned char mbits = *mask++; -	for(int z=0; z<4; z++) { +	for (int z=0; z<4; z++) {  	  unsigned char pbits = *pix; -	  if(mbits & 64) pbits = (pbits & ~0xf) | unused; -	  if(mbits & 128) pbits = (pbits & 0xf) | (unused << 4); +	  if (mbits & 64) pbits = (pbits & ~0xf) | unused; +	  if (mbits & 128) pbits = (pbits & 0xf) | (unused << 4);  	  *pix++ = pbits;  	  mbits <<= 2;  	} @@ -193,10 +193,10 @@ bool Icon::load_image1(const void *data, int len, int offs)      short pla, bitcnt;      int bytes, offs;    } hdr; -  if(len < offs+16) +  if (len < offs+16)      return false;    memcpy(&hdr, ((const char *)data)+offs, 16); -  if(hdr.bytes > 0 && hdr.offs >= 0 && hdr.offs+hdr.bytes <= len) +  if (hdr.bytes > 0 && hdr.offs >= 0 && hdr.offs+hdr.bytes <= len)      return load_image2(((const char *)data)+hdr.offs, hdr.bytes);    else      return false; @@ -208,13 +208,13 @@ bool Icon::load(const void *data, int len, int offs)    memset(bitmap, 0, sizeof(bitmap));    memset(palette, 0, sizeof(palette));    texture = NULL; -  if(len < offs+6) +  if (len < offs+6)      return false;    memcpy(&hdr, ((const char *)data)+offs, 6); -  if(hdr.type != 1 || hdr.cnt < 1 || offs+6+(hdr.cnt<<4) > len) +  if (hdr.type != 1 || hdr.cnt < 1 || offs+6+(hdr.cnt<<4) > len)      return false; -  for(int i=0; i<hdr.cnt; i++) -    if(load_image1(data, len, offs+6+(i<<4))) +  for (int i=0; i<hdr.cnt; i++) +    if (load_image1(data, len, offs+6+(i<<4)))        return true;    return false;  } @@ -223,11 +223,11 @@ bool Icon::load(const char *filename)  {    char buf[2048];    int fd; -  if((fd = open(filename, O_RDONLY))>=0) { +  if ((fd = open(filename, O_RDONLY))>=0) {      int sz;      sz = read(fd, buf, sizeof(buf));      close(fd); -    if(sz>0) +    if (sz>0)        return load(buf, sz);    }    return false; diff --git a/backends/platform/dc/input.cpp b/backends/platform/dc/input.cpp index aa0d9efa21..6d7178fc97 100644 --- a/backends/platform/dc/input.cpp +++ b/backends/platform/dc/input.cpp @@ -39,70 +39,70 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,    static byte lastlmb = 0, lastrmb = 0;    static int8 mouse_wheel = 0, lastwheel = 0;    shiftFlags = 0; -  for(int i=0; i<4; i++, pad++) -    if(pad->func & MAPLE_FUNC_CONTROLLER) { +  for (int i=0; i<4; i++, pad++) +    if (pad->func & MAPLE_FUNC_CONTROLLER) {        int buttons = pad->cond.controller.buttons; -      if(!(buttons & 0x060e)) exit(0); +      if (!(buttons & 0x060e)) exit(0); -      if(!(buttons & 4)) lmb++; -      if(!(buttons & 2)) rmb++; +      if (!(buttons & 4)) lmb++; +      if (!(buttons & 2)) rmb++; -      if(!(buttons & 8)) newkey = Common::KEYCODE_F5; -      else if(!(buttons & 512)) newkey = ' '; -      else if(!(buttons & 1024)) newkey = numpadmap[(buttons>>4)&15]; +      if (!(buttons & 8)) newkey = Common::KEYCODE_F5; +      else if (!(buttons & 512)) newkey = ' '; +      else if (!(buttons & 1024)) newkey = numpadmap[(buttons>>4)&15]; -      if(!(buttons & 128)) if(inter) newkey = 1001; else mouse_x++; -      if(!(buttons & 64)) if(inter) newkey = 1002; else mouse_x--; -      if(!(buttons & 32)) if(inter) newkey = 1003; else mouse_y++; -      if(!(buttons & 16)) if(inter) newkey = 1004; else mouse_y--; +      if (!(buttons & 128)) if (inter) newkey = 1001; else mouse_x++; +      if (!(buttons & 64)) if (inter) newkey = 1002; else mouse_x--; +      if (!(buttons & 32)) if (inter) newkey = 1003; else mouse_y++; +      if (!(buttons & 16)) if (inter) newkey = 1004; else mouse_y--;        mouse_x += ((int)pad->cond.controller.joyx-128)>>4;        mouse_y += ((int)pad->cond.controller.joyy-128)>>4; -      if(pad->cond.controller.ltrigger > 200) newkey = 1005; -      else if(pad->cond.controller.rtrigger > 200) newkey = 1006; +      if (pad->cond.controller.ltrigger > 200) newkey = 1005; +      else if (pad->cond.controller.rtrigger > 200) newkey = 1006; -    } else if(pad->func & MAPLE_FUNC_MOUSE) { +    } else if (pad->func & MAPLE_FUNC_MOUSE) {        int buttons = pad->cond.mouse.buttons; -      if(!(buttons & 4)) lmb++; -      if(!(buttons & 2)) rmb++; +      if (!(buttons & 4)) lmb++; +      if (!(buttons & 2)) rmb++; -      if(!(buttons & 8)) newkey = Common::KEYCODE_F5; +      if (!(buttons & 8)) newkey = Common::KEYCODE_F5;        mouse_x += pad->cond.mouse.axis1;        mouse_y += pad->cond.mouse.axis2;        mouse_wheel += pad->cond.mouse.axis3; -      if(inter) +      if (inter)  	inter->mouse(mouse_x, mouse_y);        pad->cond.mouse.axis1 = 0;        pad->cond.mouse.axis2 = 0;        pad->cond.mouse.axis3 = 0; -    } else if(pad->func & MAPLE_FUNC_KEYBOARD) { -      for(int p=0; p<6; p++) { +    } else if (pad->func & MAPLE_FUNC_KEYBOARD) { +      for (int p=0; p<6; p++) {  	int shift = pad->cond.kbd.shift;  	int key = pad->cond.kbd.key[p]; -	if(shift & 0x08) lmb++; -	if(shift & 0x80) rmb++; -	if(shift & 0x11) shiftFlags |= Common::KBD_CTRL; -	if(shift & 0x44) shiftFlags |= Common::KBD_ALT; -	if(shift & 0x22) shiftFlags |= Common::KBD_SHIFT; -	if(key >= 4 && key <= 0x1d) +	if (shift & 0x08) lmb++; +	if (shift & 0x80) rmb++; +	if (shift & 0x11) shiftFlags |= Common::KBD_CTRL; +	if (shift & 0x44) shiftFlags |= Common::KBD_ALT; +	if (shift & 0x22) shiftFlags |= Common::KBD_SHIFT; +	if (key >= 4 && key <= 0x1d)  	  newkey = key+('a'-4); -	else if(key >= 0x1e && key <= 0x26) +	else if (key >= 0x1e && key <= 0x26)  	  newkey = key+((shift & 0x22)? ('!'-0x1e) : ('1'-0x1e)); -	else if(key >= 0x59 && key <= 0x61) +	else if (key >= 0x59 && key <= 0x61)  	  newkey = key+('1'-0x59); -	else if(key >= 0x2d && key <= 0x38 && key != 0x31) +	else if (key >= 0x2d && key <= 0x38 && key != 0x31)  	  newkey = ((shift & 0x22)?  		    "=?`{ }+*?<>?" :  		    "-^@[ ];:?,./")[key - 0x2d]; -	else if(key >= 0x3a && key <= 0x43) +	else if (key >= 0x3a && key <= 0x43)  	  newkey = key+(Common::KEYCODE_F1-0x3a); -	else if(key >= 0x54 && key <= 0x57) +	else if (key >= 0x54 && key <= 0x57)  	  newkey = "/*-+"[key-0x54];  	else switch(key) {  	case 0x27: case 0x62: @@ -118,17 +118,17 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,  	case 0x2c:  	  newkey = Common::KEYCODE_SPACE; break;  	case 0x4c: -	  if((shift & 0x11) && (shift & 0x44)) +	  if ((shift & 0x11) && (shift & 0x44))  	    exit(0);  	  break;  	case 0x4f: -	  if(inter) newkey = 1001; else mouse_x++; break; +	  if (inter) newkey = 1001; else mouse_x++; break;  	case 0x50: -	  if(inter) newkey = 1002; else mouse_x--; break; +	  if (inter) newkey = 1002; else mouse_x--; break;  	case 0x51: -	  if(inter) newkey = 1003; else mouse_y++; break; +	  if (inter) newkey = 1003; else mouse_y++; break;  	case 0x52: -	  if(inter) newkey = 1004; else mouse_y--; break; +	  if (inter) newkey = 1004; else mouse_y--; break;  	case 0x63:  	  newkey = '.'; break;  	case 0x64: case 0x87: @@ -139,28 +139,28 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,        }      } -  if(lmb && inter && !lastlmb) { +  if (lmb && inter && !lastlmb) {      newkey = 1000;      lmb = 0;    } -  if(lmb && !lastlmb) { +  if (lmb && !lastlmb) {      lastlmb = 1;      return -Common::EVENT_LBUTTONDOWN; -  } else if(lastlmb && !lmb) { +  } else if (lastlmb && !lmb) {      lastlmb = 0;      return -Common::EVENT_LBUTTONUP;    } -  if(rmb && !lastrmb) { +  if (rmb && !lastrmb) {      lastrmb = 1;      return -Common::EVENT_RBUTTONDOWN; -  } else if(lastrmb && !rmb) { +  } else if (lastrmb && !rmb) {      lastrmb = 0;      return -Common::EVENT_RBUTTONUP;    } -  if(mouse_wheel != lastwheel) -    if(((int8)(mouse_wheel - lastwheel)) > 0) { +  if (mouse_wheel != lastwheel) +    if (((int8)(mouse_wheel - lastwheel)) > 0) {        lastwheel++;        return -Common::EVENT_WHEELDOWN;      } else { @@ -168,22 +168,22 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,        return -Common::EVENT_WHEELUP;      } -  if(newkey && inter && newkey != lastkey) { +  if (newkey && inter && newkey != lastkey) {      int transkey = inter->key(newkey, shiftFlags); -    if(transkey) { +    if (transkey) {        newkey = transkey;        inter = NULL;      }    } -  if(!newkey || (lastkey && newkey != lastkey)) { +  if (!newkey || (lastkey && newkey != lastkey)) {      int upkey = lastkey;      lastkey = 0; -    if(upkey) +    if (upkey)        return upkey | (1<<30); -  } else if(!lastkey) { +  } else if (!lastkey) {      lastkey = newkey; -    if(newkey >= 1000 || !inter) +    if (newkey >= 1000 || !inter)        return newkey;    } @@ -194,13 +194,13 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event)  {    unsigned int t = Timer(); -  if(_timer != NULL) +  if (_timer != NULL)      _timer->handler(); -  if(((int)(t-_devpoll))<0) +  if (((int)(t-_devpoll))<0)      return false;    _devpoll += USEC_TO_TIMER(17000); -  if(((int)(t-_devpoll))>=0) +  if (((int)(t-_devpoll))>=0)      _devpoll = t + USEC_TO_TIMER(17000);    int mask = getimask(); @@ -220,25 +220,25 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event)      event.mouse.y -= _overlay_y;    }    event.kbd.ascii = event.kbd.keycode = 0; -  if(e<0) { +  if (e<0) {      event.type = (Common::EventType)-e;      return true; -  } else if(e>0) { +  } else if (e>0) {      bool processed = false, down = !(e&(1<<30));      e &= ~(1<<30); -    if(e < 1000) { +    if (e < 1000) {        event.type = (down? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP);        event.kbd.keycode = e;        event.kbd.ascii = (e>='a' && e<='z' && (event.kbd.flags & Common::KBD_SHIFT)?  			  e &~ 0x20 : e);        processed = true; -    } else if(down) { -      if(e == 1005) +    } else if (down) { +      if (e == 1005)  	setFeatureState(kFeatureVirtualKeyboard,  			!getFeatureState(kFeatureVirtualKeyboard));      }      return processed; -  } else if(_ms_cur_x != _ms_old_x || _ms_cur_y != _ms_old_y) { +  } else if (_ms_cur_x != _ms_old_x || _ms_cur_y != _ms_old_y) {      event.type = Common::EVENT_MOUSEMOVE;      _ms_old_x = _ms_cur_x;      _ms_old_y = _ms_cur_y; diff --git a/backends/platform/dc/label.cpp b/backends/platform/dc/label.cpp index cba5553dd3..44e4701a43 100644 --- a/backends/platform/dc/label.cpp +++ b/backends/platform/dc/label.cpp @@ -47,13 +47,13 @@ static void draw_char(unsigned short *dst, int mod, int c, void *font_base)  {    unsigned char *src;    int i, j; -  if(c<=32 || c>255 || (c>=127 && c<160)) c=160; -  if(c<128) c -= 32; else c -= 64; +  if (c<=32 || c>255 || (c>=127 && c<160)) c=160; +  if (c<128) c -= 32; else c -= 64;    src = c*36 + (unsigned char *)font_base; -  for(i=0; i<12; i++) { +  for (i=0; i<12; i++) {      int n = (src[0]<<16)|(src[1]<<8)|src[2]; -    for(j=0; j<12; j++, n<<=1) -      if(n & (1<<23)) { +    for (j=0; j<12; j++, n<<=1) +      if (n & (1<<23)) {  	dst[j] = 0xffff;  	dst[j+1] = 0xffff;  	dst[j+2] = 0xa108; @@ -61,8 +61,8 @@ static void draw_char(unsigned short *dst, int mod, int c, void *font_base)  	dst[j+mod+1] = 0xa108;        }      dst += mod; -    for(j=0; j<12; j++, n<<=1) -      if(n & (1<<23)) { +    for (j=0; j<12; j++, n<<=1) +      if (n & (1<<23)) {  	dst[j] = 0xffff;  	dst[j+1] = 0xffff;  	dst[j+2] = 0xa108; @@ -78,15 +78,15 @@ void Label::create_texture(const char *text)  {    void *font = get_romfont_address();    int l = strlen(text); -  if(l>64) l=64; +  if (l>64) l=64;    int w = 14*l; -  for(tex_u=TA_POLYMODE2_U_SIZE_8, u=8; u<w; u<<=1, tex_u += 1<<3); +  for (tex_u=TA_POLYMODE2_U_SIZE_8, u=8; u<w; u<<=1, tex_u += 1<<3);    int tsz = u*32;    unsigned short *tex = (unsigned short *)ta_txalloc(tsz*2); -  for(int i=0; i<tsz; i++) +  for (int i=0; i<tsz; i++)      tex[i] = 0;    int p=l*14; -  while(l>0) +  while (l>0)      draw_char(tex+(p-=14), u, text[--l], font);    texture = tex;  } diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index b082afabf5..7c472ccf24 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -162,7 +162,7 @@ static void detectGames(FSList &files, GameList &candidates)  static bool isIcon(const FilesystemNode &entry)  {    int l = entry.displayName().size(); -  if(l>4 && !strcasecmp(entry.displayName().c_str()+l-4, ".ICO")) +  if (l>4 && !strcasecmp(entry.displayName().c_str()+l-4, ".ICO"))      return true;    else      return false; @@ -172,13 +172,13 @@ static bool loadIcon(Game &game, Dir *dirs, int num_dirs)  {    char icofn[520];    sprintf(icofn, "%s%s.ICO", game.dir, game.filename_base); -  if(game.icon.load(icofn)) +  if (game.icon.load(icofn))      return true; -  for(int i=0; i<num_dirs; i++) -    if(!strcmp(dirs[i].name, game.dir) && +  for (int i=0; i<num_dirs; i++) +    if (!strcmp(dirs[i].name, game.dir) &&         dirs[i].deficon[0]) {        sprintf(icofn, "%s%s", game.dir, dirs[i].deficon); -      if(game.icon.load(icofn)) +      if (game.icon.load(icofn))  	return true;        break;      } @@ -193,8 +193,8 @@ static void makeDefIcon(Icon &icon)  static bool uniqueGame(const char *base, const char *dir, Game *games, int cnt)  { -  while(cnt--) -    if(!strcmp(dir, games->dir) && +  while (cnt--) +    if (!strcmp(dir, games->dir) &&         !stricmp(base, games->filename_base))        return false;      else @@ -207,7 +207,7 @@ static int findGames(Game *games, int max)    Dir *dirs = new Dir[MAX_DIR];    int curr_game = 0, curr_dir = 0, num_dirs = 1;    dirs[0].node = FilesystemNode(""); -  while(curr_game < max && curr_dir < num_dirs) { +  while (curr_game < max && curr_dir < num_dirs) {      strncpy(dirs[curr_dir].name, dirs[curr_dir].node.path().c_str(), 252);      dirs[curr_dir].name[251] = '\0';      dirs[curr_dir].deficon[0] = '\0'; @@ -216,13 +216,13 @@ static int findGames(Game *games, int max)      for (FSList::const_iterator entry = fslist.begin(); entry != fslist.end();  	 ++entry) {        if (entry->isDirectory()) { -	if(num_dirs < MAX_DIR && strcasecmp(entry->displayName().c_str(), +	if (num_dirs < MAX_DIR && strcasecmp(entry->displayName().c_str(),  					    "install")) {  	  dirs[num_dirs].node = *entry;  	  num_dirs++;  	}        } else -	if(isIcon(*entry)) +	if (isIcon(*entry))  	  strcpy(dirs[curr_dir-1].deficon, entry->displayName().c_str());  	else  	  files.push_back(*entry); @@ -231,12 +231,12 @@ static int findGames(Game *games, int max)      GameList candidates;      detectGames(files, candidates); -    for(GameList::const_iterator ge = candidates.begin(); +    for (GameList::const_iterator ge = candidates.begin();  	ge != candidates.end(); ++ge) -      if(curr_game < max) { +      if (curr_game < max) {  	strcpy(games[curr_game].filename_base, ge->gameid().c_str());  	strcpy(games[curr_game].dir, dirs[curr_dir-1].name); -	if(uniqueGame(games[curr_game].filename_base, +	if (uniqueGame(games[curr_game].filename_base,  		      games[curr_game].dir, games, curr_game)) {  	  strcpy(games[curr_game].text, ge->description().c_str()); @@ -251,8 +251,8 @@ static int findGames(Game *games, int max)        }    } -  for(int i=0; i<curr_game; i++) -    if(!loadIcon(games[i], dirs, num_dirs)) +  for (int i=0; i<curr_game; i++) +    if (!loadIcon(games[i], dirs, num_dirs))        makeDefIcon(games[i].icon);    delete[] dirs;    return curr_game; @@ -279,11 +279,11 @@ void waitForDisk()    void *mark = ta_txmark();    lab.create_texture("Please insert game CD.");    //printf("waitForDisk, cdstate = %d\n", getCdState()); -  for(;;) { +  for (;;) {      int s = getCdState(); -    if(s >= 6) +    if (s >= 6)        wasopen = 1; -    if(s > 0 && s < 6 && wasopen) { +    if (s > 0 && s < 6 && wasopen) {        cdfs_reinit();        chdir("/");        chdir("/"); @@ -326,12 +326,12 @@ int gameMenu(Game *games, int num_games)    int top_game = 0, selector_pos = 0;    int mousex = 0, mousey = 0; -  if(!num_games) +  if (!num_games)      return -1; -  for(;;) { +  for (;;) { -    if(getCdState()>=6) +    if (getCdState()>=6)        return -1;      ta_begin_frame(); @@ -341,10 +341,10 @@ int gameMenu(Game *games, int num_games)      ta_commit_end();      float y = 40.0; -    for(int i=top_game, cnt=0; cnt<10 && i<num_games; i++, cnt++) { +    for (int i=top_game, cnt=0; cnt<10 && i<num_games; i++, cnt++) {        int pal = 48+(i&15); -      if(cnt == selector_pos) +      if (cnt == selector_pos)  	draw_trans_quad(100.0, y, 590.0, y+32.0,  			0x7000ff00, 0x7000ff00, 0x7000ff00, 0x7000ff00); @@ -364,10 +364,10 @@ int gameMenu(Game *games, int num_games)      event = handleInput(locked_get_pads(), mousex, mousey, shiftFlags);      setimask(mask); -    if(event==-Common::EVENT_LBUTTONDOWN || event==Common::KEYCODE_ENTER || event==Common::KEYCODE_F5) { +    if (event==-Common::EVENT_LBUTTONDOWN || event==Common::KEYCODE_ENTER || event==Common::KEYCODE_F5) {        int selected_game = top_game + selector_pos; -      for(int fade=0; fade<=256; fade+=4) { +      for (int fade=0; fade<=256; fade+=4) {  	unsigned int fade_colour = 0x00ffffff | ((255-fade)<<24); @@ -379,10 +379,10 @@ int gameMenu(Game *games, int num_games)  	float y = 40.0; -	if(fade < 256) -	  for(int i=top_game, cnt=0; cnt<10 && i<num_games; +	if (fade < 256) +	  for (int i=top_game, cnt=0; cnt<10 && i<num_games;  	      i++, cnt++, y += 40.0) -	    if(cnt != selector_pos) +	    if (cnt != selector_pos)  	      drawGameLabel(games[i], 48+(i&15), 50.0, y, 0xffffff, fade);  	y = (40.0/256.0 * (selector_pos + 1))*(256-fade) + 80.0/256.0*fade; @@ -397,16 +397,16 @@ int gameMenu(Game *games, int num_games)        return selected_game;      } -    if(mousey>=16) { -      if(selector_pos + top_game + 1 < num_games) -	if(++selector_pos >= 10) { +    if (mousey>=16) { +      if (selector_pos + top_game + 1 < num_games) +	if (++selector_pos >= 10) {  	  --selector_pos;  	  ++top_game;  	}        mousey -= 16; -    } else if(mousey<=-16) { -      if(selector_pos + top_game > 0) -	if(--selector_pos < 0) { +    } else if (mousey<=-16) { +      if (selector_pos + top_game > 0) +	if (--selector_pos < 0) {  	  ++selector_pos;  	  --top_game;  	} @@ -423,10 +423,10 @@ bool selectGame(char *&ret, char *&dir_ret, Icon &icon)    ta_sync();    void *mark = ta_txmark(); -  for(;;) { +  for (;;) {      num_games = findGames(games, MAX_GAMES); -    for(int i=0; i<num_games; i++) { +    for (int i=0; i<num_games; i++) {        games[i].icon.create_texture();        games[i].label.create_texture(games[i].text);      } @@ -436,22 +436,22 @@ bool selectGame(char *&ret, char *&dir_ret, Icon &icon)      ta_sync();      ta_txrelease(mark); -    if(selected == -1) +    if (selected == -1)        waitForDisk();      else        break;    } -  if(selected >= num_games) +  if (selected >= num_games)      selected = -1; -  if(selected >= 0) +  if (selected >= 0)      the_game = games[selected];    delete games; -  if(selected>=0) { +  if (selected>=0) {  #if 0      chdir(the_game.dir);  #else diff --git a/backends/platform/dc/softkbd.cpp b/backends/platform/dc/softkbd.cpp index 79363713a5..1f2bd619e1 100644 --- a/backends/platform/dc/softkbd.cpp +++ b/backends/platform/dc/softkbd.cpp @@ -70,10 +70,10 @@ SoftKeyboard::SoftKeyboard(const OSystem_Dreamcast *_os)    assert((sizeof(key_codes)/sizeof(key_codes[0])) == SK_NUM_KEYS);    const char *np = key_names; -  for(int i=0; i<SK_NUM_KEYS; i++) { +  for (int i=0; i<SK_NUM_KEYS; i++) {      labels[0][i].create_texture(np);      np += strlen(np)+1; -    if(key_codes[i]>8192) { +    if (key_codes[i]>8192) {        labels[1][i].create_texture(np);        np += strlen(np)+1;      } @@ -92,19 +92,19 @@ void SoftKeyboard::draw(float x, float y, int transp)  		  bg_alpha_mask|0x8080ff, bg_alpha_mask|0x8080ff);    x0 = x += 4.0;    y += 4.0; -  for(int i=0; i<SK_NUM_KEYS; i++) { +  for (int i=0; i<SK_NUM_KEYS; i++) {      float w = (i == 58? 164.0 : 24.0);      unsigned int bg = (i == keySel? bg_alpha_mask|0xffff00 :  		       bg_alpha_mask|0xc0c0ff);      draw_trans_quad(x, y, x+w, y+24.0, bg, bg, bg, bg); -    if(key_codes[i]<0 && (shiftState & ~key_codes[i])) +    if (key_codes[i]<0 && (shiftState & ~key_codes[i]))        labels[0][i].draw(x+2, y+5, txt_alpha_mask|0xffffff, 0.5); -    else if(key_codes[i]>8192 && (shiftState & Common::KBD_SHIFT)) +    else if (key_codes[i]>8192 && (shiftState & Common::KBD_SHIFT))        labels[1][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5);      else        labels[0][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5);      x += w+4.0; -    if(++c == 11) { +    if (++c == 11) {        c = 0;        x = x0;        y += 28.0; @@ -116,41 +116,41 @@ int SoftKeyboard::key(int k, byte &shiftFlags)  {    switch(k) {    case 1001: -    if(++keySel == SK_NUM_KEYS) +    if (++keySel == SK_NUM_KEYS)        keySel = 0;      break;    case 1002: -    if(--keySel < 0) +    if (--keySel < 0)        keySel = SK_NUM_KEYS - 1;      break;    case 1003: -    if(keySel >= 55) { -      if(keySel > 58) +    if (keySel >= 55) { +      if (keySel > 58)  	keySel += 5;        keySel -= 55; -    } else if(keySel > 47) { -      if((keySel += 6) < 59) +    } else if (keySel > 47) { +      if ((keySel += 6) < 59)  	keySel = 59;      } else        keySel += 11;      break;    case 1004: -    if(keySel > 58) +    if (keySel > 58)        keySel -= 6; -    else if((keySel -= 11) < 0) -      if((keySel += 66) > 58) -	if((keySel -= 5) < 59) +    else if ((keySel -= 11) < 0) +      if ((keySel += 66) > 58) +	if ((keySel -= 5) < 59)  	  keySel = 59;      break;    case 1000:    case 13:    case 32:    case 319: -    if(key_codes[keySel]<0) +    if (key_codes[keySel]<0)        shiftState ^= ~key_codes[keySel];      else {        shiftFlags = shiftState; -      if(key_codes[keySel] > 8192) +      if (key_codes[keySel] > 8192)  	return ((shiftState & Common::KBD_SHIFT)? (key_codes[keySel]>>8):  		key_codes[keySel]) & 0xff;        else @@ -164,9 +164,9 @@ int SoftKeyboard::key(int k, byte &shiftFlags)  void SoftKeyboard::mouse(int x, int y)  {    os->mouseToSoftKbd(x, y, x, y); -  if(x >= 0 && x < 11*28 && y >= 0 && y < 6*28 && +  if (x >= 0 && x < 11*28 && y >= 0 && y < 6*28 &&       x%28 >= 4 && y%28 >= 4) -    if((keySel = 11*(y/28)+(x/28)) > 58) -      if((keySel -= 5) < 59) +    if ((keySel = 11*(y/28)+(x/28)) > 58) +      if ((keySel -= 5) < 59)  	keySel = 58;  } diff --git a/backends/platform/dc/time.cpp b/backends/platform/dc/time.cpp index 06bb931717..890e98f6b4 100644 --- a/backends/platform/dc/time.cpp +++ b/backends/platform/dc/time.cpp @@ -51,8 +51,8 @@ void OSystem_Dreamcast::delayMillis(uint msecs)    getMillis();    unsigned int t, start = Timer();    int time = (((unsigned int)msecs)*3125U)>>6; -  while(((int)((t = Timer())-start))<time) { -    if(_timer != NULL) +  while (((int)((t = Timer())-start))<time) { +    if (_timer != NULL)        _timer->handler();      checkSound();    } diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp index 7b3ca835d2..5b7eaf5f46 100644 --- a/backends/platform/dc/vmsave.cpp +++ b/backends/platform/dc/vmsave.cpp @@ -87,14 +87,14 @@ static vmsaveResult trySave(const char *gamename, const char *data, int size,    time_t t;    unsigned char iconbuffer[512+32]; -  if(!vmsfs_check_unit(vm, 0, &info)) +  if (!vmsfs_check_unit(vm, 0, &info))      return VMSAVE_NOVM; -  if(!vmsfs_get_superblock(&info, &super)) +  if (!vmsfs_get_superblock(&info, &super))      return VMSAVE_NOVM;    int free_cnt = vmsfs_count_free(&super); -  if(vmsfs_open_file(&super, filename, &file)) +  if (vmsfs_open_file(&super, filename, &file))      free_cnt += file.blks; -  if(((128+512+size+511)>>9) > free_cnt) +  if (((128+512+size+511)>>9) > free_cnt)      return VMSAVE_NOSPACE;    memset(&header, 0, sizeof(header)); @@ -117,7 +117,7 @@ static vmsaveResult trySave(const char *gamename, const char *data, int size,    vmsfs_beep(&info, 1);    vmsfs_errno = 0; -  if(!vmsfs_create_file(&super, filename, &header, +  if (!vmsfs_create_file(&super, filename, &header,  			iconbuffer+sizeof(header.palette), NULL,  			data, size, &tstamp)) {      fprintf(stderr, "%s\n", vmsfs_describe_error()); @@ -140,16 +140,16 @@ static bool tryLoad(char *&buffer, int &size, const char *filename, int vm)    time_t t;    unsigned char iconbuffer[512+32]; -  if(!vmsfs_check_unit(vm, 0, &info)) +  if (!vmsfs_check_unit(vm, 0, &info))      return false; -  if(!vmsfs_get_superblock(&info, &super)) +  if (!vmsfs_get_superblock(&info, &super))      return false; -  if(!vmsfs_open_file(&super, filename, &file)) +  if (!vmsfs_open_file(&super, filename, &file))      return false;    buffer = new char[size = file.size]; -  if(vmsfs_read_file(&file, (unsigned char *)buffer, size)) +  if (vmsfs_read_file(&file, (unsigned char *)buffer, size))      return true;    delete[] buffer; @@ -165,19 +165,19 @@ static void tryList(const char *prefix, bool *marks, int num, int vm)    struct dir_entry de;    int pl = strlen(prefix); -  if(!vmsfs_check_unit(vm, 0, &info)) +  if (!vmsfs_check_unit(vm, 0, &info))      return; -  if(!vmsfs_get_superblock(&info, &super)) +  if (!vmsfs_get_superblock(&info, &super))      return;    vmsfs_open_dir(&super, &iter); -  while(vmsfs_next_dir_entry(&iter, &de)) -    if(de.entry[0]) { +  while (vmsfs_next_dir_entry(&iter, &de)) +    if (de.entry[0]) {        char buf[16], *endp = NULL;        strncpy(buf, (char *)de.entry+4, 12);        buf[12] = 0;        int l = strlen(buf);        long i = 42; -      if(l > pl && !strncmp(buf, prefix, pl) && +      if (l > pl && !strncmp(buf, prefix, pl) &&  	 (i = strtol(buf+pl, &endp, 10))>=0 && i<num &&  	 (endp - buf) == l)  	marks[i] = true; @@ -189,15 +189,15 @@ vmsaveResult writeSaveGame(const char *gamename, const char *data, int size,  {    vmsaveResult r, res = VMSAVE_NOVM; -  if(lastvm >= 0 && +  if (lastvm >= 0 &&       (res = trySave(gamename, data, size, filename, icon, lastvm)) == VMSAVE_OK)      return res; -  for(int i=0; i<24; i++) -    if((r = trySave(gamename, data, size, filename, icon, i)) == VMSAVE_OK) { +  for (int i=0; i<24; i++) +    if ((r = trySave(gamename, data, size, filename, icon, i)) == VMSAVE_OK) {        lastvm = i;        return r; -    } else if(r > res) +    } else if (r > res)        res = r;    return res; @@ -205,12 +205,12 @@ vmsaveResult writeSaveGame(const char *gamename, const char *data, int size,  bool readSaveGame(char *&buffer, int &size, const char *filename)  { -  if(lastvm >= 0 && +  if (lastvm >= 0 &&       tryLoad(buffer, size, filename, lastvm))      return true; -  for(int i=0; i<24; i++) -    if(tryLoad(buffer, size, filename, i)) { +  for (int i=0; i<24; i++) +    if (tryLoad(buffer, size, filename, i)) {        lastvm = i;        return true;      } @@ -235,7 +235,7 @@ public:    ~InVMSave()    { -    if(buffer != NULL) +    if (buffer != NULL)        delete[] buffer;    } @@ -248,11 +248,11 @@ public:    void tryUncompress()    { -    if(_size > 0 && buffer[0] != 'S') { +    if (_size > 0 && buffer[0] != 'S') {        // Data does not start with "SCVM".  Maybe compressed?        char *expbuf = new char[MAX_SAVE_SIZE];        unsigned long destlen = MAX_SAVE_SIZE; -      if(!uncompress((Bytef*)expbuf, &destlen, (Bytef*)buffer, _size)) { +      if (!uncompress((Bytef*)expbuf, &destlen, (Bytef*)buffer, _size)) {  	delete[] buffer;  	buffer = expbuf;  	_size = destlen; @@ -294,7 +294,7 @@ public:    virtual Common::InSaveFile *openForLoading(const char *filename) {  	InVMSave *s = new InVMSave(); -	if(s->readSaveGame(filename)) { +	if (s->readSaveGame(filename)) {  	  s->tryUncompress();  	  return s;  	} else { @@ -311,26 +311,26 @@ void OutVMSave::finalize()    extern const char *gGameName;    extern Icon icon; -  if(committed >= pos) +  if (committed >= pos)      return;    char *data = buffer, *compbuf = NULL;    int len = pos; -  if(pos) { +  if (pos) {      // Try compression      compbuf = new char[pos];      unsigned long destlen = pos; -    if(!compress((Bytef*)compbuf, &destlen, (Bytef*)buffer, pos)) { +    if (!compress((Bytef*)compbuf, &destlen, (Bytef*)buffer, pos)) {        data = compbuf;        len = destlen;      }    }    vmsaveResult r = writeSaveGame(gGameName, data, len, filename, icon);    committed = pos; -  if(compbuf != NULL) +  if (compbuf != NULL)      delete[] compbuf; -  if(r != VMSAVE_OK) +  if (r != VMSAVE_OK)      iofailed = true;    displaySaveResult(r);  } @@ -375,9 +375,9 @@ void InVMSave::seek(int32 offs, int whence)      _pos = _size + offs;      break;    } -  if(_pos < 0) +  if (_pos < 0)      _pos = 0; -  else if(_pos > _size) +  else if (_pos > _size)      _pos = _size;  } @@ -399,7 +399,7 @@ void VMSaveManager::listSavefiles(const char *prefix, bool *marks, int num)  {    memset(marks, false, num*sizeof(bool)); -  for(int i=0; i<24; i++) +  for (int i=0; i<24; i++)      tryList(prefix, marks, num, i);  }  | 
