Skip to content

Commit

Permalink
portability patch part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
tonioni committed May 19, 2012
1 parent 4462c47 commit e981fde
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 45 deletions.
3 changes: 2 additions & 1 deletion blkdev.cpp
Expand Up @@ -116,10 +116,11 @@ static int cdscsidevicetype[MAX_TOTAL_SCSI_DEVICES];
extern struct device_functions devicefunc_win32_aspi;
extern struct device_functions devicefunc_win32_spti;
extern struct device_functions devicefunc_win32_ioctl;
extern struct device_functions devicefunc_cdimage;

#endif

extern struct device_functions devicefunc_cdimage;

static struct device_functions *devicetable[] = {
NULL,
&devicefunc_cdimage,
Expand Down
5 changes: 3 additions & 2 deletions blkdev_cdimage.cpp
Expand Up @@ -1002,6 +1002,7 @@ static int parsemds (struct cdunit *cdu, struct zfile *zmds, const TCHAR *img)
struct cdtoc *t;
uae_u8 *mds = NULL;
uae_u64 size;
MDS_SessionBlock *sb;

write_log (_T("MDS TOC: '%s'\n"), img);
size = zfile_size (zmds);
Expand All @@ -1019,7 +1020,7 @@ static int parsemds (struct cdunit *cdu, struct zfile *zmds, const TCHAR *img)
goto end;
}

