Remove POSIX dup and access calls, and rename qword to fix compilation

with Cell SDK.
This commit is contained in:
Brandon Wright 2010-11-19 05:02:34 -06:00
parent 21cd874de1
commit 45ca5f3eb6
2 changed files with 27 additions and 27 deletions

View File

@ -786,8 +786,8 @@ int S9xMovieOpen (const char *filename, bool8 read_only)
read_movie_extrarominfo(fd, &Movie);
fn = dup(fileno(fd));
fclose(fd);
fflush(fd);
fn = fileno(fd);
store_previous_settings();
restore_movie_settings();
@ -807,6 +807,7 @@ int S9xMovieOpen (const char *filename, bool8 read_only)
result = S9xUnfreezeFromStream(stream);
CLOSE_STREAM(stream);
fclose(fd);
if (result != SUCCESS)
return (result);
@ -853,7 +854,6 @@ int S9xMovieCreate (const char *filename, uint8 controllers_mask, uint8 opts, co
{
FILE *fd;
STREAM stream;
int fn;
if (controllers_mask == 0)
return (WRONG_FORMAT);
@ -902,10 +902,9 @@ int S9xMovieCreate (const char *filename, uint8 controllers_mask, uint8 opts, co
write_movie_extrarominfo(fd, &Movie);
fn = dup(fileno(fd));
fclose(fd);
stream = REOPEN_STREAM(fn, "ab");
stream = OPEN_STREAM(filename, "ab");
if (!stream)
return (FILE_NOT_FOUND);
@ -1009,9 +1008,10 @@ int S9xMovieGetInfo (const char *filename, struct MovieInfo *info)
strncpy(info->ROMName, local_movie.ROMName, 23);
fclose(fd);
if (access(filename, W_OK))
if ((fd = fopen(filename, "r+")) == NULL)
info->ReadOnly = true;
else
fclose(fd);
return (SUCCESS);
}

View File

@ -1881,7 +1881,7 @@ static void FreezeStruct (STREAM stream, const char *name, void *base, FreezeDat
uint8 *addr;
uint16 word;
uint32 dword;
int64 qword;
int64 qaword;
int relativeAddr;
for (i = 0; i < num_fields; i++)
@ -1930,15 +1930,15 @@ static void FreezeStruct (STREAM stream, const char *name, void *base, FreezeDat
break;
case 8:
qword = *((int64 *) (addr));
*ptr++ = (uint8) (qword >> 56);
*ptr++ = (uint8) (qword >> 48);
*ptr++ = (uint8) (qword >> 40);
*ptr++ = (uint8) (qword >> 32);
*ptr++ = (uint8) (qword >> 24);
*ptr++ = (uint8) (qword >> 16);
*ptr++ = (uint8) (qword >> 8);
*ptr++ = (uint8) qword;
qaword = *((int64 *) (addr));
*ptr++ = (uint8) (qaword >> 56);
*ptr++ = (uint8) (qaword >> 48);
*ptr++ = (uint8) (qaword >> 40);
*ptr++ = (uint8) (qaword >> 32);
*ptr++ = (uint8) (qaword >> 24);
*ptr++ = (uint8) (qaword >> 16);
*ptr++ = (uint8) (qaword >> 8);
*ptr++ = (uint8) qaword;
break;
}
@ -2117,7 +2117,7 @@ static void UnfreezeStructFromCopy (void *sbase, FreezeData *fields, int num_fie
uint8 *ptr = block;
uint16 word;
uint32 dword;
int64 qword;
int64 qaword;
uint8 *addr;
void *base;
int relativeAddr;
@ -2183,15 +2183,15 @@ static void UnfreezeStructFromCopy (void *sbase, FreezeData *fields, int num_fie
break;
}
qword = (int64) *ptr++ << 56;
qword |= (int64) *ptr++ << 48;
qword |= (int64) *ptr++ << 40;
qword |= (int64) *ptr++ << 32;
qword |= (int64) *ptr++ << 24;
qword |= (int64) *ptr++ << 16;
qword |= (int64) *ptr++ << 8;
qword |= (int64) *ptr++;
*((int64 *) (addr)) = qword;
qaword = (int64) *ptr++ << 56;
qaword |= (int64) *ptr++ << 48;
qaword |= (int64) *ptr++ << 40;
qaword |= (int64) *ptr++ << 32;
qaword |= (int64) *ptr++ << 24;
qaword |= (int64) *ptr++ << 16;
qaword |= (int64) *ptr++ << 8;
qaword |= (int64) *ptr++;
*((int64 *) (addr)) = qaword;
break;
default: