diff --git a/src/emulator.c b/src/emulator.c index 58457382..b611d99d 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -682,13 +682,13 @@ void emu_render_frame(struct emu *emu) { frame_y = 0; } else if (emu->aspect_ratio == ASPECT_RATIO_16BY9) { frame_width = emu->video_width; - frame_height = frame_width * (9.0f / 16.0f); + frame_height = (int)(frame_width * (9.0f / 16.0f)); frame_x = 0; - frame_y = (emu->video_height - frame_height) / 2.0f; + frame_y = (int)((emu->video_height - frame_height) / 2.0f); } else if (emu->aspect_ratio == ASPECT_RATIO_4BY3) { frame_height = emu->video_height; - frame_width = frame_height * (4.0f / 3.0f); - frame_x = (emu->video_width - frame_width) / 2.0f; + frame_width = (int)(frame_height * (4.0f / 3.0f)); + frame_x = (int)((emu->video_width - frame_width) / 2.0f); frame_y = 0; } else { LOG_FATAL("unexpected aspect ratio %d", emu->aspect_ratio); diff --git a/src/guest/aica/aica.c b/src/guest/aica/aica.c index 495d1857..e96283c1 100644 --- a/src/guest/aica/aica.c +++ b/src/guest/aica/aica.c @@ -66,11 +66,11 @@ struct aica_channel { uint8_t *base; /* current position in the sound source */ - int phase; + uint32_t phase; /* fractional remainder after phase increment */ - int phasefrc; + uint32_t phasefrc; /* amount to step the sound source each sample */ - int phaseinc; + uint32_t phaseinc; /* decoding state */ sample_t prev_sample, prev_quant; @@ -203,7 +203,7 @@ static inline sample_t aica_adjust_channel_volume(struct aica_channel *ch, return (in * y) >> 15; } -static void aica_decode_adpcm(sample_t data, sample_t prev, sample_t prev_quant, +static void aica_decode_adpcm(uint8_t data, sample_t prev, sample_t prev_quant, sample_t *next, sample_t *next_quant) { /* the decoded value (n) = (1 - 2 * l4) * (l3 + l2/2 + l1/4 + 1/8) * quantized width (n) + decoded value (n - 1) @@ -439,9 +439,9 @@ static float aica_channel_duration(struct aica_channel *ch) { return ch->data->LEA / hz; } -static int aica_channel_phaseinc(struct aica_channel *ch) { +static uint32_t aica_channel_phaseinc(struct aica_channel *ch) { /* by default, increment by one sample per step */ - int phaseinc = AICA_PHASE_BASE; + uint32_t phaseinc = AICA_PHASE_BASE; /* FNS represents the fractional phase increment, used to linearly interpolate between samples. note, the phase increment has 18 total fractional bits, @@ -543,7 +543,7 @@ static void aica_channel_step_one(struct aica *aica, struct aica_channel *ch) { case AICA_FMT_ADPCM: case AICA_FMT_ADPCM_STREAM: { int shift = (ch->phase & 1) << 2; - sample_t data = (ch->base[ch->phase >> 1] >> shift) & 0xf; + uint8_t data = (ch->base[ch->phase >> 1] >> shift) & 0xf; aica_decode_adpcm(data, ch->prev_sample, ch->prev_quant, &ch->next_sample, &ch->next_quant); } break; @@ -636,8 +636,8 @@ static void aica_generate_frames(struct aica *aica) { l = aica_adjust_master_volume(aica, l); r = aica_adjust_master_volume(aica, r); - buffer[frame * 2 + 0] = CLAMP(l, INT16_MIN, INT16_MAX); - buffer[frame * 2 + 1] = CLAMP(r, INT16_MIN, INT16_MAX); + buffer[frame * 2 + 0] = (int16_t)CLAMP(l, INT16_MIN, INT16_MAX); + buffer[frame * 2 + 1] = (int16_t)CLAMP(r, INT16_MIN, INT16_MAX); } dc_push_audio(dc, buffer, AICA_BATCH_SIZE); diff --git a/src/guest/bios/bios.c b/src/guest/bios/bios.c index c1ba54ac..6dd433fe 100644 --- a/src/guest/bios/bios.c +++ b/src/guest/bios/bios.c @@ -142,7 +142,6 @@ static void bios_override_flash_settings(struct bios *bios) { static void bios_validate_flash(struct bios *bios) { struct dreamcast *dc = bios->dc; struct flash *flash = dc->flash; - struct flash_header_block header; /* validate partition 0 (factory settings) */ { diff --git a/src/guest/bios/syscalls.c b/src/guest/bios/syscalls.c index ba8d5035..3bf6d526 100644 --- a/src/guest/bios/syscalls.c +++ b/src/guest/bios/syscalls.c @@ -299,7 +299,7 @@ static void bios_gdrom_mainloop(struct bios *bios) { LOG_SYSCALL("GDC_GET_VER 0x%x", dst); const char *version = "GDC Version 1.10 1999-03-31"; - const int len = strlen(version); + const int len = (int)strlen(version); as_memcpy_to_guest(space, dst, version, len); diff --git a/src/guest/gdrom/disc.c b/src/guest/gdrom/disc.c index 9d6c2d92..9e9da06c 100644 --- a/src/guest/gdrom/disc.c +++ b/src/guest/gdrom/disc.c @@ -31,7 +31,7 @@ static void disc_get_meta(struct disc *disc, struct disc_meta *meta) { memcpy(meta, tmp, sizeof(*meta)); } -int disc_read_bytes(struct disc *disc, int fad, int len, void *dst, +int disc_read_bytes(struct disc *disc, int fad, int len, uint8_t *dst, int dst_size) { CHECK_LE(len, dst_size); @@ -56,7 +56,7 @@ int disc_read_bytes(struct disc *disc, int fad, int len, void *dst, } int disc_read_sectors(struct disc *disc, int fad, int num_sectors, - int sector_fmt, int sector_mask, void *dst, + int sector_fmt, int sector_mask, uint8_t *dst, int dst_size) { struct track *track = disc_lookup_track(disc, fad); CHECK_NOTNULL(track); diff --git a/src/guest/gdrom/disc.h b/src/guest/gdrom/disc.h index d21184b2..550bc8ae 100644 --- a/src/guest/gdrom/disc.h +++ b/src/guest/gdrom/disc.h @@ -69,8 +69,9 @@ void disc_get_toc(struct disc *disc, int area, struct track **first_track, int disc_find_file(struct disc *disc, const char *filename, int *fad, int *len); int disc_read_sectors(struct disc *disc, int fad, int num_sectors, - int sector_fmt, int sector_mask, void *dst, int dst_size); -int disc_read_bytes(struct disc *disc, int fad, int len, void *dst, + int sector_fmt, int sector_mask, uint8_t *dst, + int dst_size); +int disc_read_bytes(struct disc *disc, int fad, int len, uint8_t *dst, int dst_size); #endif diff --git a/src/guest/holly/holly.c b/src/guest/holly/holly.c index f6a21801..fa8f3e52 100644 --- a/src/guest/holly/holly.c +++ b/src/guest/holly/holly.c @@ -164,7 +164,7 @@ static void holly_maple_dma(struct holly *hl) { #define SB_SUSP(ch) (hl->SB_ADSUSP + ((ch)*HOLLY_G2_NUM_REGS)) #define HOLLY_INT_G2INT(ch) HOLLY_INTERRUPT(HOLLY_INT_NRM, (0x8000 << ch)) -static void (*g2_timers[])(void *); +static void (*g2_timers[4])(void *); #define DEFINE_G2_DMA_TIMER(ch) \ static void holly_g2_dma_timer_channel##ch(void *data) { \ @@ -193,7 +193,7 @@ DEFINE_G2_DMA_TIMER(1); DEFINE_G2_DMA_TIMER(2); DEFINE_G2_DMA_TIMER(3); -static void (*g2_timers[])(void *) = { +static void (*g2_timers[4])(void *) = { &holly_g2_dma_timer_channel0, &holly_g2_dma_timer_channel1, &holly_g2_dma_timer_channel2, &holly_g2_dma_timer_channel3, }; diff --git a/src/guest/sh4/sh4_mmu.c b/src/guest/sh4/sh4_mmu.c index b424362d..2a85630e 100644 --- a/src/guest/sh4/sh4_mmu.c +++ b/src/guest/sh4/sh4_mmu.c @@ -18,7 +18,7 @@ enum { }; static void sh4_mmu_utlb_sync(struct sh4 *sh4, struct sh4_tlb_entry *entry) { - int n = entry - sh4->utlb; + int n = (int)(entry - sh4->utlb); /* check if entry maps to sq region [0xe0000000, 0xe3ffffff] */ if ((entry->hi.VPN & (0xfc000000 >> 10)) == (0xe0000000 >> 10)) {