MDS_SessionBlock *sb = (MDS_SessionBlock*)(mds + head->sessions_blocks_offset);
sb = (MDS_SessionBlock*)(mds + head->sessions_blocks_offset);
cdu->tracks = sb->last_track - sb->first_track + 1;
for (int i = 0; i < sb->num_all_blocks; i++) {
MDS_TrackBlock *tb = (MDS_TrackBlock*)(mds + sb->tracks_blocks_offset + i * sizeof (MDS_TrackBlock));
Expand Down Expand Up @@ -1048,7 +1049,7 @@ static int parsemds (struct cdunit *cdu, struct zfile *zmds, const TCHAR *img)
if (footer->widechar_filename == 0)
fname = au ((char*)(mds + footer->filename_offset));
else
fname = my_strdup ((wchar_t*)(mds + footer->filename_offset));
fname = my_strdup ((TCHAR*)(mds + footer->filename_offset));
if (fname[0] == '*' && fname[1] == '.') {
TCHAR newname[MAX_DPATH];
_tcscpy (newname, img);
Expand Down
25 changes: 12 additions & 13 deletions custom.cpp
Expand Up @@ -2989,7 +2989,7 @@ void init_hz (bool fullinit)
if ((beamcon0 & 0xA0) != (new_beamcon0 & 0xA0))
hzc = 1;
if (beamcon0 != new_beamcon0) {
write_log (_T("BEAMCON0 %04x -> %04x PC%=%08x\n"), beamcon0, new_beamcon0, M68K_GETPC);
write_log (_T("BEAMCON0 %04x -> %04x PC=%08x\n"), beamcon0, new_beamcon0, M68K_GETPC);
vpos_count_diff = vpos_count = 0;
}
beamcon0 = new_beamcon0;
Expand Down Expand Up @@ -3505,7 +3505,7 @@ static void DMACON (int hpos, uae_u16 v)
changed = dmacon ^ oldcon;
#if 0
if (changed)
write_log (L"%04x -> %04x %08x\n", oldcon, dmacon, m68k_getpc ());
write_log (_T("%04x -> %04x %08x\n"), oldcon, dmacon, m68k_getpc ());
#endif
oldcop = (oldcon & DMA_COPPER) && (oldcon & DMA_MASTER);
newcop = (dmacon & DMA_COPPER) && (dmacon & DMA_MASTER);
Expand Down Expand Up @@ -5216,9 +5216,7 @@ static void rtg_vsynccheck (void)
{
if (vblank_found_rtg) {
vblank_found_rtg = false;
#ifdef PICASSO96
rtg_vsync ();
#endif
}
}

Expand Down Expand Up @@ -5307,7 +5305,7 @@ static bool framewait (void)
vsynctimeperline = 1;

if (0 || (log_vsync & 2)) {
write_log (L"%06d %06d/%06d %03d%%\n", t, vsynctimeperline, vsynctimebase, t * 100 / vsynctimebase);
write_log (_T("%06d %06d/%06d %03d%%\n"), t, vsynctimeperline, vsynctimebase, t * 100 / vsynctimebase);
}

frame_shown = true;
Expand Down Expand Up @@ -5388,7 +5386,7 @@ static bool framewait (void)
vsyncmaxtime = now + max;

if (0 || (log_vsync & 2)) {
write_log (L"%05d:%05d:%05d=%05d:%05d/%05d %03d%%\n", adjust_avg, frameskipt_avg, flipdelay_avg,
write_log (_T("%05d:%05d:%05d=%05d:%05d/%05d %03d%%\n"), adjust_avg, frameskipt_avg, flipdelay_avg,
val, vsynctimeperline, vsynctimebase, val * 100 / vsynctimebase);
}

Expand Down Expand Up @@ -5448,7 +5446,7 @@ static bool framewait (void)
vsyncmaxtime = now + max;

if (0 || (log_vsync & 2)) {
write_log (L"%06d:%06d:%06d:%06d %06d/%06d %03d%%\n", frameskipt_avg, flipdelay_avg, adjust, adjustx,
write_log (_T("%06d:%06d:%06d:%06d %06d/%06d %03d%%\n"), frameskipt_avg, flipdelay_avg, adjust, adjustx,
vsynctimeperline, vsynctimebase, (vsynctimebase - max) * 100 / vsynctimebase);
}

Expand All @@ -5471,7 +5469,7 @@ static bool framewait (void)
tickdiff = 0;
prevtick = tick;
frametickcnt = 0;
write_log (L"!\n");
write_log (_T("!\n"));
} else {
frametickcnt++;
}
Expand All @@ -5482,7 +5480,7 @@ static bool framewait (void)
diff = 5000;
clockadjust = -vsynctimebase * diff / 1000;
clockadjust *= 100;
write_log (L"%d:%d:%d\n", framems - tickdiff, diff, clockadjust);
write_log (_T("%d:%d:%d\n"), framems - tickdiff, diff, clockadjust);
#endif
if (currprefs.m68k_speed < 0) {

Expand Down Expand Up @@ -6151,12 +6149,13 @@ static void hsync_handler_post (bool onvsync)

events_dmal_hsync ();
#if 0
// AF testing stuff
static int cnt = 0;
cnt++;
if (cnt == 500) {
int port_insert_custom (int inputmap_port, int devicetype, DWORD flags, const TCHAR *custom);
port_insert_custom (0, 2, 0, L"Fire.autorepeat=0x38 Left=0x4B Right=0x4D Up=0x48 Down=0x50 Fire=0x4C Fire2=0x52'");
port_insert_custom (1, 2, 0, L"Left=0x48 Right=0x50 Up=0x4B Down=0x4D Fire=0x4C");
port_insert_custom (0, 2, 0, _T("Fire.autorepeat=0x38 Left=0x4B Right=0x4D Up=0x48 Down=0x50 Fire=0x4C Fire2=0x52'"));
port_insert_custom (1, 2, 0, _T("Left=0x48 Right=0x50 Up=0x4B Down=0x4D Fire=0x4C"));
} else if (cnt == 1000) {
TCHAR out[256];
bool port_get_custom (int inputmap_port, TCHAR *out);
Expand Down Expand Up @@ -6203,7 +6202,7 @@ static void hsync_handler_post (bool onvsync)
}
}
} else {
;//write_log (L"%d ", vpos);
;//write_log (_T("%d "), vpos);
}
}
} else {
Expand All @@ -6214,7 +6213,7 @@ static void hsync_handler_post (bool onvsync)
while (!vsync_isdone () && (int)vsyncmintime - (int)(rpt + vsynctimebase / 10) > 0 && (int)vsyncmintime - (int)rpt < vsynctimebase) {
sleep_millis_main (1);
rpt = read_processor_time ();
//write_log (L"*");
//write_log (_T("*"));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion expansion.cpp
Expand Up @@ -222,7 +222,7 @@ void expamem_next (void)
map_banks (&expamem_bank, 0xE8, 1, 0);
++ecard;
if (ecard < cardno) {
expamem_bank.name = card_name[ecard] ? card_name[ecard] : _T("None");
expamem_bank.name = card_name[ecard] ? card_name[ecard] : (TCHAR*) _T("None");
(*card_init[ecard]) ();
} else {
expamem_init_clear2 ();
Expand Down
14 changes: 7 additions & 7 deletions filesys.cpp
Expand Up @@ -678,8 +678,8 @@ static void initialize_mountinfo (void)
uci->devname, uci->sectors, uci->surfaces, uci->reserved,
uci->bootpri, uci->filesys);
} else if (uci->controller <= HD_CONTROLLER_SCSI6) {
#ifdef A2091
if (currprefs.cs_mbdmac) {
#ifdef A2091
a3000_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly,
uci->devname, uci->sectors, uci->surfaces, uci->reserved,
uci->bootpri, uci->filesys);
Expand Down Expand Up @@ -3203,7 +3203,7 @@ static void
xfree (x2);

put_long (info + 116, fsdb_can ? aino->amigaos_mode : fsdb_mode_supported (aino));
put_long (info + 124, statbuf.st_size > MAXFILESIZE32 ? MAXFILESIZE32 : statbuf.st_size);
put_long (info + 124, statbuf.st_size > MAXFILESIZE32 ? MAXFILESIZE32 : (uae_u32)statbuf.st_size);
#ifdef HAVE_ST_BLOCKS
put_long (info + 128, statbuf.st_blocks);
#else
Expand Down Expand Up @@ -5238,11 +5238,11 @@ static void action_change_file_size64 (Unit *unit, dpacket packet)

/* Write one then truncate: that should give the right size in all cases. */
fs_lseek (k->fd, offset, whence);
offset = fs_lseek (k->fd, offset, whence);
offset = fs_lseek64 (k->fd, offset, whence);
fs_write (k->fd, /* whatever */(uae_u8*)&k1, 1);
if (k->file_pos > offset)
k->file_pos = offset;
fs_lseek (k->fd, k->file_pos, SEEK_SET);
fs_lseek64 (k->fd, k->file_pos, SEEK_SET);

if (my_truncate (k->aino->nname, offset) == -1) {
PUT_PCK64_RES1 (packet, DOS_FALSE);
Expand Down Expand Up @@ -7006,7 +7006,7 @@ static uae_u8 *restore_key (UnitInfo *ui, Unit *u, uae_u8 *src)
openmode = ((k->dosmode & A_FIBF_READ) == 0 ? O_WRONLY
: (k->dosmode & A_FIBF_WRITE) == 0 ? O_RDONLY
: O_RDWR);
write_log (_T("FS: open file '%s' ('%s'), pos=%d\n"), p, pn, k->file_pos);
write_log (_T("FS: open file '%s' ('%s'), pos=%llu\n"), p, pn, k->file_pos);
a = get_aino (u, &u->rootnode, p, &err);
if (!a)
write_log (_T("*** FS: Open file aino creation failed '%s'\n"), p);
Expand Down Expand Up @@ -7046,9 +7046,9 @@ static uae_u8 *restore_key (UnitInfo *ui, Unit *u, uae_u8 *src)
uae_s64 s;
s = fs_fsize64 (k->fd);
if (s != savedsize)
write_log (_T("FS: restored file '%s' size changed! orig=%lld, now=%lld!!\n"), p, savedsize, s);
write_log (_T("FS: restored file '%s' size changed! orig=%llu, now=%lld!!\n"), p, savedsize, s);
if (k->file_pos > s) {
write_log (_T("FS: restored filepos larger than size of file '%s'!! %lld > %d\n"), p, k->file_pos, s);
write_log (_T("FS: restored filepos larger than size of file '%s'!! %llu > %lld\n"), p, k->file_pos, s);
k->file_pos = s;
}
fs_lseek64 (k->fd, k->file_pos, SEEK_SET);
Expand Down
2 changes: 1 addition & 1 deletion include/custom.h
Expand Up @@ -217,4 +217,4 @@ extern void alloc_cycle_ext (int, int);
extern bool ispal (void);
extern int current_maxvpos (void);
extern struct chipset_refresh *get_chipset_refresh (void);
extern void compute_framesync (void);
extern void compute_framesync (void);
2 changes: 2 additions & 0 deletions include/isofs.h
Expand Up @@ -2,8 +2,10 @@
#ifndef _ISOFS_FS_H
#define _ISOFS_FS_H

#ifdef WINDOWS
typedef int gid_t;
typedef int uid_t;
#endif

#define ISO_SYSTEM_ID_CDTV "CDTV"

Expand Down
6 changes: 3 additions & 3 deletions include/memory.h
Expand Up @@ -319,9 +319,9 @@ extern uae_u32 (REGPARAM3 *chipmem_bget_indirect)(uaecptr) REGPARAM;
extern void (REGPARAM3 *chipmem_lput_indirect)(uaecptr, uae_u32) REGPARAM;
extern void (REGPARAM3 *chipmem_wput_indirect)(uaecptr, uae_u32) REGPARAM;
extern void (REGPARAM3 *chipmem_bput_indirect)(uaecptr, uae_u32) REGPARAM;
extern int (REGPARAM2 *chipmem_check_indirect)(uaecptr, uae_u32);
extern uae_u8 *(REGPARAM2 *chipmem_xlate_indirect)(uaecptr);

extern int (REGPARAM3 *chipmem_check_indirect)(uaecptr, uae_u32) REGPARAM;
extern uae_u8 *(REGPARAM3 *chipmem_xlate_indirect)(uaecptr) REGPARAM;
#ifdef NATMEM_OFFSET

typedef struct shmpiece_reg {
Expand Down
16 changes: 8 additions & 8 deletions isofs.cpp
Expand Up @@ -512,12 +512,12 @@ static int isofs_read_level3_size(struct inode *inode)
return -ENOMEM;

out_noread:
write_log (_T("ISOFS: unable to read i-node block %lu\n"), block);
write_log (_T("ISOFS: unable to read i-node block %u\n"), block);
xfree(tmpde);
return -EIO;

out_toomany:
write_log (_T("ISOFS: More than 100 file sections ?!?, aborting... isofs_read_level3_size: inode=%lu\n"), inode->i_ino);
write_log (_T("ISOFS: More than 100 file sections ?!?, aborting... isofs_read_level3_size: inode=%u\n"), inode->i_ino);
goto out;
}

Expand Down Expand Up @@ -625,13 +625,13 @@ static int isofs_read_inode(struct inode *inode)
/* I have no idea what file_unit_size is used for, so
we will flag it for now */
if (de->file_unit_size[0] != 0) {
write_log (_T("ISOFS: File unit size != 0 for ISO file (%ld).\n"), inode->i_ino);
write_log (_T("ISOFS: File unit size != 0 for ISO file (%d).\n"), inode->i_ino);
}

/* I have no idea what other flag bits are used for, so
we will flag it for now */
if((de->flags[-high_sierra] & ~2)!= 0){
write_log (_T("ISOFS: Unusual flag settings for ISO file (%ld %x).\n"), inode->i_ino, de->flags[-high_sierra]);
write_log (_T("ISOFS: Unusual flag settings for ISO file (%d %x).\n"), inode->i_ino, de->flags[-high_sierra]);
}

inode->i_mtime.tv_sec =
Expand Down Expand Up @@ -1572,7 +1572,7 @@ static int isofs_get_blocks(struct inode *inode, uae_u32 iblock, struct buffer_h
* I/O errors.
*/
if (b_off > ((inode->i_size) >> ISOFS_BUFFER_BITS(inode))) {
write_log (_T("ISOFS: block >= EOF (%lu, %llu)\n"), b_off, (unsigned long long)inode->i_size);
write_log (_T("ISOFS: block >= EOF (%u, %llu)\n"), b_off, (unsigned long long)inode->i_size);
goto abort;
}

Expand Down Expand Up @@ -2000,7 +2000,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent, uae_u
write_log (_T("ISOFS: bread failed, dev=%d, iso_blknum=%d, block=%d\n"), s->unitnum, iso_blknum, block);
goto out_freebh;
out_bad_zone_size:
write_log(_T("ISOFS: Bad logical zone size %ld\n"), sbi->s_log_zone_size);
write_log(_T("ISOFS: Bad logical zone size %d\n"), sbi->s_log_zone_size);
goto out_freebh;
out_bad_size:
write_log (_T("ISOFS: Logical zone size(%d) < hardware blocksize(%u)\n"), orig_zonesize, opt.blocksize);
Expand Down Expand Up @@ -2137,7 +2137,7 @@ static struct inode *isofs_find_entry(struct inode *dir, char *tmpname, TCHAR *t
dpnt = de->name;
/* Basic sanity check, whether name doesn't exceed dir entry */
if (de_len < dlen + sizeof(struct iso_directory_record)) {
write_log (_T("iso9660: Corrupted directory entry in block %lu of inode %u\n"), block, dir->i_ino);
write_log (_T("iso9660: Corrupted directory entry in block %u of inode %u\n"), block, dir->i_ino);
return 0;
}

Expand Down Expand Up @@ -2280,7 +2280,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, char *tmpnam
}
/* Basic sanity check, whether name doesn't exceed dir entry */
if (de_len < de->name_len[0] + sizeof(struct iso_directory_record)) {
write_log (_T("iso9660: Corrupted directory entry in block %lu of inode %lu\n"), block, inode->i_ino);
write_log (_T("iso9660: Corrupted directory entry in block %u of inode %u\n"), block, inode->i_ino);
return 0;
}

Expand Down
8 changes: 5 additions & 3 deletions newcpu.cpp
Expand Up @@ -195,7 +195,7 @@ static void validate_trace (void)
static void debug_trace (void)
{
if (cputrace.writecounter > 10000 || cputrace.readcounter > 10000)
write_log (L"cputrace.readcounter=%d cputrace.writecounter=%d\n", cputrace.readcounter, cputrace.writecounter);
write_log (_T("cputrace.readcounter=%d cputrace.writecounter=%d\n"), cputrace.readcounter, cputrace.writecounter);
}

STATIC_INLINE void clear_trace (void)
Expand Down Expand Up @@ -3685,6 +3685,7 @@ static void m68k_run_1_ce (void)
static void m68k_run_1_ce (void)
{
struct regstruct *r = &regs;
uae_u16 opcode;

if (cpu_tracer < 0) {
memcpy (&r->regs, &cputrace.regs, 16 * sizeof (uae_u32));
Expand Down Expand Up @@ -3716,7 +3717,7 @@ static void m68k_run_1_ce (void)
set_cpu_tracer (false);

for (;;) {
uae_u16 opcode = r->ir;
opcode = r->ir;

#if DEBUG_CD32CDTVIO
out_cd32io (m68k_getpc ());
Expand Down Expand Up @@ -4000,6 +4001,7 @@ STATIC_INLINE void docodece020 (uae_u32 opcode)
static void m68k_run_2ce (void)
{
struct regstruct *r = &regs;
uae_u16 opcode;

if (cpu_tracer < 0) {
memcpy (&r->regs, &cputrace.regs, 16 * sizeof (uae_u32));
Expand Down Expand Up @@ -4038,7 +4040,7 @@ static void m68k_run_2ce (void)

for (;;) {
r->instruction_pc = m68k_getpc ();
uae_u16 opcode = get_word_ce020_prefetch (0);
opcode = get_word_ce020_prefetch (0);

if (cpu_tracer) {

Expand Down
4 changes: 2 additions & 2 deletions serial.cpp
Expand Up @@ -295,7 +295,7 @@ void serial_flush_buffer(void)
}
}

uae_u8 serial_readstatus(void)
uae_u8 serial_readstatus(uae_u8 ignored)
{
int status = 0;

Expand Down Expand Up @@ -335,7 +335,7 @@ uae_u8 serial_readstatus(void)
return status;
}

uae_u8 serial_writestatus (int old, int nw)
uae_u8 serial_writestatus (uae_u8 old, uae_u8 nw)
{
if ((old & 0x80) == 0x80 && (nw & 0x80) == 0x00)
serial_dtr_on();
Expand Down
6 changes: 3 additions & 3 deletions traps.cpp
Expand Up @@ -336,7 +336,7 @@ static uae_u32 trap_Call68k (TrapContext *context, uaecptr func_addr)
/*
* Handles the emulator's side of a 68k call (from an extended trap)
*/
static uae_u32 REGPARAM3 m68k_call_handler (TrapContext *dummy_ctx)
static uae_u32 REGPARAM2 m68k_call_handler (TrapContext *dummy_ctx)
{
TrapContext *context = current_context;

Expand Down Expand Up @@ -374,7 +374,7 @@ static uae_u32 REGPARAM3 m68k_call_handler (TrapContext *dummy_ctx)
/*
* Handles the return from a 68k call at the emulator's side.
*/
static uae_u32 REGPARAM3 m68k_return_handler (TrapContext *dummy_ctx)
static uae_u32 REGPARAM2 m68k_return_handler (TrapContext *dummy_ctx)
{
TrapContext *context;
uae_u32 sp;
Expand Down Expand Up @@ -408,7 +408,7 @@ static uae_u32 REGPARAM3 m68k_return_handler (TrapContext *dummy_ctx)
* Handles completion of an extended trap and passes
* return value from trap function to 68k space.
*/
static uae_u32 REGPARAM3 exit_trap_handler (TrapContext *dummy_ctx)
static uae_u32 REGPARAM2 exit_trap_handler (TrapContext *dummy_ctx)
{
TrapContext *context = current_context;

Expand Down

0 comments on commit e981fde

Please sign in to comment.