port to 64bit. Some gcc 4.4 warning fixes

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@835 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-12-06 17:03:58 +00:00
parent b0e318f7f0
commit 5f7b515538
4 changed files with 31 additions and 18 deletions

View file

@ -464,25 +464,25 @@ int emu_reload_rom(char *rom_fname)
// check for both gmv and rom
int dummy;
FILE *movie_file = fopen(rom_fname, "rb");
if(!movie_file) {
if (!movie_file) {
me_update_msg("Failed to open movie.");
return 0;
}
fseek(movie_file, 0, SEEK_END);
movie_size = ftell(movie_file);
fseek(movie_file, 0, SEEK_SET);
if(movie_size < 64+3) {
if (movie_size < 64+3) {
me_update_msg("Invalid GMV file.");
fclose(movie_file);
return 0;
}
movie_data = malloc(movie_size);
if(movie_data == NULL) {
if (movie_data == NULL) {
me_update_msg("low memory.");
fclose(movie_file);
return 0;
}
fread(movie_data, 1, movie_size, movie_file);
dummy = fread(movie_data, 1, movie_size, movie_file);
fclose(movie_file);
if (strncmp((char *)movie_data, "Gens Movie TEST", 15) != 0) {
me_update_msg("Invalid GMV file.");
@ -1008,13 +1008,16 @@ int emu_save_load_game(int load, int sram)
sram_size = SRam.size;
sram_data = SRam.data;
}
if (!sram_data) return 0; // SRam forcefully disabled for this game
if (sram_data == NULL)
return 0; // SRam forcefully disabled for this game
if (load)
{
sramFile = fopen(saveFname, "rb");
if(!sramFile) return -1;
fread(sram_data, 1, sram_size, sramFile);
if (!sramFile)
return -1;
ret = fread(sram_data, 1, sram_size, sramFile);
ret = ret > 0 ? 0 : -1;
fclose(sramFile);
if ((PicoAHW & PAHW_MCD) && (PicoOpt&POPT_EN_MCD_RAMCART))
memcpy32((int *)Pico_mcd->bram, (int *)sram_data, 0x2000/4);

View file

@ -276,7 +276,8 @@ void menu_init(void)
lprintf("found skin.txt\n");
while (!feof(f))
{
fgets(buff, sizeof(buff), f);
if (fgets(buff, sizeof(buff), f) == NULL)
break;
if (buff[0] == '#' || buff[0] == '/') continue; // comment
if (buff[0] == '\r' || buff[0] == '\n') continue; // empty line
if (strncmp(buff, "text_color=", 11) == 0)
@ -744,10 +745,15 @@ static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)
static int scandir_cmp(const void *p1, const void *p2)
{
struct dirent **d1 = (struct dirent **)p1, **d2 = (struct dirent **)p2;
if ((*d1)->d_type == (*d2)->d_type) return alphasort(d1, d2);
if ((*d1)->d_type == DT_DIR) return -1; // put before
if ((*d2)->d_type == DT_DIR) return 1;
const struct dirent **d1 = (const struct dirent **)p1;
const struct dirent **d2 = (const struct dirent **)p2;
if ((*d1)->d_type == (*d2)->d_type)
return alphasort(d1, d2);
if ((*d1)->d_type == DT_DIR)
return -1; // put before
if ((*d2)->d_type == DT_DIR)
return 1;
return alphasort(d1, d2);
}
@ -789,13 +795,13 @@ rescan:
fname = p+1;
}
n = scandir(curr_path, &namelist, scandir_filter, scandir_cmp);
n = scandir(curr_path, &namelist, scandir_filter, (void *)scandir_cmp);
if (n < 0) {
lprintf("menu_loop_romsel failed, dir: %s\n", curr_path);
// try root
getcwd(curr_path, len);
n = scandir(curr_path, &namelist, scandir_filter, scandir_cmp);
plat_get_root_dir(curr_path, len);
n = scandir(curr_path, &namelist, scandir_filter, (void *)scandir_cmp);
if (n < 0) {
// oops, we failed
lprintf("menu_loop_romsel failed, dir: %s\n", curr_path);

View file

@ -55,8 +55,8 @@ static int in_gp2x_get_mmsp2_bits(void)
static int in_gp2x_get_wiz_bits(void)
{
int value = 0;
read(gpiodev, &value, 4);
int r, value = 0;
r = read(gpiodev, &value, 4);
if (value & 0x02)
value |= 0x05;
if (value & 0x08)

View file

@ -44,7 +44,11 @@ int sndout_oss_start(int rate, int frame_samples, int stereo)
if (sounddev == -1)
{
perror("open(\"/dev/dsp\")");
return -1;
sounddev = open("/dev/dsp1", O_WRONLY|O_ASYNC);
if (sounddev == -1) {
perror("open(\"/dev/dsp1\")");
return -1;
}
}
// calculate buffer size. We one to fit 1 frame worth of sound data.