uae_u16 v = dma_get_word((wd->cdmac.dmac_acr << 1) & wd->dma_mask);
if (wd->wc.wd_dataoffset < sizeof wd->wc.wd_data - 1) {
wd->wc.wd_data[wd->wc.wd_dataoffset++] = v >> 8;
- wd->wc.wd_data[wd->wc.wd_dataoffset++] = v;
+ wd->wc.wd_data[wd->wc.wd_dataoffset++] = (uae_u8)v;
}
status = scsi_send_data (scsi, v >> 8);
if (!status)
- status = scsi_send_data (scsi, v);
+ status = scsi_send_data (scsi, (uae_u8)v);
if (decreasetc (&wd->wc))
break;
if (decreasetc (&wd->wc))
if (!aci->rc->autoboot_disabled) {
struct zfile *z = read_device_from_romconfig(aci->rc, ROMTYPE_A2091);
if (z) {
- wd->rom_size = zfile_size (z);
+ wd->rom_size = zfile_size32(z);
zfile_fread (wd->rom, wd->rom_size, 1, z);
zfile_fclose (z);
if (wd->rom_size == 32768) {
if (!aci->rc->autoboot_disabled && !combitec) {
struct zfile *z = read_device_from_romconfig(aci->rc, ROMTYPE_A2090);
if (z) {
- wd->rom_size = zfile_size (z);
+ wd->rom_size = zfile_size32(z);
zfile_fread (wd->rom, wd->rom_size, 1, z);
zfile_fclose (z);
for (int i = 1; i < slotsize / wd->rom_size; i++) {
if (!autoboot_disabled) {
struct zfile *z = read_device_from_romconfig(aci->rc, ROMTYPE_GVPS2);
if (z) {
- int size = zfile_size(z);
+ int size = zfile_size32(z);
if (series2) {
int total = 0;
int seekpos = 0;
- size = zfile_size(z);
+ size = zfile_size32(z);
if (size > 16384 + 4096) {
zfile_fread(wd->rom, 64, 1, z);
zfile_fseek(z, 16384, SEEK_SET);
wd->rom_mask = wd->rom_size - 1;
struct zfile *z = read_device_from_romconfig(aci->rc, ROMTYPE_COMSPEC);
if (z) {
- wd->rom_size = zfile_size (z);
+ wd->rom_size = zfile_size32(z);
zfile_fread (wd->rom, wd->rom_size, 1, z);
zfile_fclose (z);
wd->rom_mask = wd->rom_size - 1;
} else {
cdrom_seek_delay--;
}
- framecounter1 += (float)maxvpos * vblank_hz / (75.0 * cdrom_speed);
+ framecounter1 += (float)maxvpos * vblank_hz / (75.0f * cdrom_speed);
if (currprefs.cd_speed == 0 || currprefs.turbo_emulation)
framecounter1 = 1;
}
framecounter2--;
if (framecounter2 <= 0) {
- framecounter2 += (float)maxvpos * vblank_hz / (75.0 * cdrom_speed);
+ framecounter2 += (float)maxvpos * vblank_hz / (75.0f * cdrom_speed);
framesync = true;
}
}
uae_sem_post (&sub_sem);
}
- subcodecounter = maxvpos * vblank_hz / (75 * cdrom_speed) - 5;
+ subcodecounter = (int)(maxvpos * vblank_hz / (75 * cdrom_speed) - 5);
}
if (frame2counter > 0)
z = read_device_rom(&currprefs, ROMTYPE_AMAX, 0, NULL);
if (z) {
zfile_fseek (z, 0, SEEK_END);
- amax_rom_size = zfile_ftell (z);
+ amax_rom_size = zfile_ftell32(z);
zfile_fseek (z, 0, SEEK_SET);
} else {
write_log (_T("AMAX: failed to load rom\n"));
}
}
zfile_fseek(f, 0, SEEK_END);
- ar_rom_file_size = zfile_ftell(f);
+ ar_rom_file_size = zfile_ftell32(f);
zfile_fseek(f, 0, SEEK_SET);
zfile_fread (header, 1, sizeof header, f);
zfile_fseek (f, 0, SEEK_SET);
#endif
// file/line new/delete operators
-ATTR_FORCE_INLINE inline void *operator new(std::size_t size, const char *file, int line) throw (std::bad_alloc) { return malloc_file_line(size, file, line, false, true, false); }
-ATTR_FORCE_INLINE inline void *operator new[](std::size_t size, const char *file, int line) throw (std::bad_alloc) { return malloc_file_line(size, file, line, true, true, false); }
-ATTR_FORCE_INLINE inline void operator delete(void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
-ATTR_FORCE_INLINE inline void operator delete[](void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
+ATTR_FORCE_INLINE void *operator new(std::size_t size, const char *file, int line) { return malloc_file_line(size, file, line, false, true, false); }
+ATTR_FORCE_INLINE void *operator new[](std::size_t size, const char *file, int line) { return malloc_file_line(size, file, line, true, true, false); }
+ATTR_FORCE_INLINE void operator delete(void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
+ATTR_FORCE_INLINE void operator delete[](void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
// file/line new/delete operators with zeroing
-ATTR_FORCE_INLINE inline void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) { return malloc_file_line(size, file, line, false, true, true); }
-ATTR_FORCE_INLINE inline void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) { return malloc_file_line(size, file, line, true, true, true); }
-ATTR_FORCE_INLINE inline void operator delete(void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
-ATTR_FORCE_INLINE inline void operator delete[](void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
+ATTR_FORCE_INLINE void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) { return malloc_file_line(size, file, line, false, true, true); }
+ATTR_FORCE_INLINE void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) { return malloc_file_line(size, file, line, true, true, true); }
+ATTR_FORCE_INLINE void operator delete(void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
+ATTR_FORCE_INLINE void operator delete[](void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
} else {
zn = zvolume_addfile_abs (zv, &zai);
if (zn) {
- zn->offset = zfile_ftell(zf);
+ zn->offset = zfile_ftell32(zf);
zn->packedsize = hdr.packed_size;
zn->method = method;
}
static void crc_calc(struct lzxdata *d, unsigned char *memory, unsigned int length)
{
- register unsigned int temp;
+ unsigned int temp;
if(length)
{
static int make_decode_table(struct lzxdata *d, short number_symbols, short table_size,
unsigned char *length, unsigned short *table)
{
- register unsigned char bit_num = 0;
- register short symbol;
+ unsigned char bit_num = 0;
+ short symbol;
unsigned short leaf; /* could be a register */
unsigned short bit_mask, fill, next_symbol, reverse;
unsigned int table_mask, pos;
static int read_literal_table(struct lzxdata *d)
{
- register unsigned int control;
- register short shift;
+ unsigned int control;
+ short shift;
unsigned short temp; /* could be a register */
unsigned short symbol, pos, count, fix, max_symbol;
#if LZX_ERROR_CHECK
static void decrunch(struct lzxdata *d)
{
- register unsigned int control;
- register short shift;
+ unsigned int control;
+ short shift;
unsigned short temp; /* could be a register */
unsigned short symbol, count;
unsigned char *string;
{
merge_size = 0;
if (zn) {
- zn->offset = zfile_ftell(in_file);
+ zn->offset = zfile_ftell32(in_file);
zn->packedsize = pack_size;
}
if(!zfile_fseek(in_file, pack_size, SEEK_CUR))
if (!memcmp (buf + 12, "TOP\0", 4))
side = 0;
crc = (buf[20] << 8) | buf[21];
- pos = zfile_ftell (zf);
+ pos = zfile_ftell32(zf);
dstpos = -1;
if (side >= 0 && track >= 0 && track <= 79)
dstpos = track * 22 * 512 + (side * 11 * 512);
write_log (_T("WRP corrupt data, track=%d,side=%d,err=%d\n"), track, side, err);
} else {
uae_u16 crc2;
- int os = zfile_ftell (tmpf);
- data = zfile_getdata (tmpf, 0, os, NULL);
- crc2 = wrpcrc16 (wrpcrc16table, data, os);
+ int os = zfile_ftell32(tmpf);
+ data = zfile_getdata(tmpf, 0, os, NULL);
+ crc2 = wrpcrc16(wrpcrc16table, data, os);
if (crc != crc2)
write_log (_T("WRP crc error %04x<>%04x, track=%d,side=%d\n"), crc, crc2, track, side);
xfree (data);
return 0;
- uSizeFile = zfile_ftell( fin );
+ uSizeFile = zfile_ftell32( fin );
if (uMaxBack>uSizeFile)
uMaxBack = uSizeFile;
convertsample (rs->sample, rs->len);
zfile_fwrite (rs->sample, rs->len, 1, wavfile);
convertsample (rs->sample, rs->len);
- write_wavheader (wavfile, zfile_ftell(wavfile), freq);
+ write_wavheader (wavfile, zfile_ftell32(wavfile), freq);
zfile_fclose (wavfile);
write_log (_T("SAMPLERIPPER: %d: %dHz %d bytes\n"), cnt, freq, rs->len);
} else {
int sound_cd_volume[2];
int sound_paula_volume[2];
-static unsigned long last_cycles;
+static evt_t last_cycles;
static float next_sample_evtime;
static int previous_volcnt_update;
switch (sound_use_filter) {
case FILTER_MODEL_A500:
- fs->rc1 = a500e_filter1_a0 * input + (1 - a500e_filter1_a0) * fs->rc1 + DENORMAL_OFFSET;
- fs->rc2 = a500e_filter2_a0 * fs->rc1 + (1 - a500e_filter2_a0) * fs->rc2;
+ fs->rc1 = (float)(a500e_filter1_a0 * input + (1.0f - a500e_filter1_a0) * fs->rc1 + DENORMAL_OFFSET);
+ fs->rc2 = a500e_filter2_a0 * fs->rc1 + (1.0f - a500e_filter2_a0) * fs->rc2;
normal_output = fs->rc2;
fs->rc3 = filter_a0 * normal_output + (1 - filter_a0) * fs->rc3;
break;
case FILTER_MODEL_A1200:
- normal_output = input;
+ normal_output = (float)input;
- fs->rc2 = filter_a0 * normal_output + (1 - filter_a0) * fs->rc2 + DENORMAL_OFFSET;
+ fs->rc2 = (float)(filter_a0 * normal_output + (1 - filter_a0) * fs->rc2 + DENORMAL_OFFSET);
fs->rc3 = filter_a0 * fs->rc2 + (1 - filter_a0) * fs->rc3;
fs->rc4 = filter_a0 * fs->rc3 + (1 - filter_a0) * fs->rc4;
}
if (led_filter_on)
- o = led_output;
+ o = (int)led_output;
else
- o = normal_output;
+ o = (int)normal_output;
if (o > 32767)
o = 32767;
{
struct audio_channel_data *cdp;
unsigned long ratio, ratio1;
-#define INTERVAL (scaled_sample_evtime * 3)
+#define INTERVAL ((int)(scaled_sample_evtime * 3))
cdp = audio_channel + 0;
ratio1 = cdp->per - cdp->evtime;
ratio = (ratio1 << 12) / INTERVAL;
{
struct audio_channel_data *cdp;
unsigned long ratio, ratio1;
-#define INTERVAL (scaled_sample_evtime * 3)
+#define INTERVAL ((int)(scaled_sample_evtime * 3))
cdp = audio_channel + 0;
ratio1 = cdp->per - cdp->evtime;
ratio = (ratio1 << 12) / INTERVAL;
/* This computes the 1st order low-pass filter term b0.
* The a1 term is 1.0 - b0. The center frequency marks the -3 dB point. */
#ifndef M_PI
-#define M_PI 3.14159265358979323846
+#define M_PI 3.14159265358979323846f
#endif
static float rc_calculate_a0 (int sample_rate, int cutoff_freq)
{
if (cutoff_freq >= sample_rate / 2)
return 1.0;
- omega = 2 * M_PI * cutoff_freq / sample_rate;
+ omega = 2.0f * M_PI * cutoff_freq / sample_rate;
/* Compensate for the bilinear transformation. This allows us to specify the
* stop frequency more exactly, but the filter becomes less steep further
* from stopband. */
- omega = softfloat_tan (omega / 2.0) * 2.0;
- float out = 1.0 / (1.0 + 1.0 / omega);
+ omega = (float)softfloat_tan (omega / 2.0f) * 2.0f;
+ float out = 1.0f / (1.0f + 1.0f / omega);
return out;
}
out *= 8192;
cdp->data.last_sample = cdp->data.current_sample;
- cdp->data.current_sample = out;
+ cdp->data.current_sample = (int)out;
}
(*sample_handler) ();
}
void update_audio (void)
{
- unsigned long int n_cycles = 0;
+ int n_cycles = 0;
#if SOUNDSTUFF > 1
static int samplecounter;
#endif
if (!is_audio_active ())
goto end;
- n_cycles = get_cycles () - last_cycles;
+ n_cycles = (int)(get_cycles () - last_cycles);
while (n_cycles > 0) {
- unsigned long int best_evtime = n_cycles + 1;
- unsigned long rounded;
+ uae_u32 best_evtime = n_cycles + 1;
+ uae_u32 rounded;
int i;
for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) {
}
/* next_sample_evtime >= 0 so floor() behaves as expected */
- rounded = floorf (next_sample_evtime);
+ rounded = (uae_u32)floorf (next_sample_evtime);
float nevtime = next_sample_evtime;
if ((next_sample_evtime - rounded) >= 0.5)
rounded++;
asd->evtime = evt;
}
-static unsigned int cda_evt;
+static uae_u32 cda_evt;
static uae_s16 dummy_buffer[4] = { 0 };
-void update_cda_sound(double clk)
+void update_cda_sound(float clk)
{
- cda_evt = clk * CYCLE_UNIT / 44100;
+ cda_evt = (uae_u32)(clk * CYCLE_UNIT / 44100.0f);
}
void audio_cda_volume(struct cd_audio_state *cas, int left, int right)
}
if (audio && size == 2352)
type = CD_TRACK_AUDIO;
- if (cdrom_read_data(cdu->chd_cdf, sector + t->offset, tmpbuf, type, true)) {
+ if (cdrom_read_data(cdu->chd_cdf, sector + (UINT32)t->offset, tmpbuf, type, true)) {
memcpy(data, tmpbuf + offset, size);
return 1;
}
zfile_fread (&b, 1, 1, t->handle);
zfile_fseek (t->handle, pos, SEEK_SET);
if (!t->data && (t->enctype == AUDENC_MP3 || t->enctype == AUDENC_FLAC)) {
- t->data = xcalloc (uae_u8, t->filesize + 2352);
+ t->data = xcalloc (uae_u8, (int)t->filesize + 2352);
cdimage_unpack_active = 1;
if (t->data) {
if (t->enctype == AUDENC_MP3) {
} catch (exception) { };
}
if (mp3dec)
- t->data = mp3dec->get (t->handle, t->data, t->filesize);
+ t->data = mp3dec->get (t->handle, t->data, (int)t->filesize);
} else if (t->enctype == AUDENC_FLAC) {
flac_get_data (t);
}
if (*outpos < 0) {
_ftime (&tb2);
- diff = (tb2.time * (uae_s64)1000 + tb2.millitm) - (tb1.time * (uae_s64)1000 + tb1.millitm);
+ diff = (int)((tb2.time * (uae_s64)1000 + tb2.millitm) - (tb1.time * (uae_s64)1000 + tb1.millitm));
diff -= cdu->cdda_delay;
if (idleframes >= 0 && diff < 0 && cdu->cdda_play > 0)
sleep_millis(-diff);
#endif
} else if (t->handle) {
int totalsize = t->size + t->skipsize;
- int offset = t->offset;
+ int offset = (int)t->offset;
if (offset >= 0) {
if ((t->enctype == AUDENC_MP3 || t->enctype == AUDENC_FLAC) && t->data) {
if (t->filesize >= sector * totalsize + offset + t->size)
MDS_Header *head;
struct cdtoc *t;
uae_u8 *mds = NULL;
- uae_u64 size;
+ uae_u32 size;
MDS_SessionBlock *sb;
if (curdir)
my_setcurrentdir(occurdir, NULL);
write_log (_T("MDS TOC: '%s'\n"), img);
- size = zfile_size (zmds);
+ size = zfile_size32(zmds);
mds = xmalloc (uae_u8, size);
if (!mds)
goto end;
dtrack->filesize = cf->logical_bytes ();
dtrack->track = i + 1;
dtrack[1].address = dtrack->address + strack->frames;
- if (cf->hunk_info(dtrack->offset * CD_FRAME_SIZE / hunksize, compr, cbytes) == CHDERR_NONE) {
+ if (cf->hunk_info((UINT32)(dtrack->offset * CD_FRAME_SIZE / hunksize), compr, cbytes) == CHDERR_NONE) {
TCHAR tmp[100];
uae_u32 c = (uae_u32)compr;
for (int j = 0; j < 4; j++) {
t->address = 0;
}
t->offset = index0;
- t->index1 = (index1 - index0) / sectorsize;
+ t->index1 = (int)((index1 - index0) / sectorsize);
t->size = sectorsize;
t->handle = zfile_dup(znrg);
t->fname = my_strdup(zfile_getname(znrg));
t->enctype = AUDENC_PCM;
if (type == 0x1000) {
// audio with sub.
- t->suboffset = t->offset;
+ t->suboffset = (int)t->offset;
t->size -= SUB_CHANNEL_SIZE;
t->subcode = 1;
t->subhandle = zfile_dup(t->handle);
#define CL450_VIDEO_BUFFER_SIZE (352 * 288 * 4)
static uae_u16 cl450_regs[256];
-static double cl450_scr;
+static float cl450_scr;
#define CL450_IMEM_WORDS (2 * 512)
#define CL450_TMEM_WORDS 128
#define CL450_HMEM_WORDS 16
static bool audio_mode;
static uae_sem_t play_sem;
static volatile bool fmv_bufon[2];
-static double fmv_syncadjust;
+static float fmv_syncadjust;
static struct cd_audio_state cas;
struct cl450_videoram
p += 5;
psize -= 5;
if (audio_head_detect >= 3) {
- l64111_regs[A_PRESENT1] = pts >> 0;
- l64111_regs[A_PRESENT2] = pts >> 8;
- l64111_regs[A_PRESENT3] = pts >> 16;
- l64111_regs[A_PRESENT4] = pts >> 24;
- l64111_regs[A_PRESENT5] = pts >> 32;
+ l64111_regs[A_PRESENT1] = (uae_u16)(pts >> 0);
+ l64111_regs[A_PRESENT2] = (uae_u16)(pts >> 8);
+ l64111_regs[A_PRESENT3] = (uae_u16)(pts >> 16);
+ l64111_regs[A_PRESENT4] = (uae_u16)(pts >> 24);
+ l64111_regs[A_PRESENT5] = (uae_u16)(pts >> 32);
//write_log(_T("audio PTS %09llx SCR %09llx\n"), pts, (uae_u64)cl450_scr);
l64111_set_status(2, PTS_AVAILABLE);
}
return;
}
l64111_fifo[l64111_fifo_cnt++] = v >> 8;
- l64111_fifo[l64111_fifo_cnt++] = v;
+ l64111_fifo[l64111_fifo_cnt++] = (uae_u8)v;
if (l64111_fifo_cnt == L64111_FIFO_BYTES) {
l64111_parse();
}
static uae_u8 l64111_bget(uaecptr addr)
{
- return l64111_wget(addr);
+ return (uae_u8)l64111_wget(addr);
}
static void l64111_bput(uaecptr addr, uae_u8 v)
{
if (!fmv_ram_bank.baseaddr)
return;
fmv_ram_bank.baseaddr[addr * 2 + 0] = w >> 8;
- fmv_ram_bank.baseaddr[addr * 2 + 1] = w;
+ fmv_ram_bank.baseaddr[addr * 2 + 1] = (uae_u8)w;
}
#if DUMP_VIDEO
v = ((uae_u64)cl450_regs[HOST_scr0] & 7) << 30;
v |= (cl450_regs[HOST_scr1] & 0x7fff) << 15;
v |= cl450_regs[HOST_scr2] & 0x7fff;
- cl450_scr = v;
+ cl450_scr = (float)v;
}
static void cl450_reset_cmd(void)
static void cl450_data_wput(uae_u16 v)
{
fmv_ram_bank.baseaddr[CL450_MPEG_BUFFER + cl450_buffer_offset + 0] = v >> 8;
- fmv_ram_bank.baseaddr[CL450_MPEG_BUFFER + cl450_buffer_offset + 1] = v;
+ fmv_ram_bank.baseaddr[CL450_MPEG_BUFFER + cl450_buffer_offset + 1] = (uae_u8)v;
if (cl450_buffer_offset < CL450_MPEG_BUFFER_SIZE - 2)
cl450_buffer_offset += 2;
}
static uae_u8 cl450_bget(uaecptr addr)
{
- return cl450_wget(addr);
+ return (uae_u8)cl450_wget(addr);
}
static void cl450_bput(uaecptr addr, uae_u8 v)
{
io_bput (addr, w);
}
-static double max_sync_vpos;
-static double remaining_sync_vpos;
+static float max_sync_vpos;
+static float remaining_sync_vpos;
-void cd32_fmv_set_sync(double svpos, double adjust)
+void cd32_fmv_set_sync(float svpos, float adjust)
{
max_sync_vpos = svpos / adjust;
fmv_syncadjust = adjust;
return;
if (cl450_play > 0)
- cl450_scr += 90000.0 / (hblank_hz / fmv_syncadjust);
+ cl450_scr += 90000.0f / (hblank_hz / fmv_syncadjust);
if (cl450_video_hsync_wait > 0)
cl450_video_hsync_wait--;
cl450_videoram_read &= CL450_VIDEO_BUFFERS - 1;
cl450_videoram_cnt--;
}
- cl450_video_hsync_wait = max_sync_vpos;
+ cl450_video_hsync_wait = (int)max_sync_vpos;
while (remaining_sync_vpos >= 1.0) {
cl450_video_hsync_wait++;
remaining_sync_vpos -= 1.0;
return cfgfile_yesno (option, value, name, location, true);
}
-static int cfgfile_doubleval (const TCHAR *option, const TCHAR *value, const TCHAR *name, double *location)
-{
- TCHAR *endptr;
- if (name != NULL && _tcscmp (option, name) != 0)
- return 0;
- *location = _tcstod (value, &endptr);
- return 1;
-}
-
static int cfgfile_floatval (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, float *location)
{
TCHAR *endptr;
while (s) {
if (!_tcschr (s, ':'))
break;
- p->osd_pos.x = (int)(_tstof (s) * 10.0);
+ p->osd_pos.x = (int)(_tstof (s) * 10.0f);
s = _tcschr (s, ':');
if (!s)
break;
if (s[-1] == '%')
p->osd_pos.x += 30000;
s++;
- p->osd_pos.y = (int)(_tstof (s) * 10.0);
+ p->osd_pos.y = (int)(_tstof (s) * 10.0f);
s += _tcslen (s);
if (s[-1] == '%')
p->osd_pos.y += 30000;
int vert = -1, horiz = -1, lace = -1, ntsc = -1, framelength = -1, vsync = -1, hres = 0;
bool locked = false, rtg = false, exit = false;
bool cmdmode = false, defaultdata = false;
- double rate = -1;
+ float rate = -1;
int rpct = 0;
TCHAR cmd[MAX_DPATH], filter[64] = { 0 }, label[16] = { 0 };
TCHAR *tmpp = tmpbuf;
tmpp += 4;
}
if (rate < 0)
- rate = _tstof(tmpp);
+ rate = (float)_tstof(tmpp);
else if (!_tcsnicmp(tmpp, _T("v="), 2))
vert = _tstol(equals);
else if (!_tcsnicmp(tmpp, _T("h="), 2))
}
p = cfgfile_option_get(buf2, _T("mid"));
if (p) {
- brc->roms[idx].manufacturer = _tstol(p);
+ brc->roms[idx].manufacturer = (uae_u16)_tstol(p);
xfree(p);
}
p = cfgfile_option_get(buf2, _T("pid"));
if (p) {
- brc->roms[idx].product = _tstol(p);
+ brc->roms[idx].product = (uae_u8)_tstol(p);
xfree(p);
}
p = cfgfile_option_get(buf2, _T("data"));
|| cfgfile_intval(option, value, _T("fpu_revision"), &p->fpu_revision, 1)
|| cfgfile_intval(option, value, _T("fatgary"), &p->cs_fatgaryrev, 1)
|| cfgfile_intval(option, value, _T("ramsey"), &p->cs_ramseyrev, 1)
- || cfgfile_doubleval(option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate)
+ || cfgfile_floatval(option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate)
|| cfgfile_intval(option, value, _T("cpuboardmem1_size"), &p->cpuboardmem1.size, 0x100000)
|| cfgfile_intval(option, value, _T("cpuboardmem2_size"), &p->cpuboardmem2.size, 0x100000)
|| cfgfile_intval(option, value, _T("debugmem_size"), &p->debugmem_size, 0x100000)
p->m68k_speed *= CYCLE_UNIT;
return 1;
}
- if (cfgfile_doubleval(option, value, _T("cpu_throttle"), &p->m68k_speed_throttle)) {
+ if (cfgfile_floatval(option, value, _T("cpu_throttle"), &p->m68k_speed_throttle)) {
return 1;
}
- if (cfgfile_doubleval(option, value, _T("cpu_x86_throttle"), &p->x86_speed_throttle)) {
+ if (cfgfile_floatval(option, value, _T("cpu_x86_throttle"), &p->x86_speed_throttle)) {
return 1;
}
if (cfgfile_intval (option, value, _T("finegrain_cpu_speed"), &p->m68k_speed, 1)) {
p->m68k_speed = -1;
return 1;
}
- if (cfgfile_doubleval(option, value, _T("blitter_throttle"), &p->blitter_speed_throttle)) {
+ if (cfgfile_floatval(option, value, _T("blitter_throttle"), &p->blitter_speed_throttle)) {
return 1;
}
SAVE_EXCEPTION;
TRY(prb) {
mmu_put_user_byte(addr, val >> 8, regs.s != 0, sz_word, true);
- mmu_put_user_byte(addr + 1, val, regs.s != 0, sz_word, true);
+ mmu_put_user_byte(addr + 1, (uae_u8)val, regs.s != 0, sz_word, true);
RESTORE_EXCEPTION;
}
CATCH(prb) {
SAVE_EXCEPTION;
TRY(prb) {
mmu_put_byte(addr, val >> 8, data, sz_word);
- mmu_put_byte(addr + 1, val, data, sz_word);
+ mmu_put_byte(addr + 1, (uae_u8)val, data, sz_word);
RESTORE_EXCEPTION;
}
CATCH(prb) {
mmu_put_user_word(addr, val, super, sz_word, false);
} else {
mmu_put_user_byte(addr, val >> 8, super, sz_word, false);
- mmu_put_user_byte(addr + 1, val, super, sz_word, false);
+ mmu_put_user_byte(addr + 1, (uae_u8)val, super, sz_word, false);
}
RESTORE_EXCEPTION;
}
case 0x12: // SRP
if (rw) {
x_put_long (extra, srp_030 >> 32);
- x_put_long (extra + 4, srp_030);
+ x_put_long (extra + 4, (uae_u32)srp_030);
} else {
srp_030 = (uae_u64)x_get_long (extra) << 32;
srp_030 |= x_get_long (extra + 4);
case 0x13: // CRP
if (rw) {
x_put_long (extra, crp_030 >> 32);
- x_put_long (extra + 4, crp_030);
+ x_put_long (extra + 4, (uae_u32)crp_030);
} else {
crp_030 = (uae_u64)x_get_long (extra) << 32;
crp_030 |= x_get_long (extra + 4);
bool mmu030_decode_rp(uae_u64 RP) {
- uae_u8 descriptor_type = (RP & RP_DESCR_MASK) >> 32;
+ uae_u8 descriptor_type = (uae_u8)((RP & RP_DESCR_MASK) >> 32);
if (!descriptor_type) { /* If descriptor type is invalid */
write_log(_T("MMU Configuration Exception: Root Pointer is invalid!\n"));
Exception(56); /* MMU Configuration Exception */
uae_u32 mmu030_state_1 = get_word_mmu030(a7 + 0x32);
uae_u32 mmu030_state_2 = get_word_mmu030(a7 + 0x34);
- uae_u32 mmu030_opcode_v = (ps & 0x80000000) ? -1U : (oc & 0xffff);
+ uae_u32 mmu030_opcode_v = (ps & 0x80000000) ? 0xffffffff : (oc & 0xffff);
uae_u32 mmu030_fmovem_store_0 = 0;
uae_u32 mmu030_fmovem_store_1 = 0;
// did we have ins fault and RB bit cleared?
if ((ssw & MMU030_SSW_FB) && !(ssw & MMU030_SSW_RB)) {
uae_u16 stageb = get_word_mmu030(a7 + 0x0e);
- if (mmu030_opcode_v == -1U) {
+ if (mmu030_opcode_v == 0xffffffff) {
mmu030_opcode_stageb = stageb;
write_log(_T("Software fixed stage B! opcode = %04x\n"), stageb);
} else {
uae_u32 mmu030_state_1 = get_word_mmu030c(a7 + 0x32);
uae_u32 mmu030_state_2 = get_word_mmu030c(a7 + 0x34);
- uae_u32 mmu030_opcode_v = (ps & 0x80000000) ? -1U : (oc & 0xffff);
+ uae_u32 mmu030_opcode_v = (ps & 0x80000000) ? 0xffffffff : (oc & 0xffff);
uae_u32 mmu030_fmovem_store_0 = 0;
uae_u32 mmu030_fmovem_store_1 = 0;
}
}
-int vsynctimebase_orig;
+frame_time_t vsynctimebase_orig;
void compute_vsynctime(void)
{
- double svpos = maxvpos_nom;
- double shpos = maxhpos_short;
- double syncadjust = 1.0;
+ float svpos = maxvpos_nom + 0.0f;
+ float shpos = maxhpos_short + 0.0f;
+ float syncadjust = 1.0;
fake_vblank_hz = 0;
vblank_hz_mult = 0;
vsynctimebase_orig = vsynctimebase;
if (islinetoggle()) {
- shpos += 0.5;
+ shpos += 0.5f;
}
if (interlace_seen) {
- svpos += 0.5;
+ svpos += 0.5f;
} else if (lof_display) {
- svpos += 1.0;
+ svpos += 1.0f;
}
if (currprefs.produce_sound > 1) {
- double clk = svpos * shpos * fake_vblank_hz;
+ float clk = svpos * shpos * fake_vblank_hz;
write_log(_T("SNDRATE %.1f*%.1f*%.6f=%.6f\n"), svpos, shpos, fake_vblank_hz, clk);
devices_update_sound(clk, syncadjust);
}
struct chipset_refresh *cr = get_chipset_refresh(&currprefs);
while (cr) {
- double v = -1;
+ float v = -1;
if (!ad->picasso_on && !ad->picasso_requested_on) {
if (isvsync_chipset ()) {
if (!currprefs.gfx_variable_sync) {
if (cr->index == CHIPSET_REFRESH_PAL || cr->index == CHIPSET_REFRESH_NTSC) {
- if ((fabs(vblank_hz - 50.0) < 1 || fabs(vblank_hz - 60.0) < 1 || fabs(vblank_hz - 100.0) < 1 || fabs(vblank_hz - 120.0) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) {
+ if ((fabs(vblank_hz - 50.0f) < 1 || fabs(vblank_hz - 60.0f) < 1 || fabs(vblank_hz - 100.0) < 1 || fabs(vblank_hz - 120.0f) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) {
vsync_switchmode(0, (int)vblank_hz);
}
}
if (isvsync_chipset() < 0) {
- double v2;
+ float v2;
v2 = target_getcurrentvblankrate(0);
if (!cr->locked)
v = v2;
} else if (isvsync_chipset() > 0) {
- if (currprefs.gfx_apmode[0].gfx_refreshrate)
- v = abs(currprefs.gfx_apmode[0].gfx_refreshrate);
+ if (currprefs.gfx_apmode[0].gfx_refreshrate) {
+ v = (float)abs(currprefs.gfx_apmode[0].gfx_refreshrate);
+ }
}
}
} else {
if (cr->locked == false) {
changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = vblank_hz;
cfgfile_parse_lines (&changed_prefs, cr->commands, -1);
- if (cr->commands[0])
- write_log (_T("CMD1: '%s'\n"), cr->commands);
+ if (cr->commands[0]) {
+ write_log(_T("CMD1: '%s'\n"), cr->commands);
+ }
break;
} else {
v = cr->rate;
if (v > 0) {
changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = v;
cfgfile_parse_lines (&changed_prefs, cr->commands, -1);
- if (cr->commands[0])
- write_log (_T("CMD2: '%s'\n"), cr->commands);
+ if (cr->commands[0]) {
+ write_log(_T("CMD2: '%s'\n"), cr->commands);
+ }
}
} else {
if (cr->locked == false)
v = cr->rate;
changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = v;
cfgfile_parse_lines (&changed_prefs, cr->commands, -1);
- if (cr->commands[0])
- write_log (_T("CMD3: '%s'\n"), cr->commands);
+ if (cr->commands[0]) {
+ write_log(_T("CMD3: '%s'\n"), cr->commands);
+ }
}
found = true;
break;
compute_vsynctime();
- hblank_hz = (currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL) / (maxhpos + (islinetoggle() ? 0.5 : 0));
+ hblank_hz = (currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL) / (maxhpos + (islinetoggle() ? 0.5f : 0.0f));
write_log(_T("%s mode%s%s V=%.4fHz H=%0.4fHz (%dx%d+%d) IDX=%d (%s) D=%d RTG=%d/%d\n"),
isntsc ? _T("NTSC") : _T("PAL"),
if (!ecs_agnus) {
isntsc = currprefs.ntscmode ? 1 : 0;
}
- float clk = currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL;
+ float clk = (float)(currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL);
if (!isntsc) {
maxvpos = MAXVPOS_PAL;
maxhpos = MAXHPOS_PAL;
hardwired_vbstop = VBLANK_STOP_PAL;
equ_vblank_endline = EQU_ENDLINE_PAL;
equ_vblank_toggle = true;
- vblank_hz_shf = clk / ((maxvpos + 0) * maxhpos);
- vblank_hz_lof = clk / ((maxvpos + 1.0) * maxhpos);
- vblank_hz_lace = clk / ((maxvpos + 0.5) * maxhpos);
+ vblank_hz_shf = clk / ((maxvpos + 0.0f) * maxhpos);
+ vblank_hz_lof = clk / ((maxvpos + 1.0f) * maxhpos);
+ vblank_hz_lace = clk / ((maxvpos + 0.5f) * maxhpos);
} else {
maxvpos = MAXVPOS_NTSC;
maxhpos = MAXHPOS_NTSC;
hardwired_vbstop = VBLANK_STOP_NTSC;
equ_vblank_endline = EQU_ENDLINE_NTSC;
equ_vblank_toggle = false;
- vblank_hz_shf = clk / ((maxvpos + 0) * (maxhpos + 0.5));
- vblank_hz_lof = clk / ((maxvpos + 1.0) * (maxhpos + 0.5));
- vblank_hz_lace = clk / ((maxvpos + 0.5) * (maxhpos + 0.5));
+ vblank_hz_shf = clk / ((maxvpos + 0.0f) * (maxhpos + 0.5f));
+ vblank_hz_lof = clk / ((maxvpos + 1.0f) * (maxhpos + 0.5f));
+ vblank_hz_lace = clk / ((maxvpos + 0.5f) * (maxhpos + 0.5f));
}
dmal_htotal_mask = 0xffff;
if (vpos_count < 10) {
vpos_count = 10;
}
- vblank_hz = (isntsc ? 15734.0 : 15625.0) / vpos_count;
+ vblank_hz = (isntsc ? 15734.0f : 15625.0f) / vpos_count;
vblank_hz_nom = vblank_hz_shf = vblank_hz_lof = vblank_hz_lace = (float)vblank_hz;
maxvpos_nom = vpos_count - (lof_store ? 1 : 0);
if ((maxvpos_nom >= 256 && maxvpos_nom <= 313) || (beamcon0 & BEAMCON0_VARBEAMEN)) {
if (beamcon0 & BEAMCON0_VARBEAMEN) {
vblank_hz_nom = vblank_hz = clk / (maxvpos * maxhpos);
vblank_hz_shf = vblank_hz;
- vblank_hz_lof = clk / ((maxvpos + 1) * maxhpos);
- vblank_hz_lace = clk / ((maxvpos + 0.5) * maxhpos);
+ vblank_hz_lof = clk / ((maxvpos + 1.0f) * maxhpos);
+ vblank_hz_lace = clk / ((maxvpos + 0.5f) * maxhpos);
maxvpos_nom = maxvpos;
maxvpos_display = maxvpos;
static void sprite_get_bpl_data(int hpos, struct sprite *s, uae_u16 *dat)
{
int nr = get_bitplane_dma_rel(hpos, 1);
- uae_u32 v = (fmode & 3) ? fetched_aga[nr] : fetched_aga_spr[nr];
+ uae_u32 v = (uae_u32)((fmode & 3) ? fetched_aga[nr] : fetched_aga_spr[nr]);
dat[0] = v >> 16;
dat[1] = (uae_u16)v;
}
}
if (!currprefs.cpu_thread) {
while (!currprefs.turbo_emulation) {
- float v = rpt_vsync(clockadjust) / (syncbase / 1000.0);
+ float v = rpt_vsync(clockadjust) / (syncbase / 1000.0f);
if (v >= -FRAMEWAIT_MIN_MS)
break;
rtg_vsynccheck();
if ((timeframes & 7) == 0) {
double idle = 1000 - (idle_mavg.mavg == 0 ? 0.0 : (double)idle_mavg.mavg * 1000.0 / vsynctimebase);
- int fps = fps_mavg.mavg == 0 ? 0 : syncbase * 10 / fps_mavg.mavg;
+ int fps = fps_mavg.mavg == 0 ? 0 : (int)(syncbase * 10 / fps_mavg.mavg);
if (fps > 99999)
fps = 99999;
if (idle < 0)
if (currline >= nextline)
return;
if (vsync_hblank) {
- int diff = vsync_hblank / (nextline - currline);
+ int diff = (int)(vsync_hblank / (nextline - currline));
int us = 1000000 / diff;
if (us < target_sleep_nanos(-1)) { // spin if less than minimum sleep time
target_spin(nextline - currline - 1);
frame_rendered = true;
frame_shown = true;
do_display_slice();
- int vv = vsync_vblank;
+ int vv = (int)vsync_vblank;
while (vv >= 85) {
while (!currprefs.turbo_emulation && sync_timeout_check(maxtime)) {
maybe_process_pull_audio();
if (is_last_line()) {
// wait extra frames
- int vv = vsync_vblank;
+ int vv = (int)vsync_vblank;
for(;;) {
while (!currprefs.turbo_emulation && sync_timeout_check(maxtime)) {
maybe_process_pull_audio();
uae_u8 *restore_custom_extra(uae_u8 *src)
{
uae_u32 v = restore_u32();
+ uae_u8 tmp = 0;
if (!(v & 1))
v = 0;
//currprefs.a2091rom.enabled = changed_prefs.a2091rom.enabled = RBB;
//currprefs.a4091rom.enabled = changed_prefs.a4091rom.enabled = RBB;
- RBB;
- RBB;
- RBB;
+ tmp = RBB;
+ tmp = RBB;
+ tmp = RBB;
currprefs.cs_pcmcia = changed_prefs.cs_pcmcia = RBB;
currprefs.cs_ciaatod = changed_prefs.cs_ciaatod = RB;
static int last_hpos1, last_hpos2;
static int last_vpos1, last_vpos2;
static int last_frame = -1;
-static uae_u32 last_cycles1, last_cycles2;
+static evt_t last_cycles1, last_cycles2;
static uaecptr processptr;
static uae_char *processname;
struct refdata
{
- uae_u32 c;
+ evt_t c;
uae_u32 cnt;
};
static struct refdata refreshtable[1024];
{
int max = ecs_agnus ? 512 : 256;
int reffail = 0;
- uae_u32 c = get_cycles();
+ evt_t c = get_cycles();
for (int i = 0; i < max; i++) {
struct refdata *rd = &refreshtable[i];
if (rd->cnt < 10) {
ras = (rp >> 1) & 0xff;
}
struct refdata *rd = &refreshtable[ras];
- uae_u32 c = get_cycles();
+ evt_t c = get_cycles();
rd->c = c;
rd->cnt = 0;
}
{
if (last_dma_rec) {
if (last_dma_rec->cf_reg != 0xffff) {
- last_dma_rec->cf_dat = v;
+ last_dma_rec->cf_dat = (uae_u16)v;
} else {
last_dma_rec->dat = v;
}
debug_mark_refreshed(dr->addr);
}
-static bool get_record_dma_info(struct dma_rec *dr, int hpos, int vpos, uae_u32 cycles, TCHAR *l1, TCHAR *l2, TCHAR *l3, TCHAR *l4, TCHAR *l5)
+static bool get_record_dma_info(struct dma_rec *dr, int hpos, int vpos, evt_t cycles, TCHAR *l1, TCHAR *l2, TCHAR *l3, TCHAR *l4, TCHAR *l5)
{
int longsize = dr->size;
bool got = false;
{
struct dma_rec *dr, *dr_start;
int h, i, maxh;
- uae_u32 cycles;
+ evt_t cycles;
if (!dma_record[0] || hpos < 0 || vpos < 0)
return;
console_out_f (_T("%04X "), get_word_debug (addr + i * 2));
console_out_f (_T("\n"));
- ypos = w1 >> 8;
+ ypos = (int)(w1 >> 8);
xpos = w1 & 255;
- ypose = w2 >> 8;
+ ypose = (int)(w2 >> 8);
attach = (w2 & 0x80) ? 1 : 0;
if (w2 & 4)
ypos |= 256;
};
static dsprintfstack debugsprintf_stack[DEBUGSPRINTF_SIZE];
static uae_u16 debugsprintf_latch, debugsprintf_latched;
-static uae_u32 debugsprintf_cycles, debugsprintf_cycles_set;
+static evt_t debugsprintf_cycles, debugsprintf_cycles_set;
static uaecptr debugsprintf_va;
static int debugsprintf_mode;
char s[256];
if (!strcmp(p, "CYCLES")) {
if (debugsprintf_cycles_set) {
- v = (get_cycles() - debugsprintf_cycles) / CYCLE_UNIT;
+ v = (uae_u32)((get_cycles() - debugsprintf_cycles) / CYCLE_UNIT);
} else {
v = 0xffffffff;
}
cpuboard_rethink();
}
-void devices_update_sound(double clk, double syncadjust)
+void devices_update_sound(float clk, float syncadjust)
{
update_sound (clk);
update_sndboard_sound (clk / syncadjust);
x86_update_sound(clk / syncadjust);
}
-void devices_update_sync(double svpos, double syncadjust)
+void devices_update_sync(float svpos, float syncadjust)
{
cd32_fmv_set_sync(svpos, syncadjust);
}
static int fifo_inuse[3];
static int dma_enable, bitoffset, syncoffset;
static uae_u16 word, dsksync;
-static unsigned long dsksync_cycles;
+static evt_t dsksync_cycles;
#define WORDSYNC_TIME 11
/* Always carried through to the next line. */
int disk_hpos;
int dskready_down_time;
int writtento;
int steplimit;
- frame_time_t steplimitcycle;
+ evt_t steplimitcycle;
int indexhack, indexhackmode;
int ddhd; /* 1=DD 2=HD */
int drive_id_scnt; /* drive id shift counter */
if (currprefs.m68k_speed != 0)
return;
drv->steplimit = 4;
- drv->steplimitcycle = get_cycles ();
+ drv->steplimitcycle = get_cycles();
}
static bool drive_empty (drive * drv)
DISK_update (hpos);
v = dskbytr_val;
dskbytr_val &= ~0x8000;
- if (word == dsksync && cycles_in_range (dsksync_cycles)) {
+ if (word == dsksync && cycles_in_range(dsksync_cycles)) {
v |= 0x1000;
if (disk_debug_logging > 1) {
dumpdisk(_T("DSKBYTR SYNC"));
#define SCALA_GREEN 12
static int dflag;
-static unsigned int cycles;
+static frame_time_t cycles;
/*
RoboCop 3
}
}
zfile_fseek (f, 0, SEEK_END);
- size = zfile_ftell (f);
+ size = zfile_ftell32(f);
buf = xmalloc (uae_u8, size);
zfile_fseek (f, 0, SEEK_SET);
zfile_fread (buf, size, 1, f);
int lx = GetDeviceCaps (memHDC, LOGPIXELSX);
int rounds = 0;
while (rounds < 2) {
- curFont = CreateFont (thisFontVertPoints * dpiY / ly + 0.5, thisFontHorizPoints * dpiX / lx + 0.5,
+ curFont = CreateFont ((int)(thisFontVertPoints * dpiY / ly + 0.5), (int)(thisFontHorizPoints * dpiX / lx + 0.5),
0, 0,
FW_NORMAL,
(style & STYLE_ITALICS) ? TRUE : FALSE,
// Default tabs => Each eight characters
for (i = 0; i < 32; i++)
- horiztabs[i] = i * 8 * (1.0 / (Real64)cpi);
+ horiztabs[i] = i * 8.0f * (1.0f / (Real64)cpi);
numHorizTabs = 32;
numVertTabs = 255;
}
break;
case 0x21: // Master select (ESC !)
- cpi = params[0] & 0x01 ? 12:10;
+ cpi = (params[0] & 0x01 ? 12:10) + 0.0f;
// Reset first seven bits
style &= 0xFF80;
else
{
if (hmi < 0)
- curX += 1.0/(Real64)actcpi;
+ curX += 1.0f / (Real64)actcpi;
else
curX += hmi;
}
if (style & STYLE_STRIKETHROUGH)
lineY = PIXY + deltaY + ascender / 2;
if (style & STYLE_OVERSCORE)
- lineY = PIXY + deltaY - otm->otmTextMetrics.tmDescent - ((score == SCORE_DOUBLE || score == SCORE_DOUBLEBROKEN) ? 5 : 0);
+ lineY = (uae_u16)(PIXY + deltaY - otm->otmTextMetrics.tmDescent - ((score == SCORE_DOUBLE || score == SCORE_DOUBLEBROKEN) ? 5 : 0));
drawLine(lineStart, xEnd, lineY, score == SCORE_SINGLEBROKEN || score == SCORE_DOUBLEBROKEN);
if (score == SCORE_DOUBLE || score == SCORE_DOUBLEBROKEN)
fdi = fdi_malloc (FDI, 1);
memset (fdi, 0, sizeof (FDI));
fdi->file = f;
- oldseek = zfile_ftell (fdi->file);
+ oldseek = zfile_ftell32(fdi->file);
zfile_fseek (fdi->file, 0, SEEK_SET);
zfile_fread (fdi->header, 2048, 1, fdi->file);
zfile_fseek (fdi->file, oldseek, SEEK_SET);
static uae_u32 a_uniq, key_uniq;
-#define PUT_PCK_RES1(p,v) do { put_long_host((p)->packet_data + dp_Res1, (v)); } while (0)
-#define PUT_PCK_RES2(p,v) do { put_long_host((p)->packet_data + dp_Res2, (v)); } while (0)
+#define PUT_PCK_RES1(p,v) do { put_long_host((p)->packet_data + dp_Res1, ((uae_u32)v)); } while (0)
+#define PUT_PCK_RES2(p,v) do { put_long_host((p)->packet_data + dp_Res2, ((uae_u32)v)); } while (0)
#define GET_PCK_TYPE(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Type)))
#define GET_PCK_RES1(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Res1)))
#define GET_PCK_RES2(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Res2)))
t -= diff;
if (t < 0)
t = 0;
- *days = t / msecs_per_day;
+ *days = (int)(t / msecs_per_day);
t -= *days * msecs_per_day;
- *mins = t / (60 * 1000);
+ *mins = (int)(t / (60 * 1000));
t -= *mins * (60 * 1000);
- *ticks = t / (1000 / tickcount);
+ *ticks = (int)(t / (1000 / tickcount));
}
void amiga_to_timeval (struct mytimeval *tv, int days, int mins, int ticks, int tickcount)
else if (fsf->fstype == FS_DIRECTORY)
return my_read (fsf->of, b, size);
else if (fsf->fstype == FS_CDFS)
- return isofs_read (fsf->isof, b, size);
+ return (unsigned int)isofs_read (fsf->isof, b, size);
return 0;
}
static unsigned int fs_write (struct fs_filehandle *fsf, void *b, unsigned int size)
return isofs_lseek (fsf->isof, offset, whence);
return -1;
}
-static uae_s32 fs_lseek (struct fs_filehandle *fsf, uae_s32 offset, int whence)
+static uae_s32 fs_lseek (struct fs_filehandle *fsf, uae_s64 offset, int whence)
{
uae_s64 v = fs_lseek64 (fsf, offset, whence);
if (v < 0 || v > 0x7fffffff)
return a;
}
-static uaecptr make_lock(TrapContext *ctx, Unit *unit, uae_u32 uniq, long mode)
+static uaecptr make_lock(TrapContext *ctx, Unit *unit, uae_u32 uniq, uae_u32 mode)
{
/* allocate lock from the list kept by the assembly code */
uaecptr lock;
blocksize = (unit->volflags & MYVOLUMEINFO_CDFS) ? 2048 : 512;
numblocks = (statbuf.size + blocksize - 1) / blocksize;
- put_long_host(buf + 128, numblocks > MAXFILESIZE32 ? MAXFILESIZE32 : numblocks);
+ put_long_host(buf + 128, (uae_u32)(numblocks > MAXFILESIZE32 ? MAXFILESIZE32 : numblocks));
if (longfilesize) {
/* MorphOS 64-bit file length support */
lr->pos = pos;
lr->len = len;
lr->mode = mode;
- lr->timeout = timeout * vblank_hz / 50;
+ lr->timeout = (uae_u32)(timeout * vblank_hz / 50);
lr->msg = msg;
return lr;
}
if (type >= 2)
trap_put_long(ctx, exp + 8, entrytype);
if (type >= 3)
- trap_put_long(ctx, exp + 12, statbuf.size > MAXFILESIZE32 ? MAXFILESIZE32 : statbuf.size);
+ trap_put_long(ctx, exp + 12, (uae_u32)(statbuf.size > MAXFILESIZE32 ? MAXFILESIZE32 : statbuf.size));
if (type >= 4)
trap_put_long(ctx, exp + 16, flags);
if (type >= 5) {
}
if (type >= 6) {
trap_put_long(ctx, exp + 32, exp + size2);
- trap_put_byte(ctx, exp + size2, strlen (comment));
+ trap_put_byte(ctx, exp + size2, (uae_u8)strlen(comment));
for (i = 0; i <= strlen (comment); i++) {
trap_put_byte(ctx, exp + size2, comment[i]);
size2++;
filesize = key_filesize(k);
cur = k->file_pos;
if (size > filesize - cur)
- size = filesize - cur;
+ size = (uae_u32)(filesize - cur);
if (size == 0) {
PUT_PCK_RES1 (packet, 0);
{ TRAPCMD_GET_LONG, { ui->self->locklist }, 2, 1 },
{ TRAPCMD_PUT_LONG },
{ TRAPCMD_PUT_LONG, { ui->self->locklist, morelocks }},
- { ui->self->volume ? TRAPCMD_GET_BYTE : TRAPCMD_NOP, { ui->self->volume + 64 }},
+ { (uae_u16)(ui->self->volume ? TRAPCMD_GET_BYTE : TRAPCMD_NOP), { ui->self->volume + 64 }},
};
trap_multi(ctx, md, sizeof md / sizeof(struct trapmd));
trap_put_bytes(ctx, fs, addr, fssize);
// filesystem debugging, negative FSSIZE = debug mode.
if (segtrack_mode & 2) {
- trap_put_long(ctx, parmpacket + PP_FSSIZE, -trap_get_long(ctx, parmpacket + PP_FSSIZE));
+ trap_put_long(ctx, parmpacket + PP_FSSIZE, 0 - trap_get_long(ctx, parmpacket + PP_FSSIZE));
}
}
return 0;
for (i = 0; i < blocksize; i++)
sum += rl (p + i * 4);
- sum = -sum;
+ sum = 0 - sum;
if (sum) {
TCHAR *s = au (id);
write_log (_T("RDB: block %d ('%s') checksum error\n"), block, s);
}
zfile_fseek (zf, 0, SEEK_END);
- size = zfile_ftell (zf);
+ size = zfile_ftell32(zf);
if (size > 0) {
zfile_fseek (zf, 0, SEEK_SET);
uip->rdb_filesysstore = xmalloc (uae_u8, size);
}
memset(buf, 0, sizeof buf);
char *s = ua_fs(uip[unit_no].devname, -1);
- buf[36] = strlen(s);
+ buf[36] = (uae_u8)strlen(s);
for (int i = 0; i < buf[36]; i++)
buf[37 + i] = s[i];
xfree(s);
missing = 0;
a = xcalloc (a_inode, 1);
- a->uniq = restore_u64 ();
- a->locked_children = restore_u32 ();
- a->exnext_count = restore_u32 ();
- a->shlock = restore_u32 ();
- flags = restore_u32 ();
+ a->uniq = restore_u64to32();
+ a->locked_children = restore_u32();
+ a->exnext_count = restore_u32();
+ a->shlock = restore_u32();
+ flags = restore_u32();
if (flags & 1)
a->elock = 1;
if (flags & 4)
missing = 0;
k = xcalloc (Key, 1);
- k->uniq = restore_u64 ();
- k->file_pos = restore_u32 ();
- k->createmode = restore_u32 ();
- k->dosmode = restore_u32 ();
- savedsize = restore_u32 ();
- uniq = restore_u64 ();
- p = restore_string ();
- pos = restore_u64 ();
- size = restore_u64 ();
+ k->uniq = restore_u64to32();
+ k->file_pos = restore_u32();
+ k->createmode = restore_u32();
+ k->dosmode = restore_u32();
+ savedsize = restore_u32();
+ uniq = restore_u64to32();
+ p = restore_string();
+ pos = restore_u64();
+ size = restore_u64();
if (size) {
savedsize = size;
k->file_pos = pos;
uae_u8 *buf = xcalloc (uae_u8, 10000);
uae_u64 sp = savedsize;
while (sp) {
- uae_u32 s = sp >= 10000 ? 10000 : sp;
- fs_write (k->fd, buf, s);
+ uae_s64 s = sp >= 10000 ? 10000 : sp;
+ fs_write (k->fd, buf, (uae_u32)s);
sp -= s;
}
xfree(buf);
Unit *u = startup_create_unit(NULL, ui, num);
int cnt;
- u->dosbase = restore_u32 ();
- u->volume = restore_u32 ();
- u->port = restore_u32 ();
- u->locklist = restore_u32 ();
- u->dummy_message = restore_u32 ();
- u->cmds_sent = restore_u64 ();
- u->cmds_complete = restore_u64 ();
- u->cmds_acked = restore_u64 ();
- u->next_exkey = restore_u32 ();
- u->total_locked_ainos = restore_u32 ();
+ u->dosbase = restore_u32();
+ u->volume = restore_u32();
+ u->port = restore_u32();
+ u->locklist = restore_u32();
+ u->dummy_message = restore_u32();
+ u->cmds_sent = restore_u64to32();
+ u->cmds_complete = restore_u64to32();
+ u->cmds_acked = restore_u64to32();
+ u->next_exkey = restore_u32();
+ u->total_locked_ainos = restore_u32();
u->volflags = ui->volflags;
- cnt = restore_u32 ();
+ cnt = restore_u32();
write_log (_T("FS: restoring %d locks\n"), cnt);
while (cnt-- > 0)
src = restore_aino (ui, u, src);
- cnt = restore_u32 ();
+ cnt = restore_u32();
write_log (_T("FS: restoring %d open files\n"), cnt);
while (cnt-- > 0)
src = restore_key (ui, u, src);
- cnt = restore_u32 ();
+ cnt = restore_u32();
write_log (_T("FS: restoring %d notifications\n"), cnt);
while (cnt-- > 0)
src = restore_notify (ui, u, src);
- cnt = restore_u32 ();
+ cnt = restore_u32();
write_log (_T("FS: restoring %d exkeys\n"), cnt);
while (cnt-- > 0)
src = restore_exkey (ui, u, src);
cd_unit_number = 0;
filesys_prepare_reset2 ();
filesys_reset2 ();
- a_uniq = restore_u64 ();
- key_uniq = restore_u64 ();
+ a_uniq = restore_u64to32();
+ key_uniq = restore_u64to32();
xfree(new_filesys_root_path);
xfree(new_filesys_fs_path);
eeprom->eecs = eecs;
eeprom->eesk = eesk;
eeprom->eedo = eedo;
- eeprom->address = address;
+ eeprom->address = (uae_u8)address;
eeprom->command = command;
}
{
eeprom93xx_eeprom_t *eeprom = (eeprom93xx_eeprom_t*)eepromp;
if (offset & 1)
- return eeprom->contents[offset / 2];
+ return (uae_u8)eeprom->contents[offset / 2];
else
return eeprom->contents[offset / 2] >> 8;
}
digit = significand % 10;
significand /= 10;
if (len == 0) {
- pack_int = digit;
+ pack_int = (uae_u32)digit;
} else {
pack_frac |= digit << (64 - len * 4);
}
digit = exponent % 10;
exponent /= 10;
if (len == 0) {
- pack_exp4 = digit;
+ pack_exp4 = (uae_u32)digit;
} else {
pack_exp |= digit << (12 - len * 4);
}
if (!pcmcia_disk->hfd.drive_empty) {
int extrasize = 0;
- pcmcia_common_size = pcmcia_disk->hfd.virtsize;
+ pcmcia_common_size = (int)pcmcia_disk->hfd.virtsize;
if (pcmcia_disk->hfd.virtsize > 4 * 1024 * 1024) {
write_log (_T("PCMCIA SRAM: too large device, %llu bytes\n"), pcmcia_disk->hfd.virtsize);
- extrasize = pcmcia_disk->hfd.virtsize - 4 * 1024 * 1024;
+ extrasize = (int)pcmcia_disk->hfd.virtsize - 4 * 1024 * 1024;
if (extrasize > 262144)
extrasize = 262144;
extrasize &= ~511;
if (!gb->vgaio)
return v;
portnum -= 0x3b0;
- v = gb->vgaio->read(&gb->vga, portnum, 1);
+ v = (uae_u8)gb->vgaio->read(&gb->vga, portnum, 1);
v = bget_regtest(gb, portnum, v);
return v;
}
if (!gb->vgalowram)
return 0xff;
offset -= 0xa0000;
- return gb->vgalowram->read(&gb->vga, offset, 1);
+ return (uae_u8)gb->vgalowram->read(&gb->vga, offset, 1);
}
void vgalfb_ram_put(int board, int offset, uae_u8 v)
{
struct rtggfxboard *gb = &rtggfxboards[board];
if (!gb->vgaram)
return 0xff;
- return gb->vgaram->read(&gb->vga, offset, 1);
+ return (uae_u8)gb->vgaram->read(&gb->vga, offset, 1);
}
void *memory_region_get_ram_ptr(MemoryRegion *mr)
{
uae_u32 v;
if (!gb->vram_enabled) {
- const MemoryRegionOps *bank = getvgabank (gb, &addr);
+ const MemoryRegionOps *bank = getvgabank(gb, &addr);
if (bs < 0) { // WORD
- v = bank->read (&gb->vga, addr + 1, 1) << 24;
- v |= bank->read (&gb->vga, addr + 0, 1) << 16;
- v |= bank->read (&gb->vga, addr + 3, 1) << 8;
- v |= bank->read (&gb->vga, addr + 2, 1) << 0;
+ v = ((uae_u8)bank->read(&gb->vga, addr + 1, 1)) << 24;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 0, 1)) << 16;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 3, 1)) << 8;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 2, 1)) << 0;
} else if (bs > 0) { // LONG
- v = bank->read (&gb->vga, addr + 3, 1) << 24;
- v |= bank->read (&gb->vga, addr + 2, 1) << 16;
- v |= bank->read (&gb->vga, addr + 1, 1) << 8;
- v |= bank->read (&gb->vga, addr + 0, 1) << 0;
+ v = ((uae_u8)bank->read(&gb->vga, addr + 3, 1)) << 24;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 2, 1)) << 16;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 1, 1)) << 8;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 0, 1)) << 0;
} else {
- v = bank->read (&gb->vga, addr + 0, 1) << 24;
- v |= bank->read (&gb->vga, addr + 1, 1) << 16;
- v |= bank->read (&gb->vga, addr + 2, 1) << 8;
- v |= bank->read (&gb->vga, addr + 3, 1) << 0;
+ v = ((uae_u8)bank->read(&gb->vga, addr + 0, 1)) << 24;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 1, 1)) << 16;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 2, 1)) << 8;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 3, 1)) << 0;
}
} else {
uae_u8 *m = gb->vram + addr;
} else if (bs > 0) {
v = *((uae_u32*)m);
} else {
- v = do_get_mem_long ((uae_u32*)m);
+ v = do_get_mem_long((uae_u32*)m);
}
}
#if MEMLOGR
if (!gb->vram_enabled) {
const MemoryRegionOps *bank = getvgabank (gb, &addr);
if (bs) {
- v = bank->read (&gb->vga, addr + 0, 1) << 0;
- v |= bank->read (&gb->vga, addr + 1, 1) << 8;
+ v = ((uae_u8)bank->read(&gb->vga, addr + 0, 1)) << 0;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 1, 1)) << 8;
} else {
- v = bank->read (&gb->vga, addr + 0, 1) << 8;
- v |= bank->read (&gb->vga, addr + 1, 1) << 0;
+ v = ((uae_u8)bank->read(&gb->vga, addr + 0, 1)) << 8;
+ v |= ((uae_u8)bank->read(&gb->vga, addr + 1, 1)) << 0;
}
} else {
uae_u8 *m = gb->vram + addr;
if (!gb->vram_enabled) {
const MemoryRegionOps *bank = getvgabank (gb, &addr);
if (bs)
- v = bank->read (&gb->vga, addr ^ 1, 1);
+ v = (uae_u8)bank->read(&gb->vga, addr ^ 1, 1);
else
- v = bank->read (&gb->vga, addr + 0, 1);
+ v = (uae_u8)bank->read(&gb->vga, addr + 0, 1);
} else {
if (bs)
v = gb->vram[addr ^ 1];
if (!gb->vram_enabled) {
const MemoryRegionOps *bank = getvgabank (gb, &addr);
if (bs) {
- bank->write (&gb->vga, addr + 0, (w >> 0) & 0xff, 1);
- bank->write (&gb->vga, addr + 1, w >> 8, 1);
+ bank->write(&gb->vga, addr + 0, (w >> 0) & 0xff, 1);
+ bank->write(&gb->vga, addr + 1, w >> 8, 1);
} else {
- bank->write (&gb->vga, addr + 0, w >> 8, 1);
- bank->write (&gb->vga, addr + 1, (w >> 0) & 0xff, 1);
+ bank->write(&gb->vga, addr + 0, w >> 8, 1);
+ bank->write(&gb->vga, addr + 1, (w >> 0) & 0xff, 1);
}
} else {
uae_u8 *m = gb->vram + addr;
special_mem |= S_WRITE;
#endif
if (bs)
- bank->write (&gb->vga, addr ^ 1, b, 1);
+ bank->write(&gb->vga, addr ^ 1, b, 1);
else
- bank->write (&gb->vga, addr, b, 1);
+ bank->write(&gb->vga, addr, b, 1);
} else {
if (bs)
gb->vram[addr ^ 1] = b;
uae_u32 v = 0xffffffff;
addr = mungeaddr (gb, addr, false);
if (addr)
- v = gb->vgaio->read (&gb->vga, addr, 4);
+ v = (uae_u32)gb->vgaio->read (&gb->vga, addr, 4);
return v;
}
static uae_u32 REGPARAM2 gfxboard_wget_regs (uaecptr addr)
addr = mungeaddr (gb, addr, false);
if (addr) {
uae_u8 v1, v2;
- v1 = gb->vgaio->read (&gb->vga, addr + 0, 1);
+ v1 = (uae_u8)gb->vgaio->read (&gb->vga, addr + 0, 1);
v1 = bget_regtest (gb, addr + 0, v1);
- v2 = gb->vgaio->read (&gb->vga, addr + 1, 1);
+ v2 = (uae_u8)gb->vgaio->read (&gb->vga, addr + 1, 1);
v2 = bget_regtest (gb, addr + 1, v2);
v = (v1 << 8) | v2;
}
}
addr = mungeaddr (gb, addr, false);
if (addr) {
- v = gb->vgaio->read (&gb->vga, addr, 1);
+ v = (uae_u8)gb->vgaio->read (&gb->vga, addr, 1);
v = bget_regtest (gb, addr, v);
#if REGDEBUG
write_log(_T("GFX VGA BYTE GET IO %04X = %02X PC=%08x\n"), addr & 65535, v & 0xff, M68K_GETPC);
// memory mapped io
if (addr >= gb->p4_mmiobase && addr < gb->p4_mmiobase + 0x8000) {
uae_u32 addr2 = addr - gb->p4_mmiobase;
- v = gb->vgammio->read(&gb->vga, addr2 + 0, 1) << 24;
- v |= gb->vgammio->read(&gb->vga, addr2 + 1, 1) << 16;
- v |= gb->vgammio->read(&gb->vga, addr2 + 2, 1) << 8;
- v |= gb->vgammio->read(&gb->vga, addr2 + 3, 1) << 0;
+ v = ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 0, 1)) << 24;
+ v |= ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 1, 1)) << 16;
+ v |= ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 2, 1)) << 8;
+ v |= ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 3, 1)) << 0;
#if PICASSOIV_DEBUG_IO
write_log (_T("PicassoIV MMIO LGET %08x %08x\n"), addr, v);
#endif
// memory mapped io
if (addr >= gb->p4_mmiobase && addr < gb->p4_mmiobase + 0x8000) {
uae_u32 addr2 = addr - gb->p4_mmiobase;
- v = gb->vgammio->read(&gb->vga, addr2 + 0, 1) << 8;
- v |= gb->vgammio->read(&gb->vga, addr2 + 1, 1) << 0;
+ v = ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 0, 1)) << 8;
+ v |= ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 1, 1)) << 0;
#if PICASSOIV_DEBUG_IO
write_log (_T("PicassoIV MMIO WGET %08x %04x\n"), addr, v & 0xffff);
#endif
// memory mapped io
if (addr >= gb->p4_mmiobase && addr < gb->p4_mmiobase + 0x8000) {
uae_u32 addr2 = addr - gb->p4_mmiobase;
- v = gb->vgammio->read(&gb->vga, addr2, 1);
+ v = (uae_u8)gb->vgammio->read(&gb->vga, addr2, 1);
#if PICASSOIV_DEBUG_IO
write_log (_T("PicassoIV MMIO BGET %08x %02x\n"), addr, v & 0xff);
#endif
addr -= 0x10000;
uaecptr addr2 = mungeaddr (gb, addr, true);
if (addr2) {
- v = gb->vgaio->read (&gb->vga, addr2, 1);
- v = bget_regtest (gb, addr2, v);
+ v = (uae_u8)gb->vgaio->read(&gb->vga, addr2, 1);
+ v = bget_regtest(gb, addr2, v);
//write_log(_T("P4 VGA read %08X=%02X PC=%08x\n"), addr2, v, M68K_GETPC);
}
//write_log (_T("PicassoIV IO %08x %02x\n"), addr, v);
static float video_gamma (float value, float gamma, float bri, float con)
{
- double factor;
+ float factor;
float ret;
value += bri;
if (value <= 0.0f)
return 0.0f;
- factor = pow(255.0f, 1.0f - gamma);
+ factor = (float)pow(255.0f, 1.0f - gamma);
ret = (float)(factor * pow(value, gamma));
if (ret < 0.0f)
} else {
bri = ((float)(currprefs.gfx_luminance)) * (128.0f / 1000.0f);
con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f;
- gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f - 1.0;
+ gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f - 1.0f;
}
gams[0] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[0])) / 1000.0f;
for (int i = 0; i < (256 * 3); i++) {
for (int j = 0; j < 3; j++) {
- float val = i - 256;
+ float val = i - 256.0f;
float v;
if (currprefs.gfx_threebitcolors == 2) {
val *= 2;
} else if (currprefs.gfx_threebitcolors == 3) {
- val = (val * 252.0) / 119.0;
+ val = (float)((val * 252.0) / 119.0);
} else if (currprefs.gfx_threebitcolors == 1) {
- val = (val * 252.0) / 238.0;
+ val = (float)((val * 252.0) / 238.0);
}
if (gfx_hdr || (currprefs.gfx_luminance == 0 && currprefs.gfx_contrast == 0 && currprefs.gfx_gamma == 0 &&
}
}
-static uae_u32 limit256(int monid, double v)
+static uae_u32 limit256(int monid, float v)
{
struct amigadisplay *ad = &adisplays[monid];
if (!gfx_hdr) {
- v = v * (double)(currprefs.gf[ad->picasso_on].gfx_filter_contrast + 1000) / 1000.0 + currprefs.gf[ad->picasso_on].gfx_filter_luminance / 10.0;
+ v = v * (float)(currprefs.gf[ad->picasso_on].gfx_filter_contrast + 1000) / 1000.0f + currprefs.gf[ad->picasso_on].gfx_filter_luminance / 10.0f;
}
if (v < 0)
v = 0;
v = 255;
return (uae_u32)v;
}
-static uae_s32 limit256rb(int monid, double v)
+static uae_s32 limit256rb(int monid, float v)
{
struct amigadisplay *ad = &adisplays[monid];
if (!gfx_hdr) {
- v *= (double)(currprefs.gf[ad->picasso_on].gfx_filter_saturation + 1000) / 1000.0;
+ v *= (float)(currprefs.gf[ad->picasso_on].gfx_filter_saturation + 1000) / 1000.0f;
}
if (v < -128)
v = -128;
v = 127;
return (uae_s32)v;
}
-static double get_y(int r, int g, int b)
+static float get_y(int r, int g, int b)
{
return 0.2989f * r + 0.5866f * g + 0.1145f * b;
}
static void ww (uae_u8 *p, uae_u16 v)
{
p[0] = v >> 8;
- p[1] = v;
+ p[1] = (uae_u8)v;
}
static int rl (uae_u8 *p)
{
// old-style head=1, spt=32 always mode
head = 1;
spt = 32;
- cyl = total / (head * spt);
+ cyl = (int)(total / (head * spt));
} else {
int maxhead = sptt[i] < 255 ? 16 : 255;
spt = sptt[i];
for (head = 4; head <= maxhead; head++) {
- cyl = total / (head * spt);
+ cyl = (int)(total / (head * spt));
if (size <= 512 * 1024 * 1024) {
if (cyl <= 1023)
break;
if (idegeometry) {
*phead = 16;
*psectorspertrack = 63;
- *pcyl = blocks / ((*psectorspertrack) * (*phead));
+ *pcyl = (int)(blocks / ((*psectorspertrack) * (*phead)));
if (blocks > 16515072) {
/* >8G, CHS=16383/16/63 */
*pcyl = 16383;
blocksize = rl (p + 1 * 4);
for (i = 0; i < blocksize; i++)
sum += rl (p + i * 4);
- sum = -sum;
+ sum = 0 - sum;
pl (p, 2, sum);
}
pl(part, 6, -1);
pl(part, 7, -1);
pl(part, 8, 0); // devflags
- part[9 * 4] = _tcslen (hfd->ci.devname);
+ part[9 * 4] = (uae_u8)_tcslen(hfd->ci.devname);
ua_copy ((char*)part + 9 * 4 + 1, 30, hfd->ci.devname);
denv = part + 128;
pl(denv, 0, 16);
uae_u8 buf[512] = { 0 };
hdf_read (&hfd->hfd, buf, 0, 512);
if (buf[0] != 0 && memcmp (buf, _T("RDSK"), 4)) {
- ci->highcyl = (hfd->hfd.virtsize / ci->blocksize) / (ci->sectors * ci->surfaces);
+ ci->highcyl = (int)((hfd->hfd.virtsize / ci->blocksize) / (ci->sectors * ci->surfaces));
ci->dostype = rl (buf);
create_virtual_rdb (&hfd->hfd);
while (ci->highcyl * ci->surfaces * ci->sectors > hfd->cyls_def * hfd->secspertrack_def * hfd->heads_def) {
if (len & 511)
return read;
while (len > 0) {
- uae_u32 bamoffset = (offset / hfd->vhd_blocksize) * 4 + hfd->vhd_bamoffset;
+ uae_u32 bamoffset = (uae_u32)((offset / hfd->vhd_blocksize) * 4 + hfd->vhd_bamoffset);
uae_u32 sectoroffset = gl (hfd->vhd_header + bamoffset);
if (sectoroffset == 0xffffffff) {
memset (dataptr, 0, 512);
}
// write new offset to BAM
p = hfd->vhd_header + bamoffset;
- block = hfd->vhd_footerblock / 512;
+ block = (uae_u32)(hfd->vhd_footerblock / 512);
p[0] = block >> 24;
p[1] = block >> 16;
p[2] = block >> 8;
if (len & 511)
return written;
while (len > 0) {
- uae_u32 bamoffset = (offset / hfd->vhd_blocksize) * 4 + hfd->vhd_bamoffset;
+ uae_u32 bamoffset = (uae_u32)((offset / hfd->vhd_blocksize) * 4 + hfd->vhd_bamoffset);
uae_u32 sectoroffset = gl (hfd->vhd_header + bamoffset);
if (sectoroffset == 0xffffffff) {
if (!vhd_write_enlarge (hfd, bamoffset))
blocksize = 2 * 1024 * 1024;
else
blocksize = 512 * 1024;
- batsize = (size + blocksize - 1) / blocksize;
+ batsize = (uae_u32)((size + blocksize - 1) / blocksize);
batentrysize = batsize;
batsize *= 4;
batsize += 511;
b[0x10 + 6] = 2; // data offset
// time stamp
tm = time (NULL) - 946684800;
- b[0x18] = tm >> 24;
- b[0x19] = tm >> 16;
- b[0x1a] = tm >> 8;
- b[0x1b] = tm >> 0;
+ b[0x18] = (uae_u8)(tm >> 24);
+ b[0x19] = (uae_u8)(tm >> 16);
+ b[0x1a] = (uae_u8)(tm >> 8);
+ b[0x1b] = (uae_u8)(tm >> 0);
strcpy ((char*)b + 0x1c, "vpc "); // creator application
b[0x21] = 5; // creator version
strcpy ((char*)b + 0x24, "Wi2k"); // creator host os
// original and current size
- b[0x28] = b[0x30] = size >> 56;
- b[0x29] = b[0x31] = size >> 48;
- b[0x2a] = b[0x32] = size >> 40;
- b[0x2b] = b[0x33] = size >> 32;
- b[0x2c] = b[0x34] = size >> 24;
- b[0x2d] = b[0x35] = size >> 16;
- b[0x2e] = b[0x36] = size >> 8;
- b[0x2f] = b[0x37] = size >> 0;
+ b[0x28] = b[0x30] = (uae_u8)(size >> 56);
+ b[0x29] = b[0x31] = (uae_u8)(size >> 48);
+ b[0x2a] = b[0x32] = (uae_u8)(size >> 40);
+ b[0x2b] = b[0x33] = (uae_u8)(size >> 32);
+ b[0x2c] = b[0x34] = (uae_u8)(size >> 24);
+ b[0x2d] = b[0x35] = (uae_u8)(size >> 16);
+ b[0x2e] = b[0x36] = (uae_u8)(size >> 8);
+ b[0x2f] = b[0x37] = (uae_u8)(size >> 0);
getchs2 (&hfd, &cyl, &cylsec, &head, &tracksec);
// cylinders
b[0x38] = cyl >> 8;
int ret = 0, extra = 0;
if (offset < hfd->virtual_size) {
uae_s64 len2 = offset + len <= hfd->virtual_size ? len : hfd->virtual_size - offset;
+ if (len > INT_MAX) {
+ return 0;
+ }
if (!hfd->virtual_rdb)
return 0;
- memcpy(buffer, hfd->virtual_rdb + offset, len2);
- len -= len2;
+ memcpy(buffer, hfd->virtual_rdb + offset, (size_t)len2);
+ len -= (int)len2;
if (len <= 0)
- return len2;
+ return (int)len2;
offset += len2;
buffer = (uae_u8*)buffer + len2;
- extra = len2;
+ extra = (int)len2;
}
offset -= hfd->virtual_size;
if (hfd->hfd_type == HFD_VHD_DYNAMIC)
- ret = vhd_read (hfd, buffer, offset, len);
+ ret = (int)vhd_read (hfd, buffer, offset, len);
else if (hfd->hfd_type == HFD_VHD_FIXED)
ret = hdf_read_target (hfd, buffer, offset + 512, len);
#ifdef WITH_CHD
static int hdf_write2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
{
+ if (len > INT_MAX)
+ return 0;
int ret = 0, extra = 0;
// writes to virtual RDB are ignored
if (offset < hfd->virtual_size) {
uae_s64 len2 = offset + len <= hfd->virtual_size ? len : hfd->virtual_size - offset;
- len -= len2;
+ if (len2 > INT_MAX) {
+ return 0;
+ }
+ len -= (int)len2;
if (len <= 0)
- return len2;
+ return (int)len2;
offset += len2;
buffer = (uae_u8*)buffer + len2;
- extra = len2;
+ extra = (int)len2;
}
offset -= hfd->virtual_size;
if (hfd->hfd_type == HFD_VHD_DYNAMIC)
- ret = vhd_write (hfd, buffer, offset, len);
+ ret = (int)vhd_write (hfd, buffer, offset, len);
else if (hfd->hfd_type == HFD_VHD_FIXED)
ret = hdf_write_target (hfd, buffer, offset + 512, len);
#ifdef WITH_CHD
static uae_u64 cmd_readx(struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 offset, uae_u64 len)
{
+ if (!len || len > INT_MAX)
+ return 0;
m68k_cancel_idle();
gui_flicker_led (LED_HD, hfd->unitnum, 1);
- return hdf_read (hfd, dataptr, offset, len);
+ return hdf_read (hfd, dataptr, offset, (int)len);
}
static uae_u64 cmd_read(TrapContext *ctx, struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offset, uae_u64 len)
{
- if (!len)
+ if (!len || len > INT_MAX)
return 0;
if (!ctx && real_address_allowed()) {
addrbank *bank_data = &get_mem_bank (dataptr);
if (!bank_data)
return 0;
- if (bank_data->check(dataptr, len)) {
+ if (bank_data->check(dataptr, (uae_u32)len)) {
uae_u8 *buffer = bank_data->xlateaddr(dataptr);
- return cmd_readx(hfd, buffer, offset, len);
+ return cmd_readx(hfd, buffer, offset, (uae_u32)len);
}
}
int total = 0;
while (len > 0) {
uae_u8 buf[RTAREA_TRAP_DATA_EXTRA_SIZE];
int max = RTAREA_TRAP_DATA_EXTRA_SIZE & ~511;
- int size = len > max ? max : len;
+ int size = (int)(len > max ? max : len);
if (cmd_readx(hfd, buf, offset, size) != size)
break;
trap_put_bytes(ctx, buf, dataptr, size);
}
static uae_u64 cmd_writex(struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 offset, uae_u64 len)
{
+ if (!len || len > INT_MAX)
+ return 0;
m68k_cancel_idle();
gui_flicker_led (LED_HD, hfd->unitnum, 2);
- return hdf_write (hfd, dataptr, offset, len);
+ return hdf_write (hfd, dataptr, offset, (uae_u32)len);
}
static uae_u64 cmd_write(TrapContext *ctx, struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offset, uae_u64 len)
{
- if (!len)
+ if (!len || len > INT_MAX)
return 0;
if (!ctx && real_address_allowed()) {
addrbank *bank_data = &get_mem_bank (dataptr);
if (!bank_data)
return 0;
- if (bank_data->check(dataptr, len)) {
+ if (bank_data->check(dataptr, (uae_u32)len)) {
uae_u8 *buffer = bank_data->xlateaddr(dataptr);
return cmd_writex(hfd, buffer, offset, len);
}
while (len > 0) {
uae_u8 buf[RTAREA_TRAP_DATA_EXTRA_SIZE];
int max = RTAREA_TRAP_DATA_EXTRA_SIZE & ~511;
- int size = len > max ? max : len;
+ int size = (int)(len > max ? max : len);
trap_get_bytes(ctx, buf, dataptr, size);
if (cmd_writex(hfd, buf, offset, size) != size)
break;
break;
case 0x0e: /* READ SECTOR BUFFER */
len = hfd->ci.blocksize;
- scsi_len = len;
- memset(scsi_data, 0, len);
+ scsi_len = (int)len;
+ memset(scsi_data, 0, (size_t)len);
if (len > sizeof(hfd->sector_buffer))
len = sizeof(hfd->sector_buffer);
- memcpy(scsi_data, hfd->sector_buffer, len);
+ memcpy(scsi_data, hfd->sector_buffer, (size_t)len);
break;
case 0x0f: /* WRITE SECTOR BUFFER */
len = hfd->ci.blocksize;
- scsi_len = len;
+ scsi_len = (int)len;
if (len > sizeof(hfd->sector_buffer))
len = sizeof(hfd->sector_buffer);
- memcpy(hfd->sector_buffer, scsi_data, len);
+ memcpy(hfd->sector_buffer, scsi_data, (size_t)len);
break;
case 0x0a: /* WRITE (6) */
if (nodisk (hfd))
case 0x25: /* READ CAPACITY */
{
int pmi = cmdbuf[8] & 1;
- uae_u32 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[4] << 8) | cmdbuf[5];
+ uae_u64 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[4] << 8) | cmdbuf[5];
uae_u64 blocks;
int cyl, head, tracksec;
if (nodisk (hfd))
goto checkfail;
uae_u8 *vb = xmalloc(uae_u8, hfd->ci.blocksize);
while (len > 0) {
- int readlen = cmd_readx (hfd, vb, offset, hfd->ci.blocksize);
+ uae_u64 readlen = cmd_readx (hfd, vb, offset, hfd->ci.blocksize);
if (readlen != hfd->ci.blocksize || memcmp (vb, scsi_data, hfd->ci.blocksize)) {
xfree (vb);
goto miscompare;
d[o + 0] = d[o + 2];
d[o + 1] = d[o + 3];
d[o + 2] = t >> 8;
- d[o + 3] = t;
+ d[o + 3] = (uae_u8)t;
}
static void ql(uae_u8 *d, int o)
{
d[o + 0] = d[o + 6];
d[o + 1] = d[o + 7];
d[o + 6] = t >> 8;
- d[o + 7] = t;
+ d[o + 7] = (uae_u8)t;
}
void ata_byteswapidentity(uae_u8 *d)
pw(ide, 55, ide->hdhfd.heads);
pw(ide, 56, ide->hdhfd.secspertrack);
uae_u64 totalsecs = (uae_u64)ide->hdhfd.cyls * ide->hdhfd.heads * ide->hdhfd.secspertrack;
- pl(ide, 57, totalsecs);
+ pl(ide, 57, (uae_u32)totalsecs);
pw(ide, 59, ide->max_multiple_mode ? (0x100 | ide->max_multiple_mode >> (ide->blocksize / 512 - 1)) : 0); /* Multiple mode supported */
pw(ide, 62, 0x0f);
pw(ide, 63, 0x0f);
totalsecs = ide->blocksize ? ide->hdhfd.size / ide->blocksize : 0;
if (totalsecs > 0x0fffffff)
totalsecs = 0x0fffffff;
- pl(ide, 60, totalsecs);
+ pl(ide, 60, (uae_u32)totalsecs);
if (ide->ata_level > 0) {
pw(ide, 64, ide->ata_level ? 0x03 : 0x00); /* PIO3 and PIO4 */
pw(ide, 65, 120); /* MDMA2 supported */
if (ide->hdhfd.hfd.ci.pcyls)
ide->hdhfd.cyls = ide->hdhfd.hfd.ci.pcyls;
else
- ide->hdhfd.cyls = (ide->hdhfd.size / ide->blocksize) / ((uae_u64)ide->hdhfd.secspertrack * ide->hdhfd.heads);
+ ide->hdhfd.cyls = (int)((ide->hdhfd.size / ide->blocksize) / ((uae_u64)ide->hdhfd.secspertrack * ide->hdhfd.heads));
if (ide->hdhfd.heads * ide->hdhfd.cyls * ide->hdhfd.secspertrack > 16515072 || ide->lba48) {
if (ide->hdhfd.hfd.ci.pcyls)
ide->hdhfd.cyls = ide->hdhfd.hfd.ci.pcyls;
if (IDE_LOG > 1)
write_log(_T("IDE%d off=%d, nsec=%d (%d) %s\n"), ide->num, (uae_u32)lba, nsec, ide->multiple_mode, getidemode(ide));
if (nsec > ide->max_lba - lba) {
- nsec = ide->max_lba - lba;
+ nsec = (unsigned int)(ide->max_lba - lba);
if (IDE_LOG > 1)
write_log (_T("IDE%d nsec changed to %d\n"), ide->num, nsec);
}
if (IDE_LOG > 0)
write_log (_T("IDE%d write off=%d, sec=%d (%d) %s\n"), ide->num, (uae_u32)lba, nsec, ide->multiple_mode, getidemode(ide));
if (nsec > ide->max_lba - lba)
- nsec = ide->max_lba - lba;
+ nsec = (unsigned int)(ide->max_lba - lba);
if (nsec <= 0) {
ide_data_ready (ide);
ide_fail_err (ide, IDE_ERR_IDNF);
ide->secbuf[ide->packet_data_offset + ide->data_offset + 1] = v & 0xff;
ide->secbuf[ide->packet_data_offset + ide->data_offset + 0] = v >> 8;
} else {
- ide->secbuf[(ide->packet_data_offset + ide->data_offset) ^ 1] = v;
+ ide->secbuf[(ide->packet_data_offset + ide->data_offset) ^ 1] = (uae_u8)v;
}
} else {
if (bussize) {
ide->secbuf[ide->buffer_offset + ide->data_offset + 1] = v & 0xff;
ide->secbuf[ide->buffer_offset + ide->data_offset + 0] = v >> 8;
} else {
- ide->secbuf[(ide->buffer_offset + ide->data_offset)] = v;
+ ide->secbuf[(ide->buffer_offset + ide->data_offset)] = (uae_u8)v;
}
}
ide->data_offset += inc;
} else if (board->configured) {
int regnum = get_adide_reg(addr, board);
v = get_ide_reg(board, regnum);
- v = adide_decode_word(v);
+ v = (uae_u8)adide_decode_word(v);
}
} else if (board->type == MTEC_IDE) {
int regnum = get_adide_reg(addr, board);
if (regnum >= 0) {
v = get_ide_reg(board, regnum);
- v = adide_decode_word(v);
+ v = (uae_u8)adide_decode_word(v);
}
}
if (board->configured) {
int regnum = get_adide_reg(addr, board);
- v = adide_encode_word(v);
+ v = (uae_u8)adide_encode_word(v);
put_ide_reg(board, regnum, v);
}
if (board->configured) {
int regnum = get_adide_reg(addr, board);
- v = adide_encode_word(v);
+ v = (uae_u8)adide_encode_word(v);
put_ide_reg(board, regnum, v);
}
put_ide_reg_multi(board, IDE_DATA, v, portnum, 1);
} else {
ide_write_byte(board, addr, v >> 8);
- ide_write_byte(board, addr + 1, v);
+ ide_write_byte(board, addr + 1, (uae_u8)v);
}
} else if (board->type == ALF_IDE || board->type == TANDEM_IDE) {
put_ide_reg(board, IDE_DATA, v);
} else {
ide_write_byte(board, addr, v >> 8);
- ide_write_byte(board, addr + 1, v);
+ ide_write_byte(board, addr + 1, (uae_u8)v);
}
} else {
ide_write_byte(board, addr, v >> 8);
- ide_write_byte(board, addr + 1, v);
+ ide_write_byte(board, addr + 1, (uae_u8)v);
}
} else if (board->type == MASOBOSHI_IDE) {
put_ide_reg(board, IDE_DATA, v);
} else {
ide_write_byte(board, addr, v >> 8);
- ide_write_byte(board, addr + 1, v);
+ ide_write_byte(board, addr + 1, (uae_u8)v);
}
#if DEBUG_IDE_MASOBOSHI
write_log(_T("MASOBOSHI IO WORD WRITE %08x %04x %08x\n"), addr, v, M68K_GETPC);
put_ide_reg(board, IDE_DATA, v);
} else {
ide_write_byte(board, addr, v >> 8);
- ide_write_byte(board, addr + 1, v);
+ ide_write_byte(board, addr + 1, (uae_u8)v);
}
} else if (board->type == APOLLO_IDE) {
if ((addr & 0xc000) == 0x4000) {
apollo_scsi_bput(addr, v >> 8, board->userdata);
- apollo_scsi_bput(addr + 1, v, board->userdata);
+ apollo_scsi_bput(addr + 1, (uae_u8)v, board->userdata);
} else if (addr < 0x4000) {
int regnum = get_apollo_reg(addr, board);
if (regnum == IDE_DATA) {
ide->mask = 131072 - 1;
struct zfile *z = read_device_from_romconfig(aci->rc, ROMTYPE_APOLLO);
if (z) {
- int len = zfile_size(z);
+ int len = zfile_size32(z);
// skip 68060 $f0 ROM block
if (len >= 65536)
zfile_fseek(z, 32768, SEEK_SET);
static const uae_u8 dev_autoconfig[16] = { 0xd1, 1, 0x00, 0x00, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 };
-bool dev_hd_init(struct autoconfig_info* aci)
+bool dev_hd_init(struct autoconfig_info *aci)
{
bool ac = true;
- const struct expansionromtype* ert = get_device_expansion_rom(ROMTYPE_DEVHD);
+ const struct expansionromtype *ert = get_device_expansion_rom(ROMTYPE_DEVHD);
ide_add_reset();
- uae_u8 *rom = xcalloc(uae_u8, 65536);
- load_rom_rc(aci->rc, ROMTYPE_DEVHD, 32768, 0, rom, 65536, LOADROM_EVENONLY_ODDONE);
- memcpy(rom + 0x8000, rom, 0x8000);
+ uae_u8 *rom = xcalloc(uae_u8, 262144);
+ load_rom_rc(aci->rc, ROMTYPE_DEVHD, 131072, 0, rom, 262144, LOADROM_EVENONLY_ODDONE);
+ memmove(rom + 0x8000, rom, 262144 - 0x8000);
if (!ac) {
// fake
{ _T("BPL7PTL"), 0xdff0FA, CD_WO | CD_AGA | CD_DMA_PTR }, /* Bit plane pointer 7 (low 15 bits) */
{ _T("BPL8PTH"), 0xdff0FC, CD_WO | CD_AGA | CD_DMA_PTR }, /* Bit plane pointer 8 (high 5 bits) */
{ _T("BPL8PTL"), 0xdff0FE, CD_WO | CD_AGA | CD_DMA_PTR }, /* Bit plane pointer 8 (low 15 bits) */
- { _T("BPLCON0"), 0xdff100, CD_WO, { ~0x00f1, ~0x00b0, ~0x0080 } }, /* Bit plane control reg (misc control bits) */
+ { _T("BPLCON0"), 0xdff100, CD_WO, { (uae_u16)~0x00f1, (uae_u16)~0x00b0, (uae_u16)~0x0080}}, /* Bit plane control reg (misc control bits) */
{ _T("BPLCON1"), 0xdff102, CD_WO }, /* Bit plane control reg (scroll val PF1,PF2) */
{ _T("BPLCON2"), 0xdff104, CD_WO, { 0x007f, 0x01ff, 0x7fff } }, /* Bit plane control reg (priority control) */
{ _T("BPLCON3"), 0xdff106, CD_WO | CD_ECS_DENISE, { 0x003f, 0x003f, 0xffff } }, /* Bit plane control reg (enhanced features) */
void audio_evhandler (void);
void audio_hsync (void);
void audio_update_adkmasks (void);
-void update_sound (double clk);
-void update_cda_sound (double clk);
+void update_sound (float clk);
+void update_cda_sound (float clk);
void led_filter_audio (void);
void set_audio (void);
int audio_activate (void);
extern void cd32_fmv_new_image(int, int, int, uae_u8*);
extern void cd32_fmv_genlock(struct vidbuffer*, struct vidbuffer*);
extern void cd32_fmv_new_border_color(uae_u32);
-extern void cd32_fmv_set_sync(double svpos, double adjust);
+extern void cd32_fmv_set_sync(float svpos, float adjust);
extern int cd32_fmv_active;
return;
}
int cycs = clocks * cpucycleunit;
- int diff = regs.ce020endcycle - regs.ce020startcycle;
+ int diff = (int)(regs.ce020endcycle - regs.ce020startcycle);
if (diff > 0) {
if (diff >= cycs) {
regs.ce020startcycle += cycs;
void devices_rethink(void);
void devices_rethink_all(void func(void));
void devices_syncchange(void);
-void devices_update_sound(double clk, double syncadjust);
-void devices_update_sync(double svpos, double syncadjust);
+void devices_update_sound(float clk, float syncadjust);
+void devices_update_sync(float svpos, float syncadjust);
void do_leave_program(void);
void virtualdevice_init(void);
void virtualdevice_free(void);
#include "uae/types.h"
typedef enum {
- DRV_NONE = -1, DRV_35_DD = 0, DRV_35_HD, DRV_525_SD, DRV_35_DD_ESCOM, DRV_PC_525_ONLY_40, DRV_PC_35_ONLY_80, DRV_PC_525_40_80, DRV_525_DD, DRV_FB,
+ DRV_NONE = -1, DRV_35_DD = 0, DRV_35_HD, DRV_525_SD, DRV_35_DD_ESCOM, DRV_PC_525_ONLY_40, DRV_PC_35_ONLY_80, DRV_PC_525_40_80, DRV_525_DD, DRV_FB
} drive_type;
#define HISTORY_FLOPPY 0
#define SAVE_EXCEPTION
#define RESTORE_EXCEPTION
#define TRY(var) try
-#define CATCH(var) catch(m68k_exception var)
+#define CATCH(var) catch([[maybe_unused]] m68k_exception var)
#define THROW(n) throw m68k_exception(n)
#define THROW_AGAIN(var) throw
#define ENDTRY
void __pushtry(jmp_buf *j);
int __is_catched(void);
-typedef int m68k_exception;
+typedef int m68k_exception;
#endif
int ntsc;
int vsync;
int framelength;
- double rate;
+ float rate;
TCHAR label[16];
TCHAR commands[256];
TCHAR filterprofile[64];
bool immediate_blits;
int waiting_blits;
- double blitter_speed_throttle;
+ float blitter_speed_throttle;
unsigned int chipset_mask;
bool chipset_hr;
bool keyboard_connected;
TCHAR genlock_video_file[MAX_DPATH];
int monitoremu;
int monitoremu_mon;
- double chipset_refreshrate;
+ float chipset_refreshrate;
struct chipset_refresh cr[MAX_CHIPSET_REFRESH + 2];
int cr_selected;
int collision_level;
struct multipath path_cd;
int m68k_speed;
- double m68k_speed_throttle;
- double x86_speed_throttle;
+ float m68k_speed_throttle;
+ float x86_speed_throttle;
int cpu_model;
int mmu_model;
bool mmu_ec;
#define save_u8(x) save_u8_func (&dst, (x))
#define restore_u64() restore_u64_func (&src)
+#define restore_u64to32() (uae_u32)restore_u64_func (&src)
#define restore_u32() restore_u32_func (&src)
#define restore_u16() restore_u16_func (&src)
#define restore_u8() restore_u8_func (&src)
bool toccata_init(struct autoconfig_info *aci);
bool prelude_init(struct autoconfig_info *aci);
bool prelude1200_init(struct autoconfig_info *aci);
-void update_sndboard_sound(double);
+void update_sndboard_sound(float);
void sndboard_ext_volume(void);
bool uaesndboard_init_z2(struct autoconfig_info *aci);
bool a2386_init(struct autoconfig_info *aci);
bool isa_expansion_init(struct autoconfig_info *aci);
void x86_bridge_sync_change(void);
-void x86_update_sound(double);
+void x86_update_sound(float);
void x86_mouse(int port, int x, int y, int z, int b);
#define X86_STATE_INACTIVE 0
typedef int (*zfile_callback)(struct zfile*, void*);
-extern struct zfile *zfile_fopen (const TCHAR *, const TCHAR *, int mask);
-extern struct zfile *zfile_fopen (const TCHAR *, const TCHAR *);
-extern struct zfile *zfile_fopen (const TCHAR *, const TCHAR *, int mask, int index);
-extern struct zfile *zfile_fopen_empty (struct zfile*, const TCHAR *name, uae_u64 size);
-extern struct zfile *zfile_fopen_empty (struct zfile*, const TCHAR *name);
-extern struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, const uae_u8 *data);
-extern struct zfile *zfile_fopen_load_zfile (struct zfile *f);
-extern uae_u8 *zfile_load_data (const TCHAR *name, const uae_u8 *data,int datalen, int *outlen);
+extern struct zfile *zfile_fopen(const TCHAR *, const TCHAR *, int mask);
+extern struct zfile *zfile_fopen(const TCHAR *, const TCHAR *);
+extern struct zfile *zfile_fopen(const TCHAR *, const TCHAR *, int mask, int index);
+extern struct zfile *zfile_fopen_empty(struct zfile*, const TCHAR *name, uae_u64 size);
+extern struct zfile *zfile_fopen_empty(struct zfile*, const TCHAR *name);
+extern struct zfile *zfile_fopen_data(const TCHAR *name, uae_u64 size, const uae_u8 *data);
+extern struct zfile *zfile_fopen_load_zfile(struct zfile *f);
+extern uae_u8 *zfile_load_data(const TCHAR *name, const uae_u8 *data,int datalen, int *outlen);
extern uae_u8 *zfile_load_file(const TCHAR *name, int *outlen);
-extern struct zfile *zfile_fopen_parent (struct zfile*, const TCHAR*, uae_u64 offset, uae_u64 size);
+extern struct zfile *zfile_fopen_parent(struct zfile*, const TCHAR*, uae_u64 offset, uae_u64 size);
extern uae_u8 *zfile_get_data_pointer(struct zfile *z, int *len);
extern int zfile_exists (const TCHAR *name);
-extern void zfile_fclose (struct zfile *);
+extern void zfile_fclose (struct zfile *z);
extern uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode);
-extern uae_s64 zfile_ftell (struct zfile *z);
-extern uae_s64 zfile_size (struct zfile *z);
-extern size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z);
-extern size_t zfile_fwrite (const void *b, size_t l1, size_t l2, struct zfile *z);
-extern TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z);
-extern char *zfile_fgetsa (char *s, int size, struct zfile *z);
-extern size_t zfile_fputs (struct zfile *z, const TCHAR *s);
-extern int zfile_getc (struct zfile *z);
-extern int zfile_putc (int c, struct zfile *z);
-extern int zfile_ferror (struct zfile *z);
-extern uae_u8 *zfile_getdata (struct zfile *z, uae_s64 offset, int len, int *outlen);
-extern void zfile_exit (void);
-extern int execute_command (TCHAR *);
-extern int zfile_iscompressed (struct zfile *z);
-extern int zfile_zcompress (struct zfile *dst, void *src, int size);
-extern int zfile_zuncompress (void *dst, int dstsize, struct zfile *src, int srcsize);
-extern int zfile_gettype (struct zfile *z);
-extern int zfile_zopen (const TCHAR *name, zfile_callback zc, void *user);
-extern TCHAR *zfile_getname (struct zfile *f);
-extern TCHAR *zfile_getoriginalname (struct zfile *f);
-extern TCHAR *zfile_getfilename (struct zfile *f);
-extern uae_u32 zfile_crc32 (struct zfile *f);
-extern struct zfile *zfile_dup (struct zfile *f);
-extern struct zfile *zfile_gunzip (struct zfile *z);
-extern int zfile_is_diskimage (const TCHAR *name);
-extern int iszip (struct zfile *z);
-extern int zfile_convertimage (const TCHAR *src, const TCHAR *dst);
-extern struct zfile *zuncompress (struct znode*, struct zfile *z, int dodefault, int mask, int *retcode, int index);
-extern void zfile_seterror (const TCHAR *format, ...);
-extern TCHAR *zfile_geterror (void);
-extern int zfile_truncate (struct zfile *z, uae_s64 size);
+extern uae_s64 zfile_ftell(struct zfile *z);
+extern uae_s32 zfile_ftell32(struct zfile *z);
+extern uae_s64 zfile_size(struct zfile *z);
+extern uae_s32 zfile_size32(struct zfile *z);
+extern size_t zfile_fread(void *b, size_t l1, size_t l2, struct zfile *z);
+extern size_t zfile_fwrite(const void *b, size_t l1, size_t l2, struct zfile *z);
+extern TCHAR *zfile_fgets(TCHAR *s, int size, struct zfile *z);
+extern char *zfile_fgetsa(char *s, int size, struct zfile *z);
+extern size_t zfile_fputs(struct zfile *z, const TCHAR *s);
+extern int zfile_getc(struct zfile *z);
+extern int zfile_putc(int c, struct zfile *z);
+extern int zfile_ferror(struct zfile *z);
+extern uae_u8 *zfile_getdata(struct zfile *z, uae_s64 offset, int len, int *outlen);
+extern void zfile_exit(void);
+extern int execute_command(TCHAR *);
+extern int zfile_iscompressed(struct zfile *z);
+extern int zfile_zcompress(struct zfile *dst, void *src, int size);
+extern int zfile_zuncompress(void *dst, int dstsize, struct zfile *src, int srcsize);
+extern int zfile_gettype(struct zfile *z);
+extern int zfile_zopen(const TCHAR *name, zfile_callback zc, void *user);
+extern TCHAR *zfile_getname(struct zfile *f);
+extern TCHAR *zfile_getoriginalname(struct zfile *f);
+extern TCHAR *zfile_getfilename(struct zfile *f);
+extern uae_u32 zfile_crc32(struct zfile *f);
+extern struct zfile *zfile_dup(struct zfile *f);
+extern struct zfile *zfile_gunzip(struct zfile *z);
+extern int zfile_is_diskimage(const TCHAR *name);
+extern int iszip(struct zfile *z);
+extern int zfile_convertimage(const TCHAR *src, const TCHAR *dst);
+extern struct zfile *zuncompress(struct znode*, struct zfile *z, int dodefault, int mask, int *retcode, int index);
+extern void zfile_seterror(const TCHAR *format, ...);
+extern TCHAR *zfile_geterror(void);
+extern int zfile_truncate(struct zfile *z, uae_s64 size);
#define ZFD_NONE 0
#define ZFD_ARCHIVE 1 //zip/lha..
if (cr) {
int dir = code == AKS_INCREASEREFRESHRATE ? 5 : -5;
if (cr->rate == 0)
- cr->rate = currprefs.ntscmode ? 60 : 50;
+ cr->rate = currprefs.ntscmode ? 60.0f : 50.0f;
cr->locked = true;
cr->rate += dir;
if (cr->rate < 10)
static int lasthsync, endhsync;
static TCHAR inprec_path[MAX_DPATH];
static uae_u32 seed;
-static uae_u32 lastcycle;
+static frame_time_t lastcycle;
static uae_u32 cycleoffset;
static uae_u32 pcs[16];
inprec_ru16 ((uae_u16)(v >> 16));
inprec_ru16 ((uae_u16)v);
}
+void inprec_ru64(uae_u64 v)
+{
+ if (!input_record || !inprec_zf)
+ return;
+ inprec_ru32((uae_u32)(v >> 32));
+ inprec_ru32((uae_u32)v);
+}
static void inprec_rstr (const TCHAR *src)
{
if (!input_record || !inprec_zf)
inprec_ru16 (0xffff);
inprec_ru32 (hsync_counter);
inprec_ru8 (current_hpos ());
- inprec_ru32 (lastcycle);
+ inprec_ru64 (lastcycle);
return true;
}
uae_u8 *p = inprec_p;
uae_u32 hc = hsync_counter;
uae_u8 hpos = current_hpos ();
- uae_u32 cycles = get_cycles ();
+ frame_time_t cycles = get_cycles ();
static uae_u8 *lastp;
uae_u32 hc_orig, hc2_orig;
int mvp = current_maxvpos ();
uae_u32 type2 = p[0];
uae_u32 hc2 = (p[3] << 24) | (p[4] << 16) | (p[5] << 8) | p[6];
uae_u32 hpos2 = p[7];
- uae_u32 cycles2 = (p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11];
+ frame_time_t cycles2 = (p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11];
if (p >= inprec_buffer + inprec_size)
break;
write_log (_T("%08x (%08x) "), pcs[i], pcs2[i]);
write_log (_T("\n"));
}
- cycleoffset = cycles - cycles2;
+ cycleoffset = (uae_u32)(cycles - cycles2);
#if ENABLE_DEBUGGER == 0
gui_message (_T("INPREC OFFSET=%d\n"), (int)cycleoffset / CYCLE_UNIT);
#else
v |= inprec_pu16 ();
return v;
}
+static uae_u64 inprec_pu64(void)
+{
+ uae_u64 v = (uae_u64)inprec_pu32() << 32;
+ v |= inprec_pu32();
+ return v;
+}
static int inprec_pstr (TCHAR *dst)
{
char tmp[MAX_DPATH];
if (input_play) {
uae_u32 id;
zfile_fseek (inprec_zf, 0, SEEK_END);
- inprec_size = zfile_ftell (inprec_zf);
+ inprec_size = zfile_ftell32(inprec_zf);
zfile_fseek (inprec_zf, 0, SEEK_SET);
inprec_buffer = inprec_p = xmalloc (uae_u8, inprec_size);
zfile_fread (inprec_buffer, inprec_size, 1, inprec_zf);
inprec_ru32 (hsync_counter);
inprec_ru32 (0); // extra header size
flush ();
- header_end2 = header_end = zfile_ftell (inprec_zf);
+ header_end2 = header_end = zfile_ftell32(inprec_zf);
} else {
input_record = input_play = 0;
return 0;
#if INPUTRECORD_DEBUG > 0
if (inprec_rstart (INPREC_DEBUG2)) {
inprec_ru32 (m68k_getpc ());
- inprec_ru32 (get_cycles () | mode);
+ inprec_ru64 (get_cycles () | mode);
inprec_rend ();
}
#endif
if (inprec_pstart (INPREC_DEBUG2)) {
uae_u32 pc1 = m68k_getpc ();
uae_u32 pc2 = inprec_pu32 ();
- uae_u32 v1 = get_cycles () | mode;
- uae_u32 v2 = inprec_pu32 ();
+ uae_u64 v1 = get_cycles () | mode;
+ uae_u64 v2 = inprec_pu64 ();
if (pc1 != pc2) {
if (warned > 0) {
warned--;
if (input_play == INPREC_PLAY_RERECORD) {
pos = inprec_p - inprec_buffer;
} else if (input_record) {
- pos = zfile_ftell (inprec_zf);
+ pos = zfile_ftell32(inprec_zf);
}
write_log (_T("INPREC: getpos=%d cycles=%08X\n"), pos, lastcycle);
if (pos < 0) {
}
zfile_fseek (inprec_zf, 0, SEEK_SET);
xfree (inprec_buffer);
- inprec_size = zfile_size (inprec_zf);
+ inprec_size = zfile_size32(inprec_zf);
inprec_buffer = xmalloc (uae_u8, inprec_size);
zfile_fread (inprec_buffer, inprec_size, 1, inprec_zf);
inprec_p = inprec_plastptr = inprec_buffer + offset;
_tcscat (tmp, filename);
struct zfile *zfd = zfile_fopen (tmp, _T("wb"));
if (zfd) {
- int size = zfile_size (zf);
+ int size = zfile_size32(zf);
uae_u8 *data = zfile_getdata (zf, 0, size, NULL);
zfile_fwrite (data, size, 1, zfd);
zfile_fclose (zfd);
getfilepart (fn, MAX_DPATH, statefilename);
char *s = uutf8 (fn);
zfile_fwrite (s, strlen (s) + 1, 1, zf);
- int len = zfile_size (inprec_zf) - header_end2;
+ int len = zfile_size32(inprec_zf) - header_end2;
data = zfile_getdata (inprec_zf, header_end2, len, NULL);
uae_u8 *p = data;
uae_u8 *end = data + len;
offset = 0;
firstext = ei->i_first_extent;
- sect_size = ei->i_section_size >> ISOFS_BUFFER_BITS(inode);
+ sect_size = (unsigned int)(ei->i_section_size >> ISOFS_BUFFER_BITS(inode));
nextblk = ei->i_next_section_block;
nextoff = ei->i_next_section_offset;
section = 0;
goto abort;
}
firstext = ISOFS_I(ninode)->i_first_extent;
- sect_size = ISOFS_I(ninode)->i_section_size >> ISOFS_BUFFER_BITS(ninode);
+ sect_size = (unsigned int)(ISOFS_I(ninode)->i_section_size >> ISOFS_BUFFER_BITS(ninode));
nextblk = ISOFS_I(ninode)->i_next_section_block;
nextoff = ISOFS_I(ninode)->i_next_section_offset;
iput(ninode);
* respectively, is set
*/
match = 0;
- if (dlen > 0 && (!sbi->s_hide || (!(de->flags[-sbi->s_high_sierra] & 1))) && (sbi->s_showassoc || (!(de->flags[-sbi->s_high_sierra] & 4)))) {
+ if (dlen > 0 && (!sbi->s_hide || (!(de->flags[0-sbi->s_high_sierra] & 1))) && (sbi->s_showassoc || (!(de->flags[0-sbi->s_high_sierra] & 4)))) {
if (jname)
match = _tcsicmp(jname, nameu) == 0;
else
inode_number = isofs_get_ino(block_saved, offset_saved, bufbits);
}
- if (de->flags[-sbi->s_high_sierra] & 0x80) {
+ if (de->flags[0-sbi->s_high_sierra] & 0x80) {
first_de = 0;
filp->f_pos += de_len;
continue;
* Do not report hidden files if so instructed, or associated
* files unless instructed to do so
*/
- if ((sbi->s_hide && (de->flags[-sbi->s_high_sierra] & 1)) || (!sbi->s_showassoc && (de->flags[-sbi->s_high_sierra] & 4))) {
+ if ((sbi->s_hide && (de->flags[0-sbi->s_high_sierra] & 1)) || (!sbi->s_showassoc && (de->flags[0-sbi->s_high_sierra] & 4))) {
filp->f_pos += de_len;
continue;
}
uae_s64 isofs_lseek(struct cd_openfile_s *of, uae_s64 offset, int mode)
{
struct inode *inode = of->inode;
- int ret = -1;
+ uae_s64 ret = -1;
switch (mode)
{
case SEEK_SET:
uae_u8 *b = (uae_u8*)bp;
if (size + of->seek > inode->i_size)
- size = inode->i_size - of->seek;
+ size = (unsigned int)(inode->i_size - of->seek);
// first partial sector
if (offset & bufmask) {
- bh = isofs_bread(inode, offset / bufsize);
+ bh = isofs_bread(inode, (uae_u32)(offset / bufsize));
if (!bh)
return 0;
read = size < (bufsize - (offset & bufmask)) ? size : (bufsize - (offset & bufmask));
}
// complete sector(s)
while (size >= bufsize) {
- bh = isofs_bread(inode, offset / bufsize);
+ bh = isofs_bread(inode, (uae_u32)(offset / bufsize));
if (!bh)
return totalread;
read = size < bufsize ? size : bufsize;
}
// and finally last partial sector
if (size > 0) {
- bh = isofs_bread(inode, offset / bufsize);
+ bh = isofs_bread(inode, (uae_u32)(offset / bufsize));
if (!bh)
return totalread;
read = size;
static uae_u8 get_a2410_control(struct a2410_struct *data)
{
- uae_u8 v = data->a2410_control;
+ uae_u8 v = (uae_u8)data->a2410_control;
v &= ~(0x10 | 0x40 | 0x80);
v |= 0x20;
if (v & 0x08) // SBR
UINT32 total_cycles(void)
{
- return get_cycles() / CYCLE_UNIT;
+ return (UINT32)(get_cycles() / CYCLE_UNIT);
}
void m_to_shiftreg_cb(address_space space, offs_t offset, UINT16 *shiftreg)
break;
case A2410_BANK_RAMDAC:
//write_log(_T("RAMDAC WRITE %08x = %04x IDX=%d/%d PC=%08x\n"), aa, b, a2410_palette_index / 4, a2410_palette_index & 3, M68K_GETPC);
- write_ramdac(data, addr, b);
+ write_ramdac(data, addr, (uae_u8)b);
break;
case A2410_BANK_CONTROL:
write_log(_T("CONTROL WRITE %08x = %04x PC=%08x\n"), aa, b, M68K_GETPC);
if (size < 0) {
zfile_fseek (f, 0, SEEK_END);
- size = zfile_ftell (f) & ~0x3ff;
+ size = zfile_ftell32(f) & ~0x3ff;
zfile_fseek (f, 0, SEEK_SET);
}
- oldpos = zfile_ftell (f);
+ oldpos = zfile_ftell32(f);
i = zfile_fread (buffer, 1, sizeof(buffer), f);
if (i < sizeof(buffer))
return 0;
return false;
}
zfile_fseek (f, 0, SEEK_END);
- size = zfile_ftell (f);
+ size = zfile_ftell32(f);
extendedkickmem_bank.reserved_size = ROM_SIZE_512;
off = 0;
if (type == 0) {
(tmp[0] == 0x7f && tmp[1] == 'E' && tmp[2] == 'L' && tmp[3] == 'F')) {
struct zfile *zf = read_executable_rom(f, ROM_SIZE_512, 3);
if (zf) {
- int size = zfile_size(zf);
+ int size = zfile_size32(zf);
zfile_fclose(f);
f = zf;
if (size > ROM_SIZE_512) {
- maxsize = zfile_size(zf);
+ maxsize = zfile_size32(zf);
singlebigrom = true;
extendedkickmem2a_bank.reserved_size = 524288;
extendedkickmem2a_bank.mask = extendedkickmem2a_bank.allocated_size - 1;
if (!singlebigrom) {
zfile_fseek(f, 0, SEEK_END);
- filesize = zfile_ftell(f);
+ filesize = zfile_ftell32(f);
zfile_fseek(f, 0, SEEK_SET);
if (!singlebigrom) {
if (filesize == 1760 * 512) {
*buf++ = v >> 8;
len--;
if (len > 0) {
- *buf++ = v;
+ *buf++ = (uint8_t)v;
len--;
}
ncr->dma_ptr += 2;
*buf++ = v >> 8;
len--;
if (len > 0) {
- *buf++ = v;
+ *buf++ = (uint8_t)v;
len--;
}
ncr->dma_ptr += 2;
*buf++ = v >> 8;
len--;
if (len > 0) {
- *buf++ = v;
+ *buf++ = (uint8_t)v;
len--;
}
ncr->dma_ptr += 2;
*buf++ = v >> 8;
len--;
if (len > 0) {
- *buf++ = v;
+ *buf++ = (uint8_t)v;
len--;
}
ncr->dma_ptr += 2;
*buf++ = v >> 8;
len--;
if (len > 0) {
- *buf++ = v;
+ *buf++ = (uint8_t)v;
len--;
}
ncr->dma_ptr++;
} else if (ISCPUBOARD(BOARD_BLIZZARD, BOARD_BLIZZARD_SUB_1230III)) {
addr &= 0xffff;
if (addr >= 0x10 && addr < 0x20) {
- v = fas408_read_fifo(ncr->devobject.lsistate);
+ v = (uae_u8)fas408_read_fifo(ncr->devobject.lsistate);
return v;
}
if (addr >= 0x20) {
return v;
addr >>= reg_shift;
addr &= IO_MASK;
- v = esp_reg_read(ncr->devobject.lsistate, (addr));
+ v = (uae_u8)esp_reg_read(ncr->devobject.lsistate, (addr));
*reg = addr;
return v;
}
if (addr >= CYBERSTORM_SCSI_RAM_OFFSET && ncr->ramsize)
return cyberstorm_scsi_ram_get(addr);
addr &= IO_MASK;
- return lsi_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
+ return (uae_u32)lsi_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
}
static uae_u32 ncr710_io_bget(struct ncr_state *ncr, uaecptr addr)
{
addr &= IO_MASK;
- return lsi710_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
+ return (uae_u32)lsi710_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
}
uae_u32 cpuboard_ncr710_io_bget(uaecptr addr)
{
struct ncr_state *ncr = ncr_cpuboard;
addr &= IO_MASK;
- return lsi_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
+ return (uae_u32)lsi_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
}
static bool isncrboard(struct ncr_state *ncr, struct ncr_state **ncrb)
static void *bswap_buffer = NULL;
static uae_u32 bswap_buffer_size = 0;
-static double syncdivisor;
+static float syncdivisor;
#define FAKE_HANDLE_WINLAUNCH 0xfffffffe
}
#endif
xfree (dllname);
- syncdivisor = (3580000.0 * CYCLE_UNIT) / (double)syncbase;
+ syncdivisor = (3580000.0f * CYCLE_UNIT) / (float)syncbase;
return (uae_u32)h;
}
}
}
#if defined(X86_MSVC_ASSEMBLY)
- unsigned long rate1;
+ frame_time_t rate1;
double v;
rate1 = read_processor_time ();
ret = emulib_ExecuteNativeCode2 (context);
struct dssample *sample;
struct dschannel *channel;
int playing, recording;
- evt evttime;
+ evt_t evttime;
uae_u32 signalchannelmask;
ALCdevice *al_dev, *al_recorddev;
uae_u32 freq = get_long (audioctrl + ahiac_PlayerFreq);
double f;
uae_u32 cycles;
- evt t;
+ evt_t t;
f = ((double)(freq >> 16)) + ((double)(freq & 0xffff)) / 65536.0;
if (f < 1)
return;
- cycles = maxhpos * maxvpos_nom * vblank_hz;
- t = (evt)(cycles / f);
+ cycles = (uae_u32)(maxhpos * maxvpos_nom * vblank_hz);
+ t = (evt_t)(cycles / f);
if (dsahip->evttime == t)
return;
write_log (_T("AHI: playerfunc freq = %.2fHz\n"), f);
{
if (dc->al_source != -1) {
if (abs (dc->cs.volume) != abs (dc->csnext.volume)) {
- float vol = ((float)(abs (dc->csnext.volume))) / 65536.0;
+ float vol = ((float)(abs (dc->csnext.volume))) / 65536.0f;
alClear ();
alSourcef (dc->al_source, AL_GAIN, vol);
alError (_T("AHI: SetVolume(%d,%d)"), dc->num, vol);
static bool audio_validated;
static DWORD dwAudioInputRemaining;
static unsigned int StreamSizeAudio; // audio write position
-static double StreamSizeAudioExpected, StreamSizeAudioGot;
+static float StreamSizeAudioExpected, StreamSizeAudioGot;
static PAVISTREAM AVIAudioStream = NULL; // compressed stream pointer
static HACMSTREAM has = NULL; // stream handle that can be used to perform conversions
static ACMSTREAMHEADER ash;
typedef unsigned short UHWORD;
typedef int LWORD;
typedef unsigned int ULWORD;
-static int resampleFast(double factor, HWORD *in, HWORD *out, int inCount, int outCount, int nChans);
+static int resampleFast(float factor, HWORD *in, HWORD *out, int inCount, int outCount, int nChans);
static uae_u8 *hack_resample(uae_u8 *srcbuffer, int gotSize, int wantedSize)
{
int gotSamples = gotSize / bytesperframe;
int wantedSamples = wantedSize / bytesperframe;
- double factor = (double)wantedSamples / gotSamples;
+ float factor = (float)wantedSamples / gotSamples;
outbuf = xmalloc(uae_u8, wantedSize + bytesperframe);
resampleFast(factor, (HWORD*)srcbuffer, (HWORD*)outbuf, gotSamples, wantedSamples, ch);
return outbuf;
bytesperframe = wfxSrc.Format.nChannels * 2;
StreamSizeAudioGot += avi_sndbuffered / bytesperframe;
unsigned int lastexpected = (unsigned int)StreamSizeAudioExpected;
- StreamSizeAudioExpected += ((double)wfxSrc.Format.nSamplesPerSec) / fps_in_use;
+ StreamSizeAudioExpected += ((float)wfxSrc.Format.nSamplesPerSec) / fps_in_use;
if (avioutput_video) {
- int idiff = StreamSizeAudioGot - StreamSizeAudioExpected;
+ int idiff = (int)(StreamSizeAudioGot - StreamSizeAudioExpected);
if ((timeframes % 5) == 0)
write_log(_T("%.1f %.1f %d\n"), StreamSizeAudioExpected, StreamSizeAudioGot, idiff);
if (idiff) {
StreamSizeAudioGot = StreamSizeAudioExpected;
- AVIOuput_AVIWriteAudio(avi_sndbuffer, avi_sndbuffered, (StreamSizeAudioExpected - lastexpected) * bytesperframe);
+ AVIOuput_AVIWriteAudio(avi_sndbuffer, avi_sndbuffered, (int)(StreamSizeAudioExpected - lastexpected) * bytesperframe);
} else {
AVIOuput_AVIWriteAudio(avi_sndbuffer, avi_sndbuffered, 0);
}
return out;
}
-static int SrcLinear(HWORD X[], HWORD Y[], double factor, ULWORD *Time, UHWORD Nx)
+static int SrcLinear(HWORD X[], HWORD Y[], float factor, ULWORD *Time, UHWORD Nx)
{
HWORD iconst;
HWORD *Xp, *Ystart;
LWORD v, x1, x2;
- double dt; /* Step through input signal */
+ float dt; /* Step through input signal */
ULWORD dtb; /* Fixed-point version of Dt */
ULWORD endTime; /* When Time reaches EndTime, return to user */
- dt = 1.0 / factor; /* Output sampling period */
- dtb = dt*(1 << Np) + 0.5; /* Fixed-point representation */
+ dt = 1.0f / factor; /* Output sampling period */
+ dtb = (ULWORD)(dt*(1 << Np) + 0.5); /* Fixed-point representation */
Ystart = Y;
endTime = *Time + (1 << Np)*(LWORD)Nx;
#define OBUFFSIZE 8192 /* Output buffer size */
static int resampleFast( /* number of output samples returned */
- double factor, /* factor = Sndout/Sndin */
+ float factor, /* factor = Sndout/Sndin */
HWORD *in, /* input and output file descriptors */
HWORD *out,
int inCount, /* number of input samples to convert */
struct CapsDateTimeExt *cdt;
int type;
- if (!caps_init ())
+ if (!caps_init())
return 0;
- caps_unloadimage (drv);
- zfile_fseek (zf, 0, SEEK_END);
- len = zfile_ftell (zf);
- zfile_fseek (zf, 0, SEEK_SET);
+ caps_unloadimage(drv);
+ zfile_fseek(zf, 0, SEEK_END);
+ len = zfile_ftell32(zf);
+ zfile_fseek(zf, 0, SEEK_SET);
if (len <= 0)
return 0;
buf = xmalloc (uae_u8, len);
if (*outpos < 0) {
_ftime(&tb2);
- int diff = (tb2.time * (uae_s64)1000 + tb2.millitm) - (tb1.time * (uae_s64)1000 + tb1.millitm);
+ int diff = (int)((tb2.time * (uae_s64)1000 + tb2.millitm) - (tb1.time * (uae_s64)1000 + tb1.millitm));
diff -= ciw->cdda_delay;
if (idleframes >= 0 && diff < 0 && ciw->cdda_play > 0)
sleep_millis(-diff);
adjust = height_adjust / count;
remainder = height_adjust % count;
if (randidx < 0) {
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
randidx = rand() % count;
}
while (id3y[j] >= 0) {
if (rdim->dwNumberOfButtons >= ID_BUTTON_TOTAL) {
write_log (_T("bogus number of buttons, ignored\n"));
} else {
- did->buttons_real = did->buttons = rdim->dwNumberOfButtons;
+ did->buttons_real = did->buttons = (uae_s16)rdim->dwNumberOfButtons;
for (j = 0; j < did->buttons; j++) {
did->buttonsort[j] = j;
did->buttonmappings[j] = j;
else if (did->type == DID_MOUSE)
did->axissort[did->axles] = makesort_mouse (&pdidoi->guidType, &did->axismappings[did->axles]);
for (i = 0; i < 2; i++) {
- did->axismappings[did->axles + i] = DIJOFS_POV(numpov);
+ did->axismappings[did->axles + i] = (uae_s16)DIJOFS_POV(numpov);
_stprintf (tmp, _T("%s (%c)"), pdidoi->tszName, i ? 'Y' : 'X');
did->axisname[did->axles + i] = my_strdup (tmp);
did->axissort[did->axles + i] = did->axissort[did->axles];
}
if (s->m_TargetDimsEffectHandle) {
D3DXVECTOR4 fDimsTarget;
- fDimsTarget.x = s->targettex_width;
- fDimsTarget.y = s->targettex_height;
+ fDimsTarget.x = (FLOAT)s->targettex_width;
+ fDimsTarget.y = (FLOAT)s->targettex_height;
fDimsTarget.z = 1;
fDimsTarget.w = 1;
hr = s->pEffect->SetVector(s->m_TargetDimsEffectHandle, &fDimsTarget);
}
if (s->m_ScaleEffectHandle) {
D3DXVECTOR4 fScale;
- fScale.x = 1 << currprefs.gfx_resolution;
- fScale.y = 1 << currprefs.gfx_vresolution;
+ fScale.x = (float)(1 << currprefs.gfx_resolution);
+ fScale.y = (float)(1 << currprefs.gfx_vresolution);
fScale.w = fScale.z = 1;
hr = s->pEffect->SetVector(s->m_ScaleEffectHandle, &fScale);
if (FAILED(hr)) {
}
}
if (s->framecounterHandle)
- s->pEffect->SetFloat(s->framecounterHandle, timeframes);
+ s->pEffect->SetFloat(s->framecounterHandle, (FLOAT)timeframes);
return 1;
}
goto end;
}
- d3d->mask2texture_w = img.width;
- d3d->mask2texture_h = img.height;
+ d3d->mask2texture_w = (float)img.width;
+ d3d->mask2texture_h = (float)img.height;
d3d->mask2texture = tx;
hr = tx->LockRect(0, &locked, NULL, 0);
}
tx->UnlockRect(0);
- d3d->mask2rect.left = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, -1, 0);
- d3d->mask2rect.right = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 1, 0);
- d3d->mask2rect.top = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 0, -1);
- d3d->mask2rect.bottom = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 0, 1);
+ d3d->mask2rect.left = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, -1, 0);
+ d3d->mask2rect.right = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 1, 0);
+ d3d->mask2rect.top = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 0, -1);
+ d3d->mask2rect.bottom = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 0, 1);
if (d3d->mask2rect.left >= d3d->mask2texture_w / 2 || d3d->mask2rect.top >= d3d->mask2texture_h / 2 ||
d3d->mask2rect.right <= d3d->mask2texture_w / 2 || d3d->mask2rect.bottom <= d3d->mask2texture_h / 2) {
d3d->mask2rect.left = 0;
d3d->mask2rect.top = 0;
- d3d->mask2rect.right = d3d->mask2texture_w;
- d3d->mask2rect.bottom = d3d->mask2texture_h;
+ d3d->mask2rect.right = (LONG)d3d->mask2texture_w;
+ d3d->mask2rect.bottom = (LONG)d3d->mask2texture_h;
}
d3d->mask2texture_multx = (float)d3d->window_w / d3d->mask2texture_w;
d3d->mask2texture_multy = (float)d3d->window_h / d3d->mask2texture_h;
if (isfullscreen () > 0) {
struct MultiDisplay *md = getdisplay(&currprefs, mon->monitor_id);
- float deskw = md->rect.right - md->rect.left;
- float deskh = md->rect.bottom - md->rect.top;
+ float deskw = (float)md->rect.right - md->rect.left;
+ float deskh = (float)md->rect.bottom - md->rect.top;
//deskw = 800; deskh = 600;
float dstratio = deskw / deskh;
float srcratio = d3d->mask2texture_w / d3d->mask2texture_h;
d3d->mask2texture_multx = d3d->mask2texture_multy;
}
- d3d->mask2texture_wh = d3d->window_h;
+ d3d->mask2texture_wh = (float)d3d->window_h;
d3d->mask2texture_ww = d3d->mask2texture_w * d3d->mask2texture_multx;
d3d->mask2texture_offsetw = (d3d->window_w - d3d->mask2texture_ww) / 2;
if (d3d->mask2texture_offsetw > 0)
- d3d->blanktexture = createtext (d3d, d3d->mask2texture_offsetw + 1, d3d->window_h, D3DFMT_X8R8G8B8);
+ d3d->blanktexture = createtext(d3d, (int)(d3d->mask2texture_offsetw + 1), d3d->window_h, D3DFMT_X8R8G8B8);
xmult = d3d->mask2texture_multx;
ymult = d3d->mask2texture_multy;
- d3d->mask2rect.left *= xmult;
- d3d->mask2rect.right *= xmult;
- d3d->mask2rect.top *= ymult;
- d3d->mask2rect.bottom *= ymult;
+ d3d->mask2rect.left *= (LONG)xmult;
+ d3d->mask2rect.right *= (LONG)xmult;
+ d3d->mask2rect.top *= (LONG)ymult;
+ d3d->mask2rect.bottom *= (LONG)ymult;
d3d->mask2texture_wwx = d3d->mask2texture_w * xmult;
if (d3d->mask2texture_wwx > d3d->window_w)
- d3d->mask2texture_wwx = d3d->window_w;
+ d3d->mask2texture_wwx = (float)d3d->window_w;
if (d3d->mask2texture_wwx < d3d->mask2rect.right - d3d->mask2rect.left)
- d3d->mask2texture_wwx = d3d->mask2rect.right - d3d->mask2rect.left;
+ d3d->mask2texture_wwx = (float)d3d->mask2rect.right - d3d->mask2rect.left;
if (d3d->mask2texture_wwx > d3d->mask2texture_ww)
d3d->mask2texture_wwx = d3d->mask2texture_ww;
- d3d->mask2texture_minusx = - ((d3d->window_w - d3d->mask2rect.right) + d3d->mask2rect.left);
+ d3d->mask2texture_minusx = (float)(-((d3d->window_w - d3d->mask2rect.right) + d3d->mask2rect.left));
if (d3d->mask2texture_offsetw > 0)
d3d->mask2texture_minusx += d3d->mask2texture_offsetw * xmult;
- d3d->mask2texture_minusy = -(d3d->window_h - (d3d->mask2rect.bottom - d3d->mask2rect.top));
+ d3d->mask2texture_minusy = (float)(-(d3d->window_h - (d3d->mask2rect.bottom - d3d->mask2rect.top)));
d3d->mask2texture_hhx = d3d->mask2texture_h * ymult;
return 0;
}
}
- size = zfile_size (zf);
- buf = xmalloc (uae_u8, size);
- zfile_fread (buf, size, 1, zf);
- zfile_fclose (zf);
+ size = zfile_size32(zf);
+ buf = xmalloc(uae_u8, size);
+ zfile_fread(buf, size, 1, zf);
+ zfile_fclose(zf);
hr = D3DXCreateTextureFromFileInMemoryEx (d3d->d3ddev, buf, size,
D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 1, D3DUSAGE_DYNAMIC, D3DFMT_X8R8G8B8,
D3DPOOL_DEFAULT, D3DX_FILTER_NONE, D3DX_FILTER_NONE, 0, &dinfo, NULL, &tx);
if (!d3d->mask2texture)
return false;
- float mw = d3d->mask2rect.right - d3d->mask2rect.left;
- float mh = d3d->mask2rect.bottom - d3d->mask2rect.top;
+ float mw = (float)d3d->mask2rect.right - d3d->mask2rect.left;
+ float mh = (float)d3d->mask2rect.bottom - d3d->mask2rect.top;
float mxt = (float)mw / width;
float myt = (float)mh / height;
zr2[monid] = zr;
}
- dw = dr.right - dr.left;
- dh = dr.bottom - dr.top;
- w = sr.right - sr.left;
- h = sr.bottom - sr.top;
+ dw = (float)dr.right - dr.left;
+ dh = (float)dr.bottom - dr.top;
+ w = (float)sr.right - sr.left;
+ h = (float)sr.bottom - sr.top;
d3d->fakesize.x = w;
d3d->fakesize.y = h;
if (0 && d3d->mask2texture) {
- float mw = d3d->mask2rect.right - d3d->mask2rect.left;
- float mh = d3d->mask2rect.bottom - d3d->mask2rect.top;
+ float mw = (float)d3d->mask2rect.right - d3d->mask2rect.left;
+ float mh = (float)d3d->mask2rect.bottom - d3d->mask2rect.top;
tx = -0.5f + dw * d3d->tin_w / mw / 2;
ty = +0.5f + dh * d3d->tin_h / mh / 2;
- float xshift = -zr.left;
- float yshift = -zr.top;
+ float xshift = (float)-zr.left;
+ float yshift = (float)-zr.top;
sw = dw * d3d->tin_w / vidinfo->outbuffer->inwidth2;
sw *= mw / d3d->window_w;
tx = -0.5f + dw * d3d->tin_w / d3d->window_w / 2;
ty = +0.5f + dh * d3d->tin_h / d3d->window_h / 2;
- float xshift = - zr.left - sr.left; // - (tin_w - 2 * zr.left - w),
- float yshift = + zr.top + sr.top - (d3d->tin_h - h);
+ float xshift = (float)(- zr.left - sr.left); // - (tin_w - 2 * zr.left - w),
+ float yshift = (float)(+ zr.top + sr.top - (d3d->tin_h - h));
sw = dw * d3d->tin_w / d3d->window_w;
sh = dh * d3d->tin_h / d3d->window_h;
d3d->modeex.RefreshRate = d3d->dpp.FullScreen_RefreshRateInHz;
if (vsync > 0) {
d3d->dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- getvsyncrate(monid, d3d->dpp.FullScreen_RefreshRateInHz, &hzmult);
+ getvsyncrate(monid, (float)d3d->dpp.FullScreen_RefreshRateInHz, &hzmult);
if (hzmult < 0) {
if (!ap.gfx_strobo) {
if (d3dCaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO)
if (mode.RefreshRate > 0) {
if (vsync > 0) {
d3d->dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- getvsyncrate(monid, mode.RefreshRate, &hzmult);
+ getvsyncrate(monid, (float)mode.RefreshRate, &hzmult);
if (hzmult < 0) {
if (!ap.gfx_strobo) {
if ((d3dCaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO) && isfullscreen() > 0)
if (vsync < 0) {
d3d->vsync2 = 0;
- getvsyncrate(monid, isfullscreen() > 0 ? d3d->dpp.FullScreen_RefreshRateInHz : mode.RefreshRate, &hzmult);
+ getvsyncrate(monid, (float)(isfullscreen() > 0 ? d3d->dpp.FullScreen_RefreshRateInHz : mode.RefreshRate), &hzmult);
if (hzmult > 0) {
d3d->vsync2 = 1;
} else if (hzmult < 0) {
texelsize.z = 1; texelsize.w = 1;
hr = postEffect->SetVector (d3d->postTexelSize, &texelsize);
if (d3d->postFramecounterHandle)
- postEffect->SetFloat(d3d->postFramecounterHandle, timeframes);
+ postEffect->SetFloat(d3d->postFramecounterHandle, (FLOAT)timeframes);
if (masktexture) {
if (FAILED (hr = postEffect->SetTechnique (d3d->postTechnique)))
}
if (s->m_TargetDimsEffectHandle) {
D3DXVECTOR4 fDimsTarget;
- fDimsTarget.x = s->targettex_width;
- fDimsTarget.y = s->targettex_height;
+ fDimsTarget.x = (FLOAT)s->targettex_width;
+ fDimsTarget.y = (FLOAT)s->targettex_height;
fDimsTarget.z = 1; fDimsTarget.w = 1;
hr = postEffect->SetVector(s->m_TargetDimsEffectHandle, &fDimsTarget);
if (FAILED(hr)) {
MatrixScaling(&t, ((float)(d3d->window_w) / (d3d->tout_w + 2 * d3d->cursor_offset2_x)), ((float)(d3d->window_h) / (d3d->tout_h + 2 * d3d->cursor_offset2_y)), 0);
else
MatrixScaling(&t, 1.0f, 1.0f, 0);
- v.x = d3d->cursor_x + d3d->cursor_offset2_x;
- v.y = d3d->cursor_y + d3d->cursor_offset2_y;
- v.z = 0;
+ v.x = (float)d3d->cursor_x + d3d->cursor_offset2_x;
+ v.y = (float)d3d->cursor_y + d3d->cursor_offset2_y;
+ v.z = 0.0f;
d3d->sprite->SetTransform(&t);
d3d->sprite->Draw(d3d->cursorsurfaced3d, NULL, NULL, &v, 0xffffffff);
MatrixScaling(&t, 1, 1, 0);
v.x = 0;
if (d3d->filterd3d->gfx_filteroverlay_pos.x == -1)
- v.x = (d3d->window_w - (d3d->mask2texture_w * w)) / 2;
+ v.x = (d3d->window_w - (d3d->mask2texture_w * w)) / 2.0f;
else if (d3d->filterd3d->gfx_filteroverlay_pos.x > -24000)
- v.x = d3d->filterd3d->gfx_filteroverlay_pos.x;
+ v.x = (float)d3d->filterd3d->gfx_filteroverlay_pos.x;
else
- v.x = (d3d->window_w - (d3d->mask2texture_w * w)) / 2 + (-d3d->filterd3d->gfx_filteroverlay_pos.x - 30100) * d3d->window_w / 100.0;
+ v.x = (d3d->window_w - (d3d->mask2texture_w * w)) / 2 + (-d3d->filterd3d->gfx_filteroverlay_pos.x - 30100) * d3d->window_w / 100.0f;
v.y = 0;
if (d3d->filterd3d->gfx_filteroverlay_pos.y == -1)
- v.y = (d3d->window_h - (d3d->mask2texture_h * h)) / 2;
+ v.y = (d3d->window_h - (d3d->mask2texture_h * h)) / 2.0f;
else if (d3d->filterd3d->gfx_filteroverlay_pos.y > -24000)
- v.y = d3d->filterd3d->gfx_filteroverlay_pos.y;
+ v.y = (float)d3d->filterd3d->gfx_filteroverlay_pos.y;
else
- v.y = (d3d->window_h - (d3d->mask2texture_h * h)) / 2 + (-d3d->filterd3d->gfx_filteroverlay_pos.y - 30100) * d3d->window_h / 100.0;
+ v.y = (d3d->window_h - (d3d->mask2texture_h * h)) / 2 + (-d3d->filterd3d->gfx_filteroverlay_pos.y - 30100) * d3d->window_h / 100.0f;
v.x /= w;
v.y /= h;
r.left = 0;
r.top = 0;
- r.right = d3d->mask2texture_w;
- r.bottom = d3d->mask2texture_h;
+ r.right = (LONG)d3d->mask2texture_w;
+ r.bottom = (LONG)d3d->mask2texture_h;
if (showoverlay) {
d3d->sprite->SetTransform(&t);
d3d->sprite->Draw(d3d->mask2texture, &r, NULL, &v, 0xffffffff);
if (!led && ledtypes[i] == LED_POWER && currprefs.power_led_dim)
spr = d3d->mask2textureled_power_dim;
if (spr) {
- v.x = d3d->mask2texture_offsetw / w + d3d->mask2textureledoffsets[i * 2 + 0];
- v.y = d3d->mask2textureledoffsets[i * 2 + 1];
+ v.x = (FLOAT)(d3d->mask2texture_offsetw / w + d3d->mask2textureledoffsets[i * 2 + 0]);
+ v.y = (FLOAT)d3d->mask2textureledoffsets[i * 2 + 1];
v.z = 0;
d3d->sprite->Draw(spr, NULL, NULL, &v, 0xffffffff);
d3d->sprite->Flush();
v.y = 0;
r.left = 0;
r.top = 0;
- r.right = d3d->mask2texture_offsetw + 1;
+ r.right = (LONG)d3d->mask2texture_offsetw + 1;
r.bottom = d3d->window_h;
d3d->sprite->Draw (d3d->blanktexture, &r, NULL, &v, 0xffffffff);
if (d3d->window_w > d3d->mask2texture_offsetw + d3d->mask2texture_ww) {
v.y = 0;
r.left = 0;
r.top = 0;
- r.right = d3d->window_w - (d3d->mask2texture_offsetw + d3d->mask2texture_ww) + 1;
- r.bottom = d3d->window_h;
+ r.right = (LONG)(d3d->window_w - (d3d->mask2texture_offsetw + d3d->mask2texture_ww) + 1);
+ r.bottom = (LONG)d3d->window_h;
d3d->sprite->Draw(d3d->blanktexture, &r, NULL, &v, 0xffffffff);
}
}
if (d3d->ledtexture && (((currprefs.leds_on_screen & STATUSLINE_RTG) && WIN32GFX_IsPicassoScreen(mon)) || ((currprefs.leds_on_screen & STATUSLINE_CHIPSET) && !WIN32GFX_IsPicassoScreen(mon)))) {
int slx, sly;
statusline_getpos(d3d - d3ddata, &slx, &sly, d3d->window_w, d3d->window_h);
- v.x = slx;
- v.y = sly;
- v.z = 0;
+ v.x = (float)slx;
+ v.y = (float)sly;
+ v.z = 0.0f;
d3d->sprite->Draw(d3d->ledtexture, NULL, NULL, &v, 0xffffffff);
}
struct d3d9overlay *ov = d3d->extoverlays;
while (ov) {
if (ov->tex) {
- v.x = ov->x;
- v.y = ov->y;
- v.z = 0;
+ v.x = (float)ov->x;
+ v.y = (float)ov->y;
+ v.z = 0.0f;
d3d->sprite->Draw(ov->tex, NULL, NULL, &v, 0xffffffff);
}
ov = ov->next;
waitfakemode (d3d);
if (!isd3d (d3d))
- return -1;
+ return -1.0f;
hr = d3d->d3ddev->GetDisplayMode (0, &dmode);
if (FAILED (hr))
- return -1;
- return dmode.RefreshRate;
+ return -1.0f;
+ return (float)dmode.RefreshRate;
}
static void xD3D_guimode(int monid, int guion)
write_log(_T("Failed to open '%s'\n"), tmp);
goto end;
}
- size = zfile_size(z);
+ size = zfile_size32(z);
fx1 = xcalloc(char, size * 4);
fx2 = xcalloc(char, size * 4);
if (zfile_fread(fx1, 1, size, z) != size) {
}
if (s->m_TargetDimsEffectHandle) {
D3DXVECTOR4 fDimsTarget;
- fDimsTarget.x = s->targettex_width;
- fDimsTarget.y = s->targettex_height;
+ fDimsTarget.x = (float)s->targettex_width;
+ fDimsTarget.y = (float)s->targettex_height;
fDimsTarget.z = 1;
fDimsTarget.w = 1;
s->m_TargetDimsEffectHandle->SetFloatVector((float*)&fDimsTarget);
}
if (s->m_ScaleEffectHandle) {
D3DXVECTOR4 fScale;
- fScale.x = 1 << currprefs.gfx_resolution;
- fScale.y = 1 << currprefs.gfx_vresolution;
+ fScale.x = (float)(1 << currprefs.gfx_resolution);
+ fScale.y = (float)(1 << currprefs.gfx_vresolution);
fScale.w = fScale.z = 1;
s->m_ScaleEffectHandle->SetFloatVector((float*)&fScale);
}
positionY = (sh - bh) / 2 + d3d->yoffset;
// Calculate the screen coordinates of the left side of the bitmap.
- left = (sw + 1) / -2;
+ left = (sw + 1.0f) / -2.0f;
left += positionX;
// Calculate the screen coordinates of the right side of the bitmap.
right = left + bw;
// Calculate the screen coordinates of the top of the bitmap.
- top = (sh + 1) / 2;
+ top = (sh + 1.0f) / 2.0f;
top -= positionY;
// Calculate the screen coordinates of the bottom of the bitmap.
d3d->dr2 = dr;
d3d->zr2 = zr;
- float dw = dr.right - dr.left;
- float dh = dr.bottom - dr.top;
- float w = sr.right - sr.left;
- float h = sr.bottom - sr.top;
+ float dw = (float)dr.right - dr.left;
+ float dh = (float)dr.bottom - dr.top;
+ float w = (float)sr.right - sr.left;
+ float h = (float)sr.bottom - sr.top;
int tx = ((dr.right - dr.left) * d3d->m_bitmapWidth) / (d3d->m_screenWidth * 2);
int ty = ((dr.bottom - dr.top) * d3d->m_bitmapHeight) / (d3d->m_screenHeight * 2);
UpdateBuffers(d3d);
xD3DXMatrixOrthoOffCenterLH(&d3d->m_matProj_out, 0, w + 0.05f, 0, h + 0.05f, 0.0f, 1.0f);
- xD3DXMatrixTranslation(&d3d->m_matView_out, tx, ty, 1.0f);
+ xD3DXMatrixTranslation(&d3d->m_matView_out, (float)tx, (float)ty, 1.0f);
sw *= d3d->m_bitmapWidth;
sh *= d3d->m_bitmapHeight;
xD3DXMatrixScaling(&d3d->m_matWorld_out, sw + 0.5f / sw, sh + 0.5f / sh, 1.0f);
return;
statusline_getpos(d3d - d3d11data, &osdx, &osdy, d3d->m_screenWidth, d3d->m_screenHeight);
- d3d->osd.x = osdx;
- d3d->osd.y = osdy;
+ d3d->osd.x = (float)osdx;
+ d3d->osd.y = (float)osdy;
hr = d3d->m_deviceContext->Map(d3d->osd.texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
if (FAILED(hr)) {
write_log(_T("Overlay texture '%s' load failed.\n"), filename);
goto end;
}
- d3d->mask2texture_w = img.width;
- d3d->mask2texture_h = img.height;
+ d3d->mask2texture_w = (float)img.width;
+ d3d->mask2texture_h = (float)img.height;
if (!allocsprite(d3d, &d3d->mask2texture, img.width, img.height, true))
goto end;
d3d->mask2rect.left = 0;
d3d->mask2rect.top = 0;
- d3d->mask2rect.right = d3d->mask2texture_w;
- d3d->mask2rect.bottom = d3d->mask2texture_h;
+ d3d->mask2rect.right = (LONG)d3d->mask2texture_w;
+ d3d->mask2rect.bottom = (LONG)d3d->mask2texture_h;
- d3d->mask2rect.left = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, -1, 0);
- d3d->mask2rect.right = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 1, 0);
- d3d->mask2rect.top = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 0, -1);
- d3d->mask2rect.bottom = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 0, 1);
+ d3d->mask2rect.left = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, -1, 0);
+ d3d->mask2rect.right = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 1, 0);
+ d3d->mask2rect.top = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 0, -1);
+ d3d->mask2rect.bottom = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 0, 1);
if (d3d->mask2rect.left >= d3d->mask2texture_w / 2 || d3d->mask2rect.top >= d3d->mask2texture_h / 2 ||
d3d->mask2rect.right <= d3d->mask2texture_w / 2 || d3d->mask2rect.bottom <= d3d->mask2texture_h / 2) {
d3d->mask2rect.left = 0;
d3d->mask2rect.top = 0;
- d3d->mask2rect.right = d3d->mask2texture_w;
- d3d->mask2rect.bottom = d3d->mask2texture_h;
+ d3d->mask2rect.right = (LONG)d3d->mask2texture_w;
+ d3d->mask2rect.bottom = (LONG)d3d->mask2texture_h;
}
d3d->mask2texture_multx = (float)d3d->m_screenWidth / d3d->mask2texture_w;
d3d->mask2texture_multy = (float)d3d->m_screenHeight / d3d->mask2texture_h;
if (isfs(d3d) > 0) {
struct MultiDisplay *md = getdisplay(&currprefs, mon->monitor_id);
- float deskw = md->rect.right - md->rect.left;
- float deskh = md->rect.bottom - md->rect.top;
+ float deskw = (float)md->rect.right - md->rect.left;
+ float deskh = (float)md->rect.bottom - md->rect.top;
//deskw = 800; deskh = 600;
float dstratio = deskw / deskh;
float srcratio = d3d->mask2texture_w / d3d->mask2texture_h;
d3d->mask2texture_multx = d3d->mask2texture_multy;
}
- d3d->mask2texture_wh = d3d->m_screenHeight;
- d3d->mask2texture_ww = d3d->mask2texture_w * d3d->mask2texture_multx;
+ d3d->mask2texture_wh = (float)d3d->m_screenHeight;
+ d3d->mask2texture_ww = (float)d3d->mask2texture_w * d3d->mask2texture_multx;
d3d->mask2texture_offsetw = (d3d->m_screenWidth - d3d->mask2texture_ww) / 2;
if (d3d->mask2texture_offsetw > 0) {
- allocsprite(d3d, &d3d->blanksprite, d3d->mask2texture_offsetw + 1, d3d->m_screenHeight, false);
+ allocsprite(d3d, &d3d->blanksprite, (int)d3d->mask2texture_offsetw + 1, d3d->m_screenHeight, false);
}
xmult = d3d->mask2texture_multx;
ymult = d3d->mask2texture_multy;
- d3d->mask2rect.left *= xmult;
- d3d->mask2rect.right *= xmult;
- d3d->mask2rect.top *= ymult;
- d3d->mask2rect.bottom *= ymult;
+ d3d->mask2rect.left *= (int)xmult;
+ d3d->mask2rect.right *= (int)xmult;
+ d3d->mask2rect.top *= (int)ymult;
+ d3d->mask2rect.bottom *= (int)ymult;
d3d->mask2texture_wwx = d3d->mask2texture_w * xmult;
if (d3d->mask2texture_wwx > d3d->m_screenWidth)
- d3d->mask2texture_wwx = d3d->m_screenWidth;
+ d3d->mask2texture_wwx = (float)d3d->m_screenWidth;
if (d3d->mask2texture_wwx < d3d->mask2rect.right - d3d->mask2rect.left)
- d3d->mask2texture_wwx = d3d->mask2rect.right - d3d->mask2rect.left;
+ d3d->mask2texture_wwx = (float)d3d->mask2rect.right - d3d->mask2rect.left;
if (d3d->mask2texture_wwx > d3d->mask2texture_ww)
d3d->mask2texture_wwx = d3d->mask2texture_ww;
- d3d->mask2texture_minusx = -((d3d->m_screenWidth - d3d->mask2rect.right) + d3d->mask2rect.left);
+ d3d->mask2texture_minusx = (float)(-((d3d->m_screenWidth - d3d->mask2rect.right) + d3d->mask2rect.left));
if (d3d->mask2texture_offsetw > 0)
d3d->mask2texture_minusx += d3d->mask2texture_offsetw * xmult;
- d3d->mask2texture_minusy = -(d3d->m_screenHeight - (d3d->mask2rect.bottom - d3d->mask2rect.top));
+ d3d->mask2texture_minusy = (float)(-(d3d->m_screenHeight - (d3d->mask2rect.bottom - d3d->mask2rect.top)));
d3d->mask2texture_hhx = d3d->mask2texture_h * ymult;
ComPtr<IDXGIFactory5> factory5;
IDXGIAdapter1 *adapter;
IDXGIOutput *adapterOutput;
- IDXGIOutput2 *adapterOutput2;
DXGI_ADAPTER_DESC1 adesc;
DXGI_OUTPUT_DESC odesc;
unsigned int numModes;
d3d->fsSwapChainDesc.RefreshRate.Denominator = m->RefreshRate.Denominator;
d3d->fsSwapChainDesc.RefreshRate.Numerator = m->RefreshRate.Numerator;
if (!currprefs.gfx_variable_sync) {
- *freq = nfreq;
+ *freq = (int)nfreq;
}
}
}
if (!monid && isvsync()) {
int vsync = isvsync();
int hzmult = 0;
- getvsyncrate(monid, *freq, &hzmult);
+ getvsyncrate(monid, (float)*freq, &hzmult);
if (hzmult < 0 && !currprefs.gfx_variable_sync && apm->gfx_vsyncmode == 0) {
if (!apm->gfx_strobo) {
d3d->vblankintervals = 2;
d3d->blackscreen = true;
d3d->vblankintervals = 1;
int hzmult;
- getvsyncrate(monid, hz, &hzmult);
+ getvsyncrate(monid, (float)hz, &hzmult);
if (hzmult < 0) {
d3d->vblankintervals = 1 + (-hzmult) - (d3d->blackscreen ? 1 : 0);
}
return;
}
- float bri = ((float)(currprefs.gfx_luminance)) * (1.0f / 2000.0f) + 1.0;
- float con = ((float)(currprefs.gfx_contrast + 2000)) / 2000.0f;
+ float bri = (currprefs.gfx_luminance) * (1.0f / 2000.0f) + 1.0f;
+ float con = (currprefs.gfx_contrast + 2000.0f) / 2000.0f;
// Get a pointer to the data in the constant buffer.
dataPtr = (PSBufferType *)mappedResource.pData;
if (!spr->enabled)
return;
- left = (d3d->m_screenWidth + 1) / -2;
+ left = (d3d->m_screenWidth + 1.0f) / -2.0f;
left += spr->x;
- top = (d3d->m_screenHeight + 1) / 2;
+ top = (d3d->m_screenHeight + 1.0f) / 2.0f;
top -= spr->y;
if (spr->outwidth) {
static void setspritescaling(struct d3d11sprite *spr, float w, float h)
{
- spr->outwidth = (int)(w * spr->width + 0.5);
- spr->outheight = (int)(h * spr->height + 0.5);
+ spr->outwidth = w * spr->width + 0.5f;
+ spr->outheight = h * spr->height + 0.5f;
}
static void renderoverlay(struct d3d11struct *d3d)
if (width && height) {
d3d->cursor_offset2_x = d3d->cursor_offset_x * d3d->m_screenWidth / width;
d3d->cursor_offset2_y = d3d->cursor_offset_y * d3d->m_screenHeight / height;
- d3d->cursor_x = x * d3d->m_screenWidth / width;
- d3d->cursor_y = y * d3d->m_screenHeight / height;
+ d3d->cursor_x = (float)x * d3d->m_screenWidth / width;
+ d3d->cursor_y = (float)y * d3d->m_screenHeight / height;
} else {
d3d->cursor_x = d3d->cursor_y = 0;
d3d->cursor_offset2_x = d3d->cursor_offset2_y = 0;
//write_log(_T("%.1fx%.1f %dx%d\n"), d3d->cursor_x, d3d->cursor_y, d3d->cursor_offset2_x, d3d->cursor_offset2_y);
- float multx = 1.0;
- float multy = 1.0;
+ float multx = 1.0f;
+ float multy = 1.0f;
if (d3d->cursor_scale) {
multx = ((float)(d3d->m_screenWidth) / ((d3d->m_bitmapWidth * d3d->dmult) + 2 * d3d->cursor_offset2_x));
multy = ((float)(d3d->m_screenHeight) / ((d3d->m_bitmapHeight * d3d->dmult) + 2 * d3d->cursor_offset2_y));
}
- setspritescaling(&d3d->hwsprite, 1.0 / multx, 1.0 / multy);
+ setspritescaling(&d3d->hwsprite, 1.0f / multx, 1.0f / multy);
d3d->hwsprite.x = d3d->cursor_x * multx + d3d->cursor_offset2_x * multx;
d3d->hwsprite.y = d3d->cursor_y * multy + d3d->cursor_offset2_y * multy;
if (!d3d->mask2texture.enabled)
return false;
- float mw = d3d->mask2rect.right - d3d->mask2rect.left;
- float mh = d3d->mask2rect.bottom - d3d->mask2rect.top;
+ float mw = (float)(d3d->mask2rect.right - d3d->mask2rect.left);
+ float mh = (float)(d3d->mask2rect.bottom - d3d->mask2rect.top);
float mxt = (float)mw / width;
float myt = (float)mh / height;
return false;
if (!ext->data && s && (ext->width == 0 || ext->height == 0)) {
- s->x = ext->xpos;
- s->y = ext->ypos;
+ s->x = (float)ext->xpos;
+ s->y = (float)ext->ypos;
return true;
}
}
s->enabled = true;
- s->x = ext->xpos;
- s->y = ext->ypos;
+ s->x = (float)ext->xpos;
+ s->y = (float)ext->ypos;
hr = d3d->m_deviceContext->Map(s->texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
if (SUCCEEDED(hr)) {
static int CmdSpecify (HANDLE h_, BYTE srt_, BYTE hut_, BYTE hlt_, BYTE nd_)
{
DWORD dwRet;
- FD_SPECIFY_PARAMS sp = { (srt_ << 4) | (hut_ & 0x0f), (hlt_ << 1) | (nd_ & 1) };
+ FD_SPECIFY_PARAMS sp = { (BYTE)((srt_ << 4) | (hut_ & 0x0f)), (BYTE)((hlt_ << 1) | (nd_ & 1)) };
if (h == INVALID_HANDLE_VALUE)
return 0;
return !!DeviceIoControl(h_, IOCTL_FDCMD_SPECIFY, &sp, sizeof(sp), NULL, 0, &dwRet, NULL);
dxdata.depth == bits && dxdata.freq == freq)
return DD_OK;
- getvsyncrate(0, freq, &dxdata.vblank_skip);
+ getvsyncrate(0, (float)freq, &dxdata.vblank_skip);
dxdata.vblank_skip_cnt = 0;
ddrval = IDirectDraw7_SetDisplayMode (dxdata.maindd, width, height, bits, freq, 0);
if (FAILED (ddrval)) {
return true;
}
-void DD_vblank_reset (double freq)
+void DD_vblank_reset(float freq)
{
getvsyncrate(0, freq, &dxdata.vblank_skip);
dxdata.vblank_skip_cnt = 0;
void DirectDraw_Fill (RECT *rect, uae_u32 color);
void DirectDraw_FillPrimary (void);
bool DD_getvblankpos (int *vpos);
-void DD_vblank_reset (double freq);
+void DD_vblank_reset (float freq);
void dx_check (void);
int dx_islost (void);
s = (data[6 * 2 + 0] << 8) | (data[6 * 2 + 1] << 0);
if (offset >= 0) {
offset /= 512;
- c = offset / (h * s);
+ c = (int)(offset / (h * s));
offset -= c * h * s;
- h = offset / s;
+ h = (int)(offset / s);
offset -= h * s;
- s = offset + 1;
+ s = (int)offset + 1;
}
*cp = c;
*hp = h;
SetupDiDestroyDeviceInfoList(hIntDevInfo);
if (vpm[0] == 0xffffffff || vpm[1] == 0xffffffff)
return false;
- udi->usb_vid = vpm[0];
- udi->usb_pid = vpm[1];
+ udi->usb_vid = (uae_u16)vpm[0];
+ udi->usb_pid = (uae_u16)vpm[1];
return true;
}
} else {
get = COPY_CACHE_SIZE;
if (sizecnt + get > size)
- get = size - sizecnt;
+ get = (DWORD)(size - sizecnt);
if (!ReadFile(h, cache, get, &got, NULL)) {
progressdialogreturn = 4;
break;
}
if (got > 0) {
if (written + got > size)
- got = size - written;
+ got = (DWORD)(size - written);
if (!WriteFile (hdst, cache, got, &gotdst, NULL)) {
progressdialogreturn = 5;
break;
IS_BORDER(R),IS_BORDER(T),IS_BORDER(RT), \
texture+((x+(border%16)*HQ2X_RESOLUTION+y*16*HQ2X_RESOLUTION+(border&~15)*HQ2X_RESOLUTION*HQ2X_RESOLUTION)*4))
-static double sign(double a) {
- return (a < 0?-1:1);
+static float sign(float a) {
+ return (a < 0.0f ? -1.0f : 1.0f);
}
/*
cordinate system. It is mathematically exact, and well-tested for xcenter > 0 and ycenter > 0 (it's only
used that way). It should be correct for other cases as well, but well... famous last words :)
*/
-static double intersect_any(double xcenter, double ycenter, double xsize, double ysize, double yoffset, double gradient) {
- double g = fabs(gradient)*xsize/ysize;
- double o = -((yoffset-ycenter) + gradient*xcenter)/ysize*sign(ycenter)*sign(yoffset)-g*0.5+0.5;
- double yl = o, yr = o+g, xb = -o/g, xt = (1-o)/g;
- double area = 1.0;
+static float intersect_any(float xcenter, float ycenter, float xsize, float ysize, float yoffset, float gradient) {
+ float g = (float)fabs(gradient)*xsize/ysize;
+ float o = -((yoffset-ycenter) + gradient*xcenter)/ysize*sign(ycenter)*sign(yoffset)-g*0.5f+0.5f;
+ float yl = o, yr = o+g, xb = -o/g, xt = (1-o)/g;
+ float area = 1.0;
if (yl >= 1.0) xt = xb = area = 0.0;
else if (yl > 0.0) {
- area = 1.0-yl;
+ area = 1.0f-yl;
xb = 0.0;
}
else if (yr <= 0.0) yl = yr = area = 1.0;
return area;
}
-static double intersect_h(double xcenter, double ycenter, double xsize, double ysize) {
- return fmax(0.0,fmin(1.0,(.55-fabs(xcenter)+xsize/2.0)/xsize));
+static float intersect_h(float xcenter, float ycenter, float xsize, float ysize) {
+ return (float)fmax(0.0f,fmin(1.0f,(0.55f-fabs(xcenter)+xsize/2.0f)/xsize));
}
-static double intersect_any_h(double xcenter, double ycenter, double xsize, double ysize, double yoffset, double gradient) {
- double hinside = intersect_h(xcenter,ycenter,xsize,ysize);
+static float intersect_any_h(float xcenter, float ycenter, float xsize, float ysize, float yoffset, float gradient) {
+ float hinside = intersect_h(xcenter,ycenter,xsize,ysize);
return hinside*hinside*intersect_any(xcenter,ycenter,xsize,ysize,yoffset,gradient);
}
-static double intersect_v(double xcenter, double ycenter, double xsize, double ysize) {
- return fmax(0.0,fmin(1.0,(.55-fabs(ycenter)+ysize/2.0)/ysize));
+static float intersect_v(float xcenter, float ycenter, float xsize, float ysize) {
+ return (float)fmax(0.0f,fmin(1.0f,(0.55f-fabs(ycenter)+ysize/2.0f)/ysize));
}
-static double intersect_any_v(double xcenter, double ycenter, double xsize, double ysize, double yoffset, double gradient) {
- double vinside = intersect_v(xcenter,ycenter,xsize,ysize);
+static float intersect_any_v(float xcenter, float ycenter, float xsize, float ysize, float yoffset, float gradient) {
+ float vinside = intersect_v(xcenter,ycenter,xsize,ysize);
return vinside*vinside*intersect_any(xcenter,ycenter,xsize,ysize,yoffset,gradient);
}
-static double intersect_hv(double xcenter, double ycenter, double xsize, double ysize) {
- double hinside = intersect_h(xcenter,ycenter,xsize,ysize);
- double vinside = intersect_v(xcenter,ycenter,xsize,ysize);
+static float intersect_hv(float xcenter, float ycenter, float xsize, float ysize) {
+ float hinside = intersect_h(xcenter,ycenter,xsize,ysize);
+ float vinside = intersect_v(xcenter,ycenter,xsize,ysize);
return (1-hinside)*(1-vinside)+hinside*vinside;
}
/* FIXME: not sure if this is correct, but it is rare enough and most likely near enough. fixes welcome :) */
-static double intersect_any_hv(double xcenter, double ycenter, double xsize, double ysize, double yoffset, double gradient) {
- double hvinside = intersect_hv(xcenter,ycenter,xsize,ysize);
+static float intersect_any_hv(float xcenter, float ycenter, float xsize, float ysize, float yoffset, float gradient) {
+ float hvinside = intersect_hv(xcenter,ycenter,xsize,ysize);
return hvinside*hvinside*intersect_any(xcenter,ycenter,xsize,ysize,yoffset,gradient);
}
-static double intersect_hvd(double xcenter, double ycenter, double xsize, double ysize) {
+static float intersect_hvd(float xcenter, float ycenter, float xsize, float ysize) {
return intersect_h(xcenter,ycenter,xsize,ysize)*intersect_v(xcenter,ycenter,xsize,ysize);
}
-static void setinterp(double xcenter, double ycenter, double percentage_inside, int i1, int i2, int i3, int o1, int o2, int o3, unsigned char *factors) {
- double d0, d1, d2, d3, percentage_outside, totaldistance_i, totaldistance_o;
- xcenter = fabs(xcenter);
- ycenter = fabs(ycenter);
+static void setinterp(float xcenter, float ycenter, float percentage_inside, int i1, int i2, int i3, int o1, int o2, int o3, unsigned char *factors) {
+ float d0, d1, d2, d3, percentage_outside, totaldistance_i, totaldistance_o;
+ xcenter = (float)fabs(xcenter);
+ ycenter = (float)fabs(ycenter);
d0 = (1-xcenter)*(1-ycenter);
d1 = xcenter*(1-ycenter);
d2 = (1-xcenter)*ycenter;
d3 = xcenter*ycenter;
if (i1 && i2) i3 = 0;
if (o1 && o2) o3 = 0;
- percentage_outside = 1.0-percentage_inside;
+ percentage_outside = 1.0f-percentage_inside;
totaldistance_i = d0+i1*d1+i2*d2+i3*d3;
- totaldistance_o = o1*d1+o2*d2+o3*d3+1e-12; /* +1e-12: prevent division by zero */
+ totaldistance_o = o1*d1+o2*d2+o3*d3+1e-12f; /* +1e-12: prevent division by zero */
factors[1] = (unsigned char)(((d1/totaldistance_i*percentage_inside*i1)+(d1/totaldistance_o*percentage_outside*o1))*255+.5);
factors[2] = (unsigned char)(((d2/totaldistance_i*percentage_inside*i2)+(d2/totaldistance_o*percentage_outside*o2))*255+.5);
// outwidth, outheight == width, height
void BuildHq2xLookupTexture(int outWidth, int outHeight, int rwidth, int rheight, unsigned char* texture)
{
- double xsize, ysize;
+ float xsize, ysize;
int border, y, x;
unsigned char table[4096] = HQ2X_D3D_TABLE_DATA;
- xsize = (double)rwidth / (double)outWidth;
- ysize = (double)rheight / (double)outHeight;
+ xsize = (float)rwidth / (float)outWidth;
+ ysize = (float)rheight / (float)outHeight;
for (border = 0; border < 4096; border++) {
for (y = 0; y < HQ2X_RESOLUTION; y++) {
for (x = 0; x < HQ2X_RESOLUTION; x++) {
- double xcenter = fabs((((double)x)+0.5) / (double)(HQ2X_RESOLUTION)-0.5)/0.958;
- double ycenter = fabs((((double)y)+0.5) / (double)(HQ2X_RESOLUTION)-0.5)/0.958;
+ float xcenter = (float)(fabs((((float)x)+0.5f) / (float)(HQ2X_RESOLUTION)-0.5f)/0.958f);
+ float ycenter = (float)(fabs((((float)y)+0.5f) / (float)(HQ2X_RESOLUTION)-0.5f)/0.958f);
int sx = (x < HQ2X_RESOLUTION/2?-1:1);
int sy = (y < HQ2X_RESOLUTION/2?-1:1);
int b = (sy > 0?(sx > 0?border:hmirror(border)):(sx > 0?vmirror(border):vmirror(hmirror(border))));
SETINTERP(1.0);
}
} else {
- double yoff = (table[b]&4?1:-1)*(((table[b] >> 3) & 3) + 1)/4.0;
- double grad = (table[b]&32?1:-1)*(((table[b] >> 6) & 3) + 1)/2.0;
+ float yoff = (float)((table[b]&4?1:-1)*(((table[b] >> 3) & 3) + 1.0f)/4.0f);
+ float grad = (float)((table[b]&32?1:-1)*(((table[b] >> 6) & 3) + 1.0f)/2.0f);
if (table[b] & H) {
if (table[b] & V) {
SETINTERP(intersect_any_hv(xcenter,ycenter,xsize,ysize,yoff,grad));
if (size64 < 8 * 1024 * 1024)
size64 = 8 * 1024 * 1024;
if ((uae_u64)max_allowed_mman * 1024 * 1024 > size64)
- max_allowed_mman = size64 / (1024 * 1024);
+ max_allowed_mman = (uae_u32)(size64 / (1024 * 1024));
uae_u32 natmem_size = (max_allowed_mman + 1) * 1024 * 1024;
if (natmem_size < 17 * 1024 * 1024)
return 0;
}
if (head->firstframe < 0)
- head->firstframe = zfile_ftell(zf);
+ head->firstframe = zfile_ftell32(zf);
head->ver = (header[1] >> 3) & 3;
if (head->ver == 1) {
}
if (sameframes == 0 && frames > 100) {
// assume this is CBR MP3
- size = mh.samplerate * 2 * (mh.isstereo ? 2 : 1) * ((zfile_size(zf) - firstframe) / ((mh.samplerate / 8 * mh.bitrate) / mh.freq));
+ size = mh.samplerate * 2 * (mh.isstereo ? 2 : 1) * ((zfile_size32(zf) - firstframe) / ((mh.samplerate / 8 * mh.bitrate) / mh.freq));
break;
}
}
int hres = prefs->gfx_resolution;
if (prefs->gf[0].gfx_filter) {
if (prefs->gf[0].gfx_filter_horiz_zoom_mult)
- hres += prefs->gf[0].gfx_filter_horiz_zoom_mult - 1;
+ hres += (int)prefs->gf[0].gfx_filter_horiz_zoom_mult - 1;
hres += uaefilters[prefs->gf[0].gfx_filter].intmul - 1;
}
if (hres > max_horiz_dbl)
int vres = prefs->gfx_vresolution;
if (prefs->gf[0].gfx_filter) {
if (prefs->gf[0].gfx_filter_vert_zoom_mult)
- vres += prefs->gf[0].gfx_filter_vert_zoom_mult - 1;
+ vres += (int)prefs->gf[0].gfx_filter_vert_zoom_mult - 1;
vres += uaefilters[prefs->gf[0].gfx_filter].intmul - 1;
}
if (vres > max_vert_dbl)
int full = 0;
int hres, vres;
int totalhdbl = -1, totalvdbl = -1;
- int hmult, vmult;
+ float hmult, vmult;
bool half;
bool rtg;
hres = hdbl;
if (hres > max_horiz_dbl) {
- hmult = 1 << (hres - max_horiz_dbl);
+ hmult = (float)(1 << (hres - max_horiz_dbl));
hres = max_horiz_dbl;
}
vres = vdbl;
if (vres > max_vert_dbl) {
- vmult = 1 << (vres - max_vert_dbl);
+ vmult = (float)(1 << (vres - max_vert_dbl));
vres = max_vert_dbl;
}
}
m = 4;
}
}
- p->rtg_horiz_zoom_mult = p->rtg_vert_zoom_mult = m;
+ p->rtg_horiz_zoom_mult = p->rtg_vert_zoom_mult = (float)m;
if (WIN32GFX_IsPicassoScreen(mon)) {
gm->gfx_size_win.width = vidinfo->width * m;
gm->gfx_size_win.height = vidinfo->height * m;
- hmult = m;
- vmult = m;
+ hmult = (float)m;
+ vmult = (float)m;
} else {
}
static _inline uae_u32 Q_INTERPOLATE(uae_u32 A, uae_u32 B, uae_u32 C, uae_u32 D) {
- register uae_u32 x = ((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2);
- register uae_u32 y = ((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2;
+ uae_u32 x = ((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2);
+ uae_u32 y = ((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2;
y &= qlowpixelMask;
return x + y;
} else if (color5 == color3 && color2 != color6) {
product2b = product1b = color5;
} else if (color5 == color3 && color2 == color6) {
- register int r = 0;
+ int r = 0;
r += GetResult(color6, color5, color1, colorA1);
r += GetResult(color6, color5, color4, colorB1);
} else if (color5 == color3 && color2 != color6) {
product2b = product1b = color5;
} else if (color5 == color3 && color2 == color6) {
- register int r = 0;
+ int r = 0;
r += GetResult(color6, color5, color1, colorA1);
r += GetResult(color6, color5, color4, colorB1);
}
else //if (color2 != color6)
{
- register int r = 0;
+ int r = 0;
r += GetResult(color6, color5, color1, colorA1);
r += GetResult(color6, color5, color4, colorB1);
}
else //if (color2 != color6)
{
- register int r = 0;
+ int r = 0;
r += GetResult(color6, color5, color1, colorA1);
r += GetResult(color6, color5, color4, colorB1);
for (i = 0; i < width; ++i) {
- register uae_u32 colorA, colorB;
+ uae_u32 colorA, colorB;
uae_u32 colorC, colorD,
colorE, colorF, colorG, colorH, colorI, colorJ, colorK, colorL, colorM, colorN, colorO, colorP;
uae_u32 product, product1, product2;
product1 = colorA;
product2 = colorA;
} else {
- register int r = 0;
+ int r = 0;
product1 = INTERPOLATE(colorA, colorC);
product = INTERPOLATE(colorA, colorB);
for (i = 0; i < width; ++i) {
- register uae_u32 colorA, colorB;
+ uae_u32 colorA, colorB;
uae_u32 colorC, colorD,
colorE, colorF, colorG, colorH, colorI, colorJ, colorK, colorL, colorM, colorN, colorO, colorP;
uae_u32 product, product1, product2;
product1 = colorA;
product2 = colorA;
} else {
- register int r = 0;
+ int r = 0;
product1 = INTERPOLATE(colorA, colorC);
product = INTERPOLATE(colorA, colorB);
static int ninebit;
static int lastbitcycle_active_hsyncs;
static bool gotlogwrite;
-static unsigned int lastbitcycle;
+static evt_t lastbitcycle;
static int serial_recv_previous, serial_send_previous;
static int serdatr_last_got;
int serdev;
per = ((serper & 0x7fff) + 1) * (bits - 1);
if (lastbitcycle_active_hsyncs) {
// if last bit still transmitting, add remaining time.
- int extraper = lastbitcycle - get_cycles();
+ int extraper = (int)(lastbitcycle - get_cycles());
if (extraper > 0)
per += extraper / CYCLE_UNIT;
}
switch (evt.type)
{
default:
+ case 0:
write_log (_T("ENET_CLIENT: %d\n"), evt.type);
break;
}
int xextrasamples;
#endif
- double avg_correct;
- double cnt_correct;
+ float avg_correct;
+ float cnt_correct;
};
#define SND_STATUSCNT 10
float scaled_sample_evtime_orig;
extern float sampler_evtime;
-void update_sound (double clk)
+void update_sound (float clk)
{
if (!have_sound)
return;
- scaled_sample_evtime_orig = clk * CYCLE_UNIT * sound_sync_multiplier / sdp->obtainedfreq;
+ scaled_sample_evtime_orig = clk * (float)CYCLE_UNIT * sound_sync_multiplier / sdp->obtainedfreq;
scaled_sample_evtime = scaled_sample_evtime_orig;
sampler_evtime = clk * CYCLE_UNIT * sound_sync_multiplier;
}
-extern int vsynctimebase_orig;
+extern frame_time_t vsynctimebase_orig;
#ifndef AVIOUTPUT
static int avioutput_audio;
#define ADJUST_LIMIT 6
#define ADJUST_LIMIT2 1
-void sound_setadjust (double v)
+void sound_setadjust (float v)
{
float mult;
if (v > ADJUST_LIMIT)
v = ADJUST_LIMIT;
- mult = (1000.0 + v);
+ mult = (1000.0f + v);
if (avioutput_audio && avioutput_enabled && avioutput_nosoundsync)
- mult = 1000.0;
+ mult = 1000.0f;
if (isvsync_chipset () || (avioutput_audio && avioutput_enabled && !currprefs.cachesize)) {
vsynctimebase = vsynctimebase_orig;
- scaled_sample_evtime = scaled_sample_evtime_orig * mult / 1000.0;
+ scaled_sample_evtime = scaled_sample_evtime_orig * mult / 1000.0f;
} else if (currprefs.cachesize || currprefs.m68k_speed != 0) {
- vsynctimebase = (int)(((double)vsynctimebase_orig) * mult / 1000.0);
+ vsynctimebase = (int)(vsynctimebase_orig * mult / 1000.0f);
scaled_sample_evtime = scaled_sample_evtime_orig;
} else {
- vsynctimebase = (int)(((double)vsynctimebase_orig) * mult / 1000.0);
+ vsynctimebase = (int)(vsynctimebase_orig * mult / 1000.0f);
scaled_sample_evtime = scaled_sample_evtime_orig;
}
}
-static void docorrection (struct sound_dp *s, int sndbuf, double sync, int granulaty)
+static void docorrection (struct sound_dp *s, int sndbuf, float sync, int granulaty)
{
static int tfprev;
granulaty = 10;
if (tfprev != timeframes) {
- double skipmode, avgskipmode;
- double avg = s->avg_correct / s->cnt_correct;
+ float skipmode, avgskipmode;
+ float avg = s->avg_correct / s->cnt_correct;
- skipmode = sync / 100.0;
- avgskipmode = avg / (10000.0 / granulaty);
+ skipmode = sync / 100.0f;
+ avgskipmode = avg / (10000.0f / granulaty);
if ((0 || sound_debug) && (tfprev % 10) == 0) {
write_log (_T("%+05d S=%7.1f AVG=%7.1f (IMM=%7.1f + AVG=%7.1f = %7.1f)\n"), sndbuf, sync, avg, skipmode, avgskipmode, skipmode + avgskipmode);
}
-static double sync_sound (double m)
+static float sync_sound (float m)
{
- double skipmode;
+ float skipmode;
if (isvsync ()) {
- skipmode = pow (m < 0 ? -m : m, EXPVS) / 2;
+ skipmode = (float)pow(m < 0 ? -m : m, EXPVS) / 2.0f;
if (m < 0)
skipmode = -skipmode;
if (skipmode < -ADJUST_VSSIZE)
} else if (1) {
- skipmode = pow (m < 0 ? -m : m, EXP) / 2;
+ skipmode = (float)pow(m < 0 ? -m : m, EXP) / 2.0f;
if (m < 0)
skipmode = -skipmode;
if (skipmode < -ADJUST_SIZE)
return 1;
}
-static LARGE_INTEGER qpfc, qpf;
-static void storeqpf (void)
-{
- QueryPerformanceCounter (&qpfc);
-}
-static double getqpf (void)
-{
- LARGE_INTEGER qpfc2;
- QueryPerformanceCounter (&qpfc2);
- return (qpfc2.QuadPart - qpfc.QuadPart) / (qpf.QuadPart / 1000.0);
-}
-
static void close_audio_ds (struct sound_data *sd)
{
struct sound_dp *s = sd->data;
struct sound_dp *s = sd->data;
HRESULT hr;
if (sd->devicetype == SOUND_DEVICE_AL) {
- float vol = 0.0;
- if (volume < 100 && !mute)
- vol = (100 - volume) / 100.0;
+ float vol = 0.0f;
+ if (volume < 100.0f && !mute)
+ vol = (100.0f - volume) / 100.0f;
alSourcef (s->al_Source, AL_GAIN, vol);
} else if (sd->devicetype == SOUND_DEVICE_DS) {
LONG vol = DSBVOLUME_MIN;
if (FAILED (hr))
write_log (_T("AudioVolume->SetMasterVolume(1.0) failed: %08Xs\n"), hr);
if (volume < 100 && !mute) {
- sd->softvolume = (100 - volume) * 32768 / 100.0;
+ sd->softvolume = (int)((100.0f - volume) * 32768.0f / 100.0f);
if (sd->softvolume >= 32768)
sd->softvolume = -1;
}
continue;
}
if (freq != di->defaultSampleRate && err == paInvalidSampleRate && !defaultrate) {
- freq = di->defaultSampleRate;
+ freq = (int)di->defaultSampleRate;
sd->freq = freq;
defaultrate = 1;
continue;
alcheck (sd, 7);
v -= s->al_offset;
- docorrection (s, 100 * v / sd->sndbufsize, v / sd->samplesize, 100);
+ docorrection (s, (int)(100.0f * v / sd->sndbufsize), v / (float)sd->samplesize, 100);
#if 0
gui_data.sndbuf = 100 * v / sd->sndbufsize;
oldpadding = numFramesPadding;
}
- docorrection (s, (s->wasapigoodsize - avail) * 1000 / s->wasapigoodsize, s->wasapigoodsize - avail, 100);
+ docorrection (s, (s->wasapigoodsize - avail) * 1000 / s->wasapigoodsize, (float)(s->wasapigoodsize - avail), 100);
hr = s->pRenderClient->GetBuffer (sd->sndbufframes, &pData);
wasapi_check_state(sd, hr);
s->lpDSBsecondary->Unlock (b1, s1, b2, s2);
if (sd == sdp) {
- double vdiff, m, skipmode;
+ float vdiff, m, skipmode;
- vdiff = (diff - s->snd_writeoffset) / sd->samplesize;
- m = 100.0 * vdiff / (s->max_sndbufsize / sd->samplesize);
+ vdiff = (diff - s->snd_writeoffset) / (float)sd->samplesize;
+ m = 100.0f * vdiff / (s->max_sndbufsize / sd->samplesize);
skipmode = sync_sound (m);
if (tfprev != timeframes) {
- gui_data.sndbuf = vdiff * 1000 / (s->snd_maxoffset - s->snd_writeoffset);
+ gui_data.sndbuf = (int)(vdiff * 1000.0f / (s->snd_maxoffset - s->snd_writeoffset));
s->avg_correct += vdiff;
s->cnt_correct++;
- double adj = (s->avg_correct / s->cnt_correct) / 50.0;
+ float adj = (s->avg_correct / s->cnt_correct) / 50.0f;
if ((0 || sound_debug) && !(tfprev % 10))
write_log (_T("%d,%d,%d,%d d%5d vd%5.0f s%+02.1f %.0f %+02.1f\n"),
sd->sndbufsize / sd->samplesize, s->snd_configsize / sd->samplesize, s->max_sndbufsize / sd->samplesize,
skipmode = ADJUST_LIMIT2;
if (skipmode < -ADJUST_LIMIT2)
skipmode = -ADJUST_LIMIT2;
- sound_setadjust (skipmode + adj);
+ sound_setadjust(skipmode + adj);
}
}
int bufsize = (uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer;
bufsize /= sdp->samplesize;
int todo = s->bufferFrameCount - bufsize;
- int samplesperframe = sdp->obtainedfreq / vblank_hz;
+ int samplesperframe = (int)(sdp->obtainedfreq / vblank_hz);
return samplesperframe >= todo - samplesperframe;
}
return false;
float vol;
if (SUCCEEDED (endpointVolume->GetMasterVolumeLevelScalar (&vol))) {
ok++;
- *volume = vol * 65535.0;
+ *volume = (int)(vol * 65535.0f);
}
if (SUCCEEDED (endpointVolume->GetMute (mute))) {
ok++;
extern void pause_sound (void);
extern void reset_sound (void);
extern bool sound_paused (void);
-extern void sound_setadjust (double);
+extern void sound_setadjust (float);
extern int enumerate_sound_devices (void);
-extern int drivesound_init (void);
-extern void drivesound_free (void);
extern void sound_mute (int);
extern void sound_volume (int);
extern void set_volume (int, int);
{
if (!audio)
return;
- long vol = log10((float)volume / 100.0) * 4000.0;
+ long vol = (long)(log10((float)volume / 100.0) * 4000.0);
audio->put_Volume(vol);
}
{
if (!scanlinecalibrating && calculated_scanline) {
static int lastline;
- float diff = read_processor_time() - wait_vblank_timestamp;
+ float diff = (float)(read_processor_time() - wait_vblank_timestamp);
if (diff < 0)
return -1;
int sl = (int)(diff * (vsync_activeheight + (vsync_totalheight - vsync_activeheight) / 10) * vsync_vblank / syncbase);
vsync_hblank = 0;
get_display_vblank_params(-1, &vsync_activeheight, &vsync_totalheight, &vsync_vblank, &vsync_hblank);
if (vsync_vblank <= 0)
- vsync_vblank = mon->currentmode.freq;
+ vsync_vblank = (float)mon->currentmode.freq;
// GPU scaled mode?
if (vsync_activeheight > mon->currentmode.current_height) {
float m = (float)vsync_activeheight / mon->currentmode.current_height;
- vsync_hblank = (int)(vsync_hblank / m + 0.5);
+ vsync_hblank = vsync_hblank / m + 0.5f;
vsync_activeheight = mon->currentmode.current_height;
}
*dxp = dx;
*dyp = dy;
- *mxp = 1.0 / mx;
- *myp = 1.0 / my;
+ *mxp = 1.0f / mx;
+ *myp = 1.0f / my;
}
void DX_Fill(struct AmigaMonitor *mon, int dstx, int dsty, int width, int height, uae_u32 color)
wi.cbSize = sizeof wi;
GetWindowInfo(mon->hMainWnd, &wi);
extra = wi.rcClient.top - wi.rcWindow.top;
- scale = getdpiforwindow(mon->hStatusWnd) / 96.0;
+ scale = getdpiforwindow(mon->hStatusWnd) / 96.0f;
drive_width = (int)(24 * scale);
hd_width = (int)(24 * scale);
cd_width = (int)(24 * scale);
int cl = 0, size;
struct romdata *rd = 0;
- zfile_fseek (f, 0, SEEK_END);
- size = zfile_ftell (f);
- zfile_fseek (f, 0, SEEK_SET);
+ zfile_fseek(f, 0, SEEK_END);
+ size = zfile_ftell32(f);
+ zfile_fseek(f, 0, SEEK_SET);
if (size > 524288 * 2) {/* don't skip KICK disks or 1M ROMs */
write_log (_T("'%s': too big %d, ignored\n"), zfile_getname(f), size);
return 0;
if (rb->start_address) {
struct zfile *zf = zfile_fopen(rb->lf.loadfile, _T("rb"));
if (zf) {
- rb->end_address = rb->start_address + zfile_size(zf);
+ rb->end_address = rb->start_address + zfile_size32(zf);
rb->end_address = ((rb->end_address + 65535) & ~65535) - 1;
rb->size = rb->end_address - rb->start_address + 1;
zfile_fclose(zf);
if (msg == WM_HSCROLL) {
i = SendDlgItemMessage (hDlg, IDC_FRAMERATE2, TBM_GETPOS, 0, 0);
if (i != (int)cr->rate)
- cr->rate = (double)i;
+ cr->rate = (float)i;
updaterate = true;
} else if (LOWORD (wParam) == IDC_RATE2TEXT && HIWORD (wParam) == EN_KILLFOCUS) {
if (GetDlgItemText(hDlg, IDC_RATE2TEXT, tmp, sizeof tmp / sizeof (TCHAR))) {
- cr->rate = _tstof (tmp);
+ cr->rate = (float)_tstof(tmp);
updaterate = true;
updateslider = true;
}
}
} else if (i == CHIPSET_REFRESH_PAL) {
- cr->rate = 50.0;
+ cr->rate = 50.0f;
} else if (i == CHIPSET_REFRESH_NTSC) {
- cr->rate = 60.0;
+ cr->rate = 60.0f;
}
if (cr->rate > 0 && cr->rate < 1) {
- cr->rate = currprefs.ntscmode ? 60.0 : 50.0;
+ cr->rate = currprefs.ntscmode ? 60.0f : 50.0f;
updaterate = true;
}
if (cr->rate > 300) {
- cr->rate = currprefs.ntscmode ? 60.0 : 50.0;
+ cr->rate = currprefs.ntscmode ? 60.0f : 50.0f;
updaterate = true;
}
if (updaterate) {
case IDC_AUTOCONFIG_PRODUCT:
if (fastram_select_ramboard) {
GetDlgItemText(hDlg, IDC_AUTOCONFIG_MANUFACTURER, tmp, sizeof tmp / sizeof(TCHAR));
- fastram_select_ramboard->manufacturer = _tstol(tmp);
+ fastram_select_ramboard->manufacturer = (uae_u16)_tstol(tmp);
GetDlgItemText(hDlg, IDC_AUTOCONFIG_PRODUCT, tmp, sizeof tmp / sizeof(TCHAR));
- fastram_select_ramboard->product = _tstol(tmp);
+ fastram_select_ramboard->product = (uae_u8)_tstol(tmp);
setfastram_selectmenu(hDlg, 1);
}
break;
SendDlgItemMessage(hDlg, IDC_SPEED_x86, TBM_SETPAGESIZE, 0, 10);
}
-static double getcpufreq (int m)
+static float getcpufreq (int m)
{
- double f;
+ float f;
- f = workprefs.ntscmode ? 28636360.0 : 28375160.0;
- return f * (m >> 8) / 8.0;
+ f = workprefs.ntscmode ? 28636360.0f : 28375160.0f;
+ return f * (m >> 8) / 8.0f;
}
static void values_to_cpudlg(HWND hDlg, WPARAM wParam)
workprefs.int_no_unimplemented = ischecked (hDlg, IDC_CPU_UNIMPLEMENTED) ? 0 : 1;
workprefs.address_space_24 = ischecked (hDlg, IDC_COMPATIBLE24) ? 1 : 0;
workprefs.m68k_speed = ischecked (hDlg, IDC_CS_HOST) ? -1 : 0;
- workprefs.m68k_speed_throttle = SendMessage (GetDlgItem (hDlg, IDC_SPEED), TBM_GETPOS, 0, 0) * 100;
+ workprefs.m68k_speed_throttle = (float)SendMessage (GetDlgItem (hDlg, IDC_SPEED), TBM_GETPOS, 0, 0) * 100;
if (workprefs.m68k_speed_throttle > 0 && workprefs.m68k_speed < 0)
workprefs.m68k_speed_throttle = 0;
- workprefs.x86_speed_throttle = SendMessage(GetDlgItem(hDlg, IDC_SPEED_x86), TBM_GETPOS, 0, 0) * 100;
+ workprefs.x86_speed_throttle = (float)SendMessage(GetDlgItem(hDlg, IDC_SPEED_x86), TBM_GETPOS, 0, 0) * 100;
idx = SendDlgItemMessage(hDlg, IDC_FPU_MODE, CB_GETCURSEL, 0, 0);
if (idx == 0)
workprefs.fpu_mode = 0;
int heads = phys ? current_hfdlg.ci.pheads : current_hfdlg.ci.surfaces;
int secs = phys ? current_hfdlg.ci.psecs : current_hfdlg.ci.sectors;
if (!cyls && current_hfdlg.ci.blocksize && secs && heads) {
- cyls = bsize / ((uae_u64)current_hfdlg.ci.blocksize * secs * heads);
+ cyls = (uae_u32)(bsize / ((uae_u64)current_hfdlg.ci.blocksize * secs * heads));
}
blocks = cyls * (secs * heads);
if (!blocks && current_hfdlg.ci.blocksize)
- blocks = bsize / current_hfdlg.ci.blocksize;
+ blocks = (uae_u32)(bsize / current_hfdlg.ci.blocksize);
if (current_hfdlg.ci.max_lba)
- blocks = current_hfdlg.ci.max_lba;
+ blocks = (uae_u32)current_hfdlg.ci.max_lba;
for (i = 0; i < sizeof (idtmp) / sizeof (TCHAR) - 1; i++) {
TCHAR c = id[i];
{
if (ischecked(hDlg, IDC_HDF_PHYSGEOMETRY)) {
int v = (current_hfdlg.ci.pheads * current_hfdlg.ci.psecs * current_hfdlg.ci.blocksize);
- current_hfdlg.ci.pcyls = v ? current_hfdlg.size / v : 0;
+ current_hfdlg.ci.pcyls = (int)(v ? current_hfdlg.size / v : 0);
current_hfdlg.ci.physical_geometry = true;
SetDlgItemInt (hDlg, IDC_RESERVED, current_hfdlg.ci.pcyls, FALSE);
}
float ho, vo, hz, vz;
if (workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_MANUAL) {
- hz = workprefs.gfx_xcenter_size;
- vz = workprefs.gfx_ycenter_size;
- ho = workprefs.gfx_xcenter_pos;
- vo = workprefs.gfx_ycenter_pos;
+ hz = (float)workprefs.gfx_xcenter_size;
+ vz = (float)workprefs.gfx_ycenter_size;
+ ho = (float)workprefs.gfx_xcenter_pos;
+ vo = (float)workprefs.gfx_ycenter_pos;
} else if (workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_OVERSCAN_BLANK) {
- hz = workprefs.gf[filter_nativertg].gfx_filter_left_border;
- vz = workprefs.gf[filter_nativertg].gfx_filter_right_border;
- ho = workprefs.gf[filter_nativertg].gfx_filter_top_border;
- vo = workprefs.gf[filter_nativertg].gfx_filter_bottom_border;
+ hz = (float)workprefs.gf[filter_nativertg].gfx_filter_left_border;
+ vz = (float)workprefs.gf[filter_nativertg].gfx_filter_right_border;
+ ho = (float)workprefs.gf[filter_nativertg].gfx_filter_top_border;
+ vo = (float)workprefs.gf[filter_nativertg].gfx_filter_bottom_border;
} else {
- hz = workprefs.gf[filter_nativertg].gfx_filter_horiz_zoom;
- vz = workprefs.gf[filter_nativertg].gfx_filter_vert_zoom;
- ho = workprefs.gf[filter_nativertg].gfx_filter_horiz_offset;
- vo = workprefs.gf[filter_nativertg].gfx_filter_vert_offset;
+ hz = (float)workprefs.gf[filter_nativertg].gfx_filter_horiz_zoom;
+ vz = (float)workprefs.gf[filter_nativertg].gfx_filter_vert_zoom;
+ ho = (float)workprefs.gf[filter_nativertg].gfx_filter_horiz_offset;
+ vo = (float)workprefs.gf[filter_nativertg].gfx_filter_vert_offset;
}
SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, (int)hz);
}
} else {
if (h == hz) {
- fd->gfx_filter_horiz_zoom = fdwp->gfx_filter_horiz_zoom = (int)SendMessage (hz, TBM_GETPOS, 0, 0);
+ fd->gfx_filter_horiz_zoom = fdwp->gfx_filter_horiz_zoom = (float)SendMessage (hz, TBM_GETPOS, 0, 0);
if (fdwp->gfx_filter_keep_aspect) {
fd->gfx_filter_vert_zoom = fdwp->gfx_filter_vert_zoom = currprefs.gf[filter_nativertg].gfx_filter_horiz_zoom;
- SendDlgItemMessage (hDlg, IDC_FILTERVZ, TBM_SETPOS, TRUE, fdwp->gfx_filter_vert_zoom);
+ SendDlgItemMessage (hDlg, IDC_FILTERVZ, TBM_SETPOS, TRUE, (int)fdwp->gfx_filter_vert_zoom);
}
} else if (h == vz) {
- fd->gfx_filter_vert_zoom = fdwp->gfx_filter_vert_zoom = (int)SendMessage (vz, TBM_GETPOS, 0, 0);
+ fd->gfx_filter_vert_zoom = fdwp->gfx_filter_vert_zoom = (float)SendMessage (vz, TBM_GETPOS, 0, 0);
if (fdwp->gfx_filter_keep_aspect) {
fd->gfx_filter_horiz_zoom = fdwp->gfx_filter_horiz_zoom = currprefs.gf[filter_nativertg].gfx_filter_vert_zoom;
- SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, fdwp->gfx_filter_horiz_zoom);
+ SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, (int)fdwp->gfx_filter_horiz_zoom);
}
}
- fd->gfx_filter_horiz_offset = fdwp->gfx_filter_horiz_offset = (int)SendMessage (GetDlgItem (hDlg, IDC_FILTERHO), TBM_GETPOS, 0, 0);
- fd->gfx_filter_vert_offset = fdwp->gfx_filter_vert_offset = (int)SendMessage (GetDlgItem (hDlg, IDC_FILTERVO), TBM_GETPOS, 0, 0);
+ fd->gfx_filter_horiz_offset = fdwp->gfx_filter_horiz_offset = (float)SendMessage (GetDlgItem (hDlg, IDC_FILTERHO), TBM_GETPOS, 0, 0);
+ fd->gfx_filter_vert_offset = fdwp->gfx_filter_vert_offset = (float)SendMessage (GetDlgItem (hDlg, IDC_FILTERVO), TBM_GETPOS, 0, 0);
SetDlgItemInt (hDlg, IDC_FILTERHOV, (int)workprefs.gf[filter_nativertg].gfx_filter_horiz_offset, TRUE);
SetDlgItemInt (hDlg, IDC_FILTERVOV, (int)workprefs.gf[filter_nativertg].gfx_filter_vert_offset, TRUE);
SetDlgItemInt (hDlg, IDC_FILTERHZV, (int)workprefs.gf[filter_nativertg].gfx_filter_horiz_zoom, TRUE);
struct newreswnd
{
HWND hwnd;
- uae_s16 x, y, w, h;
+ LONG x, y, w, h;
};
struct newresource
for (int i = 0; i < nr->hwndcnt; i++) {
struct newreswnd *nw = &nr->hwnds[i];
- int x = nw->x;
- x *= multx;
- x /= 100;
+ int x = (int)(nw->x * multx / 100);
- int y = nw->y;
- y *= multy;
- y /= 100;
+ int y = (int)(nw->y * multy / 100);
- int w = nw->w;
- w *= multx;
- w /= 100;
+ int w = (int)(nw->w * multx / 100);
- int h = nw->h;
- h *= multy;
- h /= 100;
+ int h = (int)(nw->h * multy / 100);
if (nr->fontchanged) {
SendMessage(nw->hwnd, WM_SETFONT, (WPARAM)nr->dinfo.hUserFont, 0);
pwi.cbSize = sizeof(WINDOWINFO);
GetWindowInfo(nr->hwnd, &pwi);
- float neww = scaleresource_width - pwi.cxWindowBorders * 2;
- float oldw = (530.0 * nr->unitx) / 8.0;
- multx = neww * 100.0 / oldw;
+ float neww = (float)scaleresource_width - pwi.cxWindowBorders * 2;
+ float oldw = (530.0f * nr->unitx) / 8.0f;
+ multx = neww * 100.0f / oldw;
- float newh = scaleresource_height - height - pwi.cyWindowBorders * 2;
- float oldh = (345.0 * nr->unity) / 8.0;
- multy = newh * 100.0 / oldh;
+ float newh = (float)scaleresource_height - height - pwi.cyWindowBorders * 2;
+ float oldh = (345.0f * nr->unity) / 8.0f;
+ multy = newh * 100.0f / oldh;
HMONITOR m = MonitorFromWindow(nr->hwnd, MONITOR_DEFAULTTOPRIMARY);
int dpi = getdpiformonitor(m);
if (remaining < 0)
return 0;
- return remaining / TIMER_USEC;
+ return (uint32_t)(remaining / TIMER_USEC);
}
return 0;
// big endian, get/put functions will swap if needed.
d[0] = c->device >> 8;
- d[1] = c->device;
+ d[1] = (uae_u8)c->device;
d[2] = c->vendor >> 8;
- d[3] = c->vendor;
+ d[3] = (uae_u8)c->vendor;
d[8] = c->deviceclass >> 16;
d[9] = c->deviceclass >> 8;
}
d[0x2c] = c->subsystem >> 8;
- d[0x2d] = c->subsystem;
+ d[0x2d] = (uae_u8)c->subsystem;
d[0x2e] = c->subsystenvendor >> 8;
- d[0x2f] = c->subsystenvendor;
+ d[0x2f] = (uae_u8)c->subsystenvendor;
d[0x3c] = c->max_latency;
d[0x3d] = c->min_grant;
pcib->memory_start_offset = pcib->window << 16;
offset = pcib->memory_start_offset;
pcib->memory_start_offset -= pcib->baseaddress;
- pcib->memory_start_offset = -pcib->memory_start_offset;
+ pcib->memory_start_offset = 0 - pcib->memory_start_offset;
}
#if 0
write_log(_T"Mediator window: %08x %04x PC=%08x\n"), offset, v, M68K_GETPC);
if (pcib->bank_2_zorro == 3) {
int offset = addr & 0x7fffff;
if (offset == 0) {
- v = pcib->window;
+ v = (uae_u8)pcib->window;
v |= 8; // id
}
if (offset == 4) {
#endif
endofline:
/* now, we have a match */
- if (table68k[opc].mnemo != i_ILLG)
- ;//write_log (_T("Double match: %x: %s\n"), opc, opcstr);
+ //if (table68k[opc].mnemo != i_ILLG)
+ // write_log (_T("Double match: %x: %s\n"), opc, opcstr);
if (find == -1) {
for (find = 0;; find++) {
if (_tcscmp (mnemonic, lookuptab[find].name) == 0) {
if (!f)
return;
zfile_fseek (f, 0, SEEK_END);
- keysize = zfile_ftell (f);
+ keysize = zfile_ftell32(f);
if (keysize > 0) {
zfile_fseek (f, 0, SEEK_SET);
keybuf = xmalloc (uae_u8, keysize);
uae_u8 *p;
struct romdata *rd;
- pos = zfile_ftell (f);
+ pos = zfile_ftell32(f);
zfile_fseek (f, 0, SEEK_END);
- size = zfile_ftell (f);
+ size = zfile_ftell32(f);
if (size > 2048 * 1024)
return NULL;
p = xmalloc (uae_u8, size);
struct zfile *f2 = NULL;
struct zfile *f = rom_fopen(name, mode, mask);
if (f) {
- int size = zfile_size(f);
+ int size = zfile_size32(f);
if (size == 524288 * 2 || size == 524288 || size == 262144) {
uae_u8 *newrom = NULL;
uae_u8 *tmp1 = xcalloc(uae_u8, 524288 * 2);
uae_u8 *buf;
addkeydir(filename);
zfile_fseek(f, 0, SEEK_END);
- size = zfile_ftell(f) - sizeof tmp;
+ size = zfile_ftell32(f) - sizeof tmp;
zfile_fseek(f, sizeof tmp, SEEK_SET);
buf = xmalloc(uae_u8, size);
zfile_fread(buf, size, 1, f);
samplebuffer = NULL;
}
-static evt oldcycles;
+static evt_t oldcycles;
static int oldoffset;
uae_u8 sampler_getsample (int channel)
static int cap_pos;
static float diffsample;
#endif
- static double doffset_offset;
+ static float doffset_offset;
HRESULT hr;
DWORD t;
void *p1, *p2;
DWORD len1, len2;
- evt cycles;
+ evt_t cycles;
int sample, samplecnt;
- double doffset;
+ float doffset;
int offset;
if (!currprefs.sampler_stereo)
s = ua (name);
zfile_fwrite (s, 1, 4, f);
xfree (s);
- pos = zfile_ftell (f);
+ pos = zfile_ftell32(f);
/* chunk size */
dst = &tmp[0];
chunklen = len + 4 + 4 + 4;
size_t opos;
dst = &tmp[0];
save_u32 (len);
- opos = zfile_ftell (f);
+ opos = zfile_ftell32(f);
zfile_fwrite (&tmp[0], 1, 4, f);
len = zfile_zcompress (f, chunk, len);
if (len > 0) {
len2 = 0;
*len = len2;
if (len2 == 0) {
- *filepos = zfile_ftell (f);
+ *filepos = zfile_ftell32(f);
return 0;
}
if (flags & 1) {
zfile_fread (tmp, 1, 4, f);
src = tmp;
- *totallen = restore_u32 ();
- *filepos = zfile_ftell (f) - 4 - 4 - 4;
+ *totallen = restore_u32();
+ *filepos = zfile_ftell32(f) - 4 - 4 - 4;
len2 -= 4;
} else {
- *filepos = zfile_ftell (f) - 4 - 4;
+ *filepos = zfile_ftell32(f) - 4 - 4;
}
/* chunk data. RAM contents will be loaded during the reset phase,
no need to malloc multiple megabytes here. */
if (!f)
goto error;
zfile_fseek (f, 0, SEEK_END);
- filesize = zfile_ftell (f);
+ filesize = zfile_ftell32(f);
zfile_fseek (f, 0, SEEK_SET);
savestate_state = STATE_RESTORE;
savestate_init ();
size_t pos;
if (savestate_specialdump == 2)
write_wavheader (f, 0, 22050);
- pos = zfile_ftell (f);
+ pos = zfile_ftell32(f);
save_rams (f, -1);
if (savestate_specialdump == 2) {
int len, len2, i;
uae_u8 *tmp;
- len = zfile_ftell (f) - pos;
+ len = zfile_ftell32(f) - pos;
tmp = xmalloc (uae_u8, len);
zfile_fseek(f, pos, SEEK_SET);
len2 = zfile_fread (tmp, 1, len, f);
{
if (!staterecord_statefile)
return;
- struct zfile *zf = zfile_fopen (filename, _T("wb"), 0);
+ struct zfile *zf = zfile_fopen(filename, _T("wb"), 0);
if (zf) {
- int len = zfile_size (staterecord_statefile);
- uae_u8 *data = zfile_getdata (staterecord_statefile, 0, len, NULL);
- zfile_fwrite (data, len, 1, zf);
+ int len = zfile_size32(staterecord_statefile);
+ uae_u8 *data = zfile_getdata(staterecord_statefile, 0, len, NULL);
+ zfile_fwrite(data, len, 1, zf);
xfree (data);
- zfile_fclose (zf);
+ zfile_fclose(zf);
write_log (_T("input statefile '%s' saved\n"), filename);
}
}
* reversal sits exactly on the index we have some time to donate to
* the first reversal of the first revolution. */
val = d->total_ticks - d->acc_ticks;
- d->acc_ticks = -val;
+ d->acc_ticks = 0 - val;
}
for (;;) {
if (b)
mfmbuf[i>>4] |= 0x8000u >> (i&15);
if ((i & 7) == 7) {
- tracktiming[i>>3] = d->latency - prev_latency;
+ tracktiming[i>>3] = (uae_u16)(d->latency - prev_latency);
prev_latency = d->latency;
}
}
if (i & 7)
- tracktiming[i>>3] = ((d->latency - prev_latency) * 8) / (i & 7);
+ tracktiming[i>>3] = (uae_u16)(((d->latency - prev_latency) * 8) / (i & 7));
- av_latency = prev_latency / (i>>3);
+ av_latency = (uint32_t)(prev_latency / (i>>3));
for (j = 0; j < (i+7)>>3; j++)
tracktiming[j] = ((uint32_t)tracktiming[j] * 1000u) / av_latency;
offset /= blocksize;
while (length > 0) {
uae_u8 buffer[4096];
- if (!sys_command_read (dev->unitnum, buffer, offset, 1))
+ if (!sys_command_read (dev->unitnum, buffer, (int)offset, 1))
return 20;
trap_memcpyha_safe(ctx, data, buffer, blocksize);
data += blocksize;
uae_u8 buffer[4096];
int err;
trap_memcpyah_safe(ctx, buffer, data, blocksize);
- err = sys_command_write (dev->unitnum, buffer, offset, 1);
+ err = sys_command_write (dev->unitnum, buffer, (int)offset, 1);
if (!err)
return 20;
if (err < 0)
*io_actual = 0;
startoffset = offset % blocksize;
offset -= startoffset;
- sector = offset / blocksize;
+ sector = (uae_u32)(offset / blocksize);
while (length > 0) {
uae_u8 temp[4096];
if (blocksize != 2048) {
int scsi_tape_emulate (struct scsi_data_tape *tape, uae_u8 *cmdbuf, int scsi_cmd_len,
uae_u8 *scsi_data, int *data_len, uae_u8 *r, int *reply_len, uae_u8 *s, int *sense_len)
{
- uae_s64 len;
+ int len;
int lr = 0, ls = 0;
int scsi_len = -1;
int status = 0;
goto errreq;
len = rl (cmdbuf + 1) & 0xffffff;
if (log_tapeemu)
- write_log (_T("TAPEEMU WRITE FILEMARK %lld\n"), len);
+ write_log (_T("TAPEEMU WRITE FILEMARK %d\n"), len);
if (notape (tape))
goto notape;
if (tape->unloaded)
s[13] = 1; /* File Mark detected */
ls = 0x12;
if (log_tapeemu)
- write_log(_T("TAPEEMU READ FILE END, %lld remaining (BEOM=%d)\n"), len - scsi_len, tape->beom);
+ write_log(_T("TAPEEMU READ FILE END, %ld remaining (BEOM=%d)\n"), len - scsi_len, tape->beom);
} else if (tape->beom > 0) {
scsi_len = 0;
if (tape->beom <= 0)
s[13] = tape->beom == 2 ? 2 : 5; /* End-of-media / End-of-data */
ls = 0x12;
if (log_tapeemu)
- write_log(_T("TAPEEMU READ DATA END, %lld remaining\n"), len - scsi_len);
+ write_log(_T("TAPEEMU READ DATA END, %ld remaining\n"), len - scsi_len);
}
break;
int cksum(struct mbuf *m, int len)
{
- register u_int16_t *w;
- register int sum = 0;
- register int mlen = 0;
+ u_int16_t *w;
+ int sum = 0;
+ int mlen = 0;
int byte_swapped = 0;
union {
void msize_init(void);
struct mbuf * m_get(void);
void m_free(struct mbuf *);
-void m_cat(register struct mbuf *, register struct mbuf *);
+void m_cat(struct mbuf *, struct mbuf *);
void m_inc(struct mbuf *, int);
void m_adj(struct mbuf *, int);
int m_copy(struct mbuf *, struct mbuf *, int, int);
void tcp_fasttimo(void);
void tcp_slowtimo(void);
void tcp_canceltimers(struct tcpcb *);
-struct tcpcb * tcp_timers(register struct tcpcb *, int);
+struct tcpcb * tcp_timers(struct tcpcb *, int);
#endif
static void uaesndboard_reset(int hardreset);
static void sndboard_reset(int hardreset);
-static double base_event_clock;
+static float base_event_clock;
extern addrbank uaesndboard_bank_z2, uaesndboard_bank_z3;
#define STATUS_READ_RECORD_HALF 4
-void update_sndboard_sound (double clk)
+void update_sndboard_sound (float clk)
{
base_event_clock = clk;
}
codec_setup(data);
- data->event_time = base_event_clock * CYCLE_UNIT / data->freq;
- data->record_event_time = base_event_clock * CYCLE_UNIT / (data->freq_adjusted * data->record_bytespersample);
+ data->event_time = (int)(base_event_clock * CYCLE_UNIT / data->freq);
+ data->record_event_time = (int)(base_event_clock * CYCLE_UNIT / (data->freq_adjusted * data->record_bytespersample));
data->record_event_counter = 0;
if (data->snddev_active & STATUS_FIFO_PLAY) {
data->freq = fm801_freq[f];
if (!data->freq)
data->freq = 44100;
- data->event_time = base_event_clock * CYCLE_UNIT / data->freq;
+ data->event_time = (int)(base_event_clock * CYCLE_UNIT / data->freq);
data->bits = (control & 0x4000) ? 16 : 8;
f = (control >> 12) & 3;
switch (f)
void AUD_set_active_out(SWVoiceOut *sw, int on)
{
sw->active = on != 0;
- sw->event_time = base_event_clock * CYCLE_UNIT / sw->freq;
+ sw->event_time = (int)(base_event_clock * CYCLE_UNIT / sw->freq);
sw->samplebuf_index = 0;
sw->samplebuf_total = 0;
calculate_volume_qemu();
uint32_t aHigh, aLow, bHigh, bLow;
uint64_t z0, zMiddleA, zMiddleB, z1;
- aLow = a;
+ aLow = (uint32_t)a;
aHigh = a>>32;
- bLow = b;
+ bLow = (uint32_t)b;
bHigh = b>>32;
z1 = ( (uint64_t) aLow ) * bLow;
zMiddleA = ( (uint64_t) aLow ) * bHigh;
else {
a >>= 32;
}
- shiftCount += countLeadingZeros32( a );
+ shiftCount += countLeadingZeros32( (uint32_t)a );
return shiftCount;
#endif
}
roundBits = absZ & 0x7F;
absZ = ( absZ + roundIncrement )>>7;
absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
- z = absZ;
+ z = (int32_t)absZ;
if ( zSign ) z = - z;
if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
float_raise(float_flag_invalid, status);
roundBits = absZ & 0x7F;
absZ = ( absZ + roundIncrement )>>7;
absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
- z = absZ;
+ z = (int16_t)absZ;
if ( zSign ) z = - z;
z = (int16_t) z;
if ( ( absZ>>16 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
roundBits = absZ & 0x7F;
absZ = ( absZ + roundIncrement )>>7;
absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
- z = absZ;
+ z = (int8_t)absZ;
if ( zSign ) z = - z;
z = (int8_t) z;
if ( ( absZ>>8 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
shiftCount = 0x403E - aExp;
savedASig = aSig;
aSig >>= shiftCount;
- z = aSig;
+ z = (int32_t)aSig;
if ( aSign ) z = - z;
if ( ( z < 0 ) ^ aSign ) {
invalid:
shift64RightJamming( aSig, 33, &aSig );
if ( aExp || aSig ) aExp -= 0x3F81;
#endif
- return roundAndPackFloat32(aSign, aExp, aSig, status);
+ return roundAndPackFloat32(aSign, aExp, (uint32_t)aSig, status);
}
shiftCount = countLeadingZeros64( aSig );
- if ( shiftCount > aExp ) shiftCount = aExp;
+ if ( shiftCount > aExp ) shiftCount = (int8_t)aExp;
aExp -= shiftCount;
aSig <<= shiftCount;
shiftCount = 0x403E - bExp;
bSig >>= shiftCount;
- aExp = bSign ? ( aExp - bSig ) : ( aExp + bSig );
+ aExp = (int32_t)(bSign ? ( aExp - bSig ) : ( aExp + bSig ));
return roundAndPackFloatx80(
status->floatx80_rounding_precision, aSign, aExp, aSig, 0, status);
zSig0 &= ~(((int64_t)(zSig1<<1) == 0) & 1);
}
- zExp = zSign ? (0 - zSig0) : zSig0;
+ zExp = (int32_t)(zSign ? (0 - zSig0) : zSig0);
return zExp;
}
statusline_data[i].text = my_strdup(buffer);
statusline_data[i].type = statustype;
if (i == 0)
- statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1);
+ statusline_delay = (int)(STATUSLINE_MS * vblank_hz / 1000.0f);
statusline_text_active = statusline_data[0].text;
statusline_update_notification();
return;
if (!statusline_data[0].text)
return;
if (statusline_delay == 0)
- statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1);
- if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000 * 1))
- statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1);
- if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000 * 3) && statusline_data[1].text)
- statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 3);
+ statusline_delay = (int)(STATUSLINE_MS * vblank_hz / (1000.0f * 1.0f));
+ if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000.0f * 1.0f))
+ statusline_delay = (int)(STATUSLINE_MS * vblank_hz / (1000.0f * 1.0f));
+ if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000.0f * 3.0f) && statusline_data[1].text)
+ statusline_delay = (int)(STATUSLINE_MS * vblank_hz / (1000.0f * 3.0f));
statusline_delay--;
if (statusline_delay)
return;
#include <dlfcn.h>
#endif
-static double syncdivisor;
+static float syncdivisor;
#define SIGBIT 8 // SIGB_DOS
static uae_u32 open_library (const char *name, uae_u32 min_version)
{
- syncdivisor = (3580000.0 * CYCLE_UNIT) / (double) syncbase;
+ syncdivisor = (3580000.0f * CYCLE_UNIT) / (float) syncbase;
for (const char *c = name; *c; c++) {
if (*c == '/' || *c == '\\' || *c == ':') {
{
printf("uni: calling native function %p\n", uni->native_function);
- unsigned long start_time;
+ frame_time_t start_time;
const int flags = uni->flags;
if ((flags & UNI_FLAG_ASYNCHRONOUS) == 0) {
start_time = read_processor_time ();
}
if ((flags & UNI_FLAG_ASYNCHRONOUS) == 0) {
- unsigned long time_diff = read_processor_time () - start_time;
- double v = syncdivisor * time_diff;
+ frame_time_t time_diff = read_processor_time () - start_time;
+ float v = syncdivisor * time_diff;
if (v > 0) {
- if (v > 1000000 * CYCLE_UNIT) {
- v = 1000000 * CYCLE_UNIT;
+ if (v > 1000000.0f * CYCLE_UNIT) {
+ v = 1000000.0f * CYCLE_UNIT;
}
// compensate for the time spent in the native function
do_extra_cycles ((unsigned long) (syncdivisor * time_diff));
static void(*port_outl[MAX_IO_PORT])(uint16_t addr, uint32_t val, void *priv);
static void *port_priv[MAX_IO_PORT];
-static double x86_base_event_clock;
+static float x86_base_event_clock;
static int x86_sndbuffer_playpos;
static int x86_sndbuffer_playindex;
static int sound_handlers_num;
v = xb->scamp_idx1 | 0x80;
break;
case 0xea:
- v = xb->vlsi_regs_ems[xb->scamp_idx1 & 0x3f];
+ v = (uae_u8)xb->vlsi_regs_ems[xb->scamp_idx1 & 0x3f];
break;
case 0xeb:
v = xb->vlsi_regs_ems[xb->scamp_idx1 & 0x3f] >> 8;
if (port_outw[portnum]) {
port_outw[portnum](portnum, value, port_priv[portnum]);
} else {
- portout(portnum, value);
+ portout(portnum, (uae_u8)value);
portout(portnum + 1, value >> 8);
}
break;
case 0x176:
case 0x177:
case 0x376:
- v = x86_ide_hd_get(portnum, 0);
+ v = (uae_u8)x86_ide_hd_get(portnum, 0);
break;
// at ide 0
case 0x1f0:
case 0x1f6:
case 0x1f7:
case 0x3f6:
- v = x86_ide_hd_get(portnum, 0);
+ v = (uae_u8)x86_ide_hd_get(portnum, 0);
break;
// universal xt bios
case 0x30d:
case 0x30e:
case 0x30f:
- v = x86_ide_hd_get(portnum, 0);
+ v = (uae_u8)x86_ide_hd_get(portnum, 0);
break;
// led debug (a2286 bios uses this)
}
static void vga_writew(uint32_t addr, uint16_t val, void *priv)
{
- vga_ram_put(x86_vga_board, addr, val);
+ vga_ram_put(x86_vga_board, addr, (uae_u8)val);
vga_ram_put(x86_vga_board, addr + 1, val >> 8);
}
static void vga_writel(uint32_t addr, uint32_t val, void *priv)
}
static void vgalfb_writew(uint32_t addr, uint16_t val, void *priv)
{
- vgalfb_ram_put(x86_vga_board, addr, val);
+ vgalfb_ram_put(x86_vga_board, addr, (uae_u8)val);
vgalfb_ram_put(x86_vga_board, addr + 1, val >> 8);
}
static void vgalfb_writel(uint32_t addr, uint32_t val, void *priv)
} else if (addr >= 0x3800) {
int reg = to53c400reg(addr + 0, true);
if (reg >= 0)
- x86_rt1000_bput(reg, val);
+ x86_rt1000_bput(reg, (uae_u8)val);
reg = to53c400reg(addr + 1, true);
if (reg >= 0)
x86_rt1000_bput(reg, val >> 8);
if (rc) {
xb->mouse_port = (rc->device_settings & 3) + 1;
}
- xb->audeventtime = x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1;
+ xb->audeventtime = (int)(x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1);
}
static void x86_bridge_hsync(void)
xb->sound_initialized = true;
if (xb->sound_emu) {
write_log(_T("x86 sound init\n"));
- xb->audeventtime = x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1;
+ xb->audeventtime = (int)(x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1);
timer_add(&sound_poll_timer, sound_poll, NULL, 0);
xb->audstream = audio_enable_stream(true, -1, 2, audio_state_sndboard_x86, NULL);
sound_speed_changed(true);
} else if (cputype == CPU_286 && fpu_type != FPU_NONE) {
fpu_type = FPU_287;
} else if (cputype == CPU_8088 && fpu_type != FPU_NONE) {
- fpu_type == FPU_8087;
+ fpu_type = FPU_8087;
}
write_log(_T("CPU override = %s\n"), cpuname);
}
void sound_speed_changed(bool enable)
{
if (sound_poll_timer.enabled || enable) {
- sound_poll_latch = (uae_u64)((double)TIMER_USEC * (1000000.0 / currprefs.sound_freq));
+ sound_poll_latch = (uae_u64)((float)TIMER_USEC * (1000000.0f / currprefs.sound_freq));
timer_set_delay_u64(&sound_poll_timer, sound_poll_latch);
}
}
}
-void x86_update_sound(double clk)
+void x86_update_sound(float clk)
{
struct x86_bridge *xb = bridges[0];
x86_base_event_clock = clk;
if (xb) {
- xb->audeventtime = x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1;
+ xb->audeventtime = (int)(x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1);
sound_speed_changed(false);
}
}
if (len & 511)
return read;
while (len > 0) {
- bamoffset = (offset / zvhd->vhd_blocksize) * 4 + zvhd->vhd_bamoffset;
+ bamoffset = (uae_u32)((offset / zvhd->vhd_blocksize) * 4 + zvhd->vhd_bamoffset);
sectoroffset = gl (zvhd->vhd_header + bamoffset);
if (sectoroffset == 0xffffffff) {
memset (dataptr, 0, 512);
zf->seek += s;
}
while (size > 0) {
- int s = size > 512 ? 512 : size;
+ int s = size > 512 ? 512 : (int)size;
vhd_fread2 (zf, tmp, zf->seek, 512);
memcpy ((uae_u8*)data + len, tmp, s);
zf->seek += s;
if (z == NULL || z->data == NULL)
return;
+ if (z->size > INT_MAX) {
+ return;
+ }
if (z->size < 880 * 512 * 2) {
- int size = 880 * 512 * 2 - z->size;
+ int size = 880 * 512 * 2 - (int)z->size;
b = xcalloc (uae_u8, size);
zfile_fwrite (b, size, 1, z);
xfree (b);
zfile_fseek (z, pos, SEEK_SET);
zfile_fread (buffer, 2 + 2 + 4 + 4, 1, z);
- pos = zfile_ftell (z);
+ pos = zfile_ftell32(z);
type = buffer[2] * 256 + buffer[3];
len = buffer[5] * 65536 + buffer[6] * 256 + buffer[7];
bitlen = buffer[9] * 65536 + buffer[10] * 256 + buffer[11];
for (j = 0; j < len / 2; j++) {
uae_u16 v = mfm[j];
*p++ = v >> 8;
- *p++ = v;
+ *p++ = (uae_u8)v;
}
zd->zdisktracks[i].data = buf;
zd->zdisktracks[i].len = len;
zfile_fwrite (tmp, 4, 1, zo);
memset (tmp, 0, sizeof tmp);
tmp[2] = 0; tmp[3] = 1; /* track type */
- startpos = zfile_ftell (zo);
+ startpos = zfile_ftell32(zo);
for (i = 0; i < tracks; i++)
zfile_fwrite (tmp, sizeof tmp, 1, zo);
}
}
zfile_fwrite (outbuf, outsize, 1, zo);
} else {
- int pos = zfile_ftell (zo);
+ int pos = zfile_ftell32(zo);
int maxlen = len > 12798 ? len : 12798;
int lenb = len * 8;
for (j = 0; j < len / 2; j++) {
uae_u16 v = mfm[j];
*p++ = v >> 8;
- *p++ = v;
+ *p++ = (uae_u8)v;
}
zd->zdisktracks[i].data = buf;
zd->zdisktracks[i].len = len;
zfile_fwrite (tmp, 4, 1, zo);
memset (tmp, 0, sizeof tmp);
tmp[2] = 0; tmp[3] = 1; /* track type */
- startpos = zfile_ftell (zo);
+ startpos = zfile_ftell32(zo);
for (i = 0; i < tracks; i++)
zfile_fwrite (tmp, sizeof tmp, 1, zo);
}
}
zfile_fwrite (outbuf, outsize, 1, zo);
} else {
- int pos = zfile_ftell (zo);
+ int pos = zfile_ftell32(zo);
int maxlen = len > 12798 ? len : 12798;
int lenb = len * 8;
return NULL;
ret = DMS_Process_File (z, zo, CMD_UNPACK, OPT_VERBOSE, 0, 0, 0, zextra);
if (ret == NO_PROBLEM || ret == DMS_FILE_END) {
- int off = zfile_ftell (zo);
+ int off = zfile_ftell32(zo);
if (off >= 1760 * 512 / 3 && off <= 1760 * 512 * 3 / 4) { // possible split dms?
if (_tcslen (orgname) > 5) {
TCHAR *s = orgname + _tcslen (orgname) - 5;
if (!zf->data && zf->dataseek) {
nzf = zfile_create (zf, NULL);
} else if (zf->data) {
+ if (zf->size > INT_MAX) {
+ return NULL;
+ }
nzf = zfile_create (zf, NULL);
- nzf->data = xmalloc (uae_u8, zf->size);
+ nzf->data = xmalloc (uae_u8, (size_t)zf->size);
if (!nzf->data) {
write_log(_T("Out of memory: %s\n"), zfile_getname(zf));
return NULL;
}
- memcpy (nzf->data, zf->data, zf->size);
+ memcpy (nzf->data, zf->data, (size_t)zf->size);
nzf->size = zf->size;
nzf->datasize = zf->datasize;
} else if (zf->useparent) {
struct zfile *zfile_fopen_empty (struct zfile *prev, const TCHAR *name, uae_u64 size)
{
+ if (size > INT_MAX) {
+ return NULL;
+ }
struct zfile *l;
l = zfile_create (prev, NULL);
l->name = my_strdup (name ? name : _T(""));
if (size) {
- l->data = xcalloc (uae_u8, size);
+ l->data = xcalloc (uae_u8, (size_t)size);
if (!l->data) {
xfree (l);
return NULL;
struct zfile *zfile_fopen_load_zfile (struct zfile *f)
{
+ if (f->size > INT_MAX) {
+ return NULL;
+ }
struct zfile *l = zfile_fopen_empty (f, f->name, f->size);
if (!l)
return NULL;
zfile_fseek (f, 0, SEEK_SET);
- zfile_fread (l->data, f->size, 1, f);
+ zfile_fread (l->data, (size_t)f->size, 1, f);
return l;
}
{
struct zfile *l;
+ if (size > INT_MAX) {
+ return NULL;
+ }
l = zfile_create (NULL, name);
l->name = my_strdup (name ? name : _T(""));
- l->data = xmalloc (uae_u8, size);
+ l->data = xmalloc (uae_u8, (size_t)size);
l->size = size;
l->datasize = size;
- memcpy (l->data, data, size);
+ memcpy (l->data, data, (size_t)size);
return l;
}
{
if (!z->data)
return NULL;
- *len = z->size;
+ *len = (int)z->size;
return z->data;
}
zf = zfile_fopen_data (name, datalen, data);
f = zfile_gunzip (zf);
- size = f->datasize;
+ size = (int)f->datasize;
zfile_fseek (f, 0, SEEK_SET);
out = xmalloc (uae_u8, size);
zfile_fread (out, 1, size, f);
zf = zfile_fopen(name, _T("rb"));
if (!zf)
return NULL;
- size = zfile_size(zf);
+ size = zfile_size32(zf);
out = xmalloc (uae_u8, size);
zfile_fread(out, 1, size, zf);
zfile_fclose(zf);
*outlen = size;
+
return out;
}
}
}
-uae_s64 zfile_size (struct zfile *z)
+uae_s64 zfile_size(struct zfile *z)
{
return z->size;
}
+uae_s32 zfile_size32(struct zfile *z)
+{
+ uae_s64 s = z->size;
+ if (s > INT_MAX) {
+ return INT_MAX;
+ }
+ return (uae_s32)s;
+}
+
uae_s64 zfile_ftell (struct zfile *z)
{
if (z->data || z->dataseek || z->parent)
return z->seek;
return _ftelli64 (z->f);
+}
+uae_s32 zfile_ftell32(struct zfile *z)
+{
+ if (z->data || z->dataseek || z->parent) {
+ uae_s64 s = z->seek;
+ if (s > INT_MAX) {
+ return INT_MAX;
+ }
+ return (uae_s32)s;
+ }
+ uae_s64 s = _ftelli64(z->f);
+ if (s > INT_MAX) {
+ return INT_MAX;
+ }
+ return (uae_s32)s;
}
uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode)
size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z)
{
if (z->zfileread)
- return z->zfileread (b, l1, l2, z);
+ return (size_t)z->zfileread(b, l1, l2, z);
if (z->data) {
if (z->datasize < z->size && z->seek + l1 * l2 > z->datasize) {
if (z->archiveparent) {
}
if (z->seek + l1 * l2 > z->size) {
if (l1)
- l2 = (z->size - z->seek) / l1;
+ l2 = (size_t)((z->size - z->seek) / l1);
else
l2 = 0;
if (l2 < 0)
v = z->seek;
if (v + l1 * l2 > size) {
if (l1)
- l2 = (size - v) / l1;
+ l2 = (size_t)((size - v) / l1);
else
l2 = 0;
if (l2 < 0)
if (z->archiveparent)
return 0;
if (z->zfilewrite)
- return z->zfilewrite (b, l1, l2, z);
+ return (size_t)z->zfilewrite(b, l1, l2, z);
if (z->parent && z->useparent)
return 0;
if (z->data) {
if (inc < 10000)
inc = 10000;
z->allocsize += inc;
- z->data = xrealloc (uae_u8, z->data, z->allocsize);
+ z->data = xrealloc (uae_u8, z->data, (size_t)z->allocsize);
}
memcpy (z->data + z->seek, b, l1 * l2);
z->seek += l1 * l2;
uae_u8 *zfile_getdata (struct zfile *z, uae_s64 offset, int len, int *outlen)
{
- uae_s64 pos = zfile_ftell (z);
+ uae_s32 pos = zfile_ftell32(z);
uae_u8 *b;
if (len < 0) {
- zfile_fseek (z, 0, SEEK_END);
- len = zfile_ftell (z);
- zfile_fseek (z, 0, SEEK_SET);
- }
- b = xmalloc (uae_u8, len);
- zfile_fseek (z, offset, SEEK_SET);
- zfile_fread (b, len, 1, z);
- zfile_fseek (z, pos, SEEK_SET);
+ zfile_fseek(z, 0, SEEK_END);
+ len = zfile_ftell32(z);
+ zfile_fseek(z, 0, SEEK_SET);
+ }
+ b = xmalloc(uae_u8, len);
+ zfile_fseek(z, offset, SEEK_SET);
+ zfile_fread(b, len, 1, z);
+ zfile_fseek(z, pos, SEEK_SET);
if (outlen)
*outlen = len;
return b;
return f->name;
}
-uae_u32 zfile_crc32 (struct zfile *f)
+uae_u32 zfile_crc32(struct zfile *f)
{
uae_u8 *p;
int pos, size;
if (!f)
return 0;
if (f->data)
- return get_crc32 (f->data, f->size);
- pos = zfile_ftell (f);
- zfile_fseek (f, 0, SEEK_END);
- size = zfile_ftell (f);
+ return get_crc32(f->data, (uae_u32)f->size);
+ pos = zfile_ftell32(f);
+ zfile_fseek(f, 0, SEEK_END);
+ size = zfile_ftell32(f);
p = xmalloc (uae_u8, size);
if (!p)
return 0;
- memset (p, 0, size);
- zfile_fseek (f, 0, SEEK_SET);
- zfile_fread (p, 1, size, f);
- zfile_fseek (f, pos, SEEK_SET);
- crc = get_crc32 (p, size);
+ memset(p, 0, size);
+ zfile_fseek(f, 0, SEEK_SET);
+ zfile_fread(p, 1, size, f);
+ zfile_fseek(f, pos, SEEK_SET);
+ crc = get_crc32(p, size);
xfree (p);
return crc;
}
static void addvolumesize (struct zvolume *zv, uae_s64 size)
{
- unsigned int blocks = (size + 511) / 512;
-
- if (blocks == 0)
- blocks++;
+// unsigned int blocks = (size + 511) / 512;
+// if (blocks == 0)
+// blocks++;
while (zv) {
zv->size += size;
zv = zv->parent;
uae_u8 *b;
int size;
zfile_fseek (s, 0, SEEK_END);
- size = zfile_ftell (s);
+ size = zfile_ftell32(s);
zfile_fseek (s, 0, SEEK_SET);
b = xcalloc (uae_u8, size);
if (b) {
} else {
zn = zvolume_addfile_abs (zv, &zai);
if (zn)
- zn->offset = zfile_ftell (z);
+ zn->offset = zfile_ftell32(z);
}
xfree (zai.name);
}
int err = -1;
if (!(flags & FILE_DELAYEDOPEN) || z->size <= PEEK_BYTES) {
unpack_log (_T("ZIP: unpacking %s, flags=%d\n"), name, flags);
- err = unzReadCurrentFile (uz, z->data, z->datasize);
+ err = unzReadCurrentFile (uz, z->data, (size_t)z->datasize);
unpack_log (_T("ZIP: unpacked, code=%d\n"), err);
} else {
z->archiveparent = zfile_dup (zn->volume->archive);
xfree (z->archiveparent->name);
z->archiveparent->name = my_strdup (tmp);
z->datasize = PEEK_BYTES;
- err = unzReadCurrentFile (uz, z->data, z->datasize);
+ err = unzReadCurrentFile (uz, z->data, (size_t)z->datasize);
unpack_log (_T("ZIP: unpacked, code=%d\n"), err);
} else {
unpack_log (_T("ZIP: unpacking %s (failed DELAYEDOPEN)\n"), name);
- err = unzReadCurrentFile (uz, z->data, z->datasize);
+ err = unzReadCurrentFile (uz, z->data, (size_t)z->datasize);
unpack_log (_T("ZIP: unpacked, code=%d\n"), err);
}
}
&offset, &outSizeProcessed,
&allocImp, &allocTempImp);
if (res == SZ_OK) {
- zfile_fwrite (ctx->outBuffer + offset, zn->size, 1, z);
+ zfile_fwrite (ctx->outBuffer + offset, (size_t)zn->size, 1, z);
} else {
write_log (_T("7Z: SzExtract %s returned %d\n"), zn->fullname, res);
zfile_fclose (z);
z = zfile_fopen_empty (zn->volume->archive, zn->fullname, zn->size);
zf = zfile_fopen (zfile_getname (zn->volume->archive), _T("rb"), zn->volume->archive->zfdmask & ~ZFD_ADF, zn->offset - 1);
if (zf) {
- zfile_fread (z->data, zn->size, 1, zf);
+ zfile_fread (z->data, (size_t)zn->size, 1, zf);
zfile_fclose (zf);
}
} else {
z = zfile_fopen_empty (zn->volume->archive, zn->fullname, zn->size);
if (z) {
zfile_fseek (zn->volume->archive, 0, SEEK_SET);
- zfile_fread (z->data, zn->size, 1, zn->volume->archive);
+ zfile_fread (z->data, (size_t)zn->size, 1, zn->volume->archive);
}
}
return z;
adf = xcalloc (struct adfhandle, 1);
zfile_fseek (z, 0, SEEK_END);
- adf->size = zfile_ftell (z);
+ adf->size = zfile_ftell32(z);
zfile_fseek (z, 0, SEEK_SET);
adf->blocksize = 512;
zfile_fseek (adf->z, block * adf->blocksize, SEEK_SET);
else
zfile_fseek (adf->z, block * adf->blocksize + 24, SEEK_SET);
- zfile_fread (dst, bsize, 1, adf->z);
+ zfile_fread (dst, (size_t)bsize, 1, adf->z);
size -= bsize;
dst += bsize;
if (size <= 0)
zfile_fseek (adf->z, block * adf->blocksize, SEEK_SET);
if (bsize > size)
bsize = size;
- zfile_fread (dst, bsize, 1, adf->z);
+ zfile_fread (dst, (size_t)bsize, 1, adf->z);
dst += bsize;
size -= bsize;
}
uae_s64 left = size > sectorspercluster * 512 ? sectorspercluster * 512 : size;
int sector = dataregion + (cluster - 2) * sectorspercluster;
zfile_fseek (sz, sector * 512, SEEK_SET);
- zfile_fread (dz->data + offset, 1, left, sz);
+ zfile_fread (dz->data + offset, 1, (size_t)left, sz);
size -= left;
offset += left;
cluster = getcluster (sz, cluster, reserved, fatbits);