Code formatting fixes

svn-id: r28945
This commit is contained in:
Max Horn 2007-09-18 20:16:33 +00:00
parent c3d3aebe87
commit 3abc11611e
76 changed files with 602 additions and 602 deletions

View file

@ -111,11 +111,11 @@ RoninCDFilesystemNode::RoninCDFilesystemNode(const String &p, bool verify) {
if (verify) { if (verify) {
int fd; int fd;
if((fd = open(_path.c_str(), O_RDONLY)) >= 0) { if ((fd = open(_path.c_str(), O_RDONLY)) >= 0) {
close(fd); close(fd);
_isDirectory = false; _isDirectory = false;
} }
else if((fd = open(_path.c_str(), O_DIR|O_RDONLY)) >= 0) { else if ((fd = open(_path.c_str(), O_DIR|O_RDONLY)) >= 0) {
close(fd); close(fd);
} }
else { else {

View file

@ -241,7 +241,7 @@ bool GP32FilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
} }
AbstractFilesystemNode *GP32FilesystemNode::getParent() const { AbstractFilesystemNode *GP32FilesystemNode::getParent() const {
if(_isRoot) if (_isRoot)
return 0; return 0;
const char *start = _path.c_str(); const char *start = _path.c_str();

View file

@ -197,7 +197,7 @@ bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bo
if (error) if (error)
return false; return false;
while(dirIterator != expIteratorStop) { while (dirIterator != expIteratorStop) {
error = VFSDirEntryEnumerate(handle, &dirIterator, &desc); error = VFSDirEntryEnumerate(handle, &dirIterator, &desc);
if (!error) { if (!error) {
addFile(myList, mode, _path.c_str(), &desc); addFile(myList, mode, _path.c_str(), &desc);

View file

@ -178,7 +178,7 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo
continue; continue;
} }
// Skip '.' and '..' to avoid cycles // Skip '.' and '..' to avoid cycles
if((dp->d_name[0] == '.' && dp->d_name[1] == 0) || (dp->d_name[0] == '.' && dp->d_name[1] == '.')) { if ((dp->d_name[0] == '.' && dp->d_name[1] == 0) || (dp->d_name[0] == '.' && dp->d_name[1] == '.')) {
continue; continue;
} }

View file

@ -157,7 +157,7 @@ AbstractFilesystemNode *SymbianFilesystemNode::getChild(const String &n) const {
fname.Copy(ptr); fname.Copy(ptr);
TBool isFolder = EFalse; TBool isFolder = EFalse;
BaflUtils::IsFolder(CEikonEnv::Static()->FsSession(), fname, isFolder); BaflUtils::IsFolder(CEikonEnv::Static()->FsSession(), fname, isFolder);
if(!isFolder) if (!isFolder)
return 0; return 0;
return new SymbianFilesystemNode(newPath); return new SymbianFilesystemNode(newPath);
@ -182,12 +182,12 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
TInt err = fs.Volume(volumeInfo, driveNumber); TInt err = fs.Volume(volumeInfo, driveNumber);
if (err != KErrNone) if (err != KErrNone)
continue; continue;
if(fs.DriveToChar(driveNumber,driveLetter) != KErrNone) if (fs.DriveToChar(driveNumber,driveLetter) != KErrNone)
continue; continue;
driveLetterValue = driveLetter; driveLetterValue = driveLetter;
if(volumeInfo.iName.Length() > 0) { if (volumeInfo.iName.Length() > 0) {
driveLabel8.Copy(volumeInfo.iName); // 16 to 8bit des // enabling this line alone gives KERN-EXEC 3 with non-optimized GCC? WHY? grrr driveLabel8.Copy(volumeInfo.iName); // 16 to 8bit des // enabling this line alone gives KERN-EXEC 3 with non-optimized GCC? WHY? grrr
driveString8.Format(_L8("Drive %c: (%S)"), driveLetterValue, &driveLabel8); driveString8.Format(_L8("Drive %c: (%S)"), driveLetterValue, &driveLabel8);
} else { } else {
@ -211,10 +211,10 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
fname.Copy(ptr); fname.Copy(ptr);
TBuf8<256>nameBuf; TBuf8<256>nameBuf;
CDir* dirPtr; CDir* dirPtr;
if(CEikonEnv::Static()->FsSession().GetDir(fname,KEntryAttNormal|KEntryAttDir,0,dirPtr)==KErrNone) { if (CEikonEnv::Static()->FsSession().GetDir(fname,KEntryAttNormal|KEntryAttDir,0,dirPtr)==KErrNone) {
CleanupStack::PushL(dirPtr); CleanupStack::PushL(dirPtr);
TInt cnt=dirPtr->Count(); TInt cnt=dirPtr->Count();
for(TInt loop=0;loop<cnt;loop++) { for (TInt loop=0;loop<cnt;loop++) {
TEntry fileentry=(*dirPtr)[loop]; TEntry fileentry=(*dirPtr)[loop];
nameBuf.Copy(fileentry.iName); nameBuf.Copy(fileentry.iName);
SymbianFilesystemNode entry(false); SymbianFilesystemNode entry(false);

View file

@ -16,7 +16,7 @@ Char **ArgsInit() {
// initial position // initial position
argvP++; argvP++;
for(UInt8 count = 0; count < MAX_ARG; count++) for (UInt8 count = 0; count < MAX_ARG; count++)
argvP[count] = NULL; argvP[count] = NULL;
return argvP; return argvP;
@ -49,7 +49,7 @@ void ArgsFree(Char **argvP) {
MemHandle oldH; MemHandle oldH;
for(UInt8 count = 0; count < MAX_ARG; count++) for (UInt8 count = 0; count < MAX_ARG; count++)
if (argvP[count]) { if (argvP[count]) {
oldH = MemPtrRecoverHandle(argvP[count]); oldH = MemPtrRecoverHandle(argvP[count]);
MemHandleUnlock(oldH); MemHandleUnlock(oldH);
@ -68,7 +68,7 @@ void ArgsSetOwner(Char **argvP, UInt16 owner) {
MemHandle oldH; MemHandle oldH;
for(UInt8 count = 0; count < MAX_ARG; count++) for (UInt8 count = 0; count < MAX_ARG; count++)
if (argvP[count]) { if (argvP[count]) {
oldH = MemPtrRecoverHandle(argvP[count]); oldH = MemPtrRecoverHandle(argvP[count]);
MemHandleSetOwner(oldH, owner); MemHandleSetOwner(oldH, owner);
@ -81,7 +81,7 @@ void ArgsSetOwner(Char **argvP, UInt16 owner) {
void ArgsExportInit(Char **argvP, UInt32 countArg, Boolean arm) { void ArgsExportInit(Char **argvP, UInt32 countArg, Boolean arm) {
if (arm) { if (arm) {
for(UInt8 count = 0; count < MAX_ARG; count++) for (UInt8 count = 0; count < MAX_ARG; count++)
if (argvP[count]) if (argvP[count])
argvP[count] = (Char *)ByteSwap32(argvP[count]); argvP[count] = (Char *)ByteSwap32(argvP[count]);
} }
@ -96,7 +96,7 @@ void ArgsExportRelease(Boolean arm) {
Err e = FtrGet(appFileCreator, ftrArgsData, (UInt32 *)&argvP); Err e = FtrGet(appFileCreator, ftrArgsData, (UInt32 *)&argvP);
if (argvP) if (argvP)
for(UInt8 count = 0; count < MAX_ARG; count++) for (UInt8 count = 0; count < MAX_ARG; count++)
if (argvP[count]) if (argvP[count])
argvP[count] = (Char *)ByteSwap32(argvP[count]); argvP[count] = (Char *)ByteSwap32(argvP[count]);
} }

View file

@ -92,7 +92,7 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
timer_handler(); timer_handler();
sound_handler(); sound_handler();
for(;;) { for (;;) {
// check for hardkey repeat for mouse emulation // check for hardkey repeat for mouse emulation
keyCurrentState = KeyCurrentState(); keyCurrentState = KeyCurrentState();

View file

@ -95,7 +95,7 @@ void OSystem_PalmBase::initSize(uint w, uint h) {
void OSystem_PalmBase::setPalette(const byte *colors, uint start, uint num) { void OSystem_PalmBase::setPalette(const byte *colors, uint start, uint num) {
RGBColorType *base = _currentPalette + start; RGBColorType *base = _currentPalette + start;
for(uint i = 0; i < num; i++) { for (uint i = 0; i < num; i++) {
base[i].r = colors[0]; base[i].r = colors[0];
base[i].g = colors[1]; base[i].g = colors[1];
base[i].b = colors[2]; base[i].b = colors[2];

View file

@ -52,8 +52,8 @@ void DrawStatus(Boolean show) {
if (depth == 8) { if (depth == 8) {
UInt8 *src = (UInt8 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow())); UInt8 *src = (UInt8 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow()));
src += gVars->screenPitch + 1; src += gVars->screenPitch + 1;
for(y=0; y < 4; y++) { for (y=0; y < 4; y++) {
for(x=0; x < 4; x++) for (x=0; x < 4; x++)
src[x] = color; src[x] = color;
src += gVars->screenPitch; src += gVars->screenPitch;
@ -62,8 +62,8 @@ void DrawStatus(Boolean show) {
} else if (depth == 16) { } else if (depth == 16) {
Int16 *src = (Int16 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow())); Int16 *src = (Int16 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow()));
src += gVars->screenPitch + 1; src += gVars->screenPitch + 1;
for(y=0; y < 4; y++) { for (y=0; y < 4; y++) {
for(x=0; x < 4; x++) for (x=0; x < 4; x++)
src[x] = color; src[x] = color;
src += gVars->screenPitch; src += gVars->screenPitch;

View file

@ -46,7 +46,7 @@ UInt16 SilkInit(UInt32 *retVersion) {
if (e) { if (e) {
// v1 = NR // v1 = NR
e = SilkLibOpen(slkRefNum); e = SilkLibOpen(slkRefNum);
if(!e) version = vskVersionNum1; if (!e) version = vskVersionNum1;
} else { } else {
// v2 = NX/NZ // v2 = NX/NZ

View file

@ -26,7 +26,7 @@
#include "be_os5.h" #include "be_os5.h"
void OSystem_PalmOS5::setCursorPalette(const byte *colors, uint start, uint num) { void OSystem_PalmOS5::setCursorPalette(const byte *colors, uint start, uint num) {
for(uint i = 0; i < num; i++) { for (uint i = 0; i < num; i++) {
_mousePal[i + start] = gfxMakeDisplayRGB(colors[0], colors[1], colors[2]); _mousePal[i + start] = gfxMakeDisplayRGB(colors[0], colors[1], colors[2]);
colors += 4; colors += 4;
} }

View file

@ -108,6 +108,6 @@ void pcm2adpcm(Int16 *src, UInt8 *dst, UInt32 length) {
*dst++ = (UInt8)data; *dst++ = (UInt8)data;
} while(--length); } while (--length);
} }

View file

@ -44,28 +44,28 @@ void OSystem_Dreamcast::checkSound()
int n; int n;
int curr_ring_buffer_samples; int curr_ring_buffer_samples;
if(!_mixer) if (!_mixer)
return; return;
if(read_sound_int(&SOUNDSTATUS->mode) != MODE_PLAY) if (read_sound_int(&SOUNDSTATUS->mode) != MODE_PLAY)
start_sound(); start_sound();
curr_ring_buffer_samples = read_sound_int(&SOUNDSTATUS->ring_length); curr_ring_buffer_samples = read_sound_int(&SOUNDSTATUS->ring_length);
n = read_sound_int(&SOUNDSTATUS->samplepos); n = read_sound_int(&SOUNDSTATUS->samplepos);
if((n-=fillpos)<0) if ((n-=fillpos)<0)
n += curr_ring_buffer_samples; n += curr_ring_buffer_samples;
n = ADJUST_BUFFER_SIZE(n-10); n = ADJUST_BUFFER_SIZE(n-10);
if(n<100) if (n<100)
return; return;
Audio::Mixer::mixCallback(_mixer, (byte*)temp_sound_buffer, Audio::Mixer::mixCallback(_mixer, (byte*)temp_sound_buffer,
2*SAMPLES_TO_BYTES(n)); 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; int r = curr_ring_buffer_samples - fillpos;
memcpy4s(RING_BUF+fillpos, temp_sound_buffer, SAMPLES_TO_BYTES(r)); memcpy4s(RING_BUF+fillpos, temp_sound_buffer, SAMPLES_TO_BYTES(r));
fillpos = 0; fillpos = 0;
@ -74,7 +74,7 @@ void OSystem_Dreamcast::checkSound()
} else { } else {
memcpy4s(RING_BUF+fillpos, temp_sound_buffer, SAMPLES_TO_BYTES(n)); 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; fillpos = 0;
} }

View file

@ -116,14 +116,14 @@ extern "C" void flush_instruction_cache();
static void purge_copyback() static void purge_copyback()
{ {
int i; 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; *(volatile unsigned int *)(0xf4000000+i) &= ~3;
} }
void DLObject::seterror(const char *fmt, ...) void DLObject::seterror(const char *fmt, ...)
{ {
if(errbuf) { if (errbuf) {
va_list va; va_list va;
va_start(va, fmt); va_start(va, fmt);
vsnprintf(errbuf, MAXDLERRLEN, fmt, va); vsnprintf(errbuf, MAXDLERRLEN, fmt, va);
@ -151,12 +151,12 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size)
{ {
Elf32_Rela *rela; Elf32_Rela *rela;
if(!(rela = (Elf32_Rela *)malloc(size))) { if (!(rela = (Elf32_Rela *)malloc(size))) {
seterror("Out of memory."); seterror("Out of memory.");
return false; return false;
} }
if(lseek(fd, offset, SEEK_SET)<0 || if (lseek(fd, offset, SEEK_SET)<0 ||
read(fd, rela, size) != size) { read(fd, rela, size) != size) {
seterror("Relocation table load failed."); seterror("Relocation table load failed.");
free(rela); free(rela);
@ -164,7 +164,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size)
} }
int cnt = size / sizeof(*rela); 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)); 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) { switch(rela[i].r_info & 0xf) {
case 1: /* DIR32 */ case 1: /* DIR32 */
if(sym->st_shndx < 0xff00) if (sym->st_shndx < 0xff00)
*(unsigned long *)target += (unsigned long)segment; *(unsigned long *)target += (unsigned long)segment;
break; break;
default: default:
@ -195,7 +195,7 @@ bool DLObject::load(int fd)
Elf32_Shdr *shdr; Elf32_Shdr *shdr;
int symtab_sect = -1; 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) || memcmp(ehdr.e_ident, ELFMAG, SELFMAG) ||
ehdr.e_type != 2 || ehdr.e_machine != 42 || ehdr.e_type != 2 || ehdr.e_machine != 42 ||
ehdr.e_phentsize < sizeof(phdr) || ehdr.e_shentsize != sizeof(*shdr) || 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", DBG("phoff = %d, phentsz = %d, phnum = %d\n",
ehdr.e_phoff, ehdr.e_phentsize, ehdr.e_phnum); 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)) { read(fd, &phdr, sizeof(phdr)) != sizeof(phdr)) {
seterror("Program header load failed."); seterror("Program header load failed.");
return false; 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) { phdr.p_filesz > phdr.p_memsz) {
seterror("Invalid program header."); seterror("Invalid program header.");
return false; return false;
@ -222,17 +222,17 @@ bool DLObject::load(int fd)
DBG("offs = %d, filesz = %d, memsz = %d, align = %d\n", DBG("offs = %d, filesz = %d, memsz = %d, align = %d\n",
phdr.p_offset, phdr.p_filesz, phdr.p_memsz, phdr.p_align); 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."); seterror("Out of memory.");
return false; return false;
} }
DBG("segment @ %p\n", segment); 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); 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) { read(fd, segment, phdr.p_filesz) != phdr.p_filesz) {
seterror("Segment load failed."); seterror("Segment load failed.");
return false; return false;
@ -241,12 +241,12 @@ bool DLObject::load(int fd)
DBG("shoff = %d, shentsz = %d, shnum = %d\n", DBG("shoff = %d, shentsz = %d, shnum = %d\n",
ehdr.e_shoff, ehdr.e_shentsize, ehdr.e_shnum); 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."); seterror("Out of memory.");
return false; 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)) != read(fd, shdr, ehdr.e_shnum * sizeof(*shdr)) !=
ehdr.e_shnum * sizeof(*shdr)) { ehdr.e_shnum * sizeof(*shdr)) {
seterror("Section headers load failed."); seterror("Section headers load failed.");
@ -254,41 +254,41 @@ bool DLObject::load(int fd)
return false; 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", 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); 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 && shdr[i].sh_link < ehdr.e_shnum && shdr[shdr[i].sh_link].sh_type == 3 &&
symtab_sect < 0) symtab_sect < 0)
symtab_sect = i; symtab_sect = i;
} }
if(symtab_sect < 0) { if (symtab_sect < 0) {
seterror("No symbol table."); seterror("No symbol table.");
free(shdr); free(shdr);
return false; return false;
} }
if(!(symtab = malloc(shdr[symtab_sect].sh_size))) { if (!(symtab = malloc(shdr[symtab_sect].sh_size))) {
seterror("Out of memory."); seterror("Out of memory.");
free(shdr); free(shdr);
return false; 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){ read(fd, symtab, shdr[symtab_sect].sh_size) != shdr[symtab_sect].sh_size){
seterror("Symbol table load failed."); seterror("Symbol table load failed.");
free(shdr); free(shdr);
return false; 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."); seterror("Out of memory.");
free(shdr); free(shdr);
return false; 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) != read(fd, strtab, shdr[shdr[symtab_sect].sh_link].sh_size) !=
shdr[shdr[symtab_sect].sh_link].sh_size){ shdr[shdr[symtab_sect].sh_link].sh_size){
seterror("Symbol table strings load failed."); seterror("Symbol table strings load failed.");
@ -300,15 +300,15 @@ bool DLObject::load(int fd)
DBG("Loaded %d symbols.\n", symbol_cnt); DBG("Loaded %d symbols.\n", symbol_cnt);
Elf32_Sym *s = (Elf32_Sym *)symtab; Elf32_Sym *s = (Elf32_Sym *)symtab;
for(int c = symbol_cnt; c--; s++) for (int c = symbol_cnt; c--; s++)
if(s->st_shndx < 0xff00) if (s->st_shndx < 0xff00)
s->st_value += (Elf32_Addr)segment; s->st_value += (Elf32_Addr)segment;
for(int i=0; i<ehdr.e_shnum; i++) for (int i=0; i<ehdr.e_shnum; i++)
if(shdr[i].sh_type == 4 && shdr[i].sh_entsize == sizeof(Elf32_Rela) && 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[i].sh_link == symtab_sect && shdr[i].sh_info < ehdr.e_shnum &&
(shdr[shdr[i].sh_info].sh_flags & 2)) (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); free(shdr);
return false; return false;
} }
@ -325,12 +325,12 @@ bool DLObject::open(const char *path)
DBG("open(\"%s\")\n", 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); seterror("%s not found.", path);
return false; return false;
} }
if(!load(fd)) { if (!load(fd)) {
::close(fd); ::close(fd);
unload(); unload();
return false; return false;
@ -349,7 +349,7 @@ bool DLObject::open(const char *path)
dtors_start = symbol("__plugin_dtors"); dtors_start = symbol("__plugin_dtors");
dtors_end = symbol("__plugin_dtors_end"); 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) { dtors_end == NULL) {
seterror("Missing ctors/dtors."); seterror("Missing ctors/dtors.");
dtors_start = dtors_end = NULL; dtors_start = dtors_end = NULL;
@ -358,7 +358,7 @@ bool DLObject::open(const char *path)
} }
DBG("Calling constructors.\n"); 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)(); (**f)();
DBG("%s opened ok.\n", path); DBG("%s opened ok.\n", path);
@ -367,8 +367,8 @@ bool DLObject::open(const char *path)
bool DLObject::close() bool DLObject::close()
{ {
if(dtors_start != NULL && dtors_end != NULL) if (dtors_start != NULL && dtors_end != NULL)
for(void (**f)(void) = (void (**)(void))dtors_start; f != dtors_end; f++) for (void (**f)(void) = (void (**)(void))dtors_start; f != dtors_end; f++)
(**f)(); (**f)();
dtors_start = dtors_end = NULL; dtors_start = dtors_end = NULL;
unload(); unload();
@ -379,14 +379,14 @@ void *DLObject::symbol(const char *name)
{ {
DBG("symbol(\"%s\")\n", 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."); seterror("No symbol table loaded.");
return NULL; return NULL;
} }
Elf32_Sym *s = (Elf32_Sym *)symtab; Elf32_Sym *s = (Elf32_Sym *)symtab;
for(int c = symbol_cnt; c--; s++) for (int c = symbol_cnt; c--; s++)
if((s->st_info>>4 == 1 || s->st_info>>4 == 2) && if ((s->st_info>>4 == 1 || s->st_info>>4 == 2) &&
strtab[s->st_name] == '_' && !strcmp(name, strtab+s->st_name+1)) { strtab[s->st_name] == '_' && !strcmp(name, strtab+s->st_name+1)) {
DBG("=> %p\n", (void*)s->st_value); DBG("=> %p\n", (void*)s->st_value);
return (void*)s->st_value; return (void*)s->st_value;
@ -402,7 +402,7 @@ static char dlerr[MAXDLERRLEN];
void *dlopen(const char *filename, int flags) void *dlopen(const char *filename, int flags)
{ {
DLObject *obj = new DLObject(dlerr); DLObject *obj = new DLObject(dlerr);
if(obj->open(filename)) if (obj->open(filename))
return (void *)obj; return (void *)obj;
delete obj; delete obj;
return NULL; return NULL;
@ -411,11 +411,11 @@ void *dlopen(const char *filename, int flags)
int dlclose(void *handle) int dlclose(void *handle)
{ {
DLObject *obj = (DLObject *)handle; DLObject *obj = (DLObject *)handle;
if(obj == NULL) { if (obj == NULL) {
strcpy(dlerr, "Handle is NULL."); strcpy(dlerr, "Handle is NULL.");
return -1; return -1;
} }
if(obj->close()) { if (obj->close()) {
delete obj; delete obj;
return 0; return 0;
} }
@ -424,7 +424,7 @@ int dlclose(void *handle)
void *dlsym(void *handle, const char *symbol) void *dlsym(void *handle, const char *symbol)
{ {
if(handle == NULL) { if (handle == NULL) {
strcpy(dlerr, "Handle is NULL."); strcpy(dlerr, "Handle is NULL.");
return NULL; return NULL;
} }
@ -438,6 +438,6 @@ const char *dlerror()
void dlforgetsyms(void *handle) void dlforgetsyms(void *handle)
{ {
if(handle != NULL) if (handle != NULL)
((DLObject *)handle)->discard_symtab(); ((DLObject *)handle)->discard_symtab();
} }

View file

@ -64,16 +64,16 @@ void OSystem_Dreamcast::initBackend()
static bool find_track(int track, int &first_sec, int &last_sec) static bool find_track(int track, int &first_sec, int &last_sec)
{ {
struct TOC *toc = cdfs_gettoc(); struct TOC *toc = cdfs_gettoc();
if(!toc) if (!toc)
return false; return false;
int i, first, last; int i, first, last;
first = TOC_TRACK(toc->first); first = TOC_TRACK(toc->first);
last = TOC_TRACK(toc->last); last = TOC_TRACK(toc->last);
if(first < 1 || last > 99 || first > last) if (first < 1 || last > 99 || first > last)
return false; return false;
for(i=first; i<=last; i++) for (i=first; i<=last; i++)
if(!(TOC_CTRL(toc->entry[i-1])&4)) if (!(TOC_CTRL(toc->entry[i-1])&4))
if(track==1) { if (track==1) {
first_sec = TOC_LBA(toc->entry[i-1]); first_sec = TOC_LBA(toc->entry[i-1]);
last_sec = TOC_LBA(toc->entry[i]); last_sec = TOC_LBA(toc->entry[i]);
return true; 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; int first_sec, last_sec;
#if 1 #if 1
if(num_loops) if (num_loops)
--num_loops; --num_loops;
#endif #endif
if(num_loops>14) num_loops=14; if (num_loops>14) num_loops=14;
else if(num_loops<0) num_loops=15; // infinity else if (num_loops<0) num_loops=15; // infinity
if(!find_track(track, first_sec, last_sec)) if (!find_track(track, first_sec, last_sec))
return; return;
if(duration) if (duration)
last_sec = first_sec + start_frame + duration; last_sec = first_sec + start_frame + duration;
first_sec += start_frame; first_sec += start_frame;
play_cdda_sectors(first_sec, last_sec, num_loops); play_cdda_sectors(first_sec, last_sec, num_loops);
@ -168,7 +168,7 @@ void OSystem_Dreamcast::setFeatureState(Feature f, bool enable)
switch(f) { switch(f) {
case kFeatureAspectRatioCorrection: case kFeatureAspectRatioCorrection:
_aspect_stretch = enable; _aspect_stretch = enable;
if(screen) if (screen)
setScaling(); setScaling();
break; break;
case kFeatureVirtualKeyboard: case kFeatureVirtualKeyboard:
@ -230,12 +230,12 @@ int DCLauncherDialog::runModal()
{ {
char *base = NULL, *dir = NULL; char *base = NULL, *dir = NULL;
if(!selectGame(base, dir, icon)) if (!selectGame(base, dir, icon))
exit(0); exit(0);
// Set the game path. // Set the game path.
ConfMan.addGameDomain(base); ConfMan.addGameDomain(base);
if(dir != NULL) if (dir != NULL)
ConfMan.set("path", dir, base); ConfMan.set("path", dir, base);
// Set the target. // Set the target.

View file

@ -49,7 +49,7 @@
#define COPYPIXEL(n) do { \ #define COPYPIXEL(n) do { \
unsigned short _tmp = pal[*s++]; \ unsigned short _tmp = pal[*s++]; \
d[n] = _tmp|(pal[*s++]<<16); \ d[n] = _tmp|(pal[*s++]<<16); \
} while(0) } while (0)
static void texture_memcpy64_pal(void *dest, void *src, int cnt, unsigned short *pal) 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)); (0xe0000000 | (((unsigned long)dest) & 0x03ffffc0));
QACR0 = ((0xa4000000>>26)<<2)&0x1c; QACR0 = ((0xa4000000>>26)<<2)&0x1c;
QACR1 = ((0xa4000000>>26)<<2)&0x1c; QACR1 = ((0xa4000000>>26)<<2)&0x1c;
while(cnt--) { while (cnt--) {
COPYPIXEL(0); COPYPIXEL(0);
COPYPIXEL(1); COPYPIXEL(1);
COPYPIXEL(2); COPYPIXEL(2);
@ -91,7 +91,7 @@ static void texture_memcpy64(void *dest, void *src, int cnt)
(0xe0000000 | (((unsigned long)dest) & 0x03ffffc0)); (0xe0000000 | (((unsigned long)dest) & 0x03ffffc0));
QACR0 = ((0xa4000000>>26)<<2)&0x1c; QACR0 = ((0xa4000000>>26)<<2)&0x1c;
QACR1 = ((0xa4000000>>26)<<2)&0x1c; QACR1 = ((0xa4000000>>26)<<2)&0x1c;
while(cnt--) { while (cnt--) {
d[0] = *s++; d[0] = *s++;
d[1] = *s++; d[1] = *s++;
d[2] = *s++; d[2] = *s++;
@ -137,8 +137,8 @@ void commit_dummy_transpoly()
void OSystem_Dreamcast::setPalette(const byte *colors, uint start, uint num) void OSystem_Dreamcast::setPalette(const byte *colors, uint start, uint num)
{ {
unsigned short *dst = palette + start; unsigned short *dst = palette + start;
if(num>0) if (num>0)
while( num-- ) { while ( num-- ) {
*dst++ = ((colors[0]<<7)&0x7c00)| *dst++ = ((colors[0]<<7)&0x7c00)|
((colors[1]<<2)&0x03e0)| ((colors[1]<<2)&0x03e0)|
((colors[2]>>3)&0x001f); ((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) void OSystem_Dreamcast::setCursorPalette(const byte *colors, uint start, uint num)
{ {
unsigned short *dst = cursor_palette + start; unsigned short *dst = cursor_palette + start;
if(num>0) if (num>0)
while( num-- ) { while ( num-- ) {
*dst++ = ((colors[0]<<7)&0x7c00)| *dst++ = ((colors[0]<<7)&0x7c00)|
((colors[1]<<2)&0x03e0)| ((colors[1]<<2)&0x03e0)|
((colors[2]>>3)&0x001f); ((colors[2]>>3)&0x001f);
@ -168,8 +168,8 @@ void OSystem_Dreamcast::disableCursorPalette(bool disable)
void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num) void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num)
{ {
const unsigned short *src = palette + start; const unsigned short *src = palette + start;
if(num>0) if (num>0)
while( num-- ) { while ( num-- ) {
unsigned short p = *src++; unsigned short p = *src++;
colors[0] = ((p&0x7c00)>>7)|((p&0x7000)>>12); colors[0] = ((p&0x7c00)>>7)|((p&0x7000)>>12);
colors[1] = ((p&0x03e0)>>2)|((p&0x0380)>>7); 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() void OSystem_Dreamcast::setScaling()
{ {
if(_screen_w > 400) { if (_screen_w > 400) {
_xscale = _yscale = 1.0; _xscale = _yscale = 1.0;
_top_offset = (SCREEN_H-_screen_h)>>1; _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; _xscale = SCREEN_W/320.0;
_yscale = SCREEN_H/200.0; _yscale = SCREEN_H/200.0;
_top_offset = 0; _top_offset = 0;
@ -206,22 +206,22 @@ void OSystem_Dreamcast::initSize(uint w, uint h)
_screen_h = h; _screen_h = h;
_overlay_x = (w-OVL_W)/2; _overlay_x = (w-OVL_W)/2;
_overlay_y = (h-OVL_H)/2; _overlay_y = (h-OVL_H)/2;
if(_overlay_x<0) _overlay_x = 0; if (_overlay_x<0) _overlay_x = 0;
if(_overlay_y<0) _overlay_y = 0; if (_overlay_y<0) _overlay_y = 0;
setScaling(); setScaling();
ta_sync(); ta_sync();
if(!screen) if (!screen)
screen = new unsigned char[SCREEN_W*SCREEN_H]; screen = new unsigned char[SCREEN_W*SCREEN_H];
if(!overlay) if (!overlay)
overlay = new unsigned short[OVL_W*OVL_H]; overlay = new unsigned short[OVL_W*OVL_H];
for(int i=0; i<NUM_BUFFERS; i++) for (int i=0; i<NUM_BUFFERS; i++)
if(!screen_tx[i]) if (!screen_tx[i])
screen_tx[i] = ta_txalloc(SCREEN_W*SCREEN_H*2); screen_tx[i] = ta_txalloc(SCREEN_W*SCREEN_H*2);
for(int i=0; i<NUM_BUFFERS; i++) for (int i=0; i<NUM_BUFFERS; i++)
if(!mouse_tx[i]) if (!mouse_tx[i])
mouse_tx[i] = ta_txalloc(MOUSE_W*MOUSE_H*2); mouse_tx[i] = ta_txalloc(MOUSE_W*MOUSE_H*2);
for(int i=0; i<NUM_BUFFERS; i++) for (int i=0; i<NUM_BUFFERS; i++)
if(!ovl_tx[i]) if (!ovl_tx[i])
ovl_tx[i] = ta_txalloc(OVL_TXSTRIDE*OVL_H*2); ovl_tx[i] = ta_txalloc(OVL_TXSTRIDE*OVL_H*2);
_screen_buffer = 0; _screen_buffer = 0;
_mouse_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, void OSystem_Dreamcast::copyRectToScreen(const byte *buf, int pitch, int x, int y,
int w, int h) int w, int h)
{ {
if(w<1 || h<1) if (w<1 || h<1)
return; return;
unsigned char *dst = screen + y*SCREEN_W + x; unsigned char *dst = screen + y*SCREEN_W + x;
do { do {
@ -293,7 +293,7 @@ void OSystem_Dreamcast::updateScreen(void)
struct polygon_list mypoly; struct polygon_list mypoly;
struct packed_colour_vertex_list myvertex; struct packed_colour_vertex_list myvertex;
if(_screen_dirty) { if (_screen_dirty) {
_screen_buffer++; _screen_buffer++;
_screen_buffer &= NUM_BUFFERS-1; _screen_buffer &= NUM_BUFFERS-1;
@ -301,10 +301,10 @@ void OSystem_Dreamcast::updateScreen(void)
unsigned short *dst = (unsigned short *)screen_tx[_screen_buffer]; unsigned short *dst = (unsigned short *)screen_tx[_screen_buffer];
unsigned char *src = screen; 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; // *((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 ); texture_memcpy64_pal( dst, src, _screen_w>>5, palette );
src += SCREEN_W; src += SCREEN_W;
@ -314,7 +314,7 @@ void OSystem_Dreamcast::updateScreen(void)
_screen_dirty = false; _screen_dirty = false;
} }
if( _overlay_visible && _overlay_dirty ) { if ( _overlay_visible && _overlay_dirty ) {
_overlay_buffer++; _overlay_buffer++;
_overlay_buffer &= NUM_BUFFERS-1; _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 *dst = (unsigned short *)ovl_tx[_overlay_buffer];
unsigned short *src = overlay; 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 ); texture_memcpy64( dst, src, OVL_W>>5 );
src += OVL_W; src += OVL_W;
@ -378,15 +378,15 @@ void OSystem_Dreamcast::updateScreen(void)
ta_commit_end(); ta_commit_end();
if(_overlay_visible) { if (_overlay_visible) {
if(_overlay_fade < 1.0) if (_overlay_fade < 1.0)
_overlay_fade += 0.125; _overlay_fade += 0.125;
} else { } else {
if(_overlay_fade > 0) if (_overlay_fade > 0)
_overlay_fade -= 0.125; _overlay_fade -= 0.125;
} }
if(_overlay_fade > 0.0) { if (_overlay_fade > 0.0) {
mypoly.cmd = mypoly.cmd =
TA_CMD_POLYGON|TA_CMD_POLYGON_TYPE_TRANSPARENT|TA_CMD_POLYGON_SUBLIST| 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); ta_commit_list(&myvertex);
} }
if(_softkbd_on) if (_softkbd_on)
if(_softkbd_motion < 120) if (_softkbd_motion < 120)
_softkbd_motion += 10; _softkbd_motion += 10;
else else
; ;
else else
if(_softkbd_motion > 0) if (_softkbd_motion > 0)
_softkbd_motion -= 10; _softkbd_motion -= 10;
if(_softkbd_motion) if (_softkbd_motion)
_softkbd.draw(330.0*sin(0.013*_softkbd_motion) - 320.0, 200.0, _softkbd.draw(330.0*sin(0.013*_softkbd_motion) - 320.0, 200.0,
120-_softkbd_motion); 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]; unsigned short *dst = (unsigned short *)mouse_tx[_mouse_buffer];
int y=0; int y=0;
if(visible && w && h && w<=MOUSE_W && h<=MOUSE_H) if (visible && w && h && w<=MOUSE_W && h<=MOUSE_H)
for(int y=0; y<h; y++) { for (int y=0; y<h; y++) {
int x; int x;
for(x=0; x<w; x++) for (x=0; x<w; x++)
if(*buf == _ms_keycolor) { if (*buf == _ms_keycolor) {
*dst++ = 0; *dst++ = 0;
buf++; buf++;
} else } 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 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)); rx = (int)(x*_xscale - (330.0*sin(0.013*_softkbd_motion) - 320.0));
ry = (int)(y*_yscale + TOP_OFFSET - 200.0); ry = (int)(y*_yscale + TOP_OFFSET - 200.0);
} else { } else {
@ -550,7 +550,7 @@ void OSystem_Dreamcast::hideOverlay()
void OSystem_Dreamcast::clearOverlay() void OSystem_Dreamcast::clearOverlay()
{ {
if(!_overlay_visible) if (!_overlay_visible)
return; return;
memset(overlay, 0, OVL_W*OVL_H*sizeof(unsigned short)); 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, void OSystem_Dreamcast::copyRectToOverlay(const int16 *buf, int pitch,
int x, int y, int w, int h) int x, int y, int w, int h)
{ {
if(w<1 || h<1) if (w<1 || h<1)
return; return;
unsigned short *dst = overlay + y*OVL_W + x; unsigned short *dst = overlay + y*OVL_W + x;
do { do {

View file

@ -33,7 +33,7 @@ void Icon::create_vmicon(void *buffer)
unsigned short *pal = (unsigned short *)buffer; unsigned short *pal = (unsigned short *)buffer;
unsigned char *pix = ((unsigned char *)buffer)+32; 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]; int p = palette[n];
pal[n] = pal[n] =
((p>>16)&0xf000)| ((p>>16)&0xf000)|
@ -42,7 +42,7 @@ void Icon::create_vmicon(void *buffer)
((p>> 4)&0x000f); ((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); memcpy(pix, &bitmap[32/2*(31-line)], 32/2);
pix += 32/2; pix += 32/2;
} }
@ -55,9 +55,9 @@ void Icon::create_texture()
unsigned short *tex = (unsigned short *)ta_txalloc(512); unsigned short *tex = (unsigned short *)ta_txalloc(512);
unsigned short *linebase; unsigned short *linebase;
unsigned char *src = bitmap+sizeof(bitmap)-17; 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); 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); linebase[tt[x]] = src[16]|(src[0]<<8);
src -= 16; src -= 16;
} }
@ -67,7 +67,7 @@ void Icon::create_texture()
void Icon::setPalette(int pal) void Icon::setPalette(int pal)
{ {
unsigned int (*hwpal)[64][16] = (unsigned int (*)[64][16])0xa05f9000; 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]; (*hwpal)[pal][n] = palette[n];
} }
@ -124,13 +124,13 @@ int Icon::find_unused_pixel()
{ {
int use[16]; int use[16];
memset(use, 0, sizeof(use)); 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]; unsigned char pix = bitmap[n];
use[pix&0xf]++; use[pix&0xf]++;
use[pix>>4]++; use[pix>>4]++;
} }
for(int i=0; i<16; i++) for (int i=0; i<16; i++)
if(!use[i]) if (!use[i])
return i; return i;
return -1; return -1;
} }
@ -142,41 +142,41 @@ bool Icon::load_image2(const void *data, int len)
short pla, bitcnt; short pla, bitcnt;
int comp, sizeimg, xres, yres, used, imp; int comp, sizeimg, xres, yres, used, imp;
} hdr; } hdr;
if(len < 40) if (len < 40)
return false; return false;
memcpy(&hdr, data, 40); 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) hdr.bitcnt<0 || hdr.used<0)
return false; return false;
if(!hdr.used) if (!hdr.used)
hdr.used = 1<<hdr.bitcnt; hdr.used = 1<<hdr.bitcnt;
hdr.h >>= 1; hdr.h >>= 1;
/* Fix incorrect sizeimg (The Dig) */ /* 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); 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) */) hdr.sizeimg < ((hdr.w*hdr.h*(1+hdr.bitcnt)+7)>>3) */)
return false; 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; return false;
memcpy(palette, ((const char *)data)+hdr.size, hdr.used<<2); memcpy(palette, ((const char *)data)+hdr.size, hdr.used<<2);
memcpy(bitmap, ((const char *)data)+hdr.size+(hdr.used<<2), 32*32/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; palette[i] |= 0xff000000;
for(int i=hdr.used; i<16; i++) for (int i=hdr.used; i<16; i++)
palette[i] = 0; palette[i] = 0;
int unused = find_unused_pixel(); int unused = find_unused_pixel();
if(unused >= 0) { if (unused >= 0) {
const unsigned char *mask = const unsigned char *mask =
((const unsigned char *)data)+hdr.size+(hdr.used<<2)+32*32/2; ((const unsigned char *)data)+hdr.size+(hdr.used<<2)+32*32/2;
unsigned char *pix = bitmap; unsigned char *pix = bitmap;
for(int y=0; y<32; y++) for (int y=0; y<32; y++)
for(int x=0; x<32/8; x++) { for (int x=0; x<32/8; x++) {
unsigned char mbits = *mask++; unsigned char mbits = *mask++;
for(int z=0; z<4; z++) { for (int z=0; z<4; z++) {
unsigned char pbits = *pix; unsigned char pbits = *pix;
if(mbits & 64) pbits = (pbits & ~0xf) | unused; if (mbits & 64) pbits = (pbits & ~0xf) | unused;
if(mbits & 128) pbits = (pbits & 0xf) | (unused << 4); if (mbits & 128) pbits = (pbits & 0xf) | (unused << 4);
*pix++ = pbits; *pix++ = pbits;
mbits <<= 2; mbits <<= 2;
} }
@ -193,10 +193,10 @@ bool Icon::load_image1(const void *data, int len, int offs)
short pla, bitcnt; short pla, bitcnt;
int bytes, offs; int bytes, offs;
} hdr; } hdr;
if(len < offs+16) if (len < offs+16)
return false; return false;
memcpy(&hdr, ((const char *)data)+offs, 16); 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); return load_image2(((const char *)data)+hdr.offs, hdr.bytes);
else else
return false; return false;
@ -208,13 +208,13 @@ bool Icon::load(const void *data, int len, int offs)
memset(bitmap, 0, sizeof(bitmap)); memset(bitmap, 0, sizeof(bitmap));
memset(palette, 0, sizeof(palette)); memset(palette, 0, sizeof(palette));
texture = NULL; texture = NULL;
if(len < offs+6) if (len < offs+6)
return false; return false;
memcpy(&hdr, ((const char *)data)+offs, 6); 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; return false;
for(int i=0; i<hdr.cnt; i++) for (int i=0; i<hdr.cnt; i++)
if(load_image1(data, len, offs+6+(i<<4))) if (load_image1(data, len, offs+6+(i<<4)))
return true; return true;
return false; return false;
} }
@ -223,11 +223,11 @@ bool Icon::load(const char *filename)
{ {
char buf[2048]; char buf[2048];
int fd; int fd;
if((fd = open(filename, O_RDONLY))>=0) { if ((fd = open(filename, O_RDONLY))>=0) {
int sz; int sz;
sz = read(fd, buf, sizeof(buf)); sz = read(fd, buf, sizeof(buf));
close(fd); close(fd);
if(sz>0) if (sz>0)
return load(buf, sz); return load(buf, sz);
} }
return false; return false;

View file

@ -39,70 +39,70 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
static byte lastlmb = 0, lastrmb = 0; static byte lastlmb = 0, lastrmb = 0;
static int8 mouse_wheel = 0, lastwheel = 0; static int8 mouse_wheel = 0, lastwheel = 0;
shiftFlags = 0; shiftFlags = 0;
for(int i=0; i<4; i++, pad++) for (int i=0; i<4; i++, pad++)
if(pad->func & MAPLE_FUNC_CONTROLLER) { if (pad->func & MAPLE_FUNC_CONTROLLER) {
int buttons = pad->cond.controller.buttons; int buttons = pad->cond.controller.buttons;
if(!(buttons & 0x060e)) exit(0); if (!(buttons & 0x060e)) exit(0);
if(!(buttons & 4)) lmb++; if (!(buttons & 4)) lmb++;
if(!(buttons & 2)) rmb++; if (!(buttons & 2)) rmb++;
if(!(buttons & 8)) newkey = Common::KEYCODE_F5; if (!(buttons & 8)) newkey = Common::KEYCODE_F5;
else if(!(buttons & 512)) newkey = ' '; else if (!(buttons & 512)) newkey = ' ';
else if(!(buttons & 1024)) newkey = numpadmap[(buttons>>4)&15]; else if (!(buttons & 1024)) newkey = numpadmap[(buttons>>4)&15];
if(!(buttons & 128)) if(inter) newkey = 1001; else mouse_x++; if (!(buttons & 128)) if (inter) newkey = 1001; else mouse_x++;
if(!(buttons & 64)) if(inter) newkey = 1002; 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 & 32)) if (inter) newkey = 1003; else mouse_y++;
if(!(buttons & 16)) if(inter) newkey = 1004; else mouse_y--; if (!(buttons & 16)) if (inter) newkey = 1004; else mouse_y--;
mouse_x += ((int)pad->cond.controller.joyx-128)>>4; mouse_x += ((int)pad->cond.controller.joyx-128)>>4;
mouse_y += ((int)pad->cond.controller.joyy-128)>>4; mouse_y += ((int)pad->cond.controller.joyy-128)>>4;
if(pad->cond.controller.ltrigger > 200) newkey = 1005; if (pad->cond.controller.ltrigger > 200) newkey = 1005;
else if(pad->cond.controller.rtrigger > 200) newkey = 1006; 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; int buttons = pad->cond.mouse.buttons;
if(!(buttons & 4)) lmb++; if (!(buttons & 4)) lmb++;
if(!(buttons & 2)) rmb++; 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_x += pad->cond.mouse.axis1;
mouse_y += pad->cond.mouse.axis2; mouse_y += pad->cond.mouse.axis2;
mouse_wheel += pad->cond.mouse.axis3; mouse_wheel += pad->cond.mouse.axis3;
if(inter) if (inter)
inter->mouse(mouse_x, mouse_y); inter->mouse(mouse_x, mouse_y);
pad->cond.mouse.axis1 = 0; pad->cond.mouse.axis1 = 0;
pad->cond.mouse.axis2 = 0; pad->cond.mouse.axis2 = 0;
pad->cond.mouse.axis3 = 0; pad->cond.mouse.axis3 = 0;
} else if(pad->func & MAPLE_FUNC_KEYBOARD) { } else if (pad->func & MAPLE_FUNC_KEYBOARD) {
for(int p=0; p<6; p++) { for (int p=0; p<6; p++) {
int shift = pad->cond.kbd.shift; int shift = pad->cond.kbd.shift;
int key = pad->cond.kbd.key[p]; int key = pad->cond.kbd.key[p];
if(shift & 0x08) lmb++; if (shift & 0x08) lmb++;
if(shift & 0x80) rmb++; if (shift & 0x80) rmb++;
if(shift & 0x11) shiftFlags |= Common::KBD_CTRL; if (shift & 0x11) shiftFlags |= Common::KBD_CTRL;
if(shift & 0x44) shiftFlags |= Common::KBD_ALT; if (shift & 0x44) shiftFlags |= Common::KBD_ALT;
if(shift & 0x22) shiftFlags |= Common::KBD_SHIFT; if (shift & 0x22) shiftFlags |= Common::KBD_SHIFT;
if(key >= 4 && key <= 0x1d) if (key >= 4 && key <= 0x1d)
newkey = key+('a'-4); newkey = key+('a'-4);
else if(key >= 0x1e && key <= 0x26) else if (key >= 0x1e && key <= 0x26)
newkey = key+((shift & 0x22)? ('!'-0x1e) : ('1'-0x1e)); newkey = key+((shift & 0x22)? ('!'-0x1e) : ('1'-0x1e));
else if(key >= 0x59 && key <= 0x61) else if (key >= 0x59 && key <= 0x61)
newkey = key+('1'-0x59); newkey = key+('1'-0x59);
else if(key >= 0x2d && key <= 0x38 && key != 0x31) else if (key >= 0x2d && key <= 0x38 && key != 0x31)
newkey = ((shift & 0x22)? newkey = ((shift & 0x22)?
"=?`{ }+*?<>?" : "=?`{ }+*?<>?" :
"-^@[ ];:?,./")[key - 0x2d]; "-^@[ ];:?,./")[key - 0x2d];
else if(key >= 0x3a && key <= 0x43) else if (key >= 0x3a && key <= 0x43)
newkey = key+(Common::KEYCODE_F1-0x3a); newkey = key+(Common::KEYCODE_F1-0x3a);
else if(key >= 0x54 && key <= 0x57) else if (key >= 0x54 && key <= 0x57)
newkey = "/*-+"[key-0x54]; newkey = "/*-+"[key-0x54];
else switch(key) { else switch(key) {
case 0x27: case 0x62: case 0x27: case 0x62:
@ -118,17 +118,17 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
case 0x2c: case 0x2c:
newkey = Common::KEYCODE_SPACE; break; newkey = Common::KEYCODE_SPACE; break;
case 0x4c: case 0x4c:
if((shift & 0x11) && (shift & 0x44)) if ((shift & 0x11) && (shift & 0x44))
exit(0); exit(0);
break; break;
case 0x4f: case 0x4f:
if(inter) newkey = 1001; else mouse_x++; break; if (inter) newkey = 1001; else mouse_x++; break;
case 0x50: case 0x50:
if(inter) newkey = 1002; else mouse_x--; break; if (inter) newkey = 1002; else mouse_x--; break;
case 0x51: case 0x51:
if(inter) newkey = 1003; else mouse_y++; break; if (inter) newkey = 1003; else mouse_y++; break;
case 0x52: case 0x52:
if(inter) newkey = 1004; else mouse_y--; break; if (inter) newkey = 1004; else mouse_y--; break;
case 0x63: case 0x63:
newkey = '.'; break; newkey = '.'; break;
case 0x64: case 0x87: 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; newkey = 1000;
lmb = 0; lmb = 0;
} }
if(lmb && !lastlmb) { if (lmb && !lastlmb) {
lastlmb = 1; lastlmb = 1;
return -Common::EVENT_LBUTTONDOWN; return -Common::EVENT_LBUTTONDOWN;
} else if(lastlmb && !lmb) { } else if (lastlmb && !lmb) {
lastlmb = 0; lastlmb = 0;
return -Common::EVENT_LBUTTONUP; return -Common::EVENT_LBUTTONUP;
} }
if(rmb && !lastrmb) { if (rmb && !lastrmb) {
lastrmb = 1; lastrmb = 1;
return -Common::EVENT_RBUTTONDOWN; return -Common::EVENT_RBUTTONDOWN;
} else if(lastrmb && !rmb) { } else if (lastrmb && !rmb) {
lastrmb = 0; lastrmb = 0;
return -Common::EVENT_RBUTTONUP; return -Common::EVENT_RBUTTONUP;
} }
if(mouse_wheel != lastwheel) if (mouse_wheel != lastwheel)
if(((int8)(mouse_wheel - lastwheel)) > 0) { if (((int8)(mouse_wheel - lastwheel)) > 0) {
lastwheel++; lastwheel++;
return -Common::EVENT_WHEELDOWN; return -Common::EVENT_WHEELDOWN;
} else { } else {
@ -168,22 +168,22 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
return -Common::EVENT_WHEELUP; return -Common::EVENT_WHEELUP;
} }
if(newkey && inter && newkey != lastkey) { if (newkey && inter && newkey != lastkey) {
int transkey = inter->key(newkey, shiftFlags); int transkey = inter->key(newkey, shiftFlags);
if(transkey) { if (transkey) {
newkey = transkey; newkey = transkey;
inter = NULL; inter = NULL;
} }
} }
if(!newkey || (lastkey && newkey != lastkey)) { if (!newkey || (lastkey && newkey != lastkey)) {
int upkey = lastkey; int upkey = lastkey;
lastkey = 0; lastkey = 0;
if(upkey) if (upkey)
return upkey | (1<<30); return upkey | (1<<30);
} else if(!lastkey) { } else if (!lastkey) {
lastkey = newkey; lastkey = newkey;
if(newkey >= 1000 || !inter) if (newkey >= 1000 || !inter)
return newkey; return newkey;
} }
@ -194,13 +194,13 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event)
{ {
unsigned int t = Timer(); unsigned int t = Timer();
if(_timer != NULL) if (_timer != NULL)
_timer->handler(); _timer->handler();
if(((int)(t-_devpoll))<0) if (((int)(t-_devpoll))<0)
return false; return false;
_devpoll += USEC_TO_TIMER(17000); _devpoll += USEC_TO_TIMER(17000);
if(((int)(t-_devpoll))>=0) if (((int)(t-_devpoll))>=0)
_devpoll = t + USEC_TO_TIMER(17000); _devpoll = t + USEC_TO_TIMER(17000);
int mask = getimask(); int mask = getimask();
@ -220,25 +220,25 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event)
event.mouse.y -= _overlay_y; event.mouse.y -= _overlay_y;
} }
event.kbd.ascii = event.kbd.keycode = 0; event.kbd.ascii = event.kbd.keycode = 0;
if(e<0) { if (e<0) {
event.type = (Common::EventType)-e; event.type = (Common::EventType)-e;
return true; return true;
} else if(e>0) { } else if (e>0) {
bool processed = false, down = !(e&(1<<30)); bool processed = false, down = !(e&(1<<30));
e &= ~(1<<30); e &= ~(1<<30);
if(e < 1000) { if (e < 1000) {
event.type = (down? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP); event.type = (down? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP);
event.kbd.keycode = e; event.kbd.keycode = e;
event.kbd.ascii = (e>='a' && e<='z' && (event.kbd.flags & Common::KBD_SHIFT)? event.kbd.ascii = (e>='a' && e<='z' && (event.kbd.flags & Common::KBD_SHIFT)?
e &~ 0x20 : e); e &~ 0x20 : e);
processed = true; processed = true;
} else if(down) { } else if (down) {
if(e == 1005) if (e == 1005)
setFeatureState(kFeatureVirtualKeyboard, setFeatureState(kFeatureVirtualKeyboard,
!getFeatureState(kFeatureVirtualKeyboard)); !getFeatureState(kFeatureVirtualKeyboard));
} }
return processed; 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; event.type = Common::EVENT_MOUSEMOVE;
_ms_old_x = _ms_cur_x; _ms_old_x = _ms_cur_x;
_ms_old_y = _ms_cur_y; _ms_old_y = _ms_cur_y;

View file

@ -47,13 +47,13 @@ static void draw_char(unsigned short *dst, int mod, int c, void *font_base)
{ {
unsigned char *src; unsigned char *src;
int i, j; int i, j;
if(c<=32 || c>255 || (c>=127 && c<160)) c=160; if (c<=32 || c>255 || (c>=127 && c<160)) c=160;
if(c<128) c -= 32; else c -= 64; if (c<128) c -= 32; else c -= 64;
src = c*36 + (unsigned char *)font_base; 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]; int n = (src[0]<<16)|(src[1]<<8)|src[2];
for(j=0; j<12; j++, n<<=1) for (j=0; j<12; j++, n<<=1)
if(n & (1<<23)) { if (n & (1<<23)) {
dst[j] = 0xffff; dst[j] = 0xffff;
dst[j+1] = 0xffff; dst[j+1] = 0xffff;
dst[j+2] = 0xa108; 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[j+mod+1] = 0xa108;
} }
dst += mod; dst += mod;
for(j=0; j<12; j++, n<<=1) for (j=0; j<12; j++, n<<=1)
if(n & (1<<23)) { if (n & (1<<23)) {
dst[j] = 0xffff; dst[j] = 0xffff;
dst[j+1] = 0xffff; dst[j+1] = 0xffff;
dst[j+2] = 0xa108; dst[j+2] = 0xa108;
@ -78,15 +78,15 @@ void Label::create_texture(const char *text)
{ {
void *font = get_romfont_address(); void *font = get_romfont_address();
int l = strlen(text); int l = strlen(text);
if(l>64) l=64; if (l>64) l=64;
int w = 14*l; 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; int tsz = u*32;
unsigned short *tex = (unsigned short *)ta_txalloc(tsz*2); 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; tex[i] = 0;
int p=l*14; int p=l*14;
while(l>0) while (l>0)
draw_char(tex+(p-=14), u, text[--l], font); draw_char(tex+(p-=14), u, text[--l], font);
texture = tex; texture = tex;
} }

View file

@ -162,7 +162,7 @@ static void detectGames(FSList &files, GameList &candidates)
static bool isIcon(const FilesystemNode &entry) static bool isIcon(const FilesystemNode &entry)
{ {
int l = entry.displayName().size(); 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; return true;
else else
return false; return false;
@ -172,13 +172,13 @@ static bool loadIcon(Game &game, Dir *dirs, int num_dirs)
{ {
char icofn[520]; char icofn[520];
sprintf(icofn, "%s%s.ICO", game.dir, game.filename_base); sprintf(icofn, "%s%s.ICO", game.dir, game.filename_base);
if(game.icon.load(icofn)) if (game.icon.load(icofn))
return true; return true;
for(int i=0; i<num_dirs; i++) for (int i=0; i<num_dirs; i++)
if(!strcmp(dirs[i].name, game.dir) && if (!strcmp(dirs[i].name, game.dir) &&
dirs[i].deficon[0]) { dirs[i].deficon[0]) {
sprintf(icofn, "%s%s", game.dir, dirs[i].deficon); sprintf(icofn, "%s%s", game.dir, dirs[i].deficon);
if(game.icon.load(icofn)) if (game.icon.load(icofn))
return true; return true;
break; break;
} }
@ -193,8 +193,8 @@ static void makeDefIcon(Icon &icon)
static bool uniqueGame(const char *base, const char *dir, Game *games, int cnt) static bool uniqueGame(const char *base, const char *dir, Game *games, int cnt)
{ {
while(cnt--) while (cnt--)
if(!strcmp(dir, games->dir) && if (!strcmp(dir, games->dir) &&
!stricmp(base, games->filename_base)) !stricmp(base, games->filename_base))
return false; return false;
else else
@ -207,7 +207,7 @@ static int findGames(Game *games, int max)
Dir *dirs = new Dir[MAX_DIR]; Dir *dirs = new Dir[MAX_DIR];
int curr_game = 0, curr_dir = 0, num_dirs = 1; int curr_game = 0, curr_dir = 0, num_dirs = 1;
dirs[0].node = FilesystemNode(""); 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); strncpy(dirs[curr_dir].name, dirs[curr_dir].node.path().c_str(), 252);
dirs[curr_dir].name[251] = '\0'; dirs[curr_dir].name[251] = '\0';
dirs[curr_dir].deficon[0] = '\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(); for (FSList::const_iterator entry = fslist.begin(); entry != fslist.end();
++entry) { ++entry) {
if (entry->isDirectory()) { if (entry->isDirectory()) {
if(num_dirs < MAX_DIR && strcasecmp(entry->displayName().c_str(), if (num_dirs < MAX_DIR && strcasecmp(entry->displayName().c_str(),
"install")) { "install")) {
dirs[num_dirs].node = *entry; dirs[num_dirs].node = *entry;
num_dirs++; num_dirs++;
} }
} else } else
if(isIcon(*entry)) if (isIcon(*entry))
strcpy(dirs[curr_dir-1].deficon, entry->displayName().c_str()); strcpy(dirs[curr_dir-1].deficon, entry->displayName().c_str());
else else
files.push_back(*entry); files.push_back(*entry);
@ -231,12 +231,12 @@ static int findGames(Game *games, int max)
GameList candidates; GameList candidates;
detectGames(files, candidates); detectGames(files, candidates);
for(GameList::const_iterator ge = candidates.begin(); for (GameList::const_iterator ge = candidates.begin();
ge != candidates.end(); ++ge) 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].filename_base, ge->gameid().c_str());
strcpy(games[curr_game].dir, dirs[curr_dir-1].name); 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)) { games[curr_game].dir, games, curr_game)) {
strcpy(games[curr_game].text, ge->description().c_str()); 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++) for (int i=0; i<curr_game; i++)
if(!loadIcon(games[i], dirs, num_dirs)) if (!loadIcon(games[i], dirs, num_dirs))
makeDefIcon(games[i].icon); makeDefIcon(games[i].icon);
delete[] dirs; delete[] dirs;
return curr_game; return curr_game;
@ -279,11 +279,11 @@ void waitForDisk()
void *mark = ta_txmark(); void *mark = ta_txmark();
lab.create_texture("Please insert game CD."); lab.create_texture("Please insert game CD.");
//printf("waitForDisk, cdstate = %d\n", getCdState()); //printf("waitForDisk, cdstate = %d\n", getCdState());
for(;;) { for (;;) {
int s = getCdState(); int s = getCdState();
if(s >= 6) if (s >= 6)
wasopen = 1; wasopen = 1;
if(s > 0 && s < 6 && wasopen) { if (s > 0 && s < 6 && wasopen) {
cdfs_reinit(); cdfs_reinit();
chdir("/"); chdir("/");
chdir("/"); chdir("/");
@ -326,12 +326,12 @@ int gameMenu(Game *games, int num_games)
int top_game = 0, selector_pos = 0; int top_game = 0, selector_pos = 0;
int mousex = 0, mousey = 0; int mousex = 0, mousey = 0;
if(!num_games) if (!num_games)
return -1; return -1;
for(;;) { for (;;) {
if(getCdState()>=6) if (getCdState()>=6)
return -1; return -1;
ta_begin_frame(); ta_begin_frame();
@ -341,10 +341,10 @@ int gameMenu(Game *games, int num_games)
ta_commit_end(); ta_commit_end();
float y = 40.0; 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); int pal = 48+(i&15);
if(cnt == selector_pos) if (cnt == selector_pos)
draw_trans_quad(100.0, y, 590.0, y+32.0, draw_trans_quad(100.0, y, 590.0, y+32.0,
0x7000ff00, 0x7000ff00, 0x7000ff00, 0x7000ff00); 0x7000ff00, 0x7000ff00, 0x7000ff00, 0x7000ff00);
@ -364,10 +364,10 @@ int gameMenu(Game *games, int num_games)
event = handleInput(locked_get_pads(), mousex, mousey, shiftFlags); event = handleInput(locked_get_pads(), mousex, mousey, shiftFlags);
setimask(mask); 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; 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); unsigned int fade_colour = 0x00ffffff | ((255-fade)<<24);
@ -379,10 +379,10 @@ int gameMenu(Game *games, int num_games)
float y = 40.0; float y = 40.0;
if(fade < 256) if (fade < 256)
for(int i=top_game, cnt=0; cnt<10 && i<num_games; for (int i=top_game, cnt=0; cnt<10 && i<num_games;
i++, cnt++, y += 40.0) i++, cnt++, y += 40.0)
if(cnt != selector_pos) if (cnt != selector_pos)
drawGameLabel(games[i], 48+(i&15), 50.0, y, 0xffffff, fade); 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; 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; return selected_game;
} }
if(mousey>=16) { if (mousey>=16) {
if(selector_pos + top_game + 1 < num_games) if (selector_pos + top_game + 1 < num_games)
if(++selector_pos >= 10) { if (++selector_pos >= 10) {
--selector_pos; --selector_pos;
++top_game; ++top_game;
} }
mousey -= 16; mousey -= 16;
} else if(mousey<=-16) { } else if (mousey<=-16) {
if(selector_pos + top_game > 0) if (selector_pos + top_game > 0)
if(--selector_pos < 0) { if (--selector_pos < 0) {
++selector_pos; ++selector_pos;
--top_game; --top_game;
} }
@ -423,10 +423,10 @@ bool selectGame(char *&ret, char *&dir_ret, Icon &icon)
ta_sync(); ta_sync();
void *mark = ta_txmark(); void *mark = ta_txmark();
for(;;) { for (;;) {
num_games = findGames(games, MAX_GAMES); 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].icon.create_texture();
games[i].label.create_texture(games[i].text); games[i].label.create_texture(games[i].text);
} }
@ -436,22 +436,22 @@ bool selectGame(char *&ret, char *&dir_ret, Icon &icon)
ta_sync(); ta_sync();
ta_txrelease(mark); ta_txrelease(mark);
if(selected == -1) if (selected == -1)
waitForDisk(); waitForDisk();
else else
break; break;
} }
if(selected >= num_games) if (selected >= num_games)
selected = -1; selected = -1;
if(selected >= 0) if (selected >= 0)
the_game = games[selected]; the_game = games[selected];
delete games; delete games;
if(selected>=0) { if (selected>=0) {
#if 0 #if 0
chdir(the_game.dir); chdir(the_game.dir);
#else #else

View file

@ -70,10 +70,10 @@ SoftKeyboard::SoftKeyboard(const OSystem_Dreamcast *_os)
assert((sizeof(key_codes)/sizeof(key_codes[0])) == SK_NUM_KEYS); assert((sizeof(key_codes)/sizeof(key_codes[0])) == SK_NUM_KEYS);
const char *np = key_names; 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); labels[0][i].create_texture(np);
np += strlen(np)+1; np += strlen(np)+1;
if(key_codes[i]>8192) { if (key_codes[i]>8192) {
labels[1][i].create_texture(np); labels[1][i].create_texture(np);
np += strlen(np)+1; 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); bg_alpha_mask|0x8080ff, bg_alpha_mask|0x8080ff);
x0 = x += 4.0; x0 = x += 4.0;
y += 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); float w = (i == 58? 164.0 : 24.0);
unsigned int bg = (i == keySel? bg_alpha_mask|0xffff00 : unsigned int bg = (i == keySel? bg_alpha_mask|0xffff00 :
bg_alpha_mask|0xc0c0ff); bg_alpha_mask|0xc0c0ff);
draw_trans_quad(x, y, x+w, y+24.0, bg, bg, bg, bg); 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); 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); labels[1][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5);
else else
labels[0][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5); labels[0][i].draw(x+2, y+5, txt_alpha_mask|0x000000, 0.5);
x += w+4.0; x += w+4.0;
if(++c == 11) { if (++c == 11) {
c = 0; c = 0;
x = x0; x = x0;
y += 28.0; y += 28.0;
@ -116,41 +116,41 @@ int SoftKeyboard::key(int k, byte &shiftFlags)
{ {
switch(k) { switch(k) {
case 1001: case 1001:
if(++keySel == SK_NUM_KEYS) if (++keySel == SK_NUM_KEYS)
keySel = 0; keySel = 0;
break; break;
case 1002: case 1002:
if(--keySel < 0) if (--keySel < 0)
keySel = SK_NUM_KEYS - 1; keySel = SK_NUM_KEYS - 1;
break; break;
case 1003: case 1003:
if(keySel >= 55) { if (keySel >= 55) {
if(keySel > 58) if (keySel > 58)
keySel += 5; keySel += 5;
keySel -= 55; keySel -= 55;
} else if(keySel > 47) { } else if (keySel > 47) {
if((keySel += 6) < 59) if ((keySel += 6) < 59)
keySel = 59; keySel = 59;
} else } else
keySel += 11; keySel += 11;
break; break;
case 1004: case 1004:
if(keySel > 58) if (keySel > 58)
keySel -= 6; keySel -= 6;
else if((keySel -= 11) < 0) else if ((keySel -= 11) < 0)
if((keySel += 66) > 58) if ((keySel += 66) > 58)
if((keySel -= 5) < 59) if ((keySel -= 5) < 59)
keySel = 59; keySel = 59;
break; break;
case 1000: case 1000:
case 13: case 13:
case 32: case 32:
case 319: case 319:
if(key_codes[keySel]<0) if (key_codes[keySel]<0)
shiftState ^= ~key_codes[keySel]; shiftState ^= ~key_codes[keySel];
else { else {
shiftFlags = shiftState; shiftFlags = shiftState;
if(key_codes[keySel] > 8192) if (key_codes[keySel] > 8192)
return ((shiftState & Common::KBD_SHIFT)? (key_codes[keySel]>>8): return ((shiftState & Common::KBD_SHIFT)? (key_codes[keySel]>>8):
key_codes[keySel]) & 0xff; key_codes[keySel]) & 0xff;
else else
@ -164,9 +164,9 @@ int SoftKeyboard::key(int k, byte &shiftFlags)
void SoftKeyboard::mouse(int x, int y) void SoftKeyboard::mouse(int x, int y)
{ {
os->mouseToSoftKbd(x, y, x, 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) x%28 >= 4 && y%28 >= 4)
if((keySel = 11*(y/28)+(x/28)) > 58) if ((keySel = 11*(y/28)+(x/28)) > 58)
if((keySel -= 5) < 59) if ((keySel -= 5) < 59)
keySel = 58; keySel = 58;
} }

View file

@ -51,8 +51,8 @@ void OSystem_Dreamcast::delayMillis(uint msecs)
getMillis(); getMillis();
unsigned int t, start = Timer(); unsigned int t, start = Timer();
int time = (((unsigned int)msecs)*3125U)>>6; int time = (((unsigned int)msecs)*3125U)>>6;
while(((int)((t = Timer())-start))<time) { while (((int)((t = Timer())-start))<time) {
if(_timer != NULL) if (_timer != NULL)
_timer->handler(); _timer->handler();
checkSound(); checkSound();
} }

View file

@ -87,14 +87,14 @@ static vmsaveResult trySave(const char *gamename, const char *data, int size,
time_t t; time_t t;
unsigned char iconbuffer[512+32]; unsigned char iconbuffer[512+32];
if(!vmsfs_check_unit(vm, 0, &info)) if (!vmsfs_check_unit(vm, 0, &info))
return VMSAVE_NOVM; return VMSAVE_NOVM;
if(!vmsfs_get_superblock(&info, &super)) if (!vmsfs_get_superblock(&info, &super))
return VMSAVE_NOVM; return VMSAVE_NOVM;
int free_cnt = vmsfs_count_free(&super); 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; free_cnt += file.blks;
if(((128+512+size+511)>>9) > free_cnt) if (((128+512+size+511)>>9) > free_cnt)
return VMSAVE_NOSPACE; return VMSAVE_NOSPACE;
memset(&header, 0, sizeof(header)); 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_beep(&info, 1);
vmsfs_errno = 0; vmsfs_errno = 0;
if(!vmsfs_create_file(&super, filename, &header, if (!vmsfs_create_file(&super, filename, &header,
iconbuffer+sizeof(header.palette), NULL, iconbuffer+sizeof(header.palette), NULL,
data, size, &tstamp)) { data, size, &tstamp)) {
fprintf(stderr, "%s\n", vmsfs_describe_error()); 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; time_t t;
unsigned char iconbuffer[512+32]; unsigned char iconbuffer[512+32];
if(!vmsfs_check_unit(vm, 0, &info)) if (!vmsfs_check_unit(vm, 0, &info))
return false; return false;
if(!vmsfs_get_superblock(&info, &super)) if (!vmsfs_get_superblock(&info, &super))
return false; return false;
if(!vmsfs_open_file(&super, filename, &file)) if (!vmsfs_open_file(&super, filename, &file))
return false; return false;
buffer = new char[size = file.size]; 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; return true;
delete[] buffer; delete[] buffer;
@ -165,19 +165,19 @@ static void tryList(const char *prefix, bool *marks, int num, int vm)
struct dir_entry de; struct dir_entry de;
int pl = strlen(prefix); int pl = strlen(prefix);
if(!vmsfs_check_unit(vm, 0, &info)) if (!vmsfs_check_unit(vm, 0, &info))
return; return;
if(!vmsfs_get_superblock(&info, &super)) if (!vmsfs_get_superblock(&info, &super))
return; return;
vmsfs_open_dir(&super, &iter); vmsfs_open_dir(&super, &iter);
while(vmsfs_next_dir_entry(&iter, &de)) while (vmsfs_next_dir_entry(&iter, &de))
if(de.entry[0]) { if (de.entry[0]) {
char buf[16], *endp = NULL; char buf[16], *endp = NULL;
strncpy(buf, (char *)de.entry+4, 12); strncpy(buf, (char *)de.entry+4, 12);
buf[12] = 0; buf[12] = 0;
int l = strlen(buf); int l = strlen(buf);
long i = 42; 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 && (i = strtol(buf+pl, &endp, 10))>=0 && i<num &&
(endp - buf) == l) (endp - buf) == l)
marks[i] = true; marks[i] = true;
@ -189,15 +189,15 @@ vmsaveResult writeSaveGame(const char *gamename, const char *data, int size,
{ {
vmsaveResult r, res = VMSAVE_NOVM; vmsaveResult r, res = VMSAVE_NOVM;
if(lastvm >= 0 && if (lastvm >= 0 &&
(res = trySave(gamename, data, size, filename, icon, lastvm)) == VMSAVE_OK) (res = trySave(gamename, data, size, filename, icon, lastvm)) == VMSAVE_OK)
return res; return res;
for(int i=0; i<24; i++) for (int i=0; i<24; i++)
if((r = trySave(gamename, data, size, filename, icon, i)) == VMSAVE_OK) { if ((r = trySave(gamename, data, size, filename, icon, i)) == VMSAVE_OK) {
lastvm = i; lastvm = i;
return r; return r;
} else if(r > res) } else if (r > res)
res = r; res = r;
return res; 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) bool readSaveGame(char *&buffer, int &size, const char *filename)
{ {
if(lastvm >= 0 && if (lastvm >= 0 &&
tryLoad(buffer, size, filename, lastvm)) tryLoad(buffer, size, filename, lastvm))
return true; return true;
for(int i=0; i<24; i++) for (int i=0; i<24; i++)
if(tryLoad(buffer, size, filename, i)) { if (tryLoad(buffer, size, filename, i)) {
lastvm = i; lastvm = i;
return true; return true;
} }
@ -235,7 +235,7 @@ public:
~InVMSave() ~InVMSave()
{ {
if(buffer != NULL) if (buffer != NULL)
delete[] buffer; delete[] buffer;
} }
@ -248,11 +248,11 @@ public:
void tryUncompress() void tryUncompress()
{ {
if(_size > 0 && buffer[0] != 'S') { if (_size > 0 && buffer[0] != 'S') {
// Data does not start with "SCVM". Maybe compressed? // Data does not start with "SCVM". Maybe compressed?
char *expbuf = new char[MAX_SAVE_SIZE]; char *expbuf = new char[MAX_SAVE_SIZE];
unsigned long destlen = 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; delete[] buffer;
buffer = expbuf; buffer = expbuf;
_size = destlen; _size = destlen;
@ -294,7 +294,7 @@ public:
virtual Common::InSaveFile *openForLoading(const char *filename) { virtual Common::InSaveFile *openForLoading(const char *filename) {
InVMSave *s = new InVMSave(); InVMSave *s = new InVMSave();
if(s->readSaveGame(filename)) { if (s->readSaveGame(filename)) {
s->tryUncompress(); s->tryUncompress();
return s; return s;
} else { } else {
@ -311,26 +311,26 @@ void OutVMSave::finalize()
extern const char *gGameName; extern const char *gGameName;
extern Icon icon; extern Icon icon;
if(committed >= pos) if (committed >= pos)
return; return;
char *data = buffer, *compbuf = NULL; char *data = buffer, *compbuf = NULL;
int len = pos; int len = pos;
if(pos) { if (pos) {
// Try compression // Try compression
compbuf = new char[pos]; compbuf = new char[pos];
unsigned long destlen = pos; unsigned long destlen = pos;
if(!compress((Bytef*)compbuf, &destlen, (Bytef*)buffer, pos)) { if (!compress((Bytef*)compbuf, &destlen, (Bytef*)buffer, pos)) {
data = compbuf; data = compbuf;
len = destlen; len = destlen;
} }
} }
vmsaveResult r = writeSaveGame(gGameName, data, len, filename, icon); vmsaveResult r = writeSaveGame(gGameName, data, len, filename, icon);
committed = pos; committed = pos;
if(compbuf != NULL) if (compbuf != NULL)
delete[] compbuf; delete[] compbuf;
if(r != VMSAVE_OK) if (r != VMSAVE_OK)
iofailed = true; iofailed = true;
displaySaveResult(r); displaySaveResult(r);
} }
@ -375,9 +375,9 @@ void InVMSave::seek(int32 offs, int whence)
_pos = _size + offs; _pos = _size + offs;
break; break;
} }
if(_pos < 0) if (_pos < 0)
_pos = 0; _pos = 0;
else if(_pos > _size) else if (_pos > _size)
_pos = _size; _pos = _size;
} }
@ -399,7 +399,7 @@ void VMSaveManager::listSavefiles(const char *prefix, bool *marks, int num)
{ {
memset(marks, false, num*sizeof(bool)); 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); tryList(prefix, marks, num, i);
} }

View file

@ -483,7 +483,7 @@ void InterruptTimer3() {
IPC->battery = batt; IPC->battery = batt;
IPC->aux = aux; IPC->aux = aux;
for(u32 i=0; i<sizeof(ct); i++) { for (u32 i=0; i<sizeof(ct); i++) {
IPC->curtime[i] = ct[i]; IPC->curtime[i] = ct[i];
} }
@ -527,7 +527,7 @@ void arm7_synctoarm9() { // send fifo message
// interrupt handler to allow incoming notifications from arm9 // interrupt handler to allow incoming notifications from arm9
void arm7_fifo() { // check incoming fifo messages void arm7_fifo() { // check incoming fifo messages
u32 msg = REG_IPC_FIFO_RX; u32 msg = REG_IPC_FIFO_RX;
if(msg==0x87654321) Wifi_Sync(); if (msg==0x87654321) Wifi_Sync();
} }
@ -543,13 +543,13 @@ void initDebugger() {
// sync with arm9 and init wifi // sync with arm9 and init wifi
u32 fifo_temp; u32 fifo_temp;
while(1) { // wait for magic number while (1) { // wait for magic number
while(REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank(); while (REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank();
fifo_temp=REG_IPC_FIFO_RX; fifo_temp=REG_IPC_FIFO_RX;
if(fifo_temp==0x12345678) break; if (fifo_temp==0x12345678) break;
} }
while(REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank(); while (REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank();
fifo_temp=REG_IPC_FIFO_RX; // give next value to wifi_init fifo_temp=REG_IPC_FIFO_RX; // give next value to wifi_init
Wifi_Init(fifo_temp); Wifi_Init(fifo_temp);

View file

@ -148,7 +148,7 @@ void ComputeDivBy5TableIFN()
return; return;
isDivBy5Ready = true; isDivBy5Ready = true;
for(int i=0; i<160; ++i) for (int i=0; i<160; ++i)
{ {
DIV_BY_5[i] = (2*i+5)/10; DIV_BY_5[i] = (2*i+5)/10;
} }
@ -311,7 +311,7 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const
{ {
ComputeDivBy5TableIFN(); ComputeDivBy5TableIFN();
for(size_t i=0; i<64; ++i) for (size_t i=0; i<64; ++i)
{ {
u32 s0 = palette[src[5*i+0]]; u32 s0 = palette[src[5*i+0]];
u32 s1 = palette[src[5*i+1]]; u32 s1 = palette[src[5*i+1]];
@ -325,7 +325,7 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const
#else #else
static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u16* palette) static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u16* palette)
{ {
for(size_t i=0; i<64; ++i) for (size_t i=0; i<64; ++i)
{ {
u16 s0 = palette[src[5*i+0]]; u16 s0 = palette[src[5*i+0]];
u16 s1 = palette[src[5*i+1]]; u16 s1 = palette[src[5*i+1]];
@ -344,7 +344,7 @@ static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16* dest, const
{ {
ComputeDivBy5TableIFN(); ComputeDivBy5TableIFN();
for(size_t i=0; i<64; ++i) for (size_t i=0; i<64; ++i)
{ {
u16 s0 = src[5*i+0]; u16 s0 = src[5*i+0];
u16 s1 = src[5*i+1]; u16 s1 = src[5*i+1];
@ -362,7 +362,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* p
u32 fastRam[768]; u32 fastRam[768];
// Palette lookup -> 0_888 // Palette lookup -> 0_888
for(size_t i=0; i<256; ++i) for (size_t i=0; i<256; ++i)
{ {
u32 col = palette[i]; u32 col = palette[i];
u32 result = col & 0x0000001F; u32 result = col & 0x0000001F;
@ -372,7 +372,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* p
fastRam[i] = result; fastRam[i] = result;
} }
for(size_t i=0; i<200; ++i) for (size_t i=0; i<200; ++i)
{ {
Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam); Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
} }
@ -381,10 +381,10 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* p
void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* palette, int destStride, int srcStride) void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* palette, int destStride, int srcStride)
{ {
u16 fastRam[256]; u16 fastRam[256];
for(size_t i=0; i<128; ++i) for (size_t i=0; i<128; ++i)
((u32*)fastRam)[i] = ((const u32*)palette)[i]; ((u32*)fastRam)[i] = ((const u32*)palette)[i];
for(size_t i=0; i<200; ++i) for (size_t i=0; i<200; ++i)
{ {
Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam); Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
} }
@ -393,7 +393,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* p
void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride) void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride)
{ {
for(size_t i=0; i<200; ++i) for (size_t i=0; i<200; ++i)
{ {
Rescale_320x1555Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride); Rescale_320x1555Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride);
} }

View file

@ -105,7 +105,7 @@ inline static unsigned int _LZ_StringCompare( unsigned char * str1,
{ {
unsigned int len; unsigned int len;
for( len = minlen; (len < maxlen) && (str1[len] == str2[len]); ++ len ); for ( len = minlen; (len < maxlen) && (str1[len] == str2[len]); ++ len );
return len; return len;
} }
@ -123,18 +123,18 @@ inline static int _LZ_WriteVarSize( unsigned int x, unsigned char * buf )
/* Determine number of bytes needed to store the number x */ /* Determine number of bytes needed to store the number x */
y = x >> 3; y = x >> 3;
for( num_bytes = 5; num_bytes >= 2; -- num_bytes ) for ( num_bytes = 5; num_bytes >= 2; -- num_bytes )
{ {
if( y & 0xfe000000 ) break; if ( y & 0xfe000000 ) break;
y <<= 7; y <<= 7;
} }
/* Write all bytes, seven bits in each, with 8:th bit set for all */ /* Write all bytes, seven bits in each, with 8:th bit set for all */
/* but the last byte. */ /* but the last byte. */
for( i = num_bytes-1; i >= 0; -- i ) for ( i = num_bytes-1; i >= 0; -- i )
{ {
b = (x >> (i*7)) & 0x0000007f; b = (x >> (i*7)) & 0x0000007f;
if( i > 0 ) if ( i > 0 )
{ {
b |= 0x00000080; b |= 0x00000080;
} }
@ -164,7 +164,7 @@ inline static int _LZ_ReadVarSize( unsigned int * x, unsigned char * buf )
y = (y << 7) | (b & 0x0000007f); y = (y << 7) | (b & 0x0000007f);
++ num_bytes; ++ num_bytes;
} }
while( b & 0x00000080 ); while ( b & 0x00000080 );
/* Store value in x */ /* Store value in x */
*x = y; *x = y;
@ -200,26 +200,26 @@ int LZ_Compress( unsigned char *in, unsigned char *out,
unsigned char *ptr1, *ptr2; unsigned char *ptr1, *ptr2;
/* Do we have anything to compress? */ /* Do we have anything to compress? */
if( insize < 1 ) if ( insize < 1 )
{ {
return 0; return 0;
} }
/* Create histogram */ /* Create histogram */
for( i = 0; i < 256; ++ i ) for ( i = 0; i < 256; ++ i )
{ {
histogram[ i ] = 0; histogram[ i ] = 0;
} }
for( i = 0; i < insize; ++ i ) for ( i = 0; i < insize; ++ i )
{ {
++ histogram[ in[ i ] ]; ++ histogram[ in[ i ] ];
} }
/* Find the least common byte, and use it as the code marker */ /* Find the least common byte, and use it as the code marker */
marker = 0; marker = 0;
for( i = 1; i < 256; ++ i ) for ( i = 1; i < 256; ++ i )
{ {
if( histogram[ i ] < histogram[ marker ] ) if ( histogram[ i ] < histogram[ marker ] )
{ {
marker = i; marker = i;
} }
@ -237,7 +237,7 @@ int LZ_Compress( unsigned char *in, unsigned char *out,
do do
{ {
/* Determine most distant position */ /* Determine most distant position */
if( inpos > LZ_MAX_OFFSET ) maxoffset = LZ_MAX_OFFSET; if ( inpos > LZ_MAX_OFFSET ) maxoffset = LZ_MAX_OFFSET;
else maxoffset = inpos; else maxoffset = inpos;
/* Get pointer to current position */ /* Get pointer to current position */
@ -246,13 +246,13 @@ int LZ_Compress( unsigned char *in, unsigned char *out,
/* Search history window for maximum length string match */ /* Search history window for maximum length string match */
bestlength = 3; bestlength = 3;
bestoffset = 0; bestoffset = 0;
for( offset = 3; offset <= maxoffset; ++ offset ) for ( offset = 3; offset <= maxoffset; ++ offset )
{ {
/* Get pointer to candidate string */ /* Get pointer to candidate string */
ptr2 = &ptr1[ -offset ]; ptr2 = &ptr1[ -offset ];
/* Quickly determine if this is a candidate (for speed) */ /* Quickly determine if this is a candidate (for speed) */
if( (ptr1[ 0 ] == ptr2[ 0 ]) && if ( (ptr1[ 0 ] == ptr2[ 0 ]) &&
(ptr1[ bestlength ] == ptr2[ bestlength ]) ) (ptr1[ bestlength ] == ptr2[ bestlength ]) )
{ {
/* Determine maximum length for this offset */ /* Determine maximum length for this offset */
@ -262,7 +262,7 @@ int LZ_Compress( unsigned char *in, unsigned char *out,
length = _LZ_StringCompare( ptr1, ptr2, 0, maxlength ); length = _LZ_StringCompare( ptr1, ptr2, 0, maxlength );
/* Better match than any previous match? */ /* Better match than any previous match? */
if( length > bestlength ) if ( length > bestlength )
{ {
bestlength = length; bestlength = length;
bestoffset = offset; bestoffset = offset;
@ -271,7 +271,7 @@ int LZ_Compress( unsigned char *in, unsigned char *out,
} }
/* Was there a good enough match? */ /* Was there a good enough match? */
if( (bestlength >= 8) || if ( (bestlength >= 8) ||
((bestlength == 4) && (bestoffset <= 0x0000007f)) || ((bestlength == 4) && (bestoffset <= 0x0000007f)) ||
((bestlength == 5) && (bestoffset <= 0x00003fff)) || ((bestlength == 5) && (bestoffset <= 0x00003fff)) ||
((bestlength == 6) && (bestoffset <= 0x001fffff)) || ((bestlength == 6) && (bestoffset <= 0x001fffff)) ||
@ -288,19 +288,19 @@ int LZ_Compress( unsigned char *in, unsigned char *out,
/* Output single byte (or two bytes if marker byte) */ /* Output single byte (or two bytes if marker byte) */
symbol = in[ inpos ++ ]; symbol = in[ inpos ++ ];
out[ outpos ++ ] = symbol; out[ outpos ++ ] = symbol;
if( symbol == marker ) if ( symbol == marker )
{ {
out[ outpos ++ ] = 0; out[ outpos ++ ] = 0;
} }
-- bytesleft; -- bytesleft;
} }
} }
while( bytesleft > 3 ); while ( bytesleft > 3 );
/* Dump remaining bytes, if any */ /* Dump remaining bytes, if any */
while( inpos < insize ) while ( inpos < insize )
{ {
if( in[ inpos ] == marker ) if ( in[ inpos ] == marker )
{ {
out[ outpos ++ ] = marker; out[ outpos ++ ] = marker;
out[ outpos ++ ] = 0; out[ outpos ++ ] = 0;
@ -338,7 +338,7 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out,
unsigned char *ptr1, *ptr2; unsigned char *ptr1, *ptr2;
/* Do we have anything to compress? */ /* Do we have anything to compress? */
if( insize < 1 ) if ( insize < 1 )
{ {
return 0; return 0;
} }
@ -353,11 +353,11 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out,
in[i+1] == in[jumptable[i]+1]. Following the jump table gives a in[i+1] == in[jumptable[i]+1]. Following the jump table gives a
dramatic boost for the string search'n'match loop compared to doing dramatic boost for the string search'n'match loop compared to doing
a brute force search. */ a brute force search. */
for( i = 0; i < 65536; ++ i ) for ( i = 0; i < 65536; ++ i )
{ {
lastindex[ i ] = 0xffffffff; lastindex[ i ] = 0xffffffff;
} }
for( i = 0; i < insize-1; ++ i ) for ( i = 0; i < insize-1; ++ i )
{ {
symbols = (((unsigned int)in[i]) << 8) | ((unsigned int)in[i+1]); symbols = (((unsigned int)in[i]) << 8) | ((unsigned int)in[i+1]);
index = lastindex[ symbols ]; index = lastindex[ symbols ];
@ -367,20 +367,20 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out,
jumptable[ insize-1 ] = 0xffffffff; jumptable[ insize-1 ] = 0xffffffff;
/* Create histogram */ /* Create histogram */
for( i = 0; i < 256; ++ i ) for ( i = 0; i < 256; ++ i )
{ {
histogram[ i ] = 0; histogram[ i ] = 0;
} }
for( i = 0; i < insize; ++ i ) for ( i = 0; i < insize; ++ i )
{ {
++ histogram[ in[ i ] ]; ++ histogram[ in[ i ] ];
} }
/* Find the least common byte, and use it as the code marker */ /* Find the least common byte, and use it as the code marker */
marker = 0; marker = 0;
for( i = 1; i < 256; ++ i ) for ( i = 1; i < 256; ++ i )
{ {
if( histogram[ i ] < histogram[ marker ] ) if ( histogram[ i ] < histogram[ marker ] )
{ {
marker = i; marker = i;
} }
@ -404,13 +404,13 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out,
bestlength = 3; bestlength = 3;
bestoffset = 0; bestoffset = 0;
index = jumptable[ inpos ]; index = jumptable[ inpos ];
while( index != 0xffffffff ) while ( index != 0xffffffff )
{ {
/* Get pointer to candidate string */ /* Get pointer to candidate string */
ptr2 = &in[ index ]; ptr2 = &in[ index ];
/* Quickly determine if this is a candidate (for speed) */ /* Quickly determine if this is a candidate (for speed) */
if( ptr2[ bestlength ] == ptr1[ bestlength ] ) if ( ptr2[ bestlength ] == ptr1[ bestlength ] )
{ {
/* Determine maximum length for this offset */ /* Determine maximum length for this offset */
offset = inpos - index; offset = inpos - index;
@ -420,7 +420,7 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out,
length = _LZ_StringCompare( ptr1, ptr2, 2, maxlength ); length = _LZ_StringCompare( ptr1, ptr2, 2, maxlength );
/* Better match than any previous match? */ /* Better match than any previous match? */
if( length > bestlength ) if ( length > bestlength )
{ {
bestlength = length; bestlength = length;
bestoffset = offset; bestoffset = offset;
@ -432,7 +432,7 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out,
} }
/* Was there a good enough match? */ /* Was there a good enough match? */
if( (bestlength >= 8) || if ( (bestlength >= 8) ||
((bestlength == 4) && (bestoffset <= 0x0000007f)) || ((bestlength == 4) && (bestoffset <= 0x0000007f)) ||
((bestlength == 5) && (bestoffset <= 0x00003fff)) || ((bestlength == 5) && (bestoffset <= 0x00003fff)) ||
((bestlength == 6) && (bestoffset <= 0x001fffff)) || ((bestlength == 6) && (bestoffset <= 0x001fffff)) ||
@ -449,19 +449,19 @@ int LZ_CompressFast( unsigned char *in, unsigned char *out,
/* Output single byte (or two bytes if marker byte) */ /* Output single byte (or two bytes if marker byte) */
symbol = in[ inpos ++ ]; symbol = in[ inpos ++ ];
out[ outpos ++ ] = symbol; out[ outpos ++ ] = symbol;
if( symbol == marker ) if ( symbol == marker )
{ {
out[ outpos ++ ] = 0; out[ outpos ++ ] = 0;
} }
-- bytesleft; -- bytesleft;
} }
} }
while( bytesleft > 3 ); while ( bytesleft > 3 );
/* Dump remaining bytes, if any */ /* Dump remaining bytes, if any */
while( inpos < insize ) while ( inpos < insize )
{ {
if( in[ inpos ] == marker ) if ( in[ inpos ] == marker )
{ {
out[ outpos ++ ] = marker; out[ outpos ++ ] = marker;
out[ outpos ++ ] = 0; out[ outpos ++ ] = 0;
@ -492,7 +492,7 @@ void LZ_Uncompress( unsigned char *in, unsigned char *out,
unsigned int i, inpos, outpos, length, offset; unsigned int i, inpos, outpos, length, offset;
/* Do we have anything to compress? */ /* Do we have anything to compress? */
if( insize < 1 ) if ( insize < 1 )
{ {
return; return;
} }
@ -506,10 +506,10 @@ void LZ_Uncompress( unsigned char *in, unsigned char *out,
do do
{ {
symbol = in[ inpos ++ ]; symbol = in[ inpos ++ ];
if( symbol == marker ) if ( symbol == marker )
{ {
/* We had a marker byte */ /* We had a marker byte */
if( in[ inpos ] == 0 ) if ( in[ inpos ] == 0 )
{ {
/* It was a single occurrence of the marker byte */ /* It was a single occurrence of the marker byte */
out[ outpos ++ ] = marker; out[ outpos ++ ] = marker;
@ -522,7 +522,7 @@ void LZ_Uncompress( unsigned char *in, unsigned char *out,
inpos += _LZ_ReadVarSize( &offset, &in[ inpos ] ); inpos += _LZ_ReadVarSize( &offset, &in[ inpos ] );
/* Copy corresponding data from history window */ /* Copy corresponding data from history window */
for( i = 0; i < length; ++ i ) for ( i = 0; i < length; ++ i )
{ {
out[ outpos ] = out[ outpos - offset ]; out[ outpos ] = out[ outpos - offset ];
++ outpos; ++ outpos;
@ -535,5 +535,5 @@ void LZ_Uncompress( unsigned char *in, unsigned char *out,
out[ outpos ++ ] = symbol; out[ outpos ++ ] = symbol;
} }
} }
while( inpos < insize ); while ( inpos < insize );
} }

View file

@ -305,14 +305,14 @@ int getGameHeight() {
} }
void initSprites() { void initSprites() {
for(int i = 0; i < 128; i++) { for (int i = 0; i < 128; i++) {
sprites[i].attribute[0] = ATTR0_DISABLED; sprites[i].attribute[0] = ATTR0_DISABLED;
sprites[i].attribute[1] = 0; sprites[i].attribute[1] = 0;
sprites[i].attribute[2] = 0; sprites[i].attribute[2] = 0;
sprites[i].attribute[3] = 0; sprites[i].attribute[3] = 0;
} }
for(int i = 0; i < 128; i++) { for (int i = 0; i < 128; i++) {
spritesMain[i].attribute[0] = ATTR0_DISABLED; spritesMain[i].attribute[0] = ATTR0_DISABLED;
spritesMain[i].attribute[1] = 0; spritesMain[i].attribute[1] = 0;
spritesMain[i].attribute[2] = 0; spritesMain[i].attribute[2] = 0;

View file

@ -183,17 +183,17 @@ void OSystem_GP2X::moveStick() {
memcpy(stickBtn, _stickBtn, sizeof(stickBtn)); memcpy(stickBtn, _stickBtn, sizeof(stickBtn));
if((stickBtn[0])||(stickBtn[2])||(stickBtn[4])||(stickBtn[6])) if ((stickBtn[0])||(stickBtn[2])||(stickBtn[4])||(stickBtn[6]))
stickBtn[1] = stickBtn[3] = stickBtn[5] = stickBtn[7] = 0; stickBtn[1] = stickBtn[3] = stickBtn[5] = stickBtn[7] = 0;
if((stickBtn[1])||(stickBtn[2])||(stickBtn[3])){ if ((stickBtn[1])||(stickBtn[2])||(stickBtn[3])){
if(_km.x_down_count!=2){ if (_km.x_down_count!=2){
_km.x_vel = -1; _km.x_vel = -1;
_km.x_down_count = 1; _km.x_down_count = 1;
}else }else
_km.x_vel = -4; _km.x_vel = -4;
} else if((stickBtn[5])||(stickBtn[6])||(stickBtn[7])){ } else if ((stickBtn[5])||(stickBtn[6])||(stickBtn[7])){
if(_km.x_down_count!=2){ if (_km.x_down_count!=2){
_km.x_vel = 1; _km.x_vel = 1;
_km.x_down_count = 1; _km.x_down_count = 1;
}else }else
@ -205,14 +205,14 @@ void OSystem_GP2X::moveStick() {
} }
if((stickBtn[0])||(stickBtn[1])||(stickBtn[7])){ if ((stickBtn[0])||(stickBtn[1])||(stickBtn[7])){
if(_km.y_down_count!=2){ if (_km.y_down_count!=2){
_km.y_vel = -1; _km.y_vel = -1;
_km.y_down_count = 1; _km.y_down_count = 1;
}else }else
_km.y_vel = -4; _km.y_vel = -4;
} else if((stickBtn[3])||(stickBtn[4])||(stickBtn[5])){ } else if ((stickBtn[3])||(stickBtn[4])||(stickBtn[5])){
if(_km.y_down_count!=2){ if (_km.y_down_count!=2){
_km.y_vel = 1; _km.y_vel = 1;
_km.y_down_count = 1; _km.y_down_count = 1;
}else }else
@ -302,7 +302,7 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) {
GP2X_BUTTON_L & GP2X_BUTTON_A Common::EVENT_PREDICTIVE_DIALOG for predictive text entry box (AGI games) GP2X_BUTTON_L & GP2X_BUTTON_A Common::EVENT_PREDICTIVE_DIALOG for predictive text entry box (AGI games)
*/ */
while(SDL_PollEvent(&ev)) { while (SDL_PollEvent(&ev)) {
switch(ev.type) { switch(ev.type) {
case SDL_KEYDOWN:{ case SDL_KEYDOWN:{

View file

@ -63,18 +63,18 @@ static volatile unsigned short *MEM_REG;
void GP2X_device_init() { void GP2X_device_init() {
// Open devices // Open devices
if(!gp2x_dev[0]) gp2x_dev[0] = open("/dev/mixer", O_RDWR); if (!gp2x_dev[0]) gp2x_dev[0] = open("/dev/mixer", O_RDWR);
if(!gp2x_dev[1]) gp2x_dev[1] = open("/dev/batt", O_RDONLY); if (!gp2x_dev[1]) gp2x_dev[1] = open("/dev/batt", O_RDONLY);
if(!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR); if (!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR);
} }
void GP2X_device_deinit() { void GP2X_device_deinit() {
// Close devices // Close devices
{ {
int i; int i;
for(i=0;i<8;i++) for (i=0;i<8;i++)
{ {
if(gp2x_dev[i]) if (gp2x_dev[i])
{ {
close(gp2x_dev[i]); close(gp2x_dev[i]);
} }
@ -211,7 +211,7 @@ void Disable_940(void)
void gp2x_video_wait_vsync(void) void gp2x_video_wait_vsync(void)
{ {
MEM_REG[0x2846>>1]=(MEM_REG[0x2846>>1] | 0x20) & ~2; MEM_REG[0x2846>>1]=(MEM_REG[0x2846>>1] | 0x20) & ~2;
while(!(MEM_REG[0x2846>>1] & 2)); while (!(MEM_REG[0x2846>>1] & 2));
} }
//char GP2X_get_battery_level() { //char GP2X_get_battery_level() {

View file

@ -215,7 +215,7 @@ void WaitACK()
bool bBreak = false; bool bBreak = false;
int iResult; int iResult;
while(!bBreak) { while (!bBreak) {
iResult = g_Comm.comm_recv((unsigned char *)g_SendBuffer, 0x100); iResult = g_Comm.comm_recv((unsigned char *)g_SendBuffer, 0x100);
if (iResult > 0) { if (iResult > 0) {
bBreak = true; bBreak = true;
@ -234,7 +234,7 @@ void SendCommand(unsigned char *pCommand)
g_SendBuffer[iOffset++] = '$'; g_SendBuffer[iOffset++] = '$';
iCheckSum = 0; iCheckSum = 0;
while(*pCommand != 0) { while (*pCommand != 0) {
g_SendBuffer[iOffset++] = *pCommand; g_SendBuffer[iOffset++] = *pCommand;
iCheckSum += *pCommand++; iCheckSum += *pCommand++;
} }
@ -285,7 +285,7 @@ void SendCommandSize(unsigned char *pCommand, int iSize)
g_SendBuffer[iOffset++] = '$'; g_SendBuffer[iOffset++] = '$';
iCheckSum = 0; iCheckSum = 0;
while(*pCommand != 0) { while (*pCommand != 0) {
g_SendBuffer[iOffset++] = *pCommand; g_SendBuffer[iOffset++] = *pCommand;
iCheckSum += *pCommand++; iCheckSum += *pCommand++;
} }
@ -340,7 +340,7 @@ void HexToStringBW(char *pString, int iNumber)
// equiv to strcat i imagine // equiv to strcat i imagine
void PrintToString(char *pString, char *pOtherString) void PrintToString(char *pString, char *pOtherString)
{ {
while(*pOtherString != 0) { while (*pOtherString != 0) {
*pString = *pOtherString; *pString = *pOtherString;
*pString++; *pString++;
*pOtherString++; *pOtherString++;
@ -644,7 +644,7 @@ void WriteMemory(void *pAddr, unsigned int uiBytes, char *pHexString)
uiOffset += 2; uiOffset += 2;
} }
/* /*
while(1); while (1);
unsigned int *piData = (unsigned int *)pAddr; unsigned int *piData = (unsigned int *)pAddr;
*piData = 0xe7ffdefe;//0xfedeffe7; *piData = 0xe7ffdefe;//0xfedeffe7;
*/ */
@ -696,7 +696,7 @@ int FindChar(char *pBuffer, char sign)
{ {
int iRetVal = 0; int iRetVal = 0;
while(*pBuffer != sign) { while (*pBuffer != sign) {
iRetVal++; iRetVal++;
*pBuffer++; *pBuffer++;
} }
@ -830,7 +830,7 @@ void ISR()
break; break;
case MODE_DUNNO: case MODE_DUNNO:
default: default:
while(1); while (1);
} }
*/ */
SendBreakPoint(); SendBreakPoint();
@ -928,7 +928,7 @@ void ISR()
case MODE_DUNNO: case MODE_DUNNO:
default: default:
//Printf("Dunno!!\n"); //Printf("Dunno!!\n");
while(1); while (1);
} }
@ -1035,13 +1035,13 @@ void BreakPoint()
Printf("Restore: 0x%x", g_SavedStepInstruction); Printf("Restore: 0x%x", g_SavedStepInstruction);
#endif #endif
} else { } else {
while(1); while (1);
} }
g_LastWasStep = false; g_LastWasStep = false;
} }
while(!bBreakLoop) { while (!bBreakLoop) {
iResult = RecvUSB(g_ReadBuffer, 0x100); iResult = RecvUSB(g_ReadBuffer, 0x100);
//Printf("%d\n", iResult); //Printf("%d\n", iResult);
@ -1061,7 +1061,7 @@ void BreakPoint()
// I can see that i get a bunch of '+' and '-' in the messages.. lets remove them. // I can see that i get a bunch of '+' and '-' in the messages.. lets remove them.
iOffsetAdd = 4; iOffsetAdd = 4;
while((g_ReadBuffer[iOffsetAdd] == '+') || (g_ReadBuffer[iOffsetAdd] == '-')) iOffsetAdd++; while ((g_ReadBuffer[iOffsetAdd] == '+') || (g_ReadBuffer[iOffsetAdd] == '-')) iOffsetAdd++;
// Check whether it's legimit command // Check whether it's legimit command
if (g_ReadBuffer[iOffsetAdd] == '$') { if (g_ReadBuffer[iOffsetAdd] == '$') {
@ -1608,7 +1608,7 @@ unsigned int ROR(unsigned int uiValue, unsigned int uiSteps)
{ {
unsigned int uiRetval; unsigned int uiRetval;
while(uiSteps-- > 0) { while (uiSteps-- > 0) {
if (uiValue & 0x01) { if (uiValue & 0x01) {
uiValue = (uiValue >> 1) | 0x80000000; uiValue = (uiValue >> 1) | 0x80000000;
} else { } else {

View file

@ -195,7 +195,7 @@ bool gp_pumpButtonEvent() {
bool gp_pollButtonEvent(GP32BtnEvent *ev) { bool gp_pollButtonEvent(GP32BtnEvent *ev) {
gp_pumpButtonEvent(); gp_pumpButtonEvent();
if(eventQueue.isEmpty()) { if (eventQueue.isEmpty()) {
return false; return false;
} }

View file

@ -114,7 +114,7 @@ void *MemBlock::addBlock(size_t size)
} }
blk++; blk++;
} }
if(i == NUM_BLOCK) { if (i == NUM_BLOCK) {
blk = &block[0]; blk = &block[0];
for (i = 0; i < prevBlock; i++) { for (i = 0; i < prevBlock; i++) {
if (!blk->used) { if (!blk->used) {
@ -122,7 +122,7 @@ void *MemBlock::addBlock(size_t size)
} }
blk++; blk++;
} }
if(i == prevBlock) { if (i == prevBlock) {
prevBlock = 0; prevBlock = 0;
return gm_malloc(size); return gm_malloc(size);
} }
@ -289,7 +289,7 @@ void *operator new(size_t size) {
void *ptr = gp_malloc(size); void *ptr = gp_malloc(size);
#if defined(CLEAN_MEMORY_WITH_0xE7) #if defined(CLEAN_MEMORY_WITH_0xE7)
if(ptr != NULL) { if (ptr != NULL) {
gp_memset(ptr, 0xE7, size); gp_memset(ptr, 0xE7, size);
} }
#endif #endif

View file

@ -235,13 +235,13 @@ void OSystem_PSP::updateScreen() {
} }
} }
if(_overlayVisible) { if (_overlayVisible) {
for (int i = 0; i < _screenHeight; ++i) { for (int i = 0; i < _screenHeight; ++i) {
for (int j = 0; j < _screenWidth; ++j) { for (int j = 0; j < _screenWidth; ++j) {
OverlayColor pixel = _overlayBuffer[(i * _overlayWidth +j)]; OverlayColor pixel = _overlayBuffer[(i * _overlayWidth +j)];
if(pixel & 0x8000) if (pixel & 0x8000)
putPixel(xStart + j, yStart + i, pixel); putPixel(xStart + j, yStart + i, pixel);
} }
} }
@ -362,7 +362,7 @@ void OSystem_PSP::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) { OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
OverlayColor color = RGBToColor(r, g, b); OverlayColor color = RGBToColor(r, g, b);
if(a == 255) if (a == 255)
color |= 0x8000; color |= 0x8000;
return color; return color;
@ -370,7 +370,7 @@ OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
void OSystem_PSP::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) { void OSystem_PSP::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) {
colorToRGB(color, r, g, b); colorToRGB(color, r, g, b);
if(color & 0x8000) if (color & 0x8000)
a = 255; a = 255;
else else
a = 0; a = 0;
@ -530,7 +530,7 @@ bool OSystem_PSP::pollEvent(Common::Event &event) {
if (newX < 0) newX = 0; if (newX < 0) newX = 0;
if (newY < 0) newY = 0; if (newY < 0) newY = 0;
if(_overlayVisible) if (_overlayVisible)
{ {
if (newX >= _overlayWidth) newX = _overlayWidth - 1; if (newX >= _overlayWidth) newX = _overlayWidth - 1;
if (newY >= _overlayHeight) newY = _overlayHeight - 1; if (newY >= _overlayHeight) newY = _overlayHeight - 1;

View file

@ -149,7 +149,7 @@ void OSystem_PSP_GU::initSize(uint width, uint height) {
_kbdClut[0] = 0xffff; _kbdClut[0] = 0xffff;
_kbdClut[246] = 0x4ccc; _kbdClut[246] = 0x4ccc;
_kbdClut[247] = 0x0000; _kbdClut[247] = 0x0000;
for(int i=1;i<31;i++) for (int i=1;i<31;i++)
_kbdClut[i] = 0xf888; _kbdClut[i] = 0xf888;
_mouseVisible = false; _mouseVisible = false;
sceKernelDcacheWritebackAll(); sceKernelDcacheWritebackAll();
@ -167,8 +167,8 @@ bool OSystem_PSP_GU::setGraphicsMode(int mode) {
bool OSystem_PSP_GU::setGraphicsMode(const char *name) { bool OSystem_PSP_GU::setGraphicsMode(const char *name) {
int i = 0; int i = 0;
while(s_supportedGraphicsModes[i].name) { while (s_supportedGraphicsModes[i].name) {
if(!strcmpi(s_supportedGraphicsModes[i].name, name)) { if (!strcmpi(s_supportedGraphicsModes[i].name, name)) {
_graphicMode = s_supportedGraphicsModes[i].id; _graphicMode = s_supportedGraphicsModes[i].id;
return true; return true;
} }
@ -196,7 +196,7 @@ void OSystem_PSP_GU::setMouseCursor(const byte *buf, uint w, uint h, int hotspot
mouseClut[_mouseKeyColour] = 0; mouseClut[_mouseKeyColour] = 0;
sceKernelDcacheWritebackAll(); sceKernelDcacheWritebackAll();
for(unsigned int i=0;i<h;i++) for (unsigned int i=0;i<h;i++)
memcpy(_mouseBuf+i*MOUSE_SIZE, buf+i*w, w); memcpy(_mouseBuf+i*MOUSE_SIZE, buf+i*w, w);
} }
@ -277,7 +277,7 @@ void OSystem_PSP_GU::updateScreen() {
sceGuClutMode(GU_PSM_5551, 0, 0xff, 0); sceGuClutMode(GU_PSM_5551, 0, 0xff, 0);
sceGuClutLoad(32, clut256); // upload 32*8 entries (256) sceGuClutLoad(32, clut256); // upload 32*8 entries (256)
sceGuTexMode(GU_PSM_T8, 0, 0, 0); // 8-bit image sceGuTexMode(GU_PSM_T8, 0, 0, 0); // 8-bit image
if(_screenWidth == 320) if (_screenWidth == 320)
sceGuTexImage(0, 512, 256, _screenWidth, _offscreen); sceGuTexImage(0, 512, 256, _screenWidth, _offscreen);
else else
sceGuTexImage(0, 512, 512, _screenWidth, _offscreen); sceGuTexImage(0, 512, 512, _screenWidth, _offscreen);
@ -315,7 +315,7 @@ void OSystem_PSP_GU::updateScreen() {
} }
sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices); sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
if(_screenWidth == 640) { if (_screenWidth == 640) {
sceGuTexImage(0, 512, 512, _screenWidth, _offscreen+512); sceGuTexImage(0, 512, 512, _screenWidth, _offscreen+512);
vertices[0].u = 512 + 0.5; vertices[1].v = _screenHeight - 0.5; vertices[0].u = 512 + 0.5; vertices[1].v = _screenHeight - 0.5;
vertices[0].x += (vertices[1].x - vertices[0].x) * 511 / 640; vertices[0].y = 0; vertices[0].z = 0; vertices[0].x += (vertices[1].x - vertices[0].x) * 511 / 640; vertices[0].y = 0; vertices[0].z = 0;
@ -324,7 +324,7 @@ void OSystem_PSP_GU::updateScreen() {
// draw overlay // draw overlay
if(_overlayVisible) { if (_overlayVisible) {
vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0; vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0;
vertices[1].x = PSP_SCREEN_WIDTH; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0; vertices[1].x = PSP_SCREEN_WIDTH; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0;
vertices[0].u = 0.5; vertices[0].v = 0.5; vertices[0].u = 0.5; vertices[0].v = 0.5;
@ -340,7 +340,7 @@ void OSystem_PSP_GU::updateScreen() {
sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices); sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices);
// need to render twice for textures > 512 // need to render twice for textures > 512
if( _overlayWidth > 512) { if ( _overlayWidth > 512) {
sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer + 512); sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer + 512);
vertices[0].u = 512 + 0.5; vertices[1].v = _overlayHeight - 0.5; vertices[0].u = 512 + 0.5; vertices[1].v = _overlayHeight - 0.5;
vertices[0].x = PSP_SCREEN_WIDTH * 512 / 640; vertices[0].y = 0; vertices[0].z = 0; vertices[0].x = PSP_SCREEN_WIDTH * 512 / 640; vertices[0].y = 0; vertices[0].z = 0;
@ -365,7 +365,7 @@ void OSystem_PSP_GU::updateScreen() {
int mX = _mouseX - _mouseHotspotX; int mX = _mouseX - _mouseHotspotX;
int mY = _mouseY - _mouseHotspotY; int mY = _mouseY - _mouseHotspotY;
if(_overlayVisible) { if (_overlayVisible) {
float scalex, scaley; float scalex, scaley;
scalex = (float)PSP_SCREEN_WIDTH /_overlayWidth; scalex = (float)PSP_SCREEN_WIDTH /_overlayWidth;
@ -417,7 +417,7 @@ void OSystem_PSP_GU::updateScreen() {
sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices); sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
} }
if(_keyboardVisible) { if (_keyboardVisible) {
sceGuTexMode(GU_PSM_T8, 0, 0, 0); // 8-bit image sceGuTexMode(GU_PSM_T8, 0, 0, 0); // 8-bit image
sceGuClutMode(GU_PSM_4444, 0, 0xff, 0); sceGuClutMode(GU_PSM_4444, 0, 0xff, 0);
sceGuClutLoad(32, kbClut); // upload 32*8 entries (256) sceGuClutLoad(32, kbClut); // upload 32*8 entries (256)
@ -469,13 +469,13 @@ bool OSystem_PSP_GU::pollEvent(Common::Event &event) {
uint32 buttonsChanged = pad.Buttons ^ _prevButtons; uint32 buttonsChanged = pad.Buttons ^ _prevButtons;
if ((buttonsChanged & PSP_CTRL_SELECT) || (pad.Buttons & PSP_CTRL_SELECT)) { if ((buttonsChanged & PSP_CTRL_SELECT) || (pad.Buttons & PSP_CTRL_SELECT)) {
if( !(pad.Buttons & PSP_CTRL_SELECT) ) if ( !(pad.Buttons & PSP_CTRL_SELECT) )
_keyboardVisible = !_keyboardVisible; _keyboardVisible = !_keyboardVisible;
_prevButtons = pad.Buttons; _prevButtons = pad.Buttons;
return false; return false;
} }
if(!_keyboardVisible) if (!_keyboardVisible)
return OSystem_PSP::pollEvent(event); return OSystem_PSP::pollEvent(event);
if ( (buttonsChanged & PSP_CTRL_RTRIGGER) && !(pad.Buttons & PSP_CTRL_RTRIGGER)) if ( (buttonsChanged & PSP_CTRL_RTRIGGER) && !(pad.Buttons & PSP_CTRL_RTRIGGER))
@ -520,17 +520,17 @@ bool OSystem_PSP_GU::pollEvent(Common::Event &event) {
x = pad.Lx-128; x = pad.Lx-128;
y = pad.Ly-128; y = pad.Ly-128;
_kbdClut[_keySelected] = 0xf888; _kbdClut[_keySelected] = 0xf888;
if(x*x + y*y > 10000) { if (x*x + y*y > 10000) {
nub_angle = atan2(y, x); nub_angle = atan2(y, x);
_keySelected = (int)(1 + (M_PI + nub_angle) * 30 / (2 * M_PI)); _keySelected = (int)(1 + (M_PI + nub_angle) * 30 / (2 * M_PI));
_keySelected -= 2; _keySelected -= 2;
if(_keySelected < 1) if (_keySelected < 1)
_keySelected += 30; _keySelected += 30;
_kbdClut[_keySelected] = 0xffff; _kbdClut[_keySelected] = 0xffff;
if (buttonsChanged & PSP_CTRL_CROSS) { if (buttonsChanged & PSP_CTRL_CROSS) {
event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP; event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
if(_keySelected > 26) { if (_keySelected > 26) {
event.kbd.flags = 0; event.kbd.flags = 0;
switch(_keySelected) { switch(_keySelected) {
case 27: case 27:
@ -570,7 +570,7 @@ bool OSystem_PSP_GU::pollEvent(Common::Event &event) {
} }
break; break;
case (SYMBOLS|CAPS_LOCK): case (SYMBOLS|CAPS_LOCK):
if(_keySelected < 21) { if (_keySelected < 21) {
event.kbd.flags = 0; event.kbd.flags = 0;
event.kbd.ascii = kbd_ascii_cl[_keySelected-1]; event.kbd.ascii = kbd_ascii_cl[_keySelected-1];
event.kbd.keycode = kbd_code_cl[ _keySelected-1]; event.kbd.keycode = kbd_code_cl[ _keySelected-1];

View file

@ -41,7 +41,7 @@ void PSPDebugTrace (const char *format, ...) {
fd = sceIoOpen("MS0:/DTRACE.TXT", PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777); fd = sceIoOpen("MS0:/DTRACE.TXT", PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777);
if(fd <= 0) if (fd <= 0)
{ {
return; return;
} }
@ -63,7 +63,7 @@ void PSPDebugTrace (const char * filename, const char *format, ...) {
fd = sceIoOpen(filename, PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777); fd = sceIoOpen(filename, PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777);
if(fd <= 0) if (fd <= 0)
{ {
return; return;
} }

View file

@ -55,7 +55,7 @@ CEikAppUi *CScummVMDoc::CreateAppUiL() {
} }
void CScummVMUi::HandleForegroundEventL(TBool aForeground) { void CScummVMUi::HandleForegroundEventL(TBool aForeground) {
if(aForeground) { if (aForeground) {
BringUpEmulatorL(); BringUpEmulatorL();
} }
} }
@ -64,7 +64,7 @@ CScummVMUi::CScummVMUi() {
} }
CScummVMUi::~CScummVMUi() { CScummVMUi::~CScummVMUi() {
if(iWatcher) { if (iWatcher) {
iThreadWatch.LogonCancel(iWatcher->iStatus); iThreadWatch.LogonCancel(iWatcher->iStatus);
iWatcher->Cancel(); iWatcher->Cancel();
} }
@ -109,10 +109,10 @@ void CScummVMUi::ConstructL() {
iExeWgId=exeTask.WgId(); iExeWgId=exeTask.WgId();
exeTask.BringToForeground(); exeTask.BringToForeground();
if(iExeWgId == myTask.WgId()) { // Should n't be the same if (iExeWgId == myTask.WgId()) { // Should n't be the same
Exit(); Exit();
} }
if(iThreadWatch.Open(iThreadId) == KErrNone) { if (iThreadWatch.Open(iThreadId) == KErrNone) {
iWatcher = new (ELeave)CScummWatcher; iWatcher = new (ELeave)CScummWatcher;
iWatcher->iAppUi = this; iWatcher->iAppUi = this;
iThreadWatch.Logon(iWatcher->iStatus); iThreadWatch.Logon(iWatcher->iStatus);
@ -139,7 +139,7 @@ void CScummWatcher::RunL() {
void CScummVMUi::BringUpEmulatorL() { void CScummVMUi::BringUpEmulatorL() {
RThread thread; RThread thread;
if(thread.Open(iThreadId) == KErrNone) { if (thread.Open(iThreadId) == KErrNone) {
thread.Close(); thread.Close();
TApaTask apaTask(iEikonEnv->WsSession()); TApaTask apaTask(iEikonEnv->WsSession());
apaTask.SetWgId(iExeWgId); apaTask.SetWgId(iExeWgId);
@ -155,7 +155,7 @@ void CScummVMUi::HandleCommandL(TInt aCommand) {
case EEikCmdExit: case EEikCmdExit:
{ {
RThread thread; RThread thread;
if(thread.Open(iThreadId) == KErrNone) { if (thread.Open(iThreadId) == KErrNone) {
thread.Terminate(0); thread.Terminate(0);
thread.Close(); thread.Close();
} }

View file

@ -351,7 +351,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) {
case GUI::ACTION_MULTI: { case GUI::ACTION_MULTI: {
GUI::Key &key = GUI::Actions::Instance()->getKeyAction(loop); GUI::Key &key = GUI::Actions::Instance()->getKeyAction(loop);
// if key code is pause, then change event to interactive or just fall through // if key code is pause, then change event to interactive or just fall through
if(key.keycode() == SDLK_PAUSE) { if (key.keycode() == SDLK_PAUSE) {
event.type = Common::EVENT_PREDICTIVE_DIALOG; event.type = Common::EVENT_PREDICTIVE_DIALOG;
return true; return true;
} }
@ -371,7 +371,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) {
// Translate from SDL keymod event to Scummvm Key Mod Common::Event. // Translate from SDL keymod event to Scummvm Key Mod Common::Event.
// This codes is also present in GP32 backend and in SDL backend as a static function // This codes is also present in GP32 backend and in SDL backend as a static function
// Perhaps it should be shared. // Perhaps it should be shared.
if(key.flags() != 0) { if (key.flags() != 0) {
event.kbd.flags = 0; event.kbd.flags = 0;
if (ev.key.keysym.mod & KMOD_SHIFT) if (ev.key.keysym.mod & KMOD_SHIFT)

View file

@ -57,12 +57,12 @@ int stat(const char *fname, struct stat *ss)
HANDLE handle; HANDLE handle;
int len; int len;
if(fname == NULL || ss == NULL) if (fname == NULL || ss == NULL)
return -1; return -1;
/* Special case (dummy on WinCE) */ /* Special case (dummy on WinCE) */
len = strlen(fname); len = strlen(fname);
if(len >= 2 && fname[len-1] == '.' && fname[len-2] == '.' && if (len >= 2 && fname[len-1] == '.' && fname[len-2] == '.' &&
(len == 2 || fname[len-3] == '\\')) (len == 2 || fname[len-3] == '\\'))
{ {
/* That's everything implemented so far */ /* That's everything implemented so far */
@ -74,14 +74,14 @@ int stat(const char *fname, struct stat *ss)
MultiByteToWideChar(CP_ACP, 0, fname, -1, fnameUnc, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, fname, -1, fnameUnc, MAX_PATH);
handle = FindFirstFile(fnameUnc, &wfd); handle = FindFirstFile(fnameUnc, &wfd);
if(handle == INVALID_HANDLE_VALUE) if (handle == INVALID_HANDLE_VALUE)
return -1; return -1;
else else
{ {
/* That's everything implemented so far */ /* That's everything implemented so far */
memset(ss, 0, sizeof(struct stat)); memset(ss, 0, sizeof(struct stat));
ss->st_size = wfd.nFileSizeLow; ss->st_size = wfd.nFileSizeLow;
if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
ss->st_mode |= S_IFDIR; ss->st_mode |= S_IFDIR;
FindClose(handle); FindClose(handle);
@ -98,7 +98,7 @@ EXT_C time_t time(time_t* res)
t = (time_t)(((((((st.wYear-1970)*12+st.wMonth)*31+st.wDay)*7+st.wDayOfWeek)*24+st.wHour)*60+st.wMinute)*60+st.wSecond); t = (time_t)(((((((st.wYear-1970)*12+st.wMonth)*31+st.wDay)*7+st.wDayOfWeek)*24+st.wHour)*60+st.wMinute)*60+st.wSecond);
if(res) if (res)
*res = t; *res = t;
return t; return t;
} }
@ -131,18 +131,18 @@ EXT_C char *getcwd(char *buffer, int maxlen)
TCHAR fileUnc[MAX_PATH+1]; TCHAR fileUnc[MAX_PATH+1];
char* plast; char* plast;
if(cwd[0] == 0) if (cwd[0] == 0)
{ {
GetModuleFileName(NULL, fileUnc, MAX_PATH); GetModuleFileName(NULL, fileUnc, MAX_PATH);
WideCharToMultiByte(CP_ACP, 0, fileUnc, -1, cwd, MAX_PATH, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, fileUnc, -1, cwd, MAX_PATH, NULL, NULL);
plast = strrchr(cwd, '\\'); plast = strrchr(cwd, '\\');
if(plast) if (plast)
*plast = 0; *plast = 0;
/* Special trick to keep start menu clean... */ /* Special trick to keep start menu clean... */
if(_stricmp(cwd, "\\windows\\start menu") == 0) if (_stricmp(cwd, "\\windows\\start menu") == 0)
strcpy(cwd, "\\Apps"); strcpy(cwd, "\\Apps");
} }
if(buffer) if (buffer)
strncpy(buffer, cwd, maxlen); strncpy(buffer, cwd, maxlen);
return cwd; return cwd;
} }
@ -165,9 +165,9 @@ EXT_C FILE *wce_fopen(const char* fname, const char* fmode)
{ {
char fullname[MAX_PATH+1]; char fullname[MAX_PATH+1];
if(!fname || fname[0] == '\0') if (!fname || fname[0] == '\0')
return NULL; return NULL;
if(fname[0] != '\\' && fname[0] != '/') if (fname[0] != '\\' && fname[0] != '/')
{ {
getcwd(fullname, MAX_PATH); getcwd(fullname, MAX_PATH);
strncat(fullname, "\\", MAX_PATH-strlen(fullname)-1); strncat(fullname, "\\", MAX_PATH-strlen(fullname)-1);
@ -190,11 +190,11 @@ DIR* opendir(const char* fname)
TCHAR fnameUnc[MAX_PATH+1]; TCHAR fnameUnc[MAX_PATH+1];
char nameFound[MAX_PATH+1]; char nameFound[MAX_PATH+1];
if(fname == NULL) if (fname == NULL)
return NULL; return NULL;
strcpy(fnameMask, fname); strcpy(fnameMask, fname);
if(!strlen(fnameMask) || fnameMask[strlen(fnameMask)-1] != '\\') if (!strlen(fnameMask) || fnameMask[strlen(fnameMask)-1] != '\\')
strncat(fnameMask, "\\", MAX_PATH-strlen(fnameMask)-1); strncat(fnameMask, "\\", MAX_PATH-strlen(fnameMask)-1);
strncat(fnameMask, "*.*", MAX_PATH-strlen(fnameMask)-4); strncat(fnameMask, "*.*", MAX_PATH-strlen(fnameMask)-4);
@ -209,7 +209,7 @@ DIR* opendir(const char* fname)
strcpy(pdir->dd_name, fname); /* it has exactly enough space for fname and nul char */ strcpy(pdir->dd_name, fname); /* it has exactly enough space for fname and nul char */
MultiByteToWideChar(CP_ACP, 0, fnameMask, -1, fnameUnc, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, fnameMask, -1, fnameUnc, MAX_PATH);
if((pdir->dd_handle = (long)FindFirstFile(fnameUnc, &wfd)) == (long)INVALID_HANDLE_VALUE) if ((pdir->dd_handle = (long)FindFirstFile(fnameUnc, &wfd)) == (long)INVALID_HANDLE_VALUE)
{ {
free(pdir); free(pdir);
return NULL; return NULL;
@ -229,35 +229,35 @@ struct dirent* readdir(DIR* dir)
char nameFound[MAX_PATH+1]; char nameFound[MAX_PATH+1];
static struct dirent dummy; static struct dirent dummy;
if(dir->dd_stat == 0) if (dir->dd_stat == 0)
{ {
dummy.d_name = "."; dummy.d_name = ".";
dummy.d_namlen = 1; dummy.d_namlen = 1;
dir->dd_stat ++; dir->dd_stat ++;
return &dummy; return &dummy;
} }
else if(dir->dd_stat == 1) else if (dir->dd_stat == 1)
{ {
dummy.d_name = ".."; dummy.d_name = "..";
dummy.d_namlen = 2; dummy.d_namlen = 2;
dir->dd_stat ++; dir->dd_stat ++;
return &dummy; return &dummy;
} }
else if(dir->dd_stat == 2) else if (dir->dd_stat == 2)
{ {
dir->dd_stat++; dir->dd_stat++;
return &dir->dd_dir; return &dir->dd_dir;
} }
else else
{ {
if(FindNextFile((HANDLE)dir->dd_handle, &wfd) == 0) if (FindNextFile((HANDLE)dir->dd_handle, &wfd) == 0)
{ {
dir->dd_stat = -1; dir->dd_stat = -1;
return NULL; return NULL;
} }
WideCharToMultiByte(CP_ACP, 0, wfd.cFileName, -1, nameFound, MAX_PATH, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, wfd.cFileName, -1, nameFound, MAX_PATH, NULL, NULL);
if(dir->dd_dir.d_name) if (dir->dd_dir.d_name)
free(dir->dd_dir.d_name); free(dir->dd_dir.d_name);
dir->dd_dir.d_name = strdup(nameFound); dir->dd_dir.d_name = strdup(nameFound);
@ -271,13 +271,13 @@ struct dirent* readdir(DIR* dir)
int closedir(DIR* dir) int closedir(DIR* dir)
{ {
if(dir == NULL) if (dir == NULL)
return 0; return 0;
if(dir->dd_handle) if (dir->dd_handle)
FindClose((HANDLE)dir->dd_handle); FindClose((HANDLE)dir->dd_handle);
if(dir->dd_dir.d_name) if (dir->dd_dir.d_name)
free(dir->dd_dir.d_name); free(dir->dd_dir.d_name);
free(dir); free(dir);
return 1; return 1;
@ -304,12 +304,12 @@ void mkdir(char* dirname, int mode)
TCHAR pathUnc[MAX_PATH+1]; TCHAR pathUnc[MAX_PATH+1];
char* ptr; char* ptr;
strncpy(path, dirname, MAX_PATH); strncpy(path, dirname, MAX_PATH);
if(*path == '/') if (*path == '/')
*path = '\\'; *path = '\\';
/* Run through the string and attempt creating all subdirs on the path */ /* Run through the string and attempt creating all subdirs on the path */
for(ptr = path+1; *ptr; ptr ++) for (ptr = path+1; *ptr; ptr ++)
{ {
if(*ptr == '\\' || *ptr == '/') if (*ptr == '\\' || *ptr == '/')
{ {
*ptr = 0; *ptr = 0;
MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH);
@ -333,7 +333,7 @@ char *tmpnam(char *string)
GetTempFileName(TEXT("."), TEXT("A8_"), 0, pTemp); GetTempFileName(TEXT("."), TEXT("A8_"), 0, pTemp);
WideCharToMultiByte(CP_ACP, 0, pTemp, -1, buffer, MAX_PATH, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, pTemp, -1, buffer, MAX_PATH, NULL, NULL);
if(string) if (string)
{ {
strcpy(string, buffer); strcpy(string, buffer);
return string; return string;
@ -345,7 +345,7 @@ char *tmpnam(char *string)
FILE *tmpfile() FILE *tmpfile()
{ {
TCHAR pTemp[MAX_PATH+1]; TCHAR pTemp[MAX_PATH+1];
if(!GetTempFileName(TEXT("."), TEXT("A8_"), 0, pTemp)) if (!GetTempFileName(TEXT("."), TEXT("A8_"), 0, pTemp))
return _wfopen(pTemp, TEXT("w+b")); return _wfopen(pTemp, TEXT("w+b"));
else else
return 0; return 0;
@ -374,7 +374,7 @@ char *strdup(const char *strSource)
{ {
char* buffer; char* buffer;
buffer = (char*)malloc(strlen(strSource)+1); buffer = (char*)malloc(strlen(strSource)+1);
if(buffer) if (buffer)
strcpy(buffer, strSource); strcpy(buffer, strSource);
return buffer; return buffer;
} }
@ -390,7 +390,7 @@ void gettimeofday(struct timeval* tp, void* dummy)
void usleep(long usec) void usleep(long usec)
{ {
long msec = usec/1000; long msec = usec/1000;
if(msec <= 0) if (msec <= 0)
Sleep(0); Sleep(0);
else else
Sleep(msec); Sleep(msec);
@ -417,7 +417,7 @@ at least allows some projects to work.
char* getenv(char* name) char* getenv(char* name)
{ {
static char buffer[MAX_PATH+1]; static char buffer[MAX_PATH+1];
if(strcmp(name, "HOME") == 0 || strcmp(name, "HOMEDIR") == 0) if (strcmp(name, "HOME") == 0 || strcmp(name, "HOMEDIR") == 0)
{ {
getcwd(buffer, MAX_PATH); getcwd(buffer, MAX_PATH);
return buffer; return buffer;

View file

@ -172,7 +172,7 @@ int SDL_main(int argc, char **argv) {
extern void (*__CTOR_LIST__)() ; extern void (*__CTOR_LIST__)() ;
void (**constructor)() = &__CTOR_LIST__ ; void (**constructor)() = &__CTOR_LIST__ ;
constructor++ ; constructor++ ;
while(*constructor) { while (*constructor) {
(*constructor)() ; (*constructor)() ;
constructor++ ; constructor++ ;
} }
@ -2141,7 +2141,7 @@ bool OSystem_WINCE3::pollEvent(Common::Event &event) {
currentTime = GetTickCount(); currentTime = GetTickCount();
while(SDL_PollEvent(&ev)) { while (SDL_PollEvent(&ev)) {
switch(ev.type) { switch(ev.type) {
case SDL_KEYDOWN: case SDL_KEYDOWN:
debug(1, "Key down %X %s", ev.key.keysym.sym, SDL_GetKeyName((SDLKey)ev.key.keysym.sym)); debug(1, "Key down %X %s", ev.key.keysym.sym, SDL_GetKeyName((SDLKey)ev.key.keysym.sym));

View file

@ -69,7 +69,7 @@ public:
assert(header == 0x1F8B || assert(header == 0x1F8B ||
((header & 0x0F00) == 0x0800 && header % 31 == 0)); ((header & 0x0F00) == 0x0800 && header % 31 == 0));
if(header == 0x1F8B) { if (header == 0x1F8B) {
// Retrieve the original file size // Retrieve the original file size
w->seek(-4, SEEK_END); w->seek(-4, SEEK_END);
_origSize = w->readUint32LE(); _origSize = w->readUint32LE();

View file

@ -388,9 +388,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
DO_OPTION('p', "path") DO_OPTION('p', "path")
FilesystemNode path(option); FilesystemNode path(option);
if(!path.exists()) { if (!path.exists()) {
usage("Non-existent game path '%s'", option); usage("Non-existent game path '%s'", option);
} else if(!path.isReadable()) { } else if (!path.isReadable()) {
usage("Non-readable game path '%s'", option); usage("Non-readable game path '%s'", option);
} }
END_OPTION END_OPTION
@ -431,9 +431,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
DO_LONG_OPTION("soundfont") DO_LONG_OPTION("soundfont")
FilesystemNode path(option); FilesystemNode path(option);
if(!path.exists()) { if (!path.exists()) {
usage("Non-existent soundfont path '%s'", option); usage("Non-existent soundfont path '%s'", option);
} else if(!path.isReadable()) { } else if (!path.isReadable()) {
usage("Non-readable soundfont path '%s'", option); usage("Non-readable soundfont path '%s'", option);
} }
END_OPTION END_OPTION
@ -461,9 +461,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
DO_LONG_OPTION("savepath") DO_LONG_OPTION("savepath")
FilesystemNode path(option); FilesystemNode path(option);
if(!path.exists()) { if (!path.exists()) {
usage("Non-existent savegames path '%s'", option); usage("Non-existent savegames path '%s'", option);
} else if(!path.isWritable()) { } else if (!path.isWritable()) {
usage("Non-writable savegames path '%s'", option); usage("Non-writable savegames path '%s'", option);
} }
END_OPTION END_OPTION
@ -479,9 +479,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
DO_LONG_OPTION("themepath") DO_LONG_OPTION("themepath")
FilesystemNode path(option); FilesystemNode path(option);
if(!path.exists()) { if (!path.exists()) {
usage("Non-existent theme path '%s'", option); usage("Non-existent theme path '%s'", option);
} else if(!path.isReadable()) { } else if (!path.isReadable()) {
usage("Non-readable theme path '%s'", option); usage("Non-readable theme path '%s'", option);
} }
END_OPTION END_OPTION
@ -691,9 +691,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings) {
const char *dir = getenv("SCUMMVM_SAVEPATH"); const char *dir = getenv("SCUMMVM_SAVEPATH");
if (dir && *dir && strlen(dir) < MAXPATHLEN) { if (dir && *dir && strlen(dir) < MAXPATHLEN) {
FilesystemNode saveDir(dir); FilesystemNode saveDir(dir);
if(!saveDir.exists()) { if (!saveDir.exists()) {
warning("Non-existent SCUMMVM_SAVEPATH save path. It will be ignored."); warning("Non-existent SCUMMVM_SAVEPATH save path. It will be ignored.");
} else if(!saveDir.isWritable()) { } else if (!saveDir.isWritable()) {
warning("Non-writable SCUMMVM_SAVEPATH save path. It will be ignored."); warning("Non-writable SCUMMVM_SAVEPATH save path. It will be ignored.");
} else { } else {
settings["savepath"] = dir; settings["savepath"] = dir;

View file

@ -411,9 +411,9 @@ bool File::open(const FilesystemNode &node, AccessMode mode) {
bool File::remove(const String &filename){ bool File::remove(const String &filename){
if (remove(filename.c_str()) != 0) { if (remove(filename.c_str()) != 0) {
if(errno == EACCES) if (errno == EACCES)
;//TODO: read-only file ;//TODO: read-only file
if(errno == ENOENT) if (errno == ENOENT)
;//TODO: non-existent file ;//TODO: non-existent file
return false; return false;
@ -424,9 +424,9 @@ bool File::remove(const String &filename){
bool File::remove(const FilesystemNode &node){ bool File::remove(const FilesystemNode &node){
if (remove(node.getPath()) != 0) { if (remove(node.getPath()) != 0) {
if(errno == EACCES) if (errno == EACCES)
;//TODO: read-only file ;//TODO: read-only file
if(errno == ENOENT) if (errno == ENOENT)
;//TODO: non-existent file ;//TODO: non-existent file
return false; return false;

View file

@ -47,7 +47,7 @@ static bool matchString(const char *str, const char *pat) {
if (p) { if (p) {
pat = p; pat = p;
str = ++q; str = ++q;
if(!*str) if (!*str)
return !*pat; return !*pat;
break; break;
} }
@ -56,7 +56,7 @@ static bool matchString(const char *str, const char *pat) {
} }
// fallthrough // fallthrough
case '?': case '?':
if(!*str) if (!*str)
return !*pat; return !*pat;
pat++; pat++;
str++; str++;

View file

@ -246,7 +246,7 @@ void md5_finish(md5_context *ctx, uint8 digest[16]) {
} }
bool md5_file(const FilesystemNode &file, uint8 digest[16], uint32 length) { bool md5_file(const FilesystemNode &file, uint8 digest[16], uint32 length) {
if(!file.exists()) { if (!file.exists()) {
warning("md5_file: using an inexistent FilesystemNode"); warning("md5_file: using an inexistent FilesystemNode");
return false; return false;
} else if (!file.isReadable()) { } else if (!file.isReadable()) {

View file

@ -994,7 +994,7 @@ cmd(version) {
/* insert our version into the other version */ /* insert our version into the other version */
len = strlen(verMsg); len = strlen(verMsg);
gap = r - q; gap = r - q;
if(gap < 0) if (gap < 0)
gap = 0; gap = 0;
else else
gap = (gap - len) / 2; gap = (gap - len) / 2;

View file

@ -99,7 +99,7 @@ void PictureMgr::drawLine(int x1, int y1, int x2, int y2) {
int i, x, y, deltaX, deltaY, stepX, stepY, errorX, errorY, detdelta; int i, x, y, deltaX, deltaY, stepX, stepY, errorX, errorY, detdelta;
/* CM: Do clipping */ /* CM: Do clipping */
#define clip(x, y) if((x)>=(y)) (x)=(y) #define clip(x, y) if ((x)>=(y)) (x)=(y)
clip(x1, _width - 1); clip(x1, _width - 1);
clip(x2, _width - 1); clip(x2, _width - 1);
clip(y1, _height - 1); clip(y1, _height - 1);

View file

@ -664,14 +664,14 @@ void Winnie::incMenuSel(int *iSel, int fCanSel[]) {
do { do {
*iSel += 1; *iSel += 1;
if (*iSel > IDI_WTP_SEL_DROP) *iSel = IDI_WTP_SEL_OPT_1; if (*iSel > IDI_WTP_SEL_DROP) *iSel = IDI_WTP_SEL_OPT_1;
} while(!fCanSel[*iSel]); } while (!fCanSel[*iSel]);
} }
void Winnie::decMenuSel(int *iSel, int fCanSel[]) { void Winnie::decMenuSel(int *iSel, int fCanSel[]) {
do { do {
*iSel -= 1; *iSel -= 1;
if (*iSel < IDI_WTP_SEL_OPT_1) *iSel = IDI_WTP_SEL_DROP; if (*iSel < IDI_WTP_SEL_OPT_1) *iSel = IDI_WTP_SEL_DROP;
} while(!fCanSel[*iSel]); } while (!fCanSel[*iSel]);
} }
void Winnie::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) { void Winnie::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) {
@ -1046,7 +1046,7 @@ bool Winnie::getSelOkBack() {
} }
void Winnie::clrMenuSel(int *iSel, int fCanSel[]) { void Winnie::clrMenuSel(int *iSel, int fCanSel[]) {
*iSel = IDI_WTP_SEL_OPT_1; *iSel = IDI_WTP_SEL_OPT_1;
while(!fCanSel[*iSel]) { while (!fCanSel[*iSel]) {
*iSel += 1; *iSel += 1;
} }
} }

View file

@ -969,7 +969,7 @@ int AGOSEngine::go() {
(getFeatures() & GF_DEMO)) { (getFeatures() & GF_DEMO)) {
int i; int i;
while(1) { while (1) {
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
setWindowImage(3, 9902 + i); setWindowImage(3, 9902 + i);
debug(0, "Displaying image %d", 9902 + i); debug(0, "Displaying image %d", 9902 + i);

View file

@ -410,7 +410,7 @@ Item *AGOSEngine::findInByClass(Item *i, int16 m) {
Item *AGOSEngine::nextInByClass(Item *i, int16 m) { Item *AGOSEngine::nextInByClass(Item *i, int16 m) {
i = _findNextPtr; i = _findNextPtr;
while(i) { while (i) {
if (i->classFlags & m) { if (i->classFlags & m) {
_findNextPtr = derefItem(i->next); _findNextPtr = derefItem(i->next);
return i; return i;

View file

@ -50,14 +50,14 @@ int AGOSEngine::countSaveGames() {
memset(marks, false, 256 * sizeof(bool)); //assume no savegames for this title memset(marks, false, 256 * sizeof(bool)); //assume no savegames for this title
filenames = _saveFileMan->listSavefiles(prefix); filenames = _saveFileMan->listSavefiles(prefix);
for(Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){ for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){
//Obtain the last 3 digits of the filename, since they correspond to the save slot //Obtain the last 3 digits of the filename, since they correspond to the save slot
slot[0] = file->c_str()[file->size()-3]; slot[0] = file->c_str()[file->size()-3];
slot[1] = file->c_str()[file->size()-2]; slot[1] = file->c_str()[file->size()-2];
slot[2] = file->c_str()[file->size()-1]; slot[2] = file->c_str()[file->size()-1];
slotNum = atoi(slot); slotNum = atoi(slot);
if(slotNum >= 0 && slotNum < 256) if (slotNum >= 0 && slotNum < 256)
marks[slotNum] = true; //mark this slot as valid marks[slotNum] = true; //mark this slot as valid
} }

View file

@ -93,7 +93,7 @@ int loadBackground(char *name, int idx) {
printf("Loading BG: %s\n", name); printf("Loading BG: %s\n", name);
if (!backgroundPtrtable[idx]) { if (!backgroundPtrtable[idx]) {
//if(!gfxModuleData.useEGA && !gfxModuleData.useVGA) //if (!gfxModuleData.useEGA && !gfxModuleData.useVGA)
{ {
backgroundPtrtable[idx] = backgroundPtrtable[idx] =
(uint8 *) mallocAndZero(320 * 200 /*64000 */ ); (uint8 *) mallocAndZero(320 * 200 /*64000 */ );
@ -174,7 +174,7 @@ int loadBackground(char *name, int idx) {
} }
} }
//if(ptrToFree != gfxModuleData.pPage10) //if (ptrToFree != gfxModuleData.pPage10)
// free(ptrToFree); // free(ptrToFree);
if (gfxModuleData.useEGA || gfxModuleData.useTandy) { if (gfxModuleData.useEGA || gfxModuleData.useTandy) {

View file

@ -125,7 +125,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx,
(char *)filesDatabase[params.fileIdx].subData.ptr); (char *)filesDatabase[params.fileIdx].subData.ptr);
// ASSERT(0); // ASSERT(0);
} else { // poly } else { // poly
/* if(param4 == 1) /* if (param4 == 1)
* { * {
* int var_A; * int var_A;
* int var_8; * int var_8;

View file

@ -37,7 +37,7 @@ void resetPtr(cellStruct *ptr) {
void freeMessageList(cellStruct *objPtr) { void freeMessageList(cellStruct *objPtr) {
/* if (objPtr) { /* if (objPtr) {
if(objPtr->next) if (objPtr->next)
free(objPtr->next); free(objPtr->next);
free(objPtr); free(objPtr);

View file

@ -351,12 +351,12 @@ int loadFileSub1(uint8 **ptr, uint8 *name, uint8 *ptr2) {
if (!strcmp(buffer, ".SPL")) { if (!strcmp(buffer, ".SPL")) {
removeExtention((char *)name, buffer); removeExtention((char *)name, buffer);
// if(useH32) // if (useH32)
{ {
strcatuint8(buffer, ".H32"); strcatuint8(buffer, ".H32");
} }
/* else /* else
* if(useAdlib) * if (useAdlib)
* { * {
* strcatuint8(buffer,".ADL"); * strcatuint8(buffer,".ADL");
* } * }
@ -687,7 +687,7 @@ int getCursorFromObject(int mouseX, int mouseY, int *outX, int *outY) {
di += var_10; di += var_10;
} }
/* if((filesDatabase[di].subData.resourceType == 8) && (filesDatabase[di].subData.ptr)) { /* if ((filesDatabase[di].subData.resourceType == 8) && (filesDatabase[di].subData.ptr)) {
assert(0); assert(0);
} }
*/ */
@ -1045,7 +1045,7 @@ int processInput(void) {
int16 mouseY = 0; int16 mouseY = 0;
int16 button = 0; int16 button = 0;
/*if(inputSub1keyboad()) /*if (inputSub1keyboad())
* { * {
* return 1; * return 1;
* } */ * } */
@ -1327,7 +1327,7 @@ void mainLoop(void) {
// readKeyboard(); // readKeyboard();
playerDontAskQuit = processInput(); playerDontAskQuit = processInput();
//if(enableUser) //if (enableUser)
{ {
userEnabled = 1; userEnabled = 1;
enableUser = 0; enableUser = 0;
@ -1363,7 +1363,7 @@ void mainLoop(void) {
if (main5) if (main5)
fadeVar = 0; fadeVar = 0;
/*if(fadeVar) /*if (fadeVar)
* { * {
* // TODO! * // TODO!
* } */ * } */
@ -1371,11 +1371,11 @@ void mainLoop(void) {
mainDraw(0); mainDraw(0);
flipScreen(); flipScreen();
/* if(userEnabled && !main7 && !main15 && currentActiveMenu == -1) /* if (userEnabled && !main7 && !main15 && currentActiveMenu == -1)
* { * {
* getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY); * getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
* *
* if(mouseX != oldMouseX && mouseY != oldMouseY) * if (mouseX != oldMouseX && mouseY != oldMouseY)
* { * {
* int cursorType; * int cursorType;
* int newCursor1; * int newCursor1;
@ -1386,12 +1386,12 @@ void mainLoop(void) {
* *
* cursorType = getCursorFromObject(mouseX, mouseY, &newCursor1, &newCursor2); * cursorType = getCursorFromObject(mouseX, mouseY, &newCursor1, &newCursor2);
* *
* if(cursorType == 9) * if (cursorType == 9)
* { * {
* changeCursor(5); * changeCursor(5);
* } * }
* else * else
* if(cursorType == -1) * if (cursorType == -1)
* { * {
* changeCursor(6); * changeCursor(6);
* } * }
@ -1422,10 +1422,10 @@ void mainLoop(void) {
// t_end = t_start+SPEED; // t_end = t_start+SPEED;
// t_left=t_start-Osystem_GetTicks()+SPEED; // t_left=t_start-Osystem_GetTicks()+SPEED;
#ifndef FASTDEBUG #ifndef FASTDEBUG
/* if(t_left>0) /* if (t_left>0)
* if(t_left>SLEEP_MIN) * if (t_left>SLEEP_MIN)
* Osystem_Delay(t_left-SLEEP_GRAN); * Osystem_Delay(t_left-SLEEP_GRAN);
* while(Osystem_GetTicks()<t_end){q++;}; */ * while (Osystem_GetTicks()<t_end){q++;}; */
#endif #endif
manageEvents(4); manageEvents(4);

View file

@ -204,7 +204,7 @@ void loadCtpSub1(int boxIdx, int scale, uint16 *_walkboxTable,
var_E = 0; var_E = 0;
si = &polyBuffer3[1]; si = &polyBuffer3[1];
/* if(*si>=0) /* if (*si>=0)
* { * {
* di = si; * di = si;
* cx = var_12; * cx = var_12;
@ -217,12 +217,12 @@ void loadCtpSub1(int boxIdx, int scale, uint16 *_walkboxTable,
* di++; * di++;
* *
* var_2 = ax; * var_2 = ax;
* if(var_C < bx) * if (var_C < bx)
* { * {
* var_C = bx; * var_C = bx;
* } * }
* *
* if(var_2 < var_A) * if (var_2 < var_A)
* { * {
* var_A = var_2; * var_A = var_2;
* } * }
@ -232,7 +232,7 @@ void loadCtpSub1(int boxIdx, int scale, uint16 *_walkboxTable,
* *cx = var_2; * *cx = var_2;
* cx++; * cx++;
* var_E ++; * var_E ++;
* }while(di); * }while (di);
* *
* var_12 = cx; * var_12 = cx;
* } */ * } */

View file

@ -709,14 +709,14 @@ int decompCompare(void) {
addDecomp("sign(%s)", param); addDecomp("sign(%s)", param);
/* /*
if(!pop) if (!pop)
si = 1; si = 1;
if(pop<0) { if (pop<0) {
si |= 4; si |= 4;
} }
if(pop>0) { if (pop>0) {
si |= 2; si |= 2;
} }

View file

@ -863,7 +863,7 @@ int16 Op_SetColor(void) {
#define convertRatio 36.571428571428571428571428571429 #define convertRatio 36.571428571428571428571428571429
for(i=startIdx; i<=endIdx; i++) { for (i=startIdx; i<=endIdx; i++) {
R = (int)(colorR*convertRatio); R = (int)(colorR*convertRatio);
G = (int)(colorG*convertRatio); G = (int)(colorG*convertRatio);
B = (int)(colorB*convertRatio); B = (int)(colorB*convertRatio);

View file

@ -108,15 +108,15 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* ax = y; * ax = y;
* si = 0; * si = 0;
* *
* if(y>199) // out of screen vertically * if (y>199) // out of screen vertically
* return; * return;
* *
* if(y<0) // cropped on the top * if (y<0) // cropped on the top
* { * {
* cx = bx; * cx = bx;
* bx -= ax; * bx -= ax;
* dx -= bx; * dx -= bx;
* if(dx <= 0) * if (dx <= 0)
* { * {
* return; * return;
* } * }
@ -130,12 +130,12 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* ax += dx; * ax += dx;
* ax--; * ax--;
* *
* if(ax > di) * if (ax > di)
* { * {
* ax -= di; * ax -= di;
* dx -= ax; * dx -= ax;
* *
* if(dx <= 0) * if (dx <= 0)
* { * {
* return; * return;
* } * }
@ -170,7 +170,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* dx = ax; * dx = ax;
* ax = tempSwap; * ax = tempSwap;
* *
* if(ax > di) * if (ax > di)
* { * {
* return; * return;
* } * }
@ -183,12 +183,12 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* *
* dx = dx&0xFF; * dx = dx&0xFF;
* *
* if(cx<bx) * if (cx<bx)
* { * {
* return; * return;
* } * }
* *
* if(cx>di) * if (cx>di)
* { * {
* cx -= di; * cx -= di;
* cx >>= 3; * cx >>= 3;
@ -201,7 +201,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* di = 0xF8F8; * di = 0xF8F8;
* } * }
* *
* if(ax<bx) * if (ax<bx)
* { * {
* ax -= bx; * ax -= bx;
* ax = -ax; * ax = -ax;
@ -224,9 +224,9 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* *
* dx = loc_1064; * dx = loc_1064;
* *
* if(dx) * if (dx)
* { * {
* if(di&1) * if (di&1)
* { * {
* loc_10C5++; * loc_10C5++;
* } * }
@ -235,7 +235,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* ax--; * ax--;
* loc_11DC = ax; * loc_11DC = ax;
* *
* if(di&0x100) * if (di&0x100)
* { * {
* bx--; * bx--;
* } * }
@ -283,7 +283,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* bx = dx; * bx = dx;
* dx = 974; * dx = 974;
* *
* if(!bx) // no crop ? * if (!bx) // no crop ?
* { * {
* do // for each line * do // for each line
* { * {
@ -299,12 +299,12 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* *
* siPtr+=4; * siPtr+=4;
* diPtr++; * diPtr++;
* }while(--cx); * }while (--cx);
* *
* diPtr += loc_1147; // interline * diPtr += loc_1147; // interline
* siPtr += loc_114B; * siPtr += loc_114B;
* bp = bpSave; * bp = bpSave;
* }while(--bp); * }while (--bp);
* } * }
* else // croped * else // croped
* { * {
@ -326,7 +326,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* ax = bp; * ax = bp;
* loc_12E1 = ax; * loc_12E1 = ax;
* *
* if(loc_117C == 0xF8) * if (loc_117C == 0xF8)
* { * {
* direction = 1; * direction = 1;
* } * }
@ -335,7 +335,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* direction = -1; * direction = -1;
* } * }
* *
* if(direction == -1) * if (direction == -1)
* { * {
* goto label_11DC; * goto label_11DC;
* } * }
@ -358,7 +358,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* bx = (bx&0xFF00) | (ax&0xFF); * bx = (bx&0xFF00) | (ax&0xFF);
* ax = ((((((ax&0xFF00)>>8)&0xFF) | (ax&0xFF))<<8)&0xFF00) | (ax&0xFF); * ax = ((((((ax&0xFF00)>>8)&0xFF) | (ax&0xFF))<<8)&0xFF00) | (ax&0xFF);
* *
* if(ax) * if (ax)
* { * {
* bp = dx; * bp = dx;
* ax = (ax&0xFF00) | (*diPtr)&0xFF; * ax = (ax&0xFF00) | (*diPtr)&0xFF;
@ -375,7 +375,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* label_11DC: * label_11DC:
* *
* bp = loc_11DC; * bp = loc_11DC;
* if(bp >0) * if (bp >0)
* { * {
* do * do
* { * {
@ -413,7 +413,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* ax = (ax&0xFF00) | ((ax&0xFF) | bx&0xFF); * ax = (ax&0xFF00) | ((ax&0xFF) | bx&0xFF);
* ax = (ax&0xFF00) | ((ax&0xFF)<<8) | (ax&0xFF); * ax = (ax&0xFF00) | ((ax&0xFF)<<8) | (ax&0xFF);
* *
* if(ax) * if (ax)
* { * {
* cx = dx; * cx = dx;
* ax = (ax&0xFF00) | (*diPtr)&0xFF; * ax = (ax&0xFF00) | (*diPtr)&0xFF;
@ -427,10 +427,10 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* *
* siPtr += 4; * siPtr += 4;
* diPtr++; * diPtr++;
* }while(--bp); * }while (--bp);
* } * }
* *
* if(loc_122B == 0xF8) * if (loc_122B == 0xF8)
* { * {
* direction = 1; * direction = 1;
* } * }
@ -439,7 +439,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* direction = -1; * direction = -1;
* } * }
* *
* if(direction == -1) * if (direction == -1)
* { * {
* goto label_12D9; * goto label_12D9;
* } * }
@ -462,7 +462,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* bx = (bx&0xFF00) | (ax&0xFF); * bx = (bx&0xFF00) | (ax&0xFF);
* ax = ((((((ax&0xFF00)>>8)&0xFF) | (ax&0xFF))<<8)&0xFF00) | (ax&0xFF); * ax = ((((((ax&0xFF00)>>8)&0xFF) | (ax&0xFF))<<8)&0xFF00) | (ax&0xFF);
* *
* if(ax) * if (ax)
* { * {
* bp = dx; * bp = dx;
* ax = (ax&0xFF00) | (*diPtr)&0xFF; * ax = (ax&0xFF00) | (*diPtr)&0xFF;
@ -481,7 +481,7 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
* siPtr+=loc_12DD; * siPtr+=loc_12DD;
* bp = loc_12E1; * bp = loc_12E1;
* *
* }while(--bp); * }while (--bp);
* } */ * } */
{ {
@ -526,9 +526,9 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
int i; int i;
int j; int j;
for(i=x;i<height+x;i++) { for (i=x;i<height+x;i++) {
for(j=y;j<width*16+y;j++) { for (j=y;j<width*16+y;j++) {
if(i>=0&&i<200&&j>=0&&j<320) if (i>=0&&i<200&&j>=0&&j<320)
destPtr[i*320+j] = *(sourcePtr++); destPtr[i*320+j] = *(sourcePtr++);
} }
} }

View file

@ -930,7 +930,7 @@ void mainDraw(int16 param) {
if (newVal > currentObjPtr->animEnd) { if (newVal > currentObjPtr->animEnd) {
if (currentObjPtr->animLoop) { if (currentObjPtr->animLoop) {
newVal = currentObjPtr->animStart; newVal = currentObjPtr->animStart;
if(currentObjPtr->animLoop>0) if (currentObjPtr->animLoop>0)
currentObjPtr->animLoop--; currentObjPtr->animLoop--;
} else { } else {
int16 data2; int16 data2;
@ -950,7 +950,7 @@ void mainDraw(int16 param) {
} }
} else { } else {
ASSERT(0); ASSERT(0);
/* if(currentObjPtr->field_22>newVal) /* if (currentObjPtr->field_22>newVal)
* { * {
* } */ * } */
} }

View file

@ -221,7 +221,7 @@ int playerMenu(int menuX, int menuY) {
freeStuff2(); freeStuff2();
} }
/* /*
if(currentMenu) { if (currentMenu) {
freeMenu(currentMenu); freeMenu(currentMenu);
currentMenu = 0; currentMenu = 0;
var37 = 0; var37 = 0;
@ -229,7 +229,7 @@ int playerMenu(int menuX, int menuY) {
main9 = -1; main9 = -1;
} }
if(inventoryMenu) { if (inventoryMenu) {
freeMenu(inventoryMenu); freeMenu(inventoryMenu);
inventoryMenu = 0; inventoryMenu = 0;
var37 = 0; var37 = 0;
@ -237,7 +237,7 @@ int playerMenu(int menuX, int menuY) {
main9 = -1; main9 = -1;
}*/ }*/
/* if(mouseVar2) { /* if (mouseVar2) {
free3(mouseVar2); free3(mouseVar2);
} */ } */

View file

@ -40,11 +40,11 @@ void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton,
*pMouseButton = 0; *pMouseButton = 0;
/* /*
if(localStatus.left) if (localStatus.left)
*pMouseButton |= 1; *pMouseButton |= 1;
if(localStatus.right) if (localStatus.right)
*pMouseButton |= 2; *pMouseButton |= 2;
if(localStatus.middle) if (localStatus.middle)
*pMouseButton |= 4; *pMouseButton |= 4;
*/ */
} }

View file

@ -272,7 +272,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->data3Table) { if (!ovlData->data3Table) {
/* releaseScript(scriptIdx,scriptName); /* releaseScript(scriptIdx,scriptName);
if(freeIsNeeded) { if (freeIsNeeded) {
freePtr(unpackedBuffer); freePtr(unpackedBuffer);
} */ } */
@ -295,7 +295,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ptr) { if (!ptr) {
/* releaseScript(scriptIdx,scriptName); /* releaseScript(scriptIdx,scriptName);
* *
* if(freeIsNeeded) * if (freeIsNeeded)
* { * {
* freePtr(unpackedBuffer); * freePtr(unpackedBuffer);
* } */ * } */
@ -344,7 +344,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ptr) { if (!ptr) {
/* releaseScript(scriptIdx,scriptName); /* releaseScript(scriptIdx,scriptName);
* *
* if(freeIsNeeded) * if (freeIsNeeded)
* { * {
* freePtr(unpackedBuffer); * freePtr(unpackedBuffer);
* } */ * } */
@ -375,7 +375,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->ptr8) { if (!ovlData->ptr8) {
/* releaseScript(scriptIdx,scriptName); /* releaseScript(scriptIdx,scriptName);
if(freeIsNeeded) { if (freeIsNeeded) {
freePtr(unpackedBuffer); freePtr(unpackedBuffer);
} */ } */
@ -395,7 +395,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->objDataTable) { if (!ovlData->objDataTable) {
/* releaseScript(scriptIdx,scriptName); /* releaseScript(scriptIdx,scriptName);
if(freeIsNeeded) { if (freeIsNeeded) {
freePtr(unpackedBuffer); freePtr(unpackedBuffer);
} */ } */
@ -455,7 +455,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->objData2WorkTable) { if (!ovlData->objData2WorkTable) {
/* releaseScript(scriptIdx,scriptName); /* releaseScript(scriptIdx,scriptName);
if(freeIsNeeded) { if (freeIsNeeded) {
freePtr(unpackedBuffer); freePtr(unpackedBuffer);
} */ } */
@ -471,7 +471,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->objData2SourceTable) { if (!ovlData->objData2SourceTable) {
/* releaseScript(scriptIdx,scriptName); /* releaseScript(scriptIdx,scriptName);
if(freeIsNeeded) { if (freeIsNeeded) {
freePtr(unpackedBuffer); freePtr(unpackedBuffer);
} */ } */
@ -497,7 +497,7 @@ int loadOverlay(const uint8 *scriptName) {
} }
} }
/* if(freeIsNeeded) { /* if (freeIsNeeded) {
freePtr(unpackedBuffer); freePtr(unpackedBuffer);
} */ } */
@ -571,7 +571,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->specialString1) { if (!ovlData->specialString1) {
/* releaseScript(scriptIdx,scriptName); /* releaseScript(scriptIdx,scriptName);
* *
* if(freeIsNeeded) * if (freeIsNeeded)
* { * {
* freePtr(unpackedBuffer); * freePtr(unpackedBuffer);
* } */ * } */
@ -596,7 +596,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->specialString2) { if (!ovlData->specialString2) {
/* releaseScript(scriptIdx,scriptName); /* releaseScript(scriptIdx,scriptName);
* *
* if(freeIsNeeded) * if (freeIsNeeded)
* { * {
* freePtr(unpackedBuffer); * freePtr(unpackedBuffer);
* } */ * } */
@ -622,7 +622,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->stringTable[i].string) { if (!ovlData->stringTable[i].string) {
/* releaseScript(scriptIdx,scriptName); /* releaseScript(scriptIdx,scriptName);
* *
* if(freeIsNeeded) * if (freeIsNeeded)
* { * {
* freePtr(unpackedBuffer); * freePtr(unpackedBuffer);
* } */ * } */
@ -696,12 +696,12 @@ int releaseOverlay(const char *name) {
if (!ovlDataPtr) if (!ovlDataPtr)
return -4; return -4;
/* /*
if(overlayTable[overlayIdx].var1E) { if (overlayTable[overlayIdx].var1E) {
free(overlayTable[overlayIdx].var1E); free(overlayTable[overlayIdx].var1E);
overlayTable[overlayIdx].var1E = NULL; overlayTable[overlayIdx].var1E = NULL;
} }
if(overlayTable[overlayIdx].var16) { if (overlayTable[overlayIdx].var16) {
free(overlayTable[overlayIdx].var16); free(overlayTable[overlayIdx].var16);
overlayTable[overlayIdx].var16 = NULL; overlayTable[overlayIdx].var16 = NULL;
} */ } */

View file

@ -183,7 +183,7 @@ void freeDisk(void) {
} }
/* TODO /* TODO
* if(PAL_fileHandle) * if (PAL_fileHandle)
* { * {
* freeAllDataPtr(); * freeAllDataPtr();
* } * }

View file

@ -1281,7 +1281,7 @@ void Vmd::deDPCM(byte *soundBuf, byte *dataBuf, int16 &init, uint32 n) {
int32 s = init; int32 s = init;
for (uint32 i = 0; i < n; i++) { for (uint32 i = 0; i < n; i++) {
if(dataBuf[i] & 0x80) if (dataBuf[i] & 0x80)
s -= _tableDPCM[dataBuf[i] & 0x7F]; s -= _tableDPCM[dataBuf[i] & 0x7F];
else else
s += _tableDPCM[dataBuf[i]]; s += _tableDPCM[dataBuf[i]];

View file

@ -735,7 +735,7 @@ bool Inter_v3::o3_getTotTextItemPart(OpFuncParams &params) {
_vm->_game->_totTextData->items[totTextItem].offset; _vm->_game->_totTextData->items[totTextItem].offset;
// Skip background rectangles // Skip background rectangles
while(((int16) READ_LE_UINT16(totData)) != -1) while (((int16) READ_LE_UINT16(totData)) != -1)
totData += 9; totData += 9;
totData += 2; totData += 2;

View file

@ -83,7 +83,7 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) {
_screen->loadBitmap(sequences[i].filename, 2, 2, _screen->_currentPalette); _screen->loadBitmap(sequences[i].filename, 2, 2, _screen->_currentPalette);
_screen->updateScreen(); _screen->updateScreen();
seqDelay = sequences[i].frameDelay * _tickLength; seqDelay = sequences[i].frameDelay * _tickLength;
} else if(sequences[i].type == 1) { } else if (sequences[i].type == 1) {
seq_loadWSA(0, sequences[i].filename, sequences[i].frameDelay); seq_loadWSA(0, sequences[i].filename, sequences[i].frameDelay);
seqDelay = sequences[i].duration * _tickLength; seqDelay = sequences[i].duration * _tickLength;
} }
@ -410,7 +410,7 @@ void KyraEngine_v2::seq_introOverviewOver1(int currentFrame) {
if (currentFrame == 2) if (currentFrame == 2)
seq_waitForChatsToFinish(); seq_waitForChatsToFinish();
else if(currentFrame == 3) else if (currentFrame == 3)
seq_playIntroChat(12); seq_playIntroChat(12);
} }
@ -419,7 +419,7 @@ void KyraEngine_v2::seq_introOverviewForest(int currentFrame) {
if (currentFrame == 11) { if (currentFrame == 11) {
seq_waitForChatsToFinish(); seq_waitForChatsToFinish();
} else if(currentFrame == 12) { } else if (currentFrame == 12) {
delay(25); delay(25);
seq_playIntroChat(2); // "...and tree by tree..." seq_playIntroChat(2); // "...and tree by tree..."
} }
@ -430,7 +430,7 @@ void KyraEngine_v2::seq_introOverviewDragon(int currentFrame) {
if (currentFrame == 3) if (currentFrame == 3)
seq_playIntroChat(3); // "Kyrandia ceases to exist!" seq_playIntroChat(3); // "Kyrandia ceases to exist!"
else if(currentFrame == 11) else if (currentFrame == 11)
seq_waitForChatsToFinish(); seq_waitForChatsToFinish();
} }

View file

@ -329,13 +329,13 @@ void QueenEngine::findGameStateDescriptions(char descriptions[100][32]) {
memset(marks, false, SAVESTATE_MAX_NUM * sizeof(bool)); //assume no savegames for this title memset(marks, false, SAVESTATE_MAX_NUM * sizeof(bool)); //assume no savegames for this title
filenames = _saveFileMan->listSavefiles(prefix); filenames = _saveFileMan->listSavefiles(prefix);
for(Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){ for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){
//Obtain the last 2 digits of the filename, since they correspond to the save slot //Obtain the last 2 digits of the filename, since they correspond to the save slot
slot[0] = file->c_str()[file->size()-2]; slot[0] = file->c_str()[file->size()-2];
slot[1] = file->c_str()[file->size()-1]; slot[1] = file->c_str()[file->size()-1];
slotNum = atoi(slot); slotNum = atoi(slot);
if(slotNum >= 0 && slotNum < SAVESTATE_MAX_NUM) if (slotNum >= 0 && slotNum < SAVESTATE_MAX_NUM)
marks[slotNum] = true; //mark this slot as valid marks[slotNum] = true; //mark this slot as valid
} }

View file

@ -533,7 +533,7 @@ void Actor::handleActions(int msec, bool setup) {
} }
} }
if(_vm->getGameType() == GType_ITE) if (_vm->getGameType() == GType_ITE)
speed = (ACTOR_LMULT * 2 * actor->_screenScale + 63) / 256; speed = (ACTOR_LMULT * 2 * actor->_screenScale + 63) / 256;
else else
speed = (ACTOR_SPEED * actor->_screenScale + 128) >> 8; speed = (ACTOR_SPEED * actor->_screenScale + 128) >> 8;
@ -541,7 +541,7 @@ void Actor::handleActions(int msec, bool setup) {
if (speed < 1) if (speed < 1)
speed = 1; speed = 1;
if(_vm->getGameType() == GType_IHNM) if (_vm->getGameType() == GType_IHNM)
speed = speed / 2; speed = speed / 2;
if ((actor->_actionDirection == kDirUp) || (actor->_actionDirection == kDirDown)) { if ((actor->_actionDirection == kDirUp) || (actor->_actionDirection == kDirDown)) {

View file

@ -128,13 +128,13 @@ void SagaEngine::fillSaveList() {
memset(_saveMarks, false, MAX_SAVES * sizeof(bool)); //assume no savegames for this title memset(_saveMarks, false, MAX_SAVES * sizeof(bool)); //assume no savegames for this title
filenames = _saveFileMan->listSavefiles(name); filenames = _saveFileMan->listSavefiles(name);
for(Common::StringList::iterator file = filenames.begin(); file != filenames.end(); file++){ for (Common::StringList::iterator file = filenames.begin(); file != filenames.end(); file++){
//Obtain the last 2 digits of the filename, since they correspond to the save slot //Obtain the last 2 digits of the filename, since they correspond to the save slot
slot[0] = file->c_str()[file->size()-2]; slot[0] = file->c_str()[file->size()-2];
slot[1] = file->c_str()[file->size()-1]; slot[1] = file->c_str()[file->size()-1];
slotNum = atoi(slot); slotNum = atoi(slot);
if(slotNum >= 0 && slotNum < MAX_SAVES) if (slotNum >= 0 && slotNum < MAX_SAVES)
_saveMarks[slotNum] = true; //mark this slot as valid _saveMarks[slotNum] = true; //mark this slot as valid
} }

View file

@ -397,13 +397,13 @@ void ScummEngine::listSavegames(bool *marks, int num) {
memset(marks, false, num * sizeof(bool)); //assume no savegames for this title memset(marks, false, num * sizeof(bool)); //assume no savegames for this title
filenames = _saveFileMan->listSavefiles(prefix); filenames = _saveFileMan->listSavefiles(prefix);
for(Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){ for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){
//Obtain the last 2 digits of the filename, since they correspond to the save slot //Obtain the last 2 digits of the filename, since they correspond to the save slot
slot[0] = file->c_str()[file->size()-2]; slot[0] = file->c_str()[file->size()-2];
slot[1] = file->c_str()[file->size()-1]; slot[1] = file->c_str()[file->size()-1];
slotNum = atoi(slot); slotNum = atoi(slot);
if(slotNum >= 0 && slotNum < num) if (slotNum >= 0 && slotNum < num)
marks[slotNum] = true; //mark this slot as valid marks[slotNum] = true; //mark this slot as valid
} }
} }

View file

@ -947,7 +947,7 @@ void ScummEngine_v5::loadVars() {
if (a == STRINGID_IQ_SERIES && b == STRINGID_IQ_SERIES) { if (a == STRINGID_IQ_SERIES && b == STRINGID_IQ_SERIES) {
// Zak256 loads the IQ script-slot but does not use it -> ignore it // Zak256 loads the IQ script-slot but does not use it -> ignore it
if(_game.id == GID_INDY3) { if (_game.id == GID_INDY3) {
loadIQPoints(); loadIQPoints();
} }
break; break;
@ -968,7 +968,7 @@ void ScummEngine_v5::loadVars() {
if (!ptr[pos]) if (!ptr[pos])
break; break;
// replace special characters // replace special characters
if(ptr[pos] >= 32 && ptr[pos] <= 122 && ptr[pos] != 64) if (ptr[pos] >= 32 && ptr[pos] <= 122 && ptr[pos] != 64)
slotContent[pos] = ptr[pos]; slotContent[pos] = ptr[pos];
else else
slotContent[pos] = '_'; slotContent[pos] = '_';

View file

@ -564,7 +564,7 @@ void ScummEngine::checkExecVerbs() {
// like F5 (=0x8005) or joystick buttons (mask 0xFE00, e.g. SELECT=0xFE40 for the save/load menu). // like F5 (=0x8005) or joystick buttons (mask 0xFE00, e.g. SELECT=0xFE40 for the save/load menu).
// Hence the distinction with (_mouseAndKeyboardStat < MBS_MAX_KEY) between mouse- and key-events is not applicable // Hence the distinction with (_mouseAndKeyboardStat < MBS_MAX_KEY) between mouse- and key-events is not applicable
// to this games, so we have to remap the special keys here. // to this games, so we have to remap the special keys here.
if(_mouseAndKeyboardStat == 319) { if (_mouseAndKeyboardStat == 319) {
_mouseAndKeyboardStat = 0x8005; _mouseAndKeyboardStat = 0x8005;
} }
} }

View file

@ -2358,7 +2358,7 @@ void ToucheEngine::removeConversationChoice(int16 num) {
for (int i = 0; i < NUM_CONVERSATION_CHOICES; ++i) { for (int i = 0; i < NUM_CONVERSATION_CHOICES; ++i) {
if (_conversationChoicesTable[i].num == num) { if (_conversationChoicesTable[i].num == num) {
_conversationChoicesUpdated = true; _conversationChoicesUpdated = true;
for(; i < NUM_CONVERSATION_CHOICES - 1; ++i) { for (; i < NUM_CONVERSATION_CHOICES - 1; ++i) {
_conversationChoicesTable[i].num = _conversationChoicesTable[i + 1].num; _conversationChoicesTable[i].num = _conversationChoicesTable[i + 1].num;
_conversationChoicesTable[i].msg = _conversationChoicesTable[i + 1].msg; _conversationChoicesTable[i].msg = _conversationChoicesTable[i + 1].msg;
} }

View file

@ -381,19 +381,19 @@ void ToucheEngine::handleOptions(int forceDisplay) {
memset(menuData.saveLoadMarks, false, 100 * sizeof(bool)); //assume no savegames for this title memset(menuData.saveLoadMarks, false, 100 * sizeof(bool)); //assume no savegames for this title
filenames = _saveFileMan->listSavefiles(gameStateFileName); filenames = _saveFileMan->listSavefiles(gameStateFileName);
for(Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){ for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){
//Obtain the last 1 or 2 digits of the filename, since they correspond to the save slot //Obtain the last 1 or 2 digits of the filename, since they correspond to the save slot
//This engine can save games either with one or two digits, hence the additional if statement //This engine can save games either with one or two digits, hence the additional if statement
slot[0] = file->c_str()[file->size()-2]; slot[0] = file->c_str()[file->size()-2];
slot[1] = file->c_str()[file->size()-1]; slot[1] = file->c_str()[file->size()-1];
if(!atoi(&slot[0])){ if (!atoi(&slot[0])){
slotNum = atoi(&slot[1]); slotNum = atoi(&slot[1]);
} else { } else {
slotNum = atoi(slot); slotNum = atoi(slot);
} }
if(slotNum >= 0 && slotNum < 100) if (slotNum >= 0 && slotNum < 100)
menuData.saveLoadMarks[slotNum] = true; //mark this slot as valid menuData.saveLoadMarks[slotNum] = true; //mark this slot as valid
} }

View file

@ -814,7 +814,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
if (browser.runModal() > 0) { if (browser.runModal() > 0) {
// User made his choice... // User made his choice...
FilesystemNode dir(browser.getResult()); FilesystemNode dir(browser.getResult());
if(dir.isWritable()) { if (dir.isWritable()) {
_savePath->setLabel(dir.getPath()); _savePath->setLabel(dir.getPath());
} else { } else {
MessageDialog error("The chosen directory cannot be written to. Please select another one."); MessageDialog error("The chosen directory cannot be written to. Please select another one.");

View file

@ -64,7 +64,7 @@ void processMainLists(FILE *inf, CptObj *destArr, uint16 *idList) {
memcpy(dest->data, resBuf, resPos * 2); memcpy(dest->data, resBuf, resPos * 2);
} else } else
break; break;
} while(1); } while (1);
free(resBuf); free(resBuf);
} }
@ -116,7 +116,7 @@ void processCpts(FILE *inf, CptObj *destArr) {
memcpy(dest->data, resBuf, resPos * 2); memcpy(dest->data, resBuf, resPos * 2);
} else } else
break; break;
} while(1); } while (1);
free(resBuf); free(resBuf);
} }
@ -158,7 +158,7 @@ void processTurntabs(FILE *inf, CptObj *destArr) {
memcpy(dest->data, resBuf, resPos * 2); memcpy(dest->data, resBuf, resPos * 2);
} else } else
break; break;
} while(1); } while (1);
free(resBuf); free(resBuf);
} }
@ -200,7 +200,7 @@ void processBins(FILE *inf, CptObj *destArr, char *typeName, char *objName, uint
memcpy(dest->data, resBuf, resPos * 2); memcpy(dest->data, resBuf, resPos * 2);
} else } else
break; break;
} while(1); } while (1);
free(resBuf); free(resBuf);
} }
@ -239,7 +239,7 @@ void processSymlinks(FILE *inf, CptObj *destArr, uint16 *baseLists) {
assert(isEndOfObject(line, "SYMLINK", fromId)); assert(isEndOfObject(line, "SYMLINK", fromId));
} else } else
break; break;
} while(1); } while (1);
} }
void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *sve) { void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *sve) {